{"_id":"@graphql-hive/client","_rev":"1648-97a38c04179ee073af763cbf74da9ffd","name":"@graphql-hive/client","dist-tags":{"latest":"0.32.0","rc":"0.33.0-rc-20240423115227-c7141644bf64f985959bd99dadf65f9d792454b7","alpha":"0.33.0-alpha-20240423134818-25e6bc59e3ac7e6617cc4d349867034d0e740d08"},"versions":{"0.0.1":{"name":"@graphql-hive/client","version":"0.0.1","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.0.1","maintainers":[{"name":"dotansimha","email":"dotansimha@gmail.com"}],"dist":{"shasum":"9debd91ddc28abbfac56d52b8c6da9f842791191","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.0.1.tgz","fileCount":13,"integrity":"sha512-bOm10eMDo6/o9r3dguD7RcMoX7ChJN9d4RleBPwS82fIL8quZdIowiWNDUjX12aMBd388OrdtDCl2bxARSVOOA==","signatures":[{"sig":"MEUCIAfO0uSji27yQYBD3yZciN8dJ5PrcxPPVJs6GAy9XEarAiEAl6zfAmE534VPRM0KNl/wNUIt41xpaA41SHXyQeVFgGI=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":92366,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJggUW6CRA9TVsSAnZWagAA4d8P/276eouq4cIQBX/oWBm9\ni8F53/ElOCVqC+rfPFszuSNWJJAJ3bQ9u9sG58f8K6fw9wHB0UcAI0iV1XRJ\n/ZwEJT5z7GZ6fhI8xX87W3AYtV3t8TiDy2pLiL2OP3VzNR2J5wFARaLTp0OG\n2LFEjq26CwLWstr8iId2nS0ecBxAQ4QveXu0gpiyrEsmfE8NNRBQuJgwo14p\nGMi0BFSoufwFv7C8uvi3TKZZ2lR02p9Yg3SLA0o8c7MlsqC1wm1JibBbvghO\nJil/jRqX3IIrCOZ4MvYvE3WFUXlq7seTrQAShfAizxw3Vw5x5GG8ep2BOEhP\niVXgJ3l22GPxYvMyut/Xl3xLCCgt+KeRaqGJOgOSZmT02ghuej2D3inytT+u\npmWmRkYiZeIJgJQtoIVh/b64amepK8E34vdYThss2Y9IDmUOwz0FQ6R5BSi+\nxxGgTcyByQE1k8/W7lkXDQuf9nEQYgEe3/Z9U4B4DdEd4VgXUUJnFtraP8/g\nD5FTdgjH18Ebc0SdGcqcg92H4Gmb6fnSHR9szL8dOIc47tLliZskUI879Yez\nJffoFgfx82+x7ebp8NWCLogl11ic6ELiItpFWb/czIkI7WHemkBMfbb7FjYu\nat/bD18tty1WgEvoHEcAXKhsyjGtom2s92FL3d6M/6GB90OWkvCzzb62HxAF\nJg3d\r\n=Foah\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.cjs.js","module":"index.esm.js","typings":"index.d.ts","_npmUser":{"name":"dotansimha","email":"dotansimha@gmail.com"},"deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","typescript":{"definition":"index.d.ts"},"_npmVersion":"6.14.12","description":"A NodeJS client for GraphQL Hive","directories":{},"_nodeVersion":"14.16.1","dependencies":{"undici":"4.0.0-alpha.3","tiny-lru":"7.0.6","async-retry":"1.3.1"},"_hasShrinkwrap":false,"peerDependencies":{"graphql":"^15.5.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.0.1_1619084729632_0.4247000175739237","host":"s3://npm-registry-packages"}},"0.0.2":{"name":"@graphql-hive/client","version":"0.0.2","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.0.2","maintainers":[{"name":"dotansimha","email":"dotansimha@gmail.com"}],"dist":{"shasum":"3c1c436a31efd40800dbaf9271302a73f2d8838c","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.0.2.tgz","fileCount":13,"integrity":"sha512-Es7VwK/pD1lR7wszN6C63IFQNZqaWFpJwGdtM0KK2SU/uoyI9rJxU3bg/nbVQIBUrcC5Bv6/NVvEcxbNXXm2dg==","signatures":[{"sig":"MEQCIB8Bdc7a+gvtRNLEPBicfvKXy9AZk1ojtDNwSQoYtJlFAiB7lZHDZS6SdvoukxCbkCRMu8nATCQAJZseN5+51yMUbQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":92366,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJggXNbCRA9TVsSAnZWagAAV6oP/29vUjZANBT94ytvy0mR\n/G3Wz1ZUOXtlGzkvsMqflo2O73LooWZRwZAMMCHZZHwZXxHNFO4aFD/l8F7G\nmP721fWCrWU7Z+bkTiT8zUgjuYi78CSGmJPA7G3ZiauaJReWKMHT6JLbbxcK\nJ/yNj1QnGCovO6q5/wEkTDoySjL4IFJ0XgduTGzu+6dZZaN+hq/uAgOsHYHZ\nOXH8H3E0LCMwTPCAGeWoB7a2g/ZMfEmvYy2ed83uwCuS2LNphsYRiNLWEZ1q\n5tAs0T15hwsQUwIC3PzS3CXli2bNSV4+SCKkqrzDd0DbmkjkUPbQKTDiwM3S\nlv55/UAhTqOWadHuktVbjIpUt1mOtMkOoqvO4frHYmXXKGTMebwuTlPOMfE5\ncG8SA5s59rj61nv820N2lBaRm1Q7VevI+K5DTDzgcr6EWYyMJ9WfOQ6QTMmK\nlgNl9JxCoHpupB2OO2gsyDiR2JbQ8rueFEwUwXrZfgfsZT3JB0mrc7JabGu4\ncJFZbU1/2hJOBfxN2YU9ZdGnpOqN/xiW1RyckKhyS7945xC0EyOVR+69yCfT\nQsARoag1B+orQ/ChdZnon0WaYQYJGRm/Zvp0dp3haOTlZagJ1GT4YCkwYGi3\n+YT62VpYxdmFtR2b57KcKbKy5d1HMkfiitYakTt+wbarzMvV3bysuHMn51L0\najO/\r\n=S04K\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.cjs.js","module":"index.esm.js","typings":"index.d.ts","_npmUser":{"name":"dotansimha","email":"dotansimha@gmail.com"},"deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","typescript":{"definition":"index.d.ts"},"_npmVersion":"6.14.12","description":"A NodeJS client for GraphQL Hive","directories":{},"_nodeVersion":"14.16.1","dependencies":{"undici":"4.0.0-alpha.3","tiny-lru":"7.0.6","async-retry":"1.3.1"},"_hasShrinkwrap":false,"peerDependencies":{"graphql":"^15.5.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.0.2_1619096410869_0.39712336616232635","host":"s3://npm-registry-packages"}},"0.0.3":{"name":"@graphql-hive/client","version":"0.0.3","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.0.3","maintainers":[{"name":"dotansimha","email":"dotansimha@gmail.com"}],"dist":{"shasum":"378251c354eac52485417dcc7f5b9c2399a95c73","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.0.3.tgz","fileCount":13,"integrity":"sha512-rTFY34qcmPF5gQV+UIKQuER0TgbpPKbT92weu58FPIyYm7UTtXK/7S7QWBSFsx+t3DodeD3OfEz/BxZ+o3k4Hw==","signatures":[{"sig":"MEYCIQC4vQ89jraHhiaBC7c2tVd6rYRZ1p0e2xOBjk2pIC6Q2AIhAIfecrCDqWnLzYFqds2Vplwc9UIHu7B1xzhbuxwzWEUf","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":92366,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJggXmsCRA9TVsSAnZWagAAyX8P/iIzuORLl5iu7lZOxSXj\n/s2lipEBufV2v3UhkFviLDb8Qf/J1GPepCGAxJkTqyHdrlbWgGvcQPj13IX9\nHJwqHukPQonJlUtzJUUwBMFfYXcW6ciovVdT+eyI4K9np+JeaD0SEBKLqlYw\nL3Pwg6bG56l1S96B7aYaWM/Scq5ooFj33Rrj1VGRsckB27BT/H/Hh52trqU1\nn4g3SthuqvSAfy/GOe66vcA5n4r0nqzpT0uNgS45dCkdAvmsE3wUW0qmKZBw\niL59aV6YHmQh3ZYQtg9r4uHKbloHXjOE5t7Pgm6S6/7rvhgY2i9SGIUkD3ex\n/JwfE2iazu/kH/NdhER7nOD3VI5O4Wgy0TRc88XsDNBLUO0YqfUSSmXeqjR0\nMa1GxnM78ZOuMZE+uLUnKAPRBjJ9DzMxzzAayC2y+97RLgAcdlGGCgCIIJSa\nA8dnkT8gcleNCqGVIumK7hOCWUl6W1VU3dfmqGmIpREheGyAHH1lKcjQ0uxg\nBVKoyG9ThkS9O5BkEWQRbHfbr/yVjOg4owSgiZiKlJ12A1gYgMXJVJtB6pHp\nk0PfJhp2nJF02wM19wEqebeqNHV7VEQx8jUyczzkIm3TcLasmtYJRSBmPAOb\n5LMslM/pEHsQkmB1BvCRO2PuSrJIgwXS0xomYs8M5vBBvLOSphtWb56XUSEa\niVQT\r\n=ylOk\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.cjs.js","module":"index.esm.js","typings":"index.d.ts","_npmUser":{"name":"dotansimha","email":"dotansimha@gmail.com"},"deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","typescript":{"definition":"index.d.ts"},"_npmVersion":"6.14.12","description":"A NodeJS client for GraphQL Hive","directories":{},"_nodeVersion":"14.16.1","dependencies":{"undici":"4.0.0-alpha.3","tiny-lru":"7.0.6","async-retry":"1.3.1"},"_hasShrinkwrap":false,"peerDependencies":{"graphql":"^15.5.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.0.3_1619098028066_0.6124761619513952","host":"s3://npm-registry-packages"}},"0.0.4":{"name":"@graphql-hive/client","version":"0.0.4","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.0.4","maintainers":[{"name":"dotansimha","email":"dotansimha@gmail.com"}],"dist":{"shasum":"6ad1cccb39b128e510d92b5f5578a3365547808d","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.0.4.tgz","fileCount":13,"integrity":"sha512-L47kqXGLb8SztIZBbIQav9u2+QF7yLsXdMxiLj+zMvfVHm4WW02aMs1vqWSBCy0Xc23WaeuxJpBe2Yw3F57xMA==","signatures":[{"sig":"MEQCIAVOs/9ux711vHjjM2ncHMMB8VIdcL+6aO0o3KZwXmLGAiB9S9rQ2oONi1ZKiBbT9bF2AFkvOXGt8u3XYbKx/HqXEg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":63464,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJggn2LCRA9TVsSAnZWagAA2UoP/2gqY7pp5PwO61UxtH67\nmVDge+w1fkjgWEWkHT/4O4hsUW6K0/2PdJKrvbtWmLMv1wCpifw1rWcs3top\nfneck/U9K5P6R1/+ZyDH/FM/OBToYqw75AeRW1/TL3Nz+gzVWnduOZXyW5BA\nCXLcA9BiWeL71ifWgRkh0FNLbF4DPdkoqweMmPOm1okw5LtpNHxj/T91llFO\nik1dUcc5VMBQKSMLcGFuUzerRwGX+ofwI88Dqn5265YgYjd3dXXzjN45cIdr\nCHYH/qGEZptddIjV1tFCw/pYmPc5C3VPP0NFrdpLQNs420kxJ+vyEaSs4/cH\nSRtt6kMbjqRvxnxHRwWraCAWGtIsYtORJLb/Pst4a1fBYREIsEPw+bUkj0WF\njIxZSSLXgt1WuSoge5glp0qlX7duZFNg8kPbrjYUKpRBVBIxFuYW0Y/NNMdH\nR24DrANQZ0b6oH8wQDlUXnINkpgTrJcBZajKD9WVeiA2U19vhZPIMED9FdRh\ns2RzMQ0z86dWW6wz+22iKnc3KIeJwH/ayhkHqX/+oUSOT/WvKIX3Vet3hAl8\nbjWYI8v8ztV6PujQU3rBLMR86svnXCF0bXFe01ZGUdUDMzdoVb4KHBIHti8b\niyaQdM+kAHyiprmDX9zJXmxz+Kdj8I9UteCgvhR06JdAxdNYpFmoqhy5Sxtu\nYYL5\r\n=Wjyb\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.cjs.js","module":"index.esm.js","typings":"index.d.ts","_npmUser":{"name":"dotansimha","email":"dotansimha@gmail.com"},"deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","typescript":{"definition":"index.d.ts"},"_npmVersion":"6.14.12","description":"A NodeJS client for GraphQL Hive","directories":{},"_nodeVersion":"14.16.1","dependencies":{"undici":"4.0.0-alpha.3","tiny-lru":"7.0.6","async-retry":"1.3.1"},"_hasShrinkwrap":false,"peerDependencies":{"graphql":"^15.5.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.0.4_1619164554428_0.31465605937938057","host":"s3://npm-registry-packages"}},"0.0.5":{"name":"@graphql-hive/client","version":"0.0.5","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.0.5","maintainers":[{"name":"dotansimha","email":"dotansimha@gmail.com"}],"dist":{"shasum":"c589aad41a4a105a5fe962ca8c368bd3cc9e74b7","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.0.5.tgz","fileCount":13,"integrity":"sha512-+sOTrqwU+EcaCXuQ58FNR0mOX6CQcZJZCChwOBRHGGr8OPKjz6g6YrPg3LOAhUDNt5bJGe7cG9otjXEjwf80Pw==","signatures":[{"sig":"MEUCIQDftIaVzZnhfhB4EV8BJjFr+KyI4D1i6qyXrKB+2XFKBQIgR2TR3TFqRE3bfW5Mta58+SjIbV1scJYrikyDFO06sdw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":63464,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJggqTxCRA9TVsSAnZWagAAypwP/ROO7nO4t79ZsISTaga7\n/RpuLxuIbjTCiAsUH9vyhAomeHd2C7IMzi1APHAT2TQd6F8FID7rH3PfVszA\n0O6TcaILNHxM6JnSDpbS/CwuQeD25BKrnfuOx34CMFFg7S5iorBjpTzJ5hiv\nIdjsiGUKnB5tiaWtH9SHaYy6pQ891JGwgdpLJUpqjycOalRPatemZ0hN0bVJ\nEa/o6xl1laMZuLCoC1FKs5FYxOpPiRxqihofP3SJucMM95AnXcBmvywItNT9\n3UNPiObo4B+zwcZS+UCTrWGe7KO5lWaoqod8dRYZDJCdXBpyXT0OZaC4LgDR\ncvZSUrx1z36r+nXJmgBcUzg6/zfA3uhSAkxRYClSn7wMsvhSKoJ+MjOg/o2M\nLhmGgmwWESZcdxPd6imms/UcJOrHl/t1vgDK8bHSUAycEXEkSKjDcEQbTWQf\nWYVwSKwvYlBJX7te9ohS44gmN/uf9BDuRvwisa94Sfak1mkscvBSyU29OMsJ\nGqQBc9M2mSbpdEu31ZZAAdXWN/8xRrFgNzAfZ/24r5z2qpMl2dLoK5BXIlN+\nYApFVYpcLSpNH5FH1pFJBx/rKv4zlhIr0K9hOkKnubU+M9+nufML4W3pu9zB\nNoE/I2ziquioPQmlLsOGbLWD+NjtXMGDk0zaEJc7TGXrF0NZcEy24mQyZBG3\nR17k\r\n=GP+g\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.cjs.js","module":"index.esm.js","typings":"index.d.ts","_npmUser":{"name":"dotansimha","email":"dotansimha@gmail.com"},"deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","typescript":{"definition":"index.d.ts"},"_npmVersion":"6.14.12","description":"A NodeJS client for GraphQL Hive","directories":{},"_nodeVersion":"14.16.1","dependencies":{"undici":"4.0.0-alpha.4","tiny-lru":"7.0.6","async-retry":"1.3.1"},"_hasShrinkwrap":false,"peerDependencies":{"graphql":"^15.5.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.0.5_1619174641088_0.5134081403879045","host":"s3://npm-registry-packages"}},"0.0.6":{"name":"@graphql-hive/client","version":"0.0.6","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.0.6","maintainers":[{"name":"dotansimha","email":"dotansimha@gmail.com"}],"dist":{"shasum":"60a99ccb5b084bbc161d9f5f783d2adfe77f6ba9","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.0.6.tgz","fileCount":13,"integrity":"sha512-B7K5kqRrgeDLp1VCbI6JAtztwIqoaVn+ZnGXUc6bylGLXE3eTIa62bdWTlKkyr9BmEy1A9v/p9YSmS3GT0Hqqg==","signatures":[{"sig":"MEQCIF1Mf+vim2N/jJMCXmwlT0NRqjffwdHpKPsyYyMIFAdjAiAvw0uz8uZDa8LOZ2Z+8nr918unKT7T1HpBFuv8iTziUw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":63464,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJghqO/CRA9TVsSAnZWagAAhIsP/2qtqPTZelLiRmi1dWi9\nb020AimeA9O7APGnZU3AP2WNlqv1ZJz9MlQhPtYkW0oaU6KCjzYBGFSz1kOY\nl4jMmtrIZb0mlLhUnRjposZvtqGp4dxgMQ7C8NB3rSkZrCvDkI1BGij82hGI\nkfwVy7KF3HoornJFQT0qito5QspDoMwJdFdasGxYgTkb1RS2x6CJKl6tsk9c\ngB8mZNcOTnMK2dDIqm91iHsjmR7WuK6AlVylVtGkBNtPxIKuNdFzpwTW9Xsj\n3NHFtW9nY6MWbBFBI5x4vUxnZl0BACFdL1OSXqpsaZ1nqZuxQ75P04g+O10s\nJr43nbmmFvd+BQjhl5eIEflLeuAWm6kMUGUXc0ve+waAJ33u7QKlDy/xPThG\nv63A1AZt1MRn9gZ2wRIjrhbnnWcDoZjkffxWyJG9LFeHT4VeAvvkY1KYIjXl\n4dKh2nBDE7eoiOvW838oH/FYD/aWuNmGo1lJwfg62pGGNddWYKMK9RGVcqpP\nH4QmUzQnQmVHDO4fyt3tgRVOoHMy7prFIeroC6MQnOW0gkI4nftl3YDAQ3JI\nLNwdLEtC05Fim6TJGKLjSIz1Q1+oCEKnNThsPI7NDPsuhfvg0ojIxg0Q3DMv\nvyntt4UoECZ1Y7g5RRl8sYnz/u3T2jr4RQAB4BsPxlXj1Ozmi/hiClUXzVgY\nNlkS\r\n=DvP+\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.cjs.js","module":"index.esm.js","typings":"index.d.ts","_npmUser":{"name":"dotansimha","email":"dotansimha@gmail.com"},"deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","typescript":{"definition":"index.d.ts"},"_npmVersion":"6.14.12","description":"A NodeJS client for GraphQL Hive","directories":{},"_nodeVersion":"14.16.1","dependencies":{"undici":"4.0.0-alpha.4","tiny-lru":"7.0.6","async-retry":"1.3.1"},"_hasShrinkwrap":false,"peerDependencies":{"graphql":"^15.5.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.0.6_1619436478758_0.3966955105931924","host":"s3://npm-registry-packages"}},"0.0.7":{"name":"@graphql-hive/client","version":"0.0.7","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.0.7","maintainers":[{"name":"dotansimha","email":"dotansimha@gmail.com"}],"dist":{"shasum":"d10ecb90ab0d603260a55c431c6359cb094ca337","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.0.7.tgz","fileCount":13,"integrity":"sha512-husVZGGy0GVZKNur2fuyzA84mnOQo0B4tRRKx/HGJaCeRLNAVTaICdYE5wHkkOnXQrN2KPQMZuNYrnbL0HQZJw==","signatures":[{"sig":"MEYCIQC5MZiGR7qKCMuvBZWi213kSPfn68XB8MsVR3MSYsmhwAIhANozrvCASGE2EaqwNNpeYuY66V2fAXFKKxLMCiUNEoFh","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":63642,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJghqvECRA9TVsSAnZWagAA5PAP/22FWn6IPgqOfwG5Fy7B\ncV0zsg83ZAWuerVVHmhGv5jetv8tIggb/MAswF8NJrCidUQTpW3IcH5Y6fjA\n6zgZlpTUhAqyuldNJNExl6dvUybESN3Ay1TpQunwktyZkwZ6vZ0HH7mvBXbj\nVQ5RjIhefFzOZnk/ZWrD5hVePp8Cv5IBQaXA7S6dO49A7ElYOXAi/iUaOc8V\nCcAAqvbhJjSDfpnrJD8+dtInSCjOQPQs8NV0ebXjXEpYxgnGsWolu9BJAp1m\n1sGb3t6+PniVk5FGHDeVF6QGQlZgcbctqzBERvfZf80Sa55P5Siz3Ig82eLL\nQ2BuHHNrhTbnvT23DOXu59t1RpHOaRZKD0XeHjaSnTmPez1SxgdY74hR/8J+\nB06p9yUBZRFVS6oTdjrdysd6bxgLt4hZMgG1hOs5EN/MOLTknyfQrlHJjipa\nx0aRprrILEcD0nR6loSxK+7z3jtsArecfpaCxFyOipuQ4SEnS2Rw882ADnCF\nCJ+ZG1N+2vIY6FXILeNFmYcZha67zCoRjZDsLvb70+lAeC4dx517hg6Nwiq6\ne7BjreRY2Kvj78en2ADHrMWu/LuBfFtwOkjn2WxcOSV5tKg14W63I6Ah/nP2\nt9xcW1QfiG36Jkm6DpscRNieUfiowEusKM5OziC7Vx/eBA5UGlEMD1wTMqQ8\nPvUP\r\n=wevp\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.cjs.js","module":"index.esm.js","typings":"index.d.ts","_npmUser":{"name":"dotansimha","email":"dotansimha@gmail.com"},"deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","typescript":{"definition":"index.d.ts"},"_npmVersion":"6.14.12","description":"A NodeJS client for GraphQL Hive","directories":{},"_nodeVersion":"14.16.1","dependencies":{"undici":"4.0.0-alpha.4","tiny-lru":"7.0.6","async-retry":"1.3.1"},"_hasShrinkwrap":false,"peerDependencies":{"graphql":"^15.5.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.0.7_1619438531987_0.9433849194896347","host":"s3://npm-registry-packages"}},"0.0.8":{"name":"@graphql-hive/client","version":"0.0.8","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.0.8","maintainers":[{"name":"dotansimha","email":"dotansimha@gmail.com"}],"dist":{"shasum":"2dd982b6ab77526c70a687f9f8376f5502749d33","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.0.8.tgz","fileCount":13,"integrity":"sha512-YaYBzOzQ296Xei86+tomKhL/Q+QSPoNsZrUGYF8aOFbYtN9Z20vGrWp2zemFaixm9Bg87UuwLLc2/TXhuSucQQ==","signatures":[{"sig":"MEUCIQDbTYv88Op+ibcL396f6oRA+kN8SSJtuTD3lnWeRXev7wIgGuukhX5W3FTUIT9UUeN0GTT9BO//ixC6HguqmuOQ2L8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":65638,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJghrfHCRA9TVsSAnZWagAAg38P/0mN1F/MPQX0ND4uGx8o\nT2paOS6W62giUTPDTyk0MOnrbnoXA4yfC5XutUGbUftNAhEnKoa2/LbwWPXo\nVapeq3hCgN8c+qvwNs4ZEPUCtxqWhH+4DcBjT9o4woNr8aNvQFd0psmsZtOd\nArAAoC2WNAhchCOnyFV1SYIOC12FforEKSVmkfDlCL8tcR7HkMy2lTb2ntWZ\na/ImEVxl69dH14gXi6WiMifNJougoDVznAJkt8c82ZrzLCifmMpJKodP6ey4\ntyDczzsdd1tNcveQxw1GM/pXkR/H/R+OVVjWlu7r6YoTY5f42KjsfgbPypow\nX1+UfMc8qVpMZ+OJxm/BmujWyrJg3CyvFE3rwVxeFIxXBmE2W8B1fGXFv4dK\ncp1NbUVHatFRj4bwGGVakn9+93+5eH0WvhjlIFei74CxrVz1VGuulk399Dde\nVWK+VnFGb6tzo8L7I++Rt+q+gZEPtghOiz2dMom6rLpcquHR06gvfO0i0vBx\no+M96Sb8n0vn8/MRGfHOhxjQQce3SDRpUbyFdIAJQ9M1olf6/N2mhJXPYryi\nQuFlAiH4GTSCUtsa2akYqNsJ9W/TerjOK5t9fkFz9BiV8CW3fevFrax/2cd5\n54kNlpmzYto0vt0HgGPAspxBBhXeCL1aXGTtlDz/r9ajiFPWxJsmq/EXZpBJ\nGP7y\r\n=2ts7\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.cjs.js","module":"index.esm.js","typings":"index.d.ts","_npmUser":{"name":"dotansimha","email":"dotansimha@gmail.com"},"deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","typescript":{"definition":"index.d.ts"},"_npmVersion":"6.14.12","description":"A NodeJS client for GraphQL Hive","directories":{},"_nodeVersion":"14.16.1","dependencies":{"undici":"4.0.0-alpha.4","tiny-lru":"7.0.6","async-retry":"1.3.1"},"_hasShrinkwrap":false,"peerDependencies":{"graphql":"^15.5.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.0.8_1619441607447_0.19153319123054224","host":"s3://npm-registry-packages"}},"0.1.0":{"name":"@graphql-hive/client","version":"0.1.0","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.1.0","maintainers":[{"name":"dotansimha","email":"dotansimha@gmail.com"}],"dist":{"shasum":"bf2c82f29eb587f7ea0c6b67b9eda892a62c8229","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.1.0.tgz","fileCount":13,"integrity":"sha512-pcmi8O/Vow0aJSiCFXUZEzARrB3jABV+JyZqgjUZowRJeAy21aKKcsG4QY2A0b4JY4vXDYJfYBrXlrcwUqbRuw==","signatures":[{"sig":"MEYCIQCBr9bye8/spZb0xuWALJXaWjc2CxOUGUVVBySg8pKjNwIhAPKoYu5PVQjN26hTkdMMCVV233Ix1kQ9UOHJgyd+kkHm","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":91722,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgk8JiCRA9TVsSAnZWagAAqmQP/jSWWH13J+Hyg4Abo6AQ\nYdGEc9mPqHvYKCDcrNeO/iaHZCgdQev8h/PckF2XrPF01F+XEYF6hKfSvjUF\nknFK3kZC+Gd4G5OD36FmpS54xWGGa7knZuedH1JRxmlV64yxmVRmYqr045Kk\nqfjTt735fI/RNYvuAQPEOy14TS3acyMb/lSuBal8uh8LDyRC/dBqBHwsdruh\nd9EbXe9+UE17Nhc/xqLaw3xURfpjPtA2LndlRcXOTJnApewU+HPmqrQtEdtM\nwZn5jM3bqwuhcsaj+eM9v1F0/iVZDh2Z9ePU28tI1qgBf9Gb9F5t6K8K7F2H\nTmAtF9tWZL1rpC7vqO7+W9gMqMhcYvoEqV0smgxMGGRShDitqZxf4QfnAfvd\n+9hvhjeBorxk/k2uE5fijsjr6yw6xiDRouvt3UjAKfTeMlvfadB+WZN1mj0W\nben+RISENnXjUpbCihgZ94VXm9kw1cfynb68BpVGSNSBB02wOqfvIObHhRxX\nlyclai7lkD0crCG9pJs2y/3Ckr2v7ZLbJ2eS3L6vfkbxBBXgqkqhK46XpcVS\n52Vkt+HYv53ECPzyxMM3EnsGmb76WoWHIzPmPBZs7AHa398nKELb6pfwXxj1\n2UK2ibJOsuijiJNnyU0gVSIUPhehazgUkr0DZkkFJiZj+nf8fmzxDLOPwCoz\n3qVn\r\n=BLh8\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.cjs.js","module":"index.esm.js","typings":"index.d.ts","_npmUser":{"name":"dotansimha","email":"dotansimha@gmail.com"},"deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","typescript":{"definition":"index.d.ts"},"_npmVersion":"6.14.12","description":"A NodeJS client for GraphQL Hive","directories":{},"_nodeVersion":"14.16.1","dependencies":{"undici":"4.0.0-alpha.4","tiny-lru":"7.0.6","async-retry":"1.3.1"},"_hasShrinkwrap":false,"peerDependencies":{"graphql":"^15.5.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.1.0_1620296290305_0.5424796383445321","host":"s3://npm-registry-packages"}},"0.1.1":{"name":"@graphql-hive/client","version":"0.1.1","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.1.1","maintainers":[{"name":"dotansimha","email":"dotansimha@gmail.com"}],"dist":{"shasum":"cb906d100f520a53a1fc2ff13ecee85ee2b124d4","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.1.1.tgz","fileCount":13,"integrity":"sha512-7N7Q026hEM+QtsloUDO+3VcFY5OfcIlHP/gMozUW/UViFZGpbRvehtV1p4Zei574XL3B6bP69GWXt8WU7En5Tg==","signatures":[{"sig":"MEUCIQCSbpN3DGpMfgOi2SYisFqhMOoFmF+zYteevseNwn7VCgIgabO41v4wn1RfN0dYk82VBjcxn38LcXHBgP/Vc+iqscU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":93866,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgk+mpCRA9TVsSAnZWagAACTAQAIdbNFQxjYqS1fv56kto\ntODonRaJd3kKtgEZ2YI7ftchvpR28pVTwWC9IHDANUid02bYqEMOvWLkVpc1\nU3FfUYpQsTzV2UgLPYWIuWCjU+rUX1AKbG1Vjrw7OuWs80By/WANuY5rzHjD\nCqyBnc7qlRHBKTzOdQpmd63ClFSg1TwytWiaePPLctFl8CyVqwIliwbiTvRe\nHr0iKTTffEN/PrPqQecxa/oc9LYJSGLXLn5gHd8Azscpb2aLcOCwWdsQ9T9X\ndOMxKkv3o+UVtsV5BZrizWVmMjLO4bdqR687t9jJsHWq6gdHG4MMLDobCFH5\nil5O4xySs9VED3pjGHsfsRMSz47kaiuWYLVq6gDt/UNHSL5GKKIgLdffMLKT\nml9HerqozEllftwGR/xl6M3RBGYqQkTvyHIWIaGhYuA5JNEUkIKCNIvo53I4\n+cA5LlX2ksRxblDYRhZYNwxipi9yIGaWw4RUMpq0Ulwi8XHhYojhasSDbhsD\nNy5kx3e/BDO/oN2hpKf0vCoU0aZ+SUms8hD6EBkHkzYmkvcJAI6Enq3a/X1o\nHyS+EDPeUi8OmhMsxLwCVb0Fs86H3zA/r5tyvIbnWj+b1VCk+75SDc2H3XTX\nkTZL9aj5t8DEnB8xBAihzfhfsj0/L806v636m/WbDmf8rCj5RfNth9K/u3ph\nxBds\r\n=PvqQ\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.cjs.js","module":"index.esm.js","typings":"index.d.ts","_npmUser":{"name":"dotansimha","email":"dotansimha@gmail.com"},"deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","typescript":{"definition":"index.d.ts"},"_npmVersion":"6.14.12","description":"A NodeJS client for GraphQL Hive","directories":{},"_nodeVersion":"14.16.1","dependencies":{"undici":"4.0.0-alpha.4","tiny-lru":"7.0.6","async-retry":"1.3.1"},"_hasShrinkwrap":false,"peerDependencies":{"graphql":"^15.5.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.1.1_1620306344609_0.99843216390365","host":"s3://npm-registry-packages"}},"0.1.2":{"name":"@graphql-hive/client","version":"0.1.2","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.1.2","maintainers":[{"name":"dotansimha","email":"dotansimha@gmail.com"}],"dist":{"shasum":"81dcb073ab803830da7cd154e04c4184d5dc4304","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.1.2.tgz","fileCount":13,"integrity":"sha512-hEyUk0JLLfdbEHWOioh5k/eAVr0MO1y1s/9dyandQcvVlMbijiMaSILWmYV4DQDETjaZwdhBcwZm/hmuLlBSpQ==","signatures":[{"sig":"MEUCIQDXBNQWBub4m1TT9alncBbDBRXa+Q+i3TXggejIF7la/wIgX4ZmYNemEmZaUEjhwM8oZSVYFNXoWVxGU343gOS2XdQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":103763,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgmnmbCRA9TVsSAnZWagAALZwP/jgbKdyqvlIH07wF7OkJ\nF0Vn5kG0nWRMiabNv218QG8qgGrZXEITjX5tEYru4vJB4x0RJlCe37GnlT8+\nyVFehR29w2xO+7ijZx+Awb0vcMLSuDU95kNtHUDAsyvvOA1tOqIIfZROjt4s\nnZy9/2qEwTpRVCybZy1EvolyPUxOyhdYQ2jyKjMVUoX+GbD8Bn38LKXE6GeS\nx7cx42aR6tvc3K3Qkeb/897eE61ARoEAwSkSOYJQHteizEazTNgV4dY6PifK\neGwyAi/hvnB1vEv4fZtjwFo2qRlKgFRDh01TXYvxXBoCjMaxJVTfL/wHQRTi\nZnI2maiccGwcXeiaOoUrwp0+TvXFfk06uh9m1o1SPLmhxdO4s5wfw1urwEY3\n8z9HK4YesXi9u0Y7KCuK83U41zx+Dr7cRgR/vFmre+LIdHrqyja4go1bs6RQ\nfcyBvG/N+xbqnc7Meu+vo0PL1GpBOgTFz8sUY1zYlspAWH+zMoED/me0bWcj\nEBfcutg0SpaTdBsGuDm+y4EUR9Dq9hr/2TFkZHjYQIiOPUMMnVnPMwjZBnik\nxXBecruD1L1cpgVulU0S98CW3cQ15HCO2nKCqn2TdvdlkhEn0VXdZ+eR1Jak\n72pu2cxZsH0Wz7zXxI7k6loupKJwx6MKu2GPdDyqFODEoVaHMqU775QtJ2gq\nYB8m\r\n=5pNq\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.cjs.js","module":"index.esm.js","typings":"index.d.ts","_npmUser":{"name":"dotansimha","email":"dotansimha@gmail.com"},"deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","typescript":{"definition":"index.d.ts"},"_npmVersion":"6.14.12","description":"A NodeJS client for GraphQL Hive","directories":{},"_nodeVersion":"14.16.1","dependencies":{"undici":"4.0.0-alpha.4","tiny-lru":"7.0.6","async-retry":"1.3.1","@graphql-hive/core":"0.0.2"},"_hasShrinkwrap":false,"peerDependencies":{"graphql":"^15.5.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.1.2_1620736411019_0.7465781891433896","host":"s3://npm-registry-packages"}},"0.1.3":{"name":"@graphql-hive/client","version":"0.1.3","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.1.3","maintainers":[{"name":"dotansimha","email":"dotansimha@gmail.com"}],"dist":{"shasum":"5d568069e451bcf951ab79705e6a32f1142955f4","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.1.3.tgz","fileCount":13,"integrity":"sha512-bfJln9vVhpnlQBCdjK4nZFHPITt5jwMsqSuO2WPNVo36obAjsfs+8RbHYqSeDXvDIBbHYXF1C+Fv1d64QLJBwg==","signatures":[{"sig":"MEYCIQDg+X695tt14LViyHjwGO3XR8rz4dfvcIXecdmCMg6IpQIhAJCY4KH1NByROpcGZPcHcO7BHmJHtHdFuZXA3acRJEYR","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":103763,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgmoiRCRA9TVsSAnZWagAAvBAQAJUAUoIz1SuQ1aXU14Xg\nNj4HdwREInipkBJnBg+5VDzeLV89qcusJlJ2F/iTZ6plp9zarNj1mP9voJoy\ngAOkcldXL4Rwo+6XkNRGw4pYLa28BMryESD5X67BxOIvjoCwtREaT+22XUrV\nSdK8dE5unVYIiALcGSJElBnD+Hub+V2bR8fXwSv0Yi6utrRGHqYEMZYaO/rw\n0F+sg/G1pQdga4M5j+UG51KDortShyeH8z17U9Mtuvlw42Vm7TOpuEsbBHIV\nbk/5X9BJpVOsuY7RN9iVAogsQmlGHVIMAn7u5BNJSwVsRwQSsSCyjkYHl0wB\nlg+t2ij8ET9pyjXafNzoRpgYsogbw8E6r2ZfkftL/YjbTlsL0nSJXUSCJw0w\n6JHtbvx601XQd4FMxJRh9Z3rsV84ePWVeJ8JuSRGCcYlAKyzFbSfVsRPP2AP\nF+u5n6eX/+OJJ841PyK9PNRBYNnblRvYJVt0LX9VhrBxiIfhCw1scEHq9J5l\n2vReNP6RzVKMWzgx7VxoTltjhlgHWqi1Vzvtc2lJm3SPRrQvv73nQRlLP9hD\nWzFu8kj44876gEDVp3x93vRIiJcm2N/P/uRxvIZktcFMe+72vyKP90dULb/D\nbn+DbtDMcUdn9ta7yRzqxkGUx+si+c3hzumucquyY7E8l8D1nHeKVJfqhUKc\nMO1z\r\n=e1hz\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.cjs.js","module":"index.esm.js","typings":"index.d.ts","_npmUser":{"name":"dotansimha","email":"dotansimha@gmail.com"},"deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","typescript":{"definition":"index.d.ts"},"_npmVersion":"6.14.12","description":"A NodeJS client for GraphQL Hive","directories":{},"_nodeVersion":"14.16.1","dependencies":{"undici":"4.0.0-alpha.4","tiny-lru":"7.0.6","async-retry":"1.3.1","@graphql-hive/core":"0.0.3"},"_hasShrinkwrap":false,"peerDependencies":{"graphql":"^15.5.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.1.3_1620740240677_0.2339382061692612","host":"s3://npm-registry-packages"}},"0.2.0":{"name":"@graphql-hive/client","version":"0.2.0","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.2.0","maintainers":[{"name":"dotansimha","email":"dotansimha@gmail.com"}],"dist":{"shasum":"9b60157326bad311b8e914d659ae3b95596881c2","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.2.0.tgz","fileCount":14,"integrity":"sha512-RDfVsPK3C9qw6zWIscsHhFrDtKmS3Sni/mO44o6EuuXSy8zQ+8iEPoKapDhmq9fCUADySkrvrIYAvLiHiFS0Ew==","signatures":[{"sig":"MEUCIHXSrX+NRaoLbIkiCUe8faaNJV96szuyvLr4Td8d9de8AiEA0BIrEllGARdLoCj0ibG2xOhaGID370O3MZCbCag65Ng=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":153932,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgreyvCRA9TVsSAnZWagAAoU0QAID8V3AiQcDFoAXHmnL6\nFTOZB1DFhnhSsJISnwLqyJXGZxn5dJt0f0SWEdUZNFlM5xYqSwARo+TInVP1\nqxqPUMWIyxE55we99JONcag8eAMQT2eqPxBDNYHUr0MmfB9Mj1jEhuq0HQnZ\nszGUuteXR8oHfBWKFoagXLAHJRwqX+XHPD+5+g8J7FLwEJfQMw7mtro5JWA3\naYv6IQiwsYnhTadfYqik2rz8J4mFSzHRU83QD+y9nWMjvLKakX7BjMfsUVbN\nxNIM98++jlsbjq11mE5Nc9aKS9doJ7VyGQDQq8w881sAEYYHzWZ6hjtNNvep\nNw14Tim6L6CDDtG/Lx2zc5mBH32kZqcAmd5eTuVcNpIU3p+hvzMtHQMMq3SW\navF+sqlx9CNp0Z1q/PgfQ7A2r6JkKLUazM/2RpEuqmZ15FQcOxUJHXiIL9EV\nAM7faZMhSlXqeYznKxVqoOMQpV+pjh/x2kUJHHG3YzzGciXUJiWMuTljQj//\naMsIBZFZNi+1azwb6NBAcNJoVbKczwpJTSqZmsKS0E7sUEKbp9al06lVOZjM\nxtySWNaxPriWoCrxmpOOKXXZcZmsiuhnDgyFkJgUYFRmR7/jNsrVAckVSpd7\nF10In7Kbwvg9Fad1MHHucj+uHnVPvqKmJurU+QAlHXYwK0vDhTeY6R99gIHJ\nKzUp\r\n=5zBb\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.cjs.js","module":"index.esm.js","typings":"index.d.ts","_npmUser":{"name":"dotansimha","email":"dotansimha@gmail.com"},"deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","typescript":{"definition":"index.d.ts"},"_npmVersion":"6.14.13","description":"A NodeJS client for GraphQL Hive","directories":{},"_nodeVersion":"14.17.0","dependencies":{"undici":"4.0.0-alpha.4","tiny-lru":"7.0.6","async-retry":"1.3.1","@graphql-hive/core":"0.0.3"},"_hasShrinkwrap":false,"peerDependencies":{"graphql":"^15.5.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.2.0_1622011055325_0.9549784465441777","host":"s3://npm-registry-packages"}},"0.2.1":{"name":"@graphql-hive/client","version":"0.2.1","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.2.1","maintainers":[{"name":"dotansimha","email":"dotansimha@gmail.com"}],"dist":{"shasum":"771ac5b2368bfddf67911c0eba23f745d3b6cfdc","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.2.1.tgz","fileCount":14,"integrity":"sha512-sb/bIbg5u7r6eLeyNZ8NrH6PhUGKJqJeV1vechmYZlfiXkeWvfB3vLBtEl9bJOlhtMSQ0HDKYFyoPlAIluz0zw==","signatures":[{"sig":"MEYCIQCu2thmd+/5Qs0UIzAZP4e3IFjP0i1YS7Szz8ec5VbwZwIhAOQEcjRJwcGN9a39P1iexGq9Rj1Ot1HifKciXVJvVcZp","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":156636,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgrpg/CRA9TVsSAnZWagAA154P/1tKJUxUbwODjL6RPzVo\n76BdZvKvCsnIaDeMTqvaljeT58wF0BhuOHuOG57MsPb7CUGLA6GyjSW00v/T\nWwMyW/2pswnkIroaWhgOt8x8P65cIt37/XucMqUMEZO8e9DQKKxsANtoFzpq\nruozfwReew6IRpv9qMAcx2NTa0EYnhAmODWydcv0GZKsvbwEYDouiGYXnL+k\nY8nuBIsRr3D8SWSIsjQLRPf/2GpdbqLVjFHHhp0CiBipKnPX9+pIo2VXevtI\nH14bNaXi1FaO/lmjs3hM/0trSN6LdZ6vNENDSJC2p3d8xzBnXfZMMTdwpmzw\nUuBtqWBBz8m68W8HoH0ij6pvBKdiJ2+DrOh/okmCJtWR2nwLc2Ga77oM0HR8\nKlTjRCuCU3ZIp4/DcK76HoJiitamllPUgf+8LZZ+ETaBxogWalnu9qO+/z8U\nEp7GSoW+/YYGGnCmNh9AORGI/789fWTkcBqdaweXR7jx/HCCD6W44boHca7G\n+6bRvH62tsY4cLaHkkVhZwZTp22rgxl2KxLL6SwuzY1xMvtndqM7vg8vHfMH\n49sC92TiMZBtyLRCiC0uXlI6N99ZwakwKF8vAshf/K6sPs0Cd8jeU10M/rJR\n385qx58Xzihlh7Yez7r6uMFHBdvWKtd2NJbdcDtwIhevgxNigg5d8aP0IrIH\nq31B\r\n=6DQl\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.cjs.js","module":"index.esm.js","typings":"index.d.ts","_npmUser":{"name":"dotansimha","email":"dotansimha@gmail.com"},"deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","typescript":{"definition":"index.d.ts"},"_npmVersion":"6.14.13","description":"A NodeJS client for GraphQL Hive","directories":{},"_nodeVersion":"14.17.0","dependencies":{"undici":"4.0.0-alpha.4","tiny-lru":"7.0.6","async-retry":"1.3.1","@graphql-hive/core":"0.0.3"},"_hasShrinkwrap":false,"peerDependencies":{"graphql":"^15.5.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.2.1_1622054974431_0.2277073120241324","host":"s3://npm-registry-packages"}},"0.2.2":{"name":"@graphql-hive/client","version":"0.2.2","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.2.2","maintainers":[{"name":"dotansimha","email":"dotansimha@gmail.com"}],"dist":{"shasum":"b228ffe0c85e0b8ecce9a31fdcb33dabcaa6529d","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.2.2.tgz","fileCount":14,"integrity":"sha512-G0gnER5LPc7EqGvpUxsjAmIf5T9RID9P0swwgvYx8xKsGuP0xOJvONlX7EOv6BLXIaeHuV+gUTTW+2cNIjjYRA==","signatures":[{"sig":"MEQCICCbAqA+zwb8xpzdeN8701MiwlQg19T179zbWI6tCTwtAiB2M0tQeJl2t+TvKFFHdKQe4UNFnpsOpsXkvgF54kSYdw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":154934,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgtLDWCRA9TVsSAnZWagAA3KEP/2RENB/GrFMzkZmmxuQJ\nqO22s//I45bEt9MWwqSDCLabBx05jQ0azxlFTGdmSicgeuCpUgAFWdcqS9ba\n58ZRi/Q4FDzp2QiizyyxXDfA1Gr+47Rz1yUa6Wx91CQeI9Pl+coiyr8yvFP1\nyNmJHE1MTyZy/t+DpXZJtCjBrrej8Ljy07flsvp9cgPHVyGLqo6ncJpJIi8k\nfJ76JItF/uFitwdCQiEOc7su182vz7Cl9FVbJJdH3M9RTp8PND+XmnNugXh6\ntbm9WzLxc8nWubKgkcFbaOAebR6kFWdv8ca2bsHvfuLKDosvs1q4kZ7YA8VH\nM/ttSreQPBLWLfEuDMQmlDQWuQVQwXrYwn72fqXmHWPbnPrIZYG8bgy59qaX\n1bibVaEW89cMvDB5CSKKmKd1mppGGzcYdlosVSooxJwQgJdIgQLZKotxa5Pv\njJH/CS/l83kVOmid1rr8csGFFWHL3b8xTiH/Sh/ZBFscsGzBhLyg7mvI0NJl\nK1xFjA02paJpqVSroS5YKZVgkVYr3VuyJIiSMx5IHW52ocWJvaGF1bwE1+pD\ne9iYSs3RK0uW8XXPNMQC3gbyKq8YbY/gmQfzcnTaVF6SFBuVr7uAcQHA1m2r\nogFHsLS24AVGIGHMRkq3bQqT4z0caLby+ufOniH98CehHs9HxPdcV2bqornZ\nYr/T\r\n=cJke\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.cjs.js","module":"index.esm.js","typings":"index.d.ts","_npmUser":{"name":"dotansimha","email":"dotansimha@gmail.com"},"deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","typescript":{"definition":"index.d.ts"},"_npmVersion":"6.14.13","description":"A NodeJS client for GraphQL Hive","directories":{},"_nodeVersion":"14.17.0","dependencies":{"undici":"4.0.0-alpha.4","tiny-lru":"7.0.6","async-retry":"1.3.1"},"_hasShrinkwrap":false,"peerDependencies":{"graphql":"^15.5.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.2.2_1622454486064_0.8877722865558597","host":"s3://npm-registry-packages"}},"0.3.0":{"name":"@graphql-hive/client","version":"0.3.0","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.3.0","maintainers":[{"name":"dotansimha","email":"dotansimha@gmail.com"}],"dist":{"shasum":"18634350188ac77e4e4110712c330c70605cd2fa","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.3.0.tgz","fileCount":17,"integrity":"sha512-pum3Oqp0MSnYTi+2g5MkaRztNa+QU37IdCoazotYgnmRLmLaYTRgs6AdCUMX/dtdSUd98qw3sMhyiee64GmPJg==","signatures":[{"sig":"MEQCIFMMqr0jbYXATR/NaoZOe1lrCxKg4vjDE6R+nEjzmlIEAiARU16F5P1pVLzZqUX0yV29yR8eM3QcRpjmj5nHlJGu2A==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":161690,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgtn+tCRA9TVsSAnZWagAA0n8P/jG0ZLsmu3qAw4rS44xS\nPuBFYm1E5cZ8guRYppKCVl1CCkqyah9zNqsmPvxw60zOdR4VdrfSvmjDQ79Y\nLDhkA3+mPG2Uzu2Au6UjwrnjXL+3j+J5lFUK+nG1NgZs56QR2k4KLoGeeO9m\nBQONCgcydGCW2ra5KzWd9xebbnlf2RaA0CM3OK3mAc4qH9T69I3+gA8y1gNn\n0CHkO8XTjx5FH8fISBSXOag0rEN4Tv8Nenzk6Yn1WWDO4BAF2jZrBWsyE6hY\n7xiqfq7mB9QcStR5CnKcmbBIgt3PhLmzpw4jofJ2sN0198vZ6+/unsrzvkNv\nxPhNf2StfWjuAi1xPenU91c6PyHTtbVcQcmqyl7IswqBxjeArh0d7cz0KjG0\nQJySjYI6/bpDmX4lH0nlWB2Y0iXi+GEFNFc9dETzNBv8NLMdX3fuHrXVJwtN\niVz94l9H+8v7G6NHv2cexbThHLetZ2tRKBkSpCd/3QcECZYEcBAOgo9pBw7y\nZzpToZUB1OyXPHTyoEVhgAm3jDgvtTd/efk9PkdK9fI7cfe3Itf8oUVdumF+\naizHU8BB9PKydrLgPg9MIiXRzDGZnzzb2w2hHuMNtb22H+D5WG47EnxvVWko\nIpl/psAxdUybWitq92Bm6a9K/5aZDUa3Ww1g/e1d6YAbwYTvxmZ5vMDS1DM9\nmfHv\r\n=I1B5\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.cjs.js","module":"index.esm.js","typings":"index.d.ts","_npmUser":{"name":"dotansimha","email":"dotansimha@gmail.com"},"deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","typescript":{"definition":"index.d.ts"},"_npmVersion":"6.14.13","description":"A NodeJS client for GraphQL Hive","directories":{},"_nodeVersion":"14.17.0","dependencies":{"undici":"4.0.0-alpha.4","tiny-lru":"7.0.6","async-retry":"1.3.1"},"_hasShrinkwrap":false,"peerDependencies":{"graphql":"^15.5.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.3.0_1622572973245_0.28226624891308316","host":"s3://npm-registry-packages"}},"0.3.1":{"name":"@graphql-hive/client","version":"0.3.1","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.3.1","maintainers":[{"name":"dotansimha","email":"dotansimha@gmail.com"}],"dist":{"shasum":"9e7763c8babf18b20020a27fcb2411283afb1062","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.3.1.tgz","fileCount":17,"integrity":"sha512-vYidrPgRmwq5FJBlB6PENSBoKt3Uw10D8o78fjyBS745Yd3acXVZiXYEpa39OllFVvR/Lof0yxnwyt7SmY3btA==","signatures":[{"sig":"MEUCIQCur5ehDaGlPCQnJzxi67o8mPmBM0k2JJHcnGVWb9NCZgIgDlmSh2MgCYa51dHTrxp3mte9bQvq+y0ShJy1c0Mw6IQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":162490,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJguPznCRA9TVsSAnZWagAA9RcP/2YjcLXjNyoq/eBggKrI\nVM4PexYiYhBZ/vLYEN05OWz1++jnOICMkI/lzLDAkY9n9lXCO2Os4i9gdnPM\nB3IXXlJAon0ngP/3hjXTOFW65m6lRhLTAJMDo0j8B/7SHRUP2KkXj1hQVrQJ\nkLQakks1rVOr/iLbvcqiATXzrOujkJcM+tL/7HvRVldfqAq9QXRFiKnG/Sdq\nSPD/FecuHjcJy8VOXwwQlvAiiu40ojGxqLqsKGDH2r/IuJnXK6ayEeGd7voX\n/n/2nbHDwYtsmIVSxYz7fEBLuw33fSMAYeuUOe8LNN9mpzB0YFetggBhuQNj\nEMoLvqjjpCjkoHzlCtdgbDxrH9iiNA7BAs37aX1xa/Z7V4Uy6cmsiTf479a/\nktTgEqbL8t04DUKJB7dz+T8PB7LjIQ0CKJ81HzysBZi6FsC6E95nRxehVYof\nZ6rjSzSEnwfqomPGkdiphNJ/kFOMr8b3tBey3qqL4wAFKL+UDM4/rfUZt33V\n25BQSq8E3LYt0SpznJXxnBs/Q6wS4Hw1vLLRa8Wb3lcpsG/TksMdmOXosG/O\nYe23xKbkG4QXUUDqaRUROyAI6DWhSYrAgA6s3CYpfSszGo69ThXMcu1CUXMo\nlEc9wXttdA3nWuWlTzaCTRvSOH34HkN2qIAa1l+Jsav8MyTA2mLzYbuAGijY\nip+f\r\n=590s\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.cjs.js","module":"index.esm.js","typings":"index.d.ts","_npmUser":{"name":"dotansimha","email":"dotansimha@gmail.com"},"deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","typescript":{"definition":"index.d.ts"},"_npmVersion":"6.14.13","description":"A NodeJS client for GraphQL Hive","directories":{},"_nodeVersion":"14.17.0","dependencies":{"undici":"4.0.0-alpha.4","tiny-lru":"7.0.6","async-retry":"1.3.1"},"_hasShrinkwrap":false,"peerDependencies":{"graphql":"^15.5.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.3.1_1622736102851_0.643835126645953","host":"s3://npm-registry-packages"}},"0.3.2":{"name":"@graphql-hive/client","version":"0.3.2","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.3.2","maintainers":[{"name":"dotansimha","email":"dotansimha@gmail.com"}],"dist":{"shasum":"1e9d301b46537c95c4a382d0d61c4e5096f3b7ea","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.3.2.tgz","fileCount":17,"integrity":"sha512-6Hfj60YXbLy2D30O6x8vjGFWtTBFjSCwxryps576rH1GDzvhGsvRVk9yPjtlCZrnJzrmEtkjCGO9Klw1w1SVew==","signatures":[{"sig":"MEYCIQDwRKchZi54o1UFjNsEDnV3zAlBerd84xJ1r3mIOx1RZwIhAPXizDGjS0kcOWTtw4osYQ+oMiCA38t98Wp+mt1228Sq","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":162509,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgvzA7CRA9TVsSAnZWagAAZKIP/iw1OGZ71DECkrwm2k08\nio25onrRAIyNpiiE9vPSZPHhwS1RqJ4YcjluL3VRm4qoiA0rPQUONrHlT4Vw\nw0j3XU/5u5sEqloKnEPPyHS/J50uDTu8UmtA7Q1zRhqZ1+cfzoAuHW0RnUdp\n9e2gspr3A67McMbkEPjAURTZnaIk/FRjE5+uleq/WuBNOqq7sxZ19dnr3Hl1\nNPQh5ZwYA2cNTqqmNEzG0O6Ycefx5mrkcbTPKhOo+fiEE1YWxndhvkJO+DqD\ntxXlSdWeh8L/OZwP6SF2b228KLvNG2L14WBKNP9YWdpF9F5Qjm03c8drWcnk\n4wlSFXQDWZAWTiDzsqBa44A5b3rJNcNCjQAyHkpcnHcCrSjz5ZAfwf8xwr4A\n0jvmoFB/gMbcb3Y26VE6cglCOlvTWNW1gSg/md4xIFO3F/7WJBBglayU2lRz\niBVPx8b7Qm8euEpms/2GfOkZUhKhGIqkwguCruFhsSxzb9szMoIZLGsegdNI\nyL8f0/6savuWIWjOJzTGU/Su8V4aLx9stebkCwW5YB/FU/WiYCeyuM2YvXC9\nTFJcDMsEterNPjg595LNTDqtpN5h+9TOMCw8qeiLyFGb7q+v4vyGrbWKxuqA\nGTNz8k14fV4fWJE8O8rq9pTNXAhNnu6ho+1D8SFE3Eg27NlmtAj9VAfLusoO\noGPt\r\n=p3iH\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.cjs.js","module":"index.esm.js","typings":"index.d.ts","_npmUser":{"name":"dotansimha","email":"dotansimha@gmail.com"},"deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","typescript":{"definition":"index.d.ts"},"_npmVersion":"6.14.13","description":"A NodeJS client for GraphQL Hive","directories":{},"_nodeVersion":"14.17.0","dependencies":{"undici":"4.0.0-rc.5","tiny-lru":"7.0.6","async-retry":"1.3.1"},"_hasShrinkwrap":false,"peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.3.2_1623142459845_0.8957987447120779","host":"s3://npm-registry-packages"}},"0.3.3":{"name":"@graphql-hive/client","version":"0.3.3","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.3.3","maintainers":[{"name":"dotansimha","email":"dotansimha@gmail.com"}],"dist":{"shasum":"255f3de321269458ce6e7493fd77fd619d2dd5e7","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.3.3.tgz","fileCount":17,"integrity":"sha512-9LXArEW2g3ZdciaFHGXV7R+1YjEluIMoiI+nf18fwt14RGUETaCX7LU4m/TANWcgI9EZpB77yOIkfvIGcTJkxQ==","signatures":[{"sig":"MEQCIFxh562f3+U5qu+55iakojCk8yvVipOLloued9FyiikNAiBwSTvas3X6JX1qMfk7RHYRFy9eIr18VSuhggDeQy7gkg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":162843,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgv5JTCRA9TVsSAnZWagAAcVAP/3V2h5BYHYo4Vuu5448M\nuYnYpZf4AHKD/HtN7a1+m3Ylv97Ced4Xx0G1i9LBf/aBkDljOs5siaOfVRIY\nkK+tABW/SPGiKzvC0qGe4Un2TOI0VdX8cYtD1B4LdNY/uKMJ/Ska5aN7h4lX\neIN00993nZztoyABkXqsvp0ImEARSvTZ9Yl+w2K15LZH+Ux5o0VLkYHeuwLW\n/kDZ1PeEiYNycyp/7qV1f+hFKEa3wphERMgh9qYgESY50Ayh+g34BWLy8ux9\nuye8U3GaSDFltdMa2GaaDhJ5DDO8KVIQjSP1T9BaXQIeTVJiKWB1VMSHTBJ5\n0WQpF6HoNtDcpDokDbdvosXrMC8uox6a7tmvr97GTbA4GEBFVNoRx+0u0q2Z\nFjmRywUa+fgI3IaYZ+hbDzkknGynyvW/SrLH1TRy4vUY+/Pt3eXIbIBasM0l\nzsp+waxn56la+44ju/hlHhrGIaATQNAP7Wm6vPc8Neipks9ZYSNPWlCJdLzd\n8qsY15wT14Q0wAdYUrU87YbA4x/zB5sbQrjbev4OZapFBUcFUiVJQ4WfHzA9\nqW8Me4uA8oX+4OIA1nNf4MRfEqvlbEs93yY/MfrUwKTXDPtEx3T1bVX6V0mL\nB0fgXaGhtx2W7gNDwDyXTN00yd8RYErJS7te4A2TDUiF3YoF/eLFTjVtQleT\ndFhy\r\n=aMYo\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.cjs.js","module":"index.esm.js","typings":"index.d.ts","_npmUser":{"name":"dotansimha","email":"dotansimha@gmail.com"},"deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","typescript":{"definition":"index.d.ts"},"_npmVersion":"6.14.13","description":"A NodeJS client for GraphQL Hive","directories":{},"_nodeVersion":"14.17.0","dependencies":{"undici":"4.0.0-rc.7","tiny-lru":"7.0.6","async-retry":"1.3.1"},"_hasShrinkwrap":false,"peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.3.3_1623167571390_0.5315145884068948","host":"s3://npm-registry-packages"}},"0.4.0":{"name":"@graphql-hive/client","version":"0.4.0","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.4.0","maintainers":[{"name":"dotansimha","email":"dotansimha@gmail.com"}],"dist":{"shasum":"864ecbd69b4301644fc99cd7730be549c2e220ca","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.4.0.tgz","fileCount":17,"integrity":"sha512-PeL/oWXcaaeARYyjxwOjIj46c2kJStPb5qsWzbdsElHEeDcYwEDj0j/8DBbqlSxi5b3faRtBLLKGrqyY+9JCoA==","signatures":[{"sig":"MEQCIEfj/o3l0tSNTyYw66W1inE+W8FzLJu7noJEbj4z3fU+AiAr5XtAmh8Td1K4WbIsRCQE7MgvzF0bmVFrmbZLHBlpsg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":162451,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgwPVnCRA9TVsSAnZWagAA2OkP/3TkfkGVKV5YCL90ZFGF\nAcsiEehfHOL9ICSR2c6OYk8DlrnV/sGsPjbSe1tF/5vGR4nrhE2K7lyGZLy8\nLboOhsGpILMGMT/pvLYFQ8KcTbVyuqR1pA8BdASGuWFZZ+q+K9zs3hbVzfmh\nF00VGkrrdBPd4GaYtDQWqswX6mROpepulXFfLC/MqmvcPetxDWmcTQXFG74m\n78TEPGioTFZHzgWKOZ3FGe+XS20CBO9s3olBWfDIJ7Uv1cQjDLsVsdxpnX6H\nUvKX+Cel8U0a9HmeLp71s0VY0qJzsHs+e6wk/wHikC8HGrre+nLvWpDVyiir\nhKWl7H/AQ4FbXAYTtUtbJixAaNFUvR1dH2mkfLmfkWKdf/yvV5b7/X8nCv7z\neDVKZFUtXb2KRryEcaiJHW7LNWDp9xtgP2nQNgfmjOxSQRMQUe4rqUfXBkvl\n026Pzq6mwB7oud9BcUlW+EK0vSKNG3D44T/XD6arrGUuXXjbkOsoJ8ucNBpB\nGd+cg1VKDqXN2yEOXmghpgnhZ86L3fG24FilTSnIPLt4qc1NeIbmHR0RI+yW\n7+OgrxsalRornV9PLrIl2aZ9la9ZxYyVM7PT5L8eM27EOOl47DjkPVHitKVb\nvMLAx6nE6kxnFBs+t0zpZaPLW91BmQf+ebAcQv4WryM1//XxLGsE5yXdYW1K\ntJyK\r\n=Akxd\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.mjs","exports":{".":{"import":"./index.mjs","require":"./index.js"},"./*":{"import":"./*.mjs","require":"./*.js"}},"typings":"index.d.ts","_npmUser":{"name":"dotansimha","email":"dotansimha@gmail.com"},"deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","typescript":{"definition":"index.d.ts"},"_npmVersion":"6.14.13","description":"A NodeJS client for GraphQL Hive","directories":{},"_nodeVersion":"14.17.0","dependencies":{"undici":"4.0.0-rc.7","tiny-lru":"7.0.6","async-retry":"1.3.1"},"_hasShrinkwrap":false,"peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.4.0_1623258471379_0.8057304076518024","host":"s3://npm-registry-packages"}},"0.4.1":{"name":"@graphql-hive/client","version":"0.4.1","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.4.1","maintainers":[{"name":"dotansimha","email":"dotansimha@gmail.com"}],"dist":{"shasum":"10389f4fa177ed485a5b7b535efef6060800ee69","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.4.1.tgz","fileCount":17,"integrity":"sha512-19PmeV3gasPktVUe/t+/tr/Rd8WkSwgKeF4srGcyjEK7mAodNJsfIp7pwC6CcYs8uG1K3ksXn/gaZIjAna7+FA==","signatures":[{"sig":"MEUCIQC3TP8gs0gzHM/M9B7SGDAfr84l2PGoGZ5eOBswVa6aLQIgWShEBxnwRDt7wBKEUDicdehKNlZ/yo/Fj1QgnYFe6fY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":163217,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgwgRwCRA9TVsSAnZWagAAK68P/1IrjBqamhisPp3uKUOw\nQuMFvlSci7+qJuUwADPD6t7utZ0GOZBilxdYOXVnVxYWa9VK5/x6sXlyBEfL\nPQFLOekh8IW9vStnCoJuVndsUD8cfSug53ii2s4W2VrQjZrl9sjVUUtJjKao\n8XX8tXBIo+yhF9izvOOcNN6FsnMNXfvZH2m98h3OFn09K71tDb2OpY1J8KhV\n3SfxJdg+6BOumpg4VFNQ1c+u5ldO/HNnsNuF/KFSI7gEB5bVghiQzMcZiWqE\nbbtVN7KQ7xSWjz9cCF3GN3qVqhKw1QBfcBSKNu/aJJPrgPrDZMtv++Lm8LRT\nvKSzpXrAYozYz9gI1XSvIK8CpHsYI30ltK0pa2RAMdvSzGnUCj0DmcpPC+HS\nEVK8mVQjyc42LHPVPimDGNpAdIQJUVuh/ELsGDe5R46O7+4lUTLBavY+lLLx\nNuY7WdY7tP8d74WBwd2CAH+W/Vg59kFg6oQ//yw8p0kPFiKGX3Q37c8y6ym8\nJmBXtcFMwhdHXMq5g6BKWM0qc4TqyJGgjsrTUc92HjJ0QAgwM4/JihCnguz0\ne5aaPkUASWg0yM4CweZNj+w8qMG+jQJLApqtlzastZirie9pd840ltodHg1d\nRhnsbAiTcc+f2nWKfyVQ0C9miNBy/Tgf9bdQ2HQIZM/UVWBqSKfbT1Qikn6f\nJ+Oa\r\n=0IrB\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.mjs","exports":{".":{"import":"./index.mjs","require":"./index.js"},"./*":{"import":"./*.mjs","require":"./*.js"}},"typings":"index.d.ts","_npmUser":{"name":"dotansimha","email":"dotansimha@gmail.com"},"deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","typescript":{"definition":"index.d.ts"},"_npmVersion":"6.14.13","description":"A NodeJS client for GraphQL Hive","directories":{},"_nodeVersion":"14.17.0","dependencies":{"undici":"4.0.0-rc.7","tiny-lru":"7.0.6","async-retry":"1.3.1"},"_hasShrinkwrap":false,"peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.4.1_1623327856741_0.9976222026391723","host":"s3://npm-registry-packages"}},"0.4.2":{"name":"@graphql-hive/client","version":"0.4.2","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.4.2","maintainers":[{"name":"dotansimha","email":"dotansimha@gmail.com"}],"dist":{"shasum":"d4ef1e8a65cac883fb6c932f60197064f2a0eed6","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.4.2.tgz","fileCount":17,"integrity":"sha512-E870IuaKFCNOBMTaKtsBKUpZ6YHK+mRUrwILr2J82G1ELEiKjevhaKdWiBVoEFOHRPQYLtyKcxxhE1ms2LBeRw==","signatures":[{"sig":"MEQCIGQWsiyK4KP+Hy/O5NAZ6lVN5JngfCNkbV1E1UBdqmaFAiBriwbPUsyAzDVWZPhW1/FqQWBu7ikZpGb7e1BnnrmCKA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":163948,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgxPSNCRA9TVsSAnZWagAAhakP/2rlYw8Cx8QAJrmuhGpJ\ngbsp+hiZuw5ia36PAw5lka5zdBC2v/wh5Aed7aIddl7KPG8N9ywI5EKHUmB1\nLXlqizzBDXVOsE/YcMw5Mr5lTdziqUyxJv5yn2/wTIYI+uT0rwSWv5EJVXA2\nfRxOPrRyHHwZHMBbP5MmAdDMUIKpBHVlvR2WejIR0neK/PVsTVz53X1/p7cN\npYA3c0WuJYhQmDyAQ/1GrHmyY2d1udrhKnSeSUN3iWt5pj3YFbNi5+VtvuJ2\nx9Kjoe6qXFVmX4gzqr5oXXX+/P3qwN2Up/eU6k5qzzS/odd8ROs8BodmCbKJ\n9jkJUwxzIgbFsYga/xXOFEo7pT4Oexxytkx5UoLSPzgNWbjU1z/ajrGHIQEC\nIVfOLpHm1xFGjJ/bMNx5eVwoQc99WuEySO0ZfuBlIwZIF6WjJPbNYpcm51AT\n1j/q4UBpEEZn+gMSkeyKAu7xh4LTkt6yOuyi8izM8dXC03HFs3EFu5u7IaBf\nTnltcsnS/8Awf+YgIbPymuiWnj6GByPjXont4YvMSPaqI8swuaug+mS6Hsxq\nFhmtmSwMFlE/v+WTnVILTAPd3rF0Kia5JCYyNnXjp3EDiv+N1tRBuqteFgq3\niSpeYTR5nozQmoT5zIyQIyuceYrQYv3uyPQJktSSoAt6sWBJYZVOo5GrtYXS\n6V9A\r\n=SZZZ\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.mjs","exports":{".":{"import":"./index.mjs","require":"./index.js"},"./*":{"import":"./*.mjs","require":"./*.js"}},"typings":"index.d.ts","_npmUser":{"name":"dotansimha","email":"dotansimha@gmail.com"},"deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","typescript":{"definition":"index.d.ts"},"_npmVersion":"6.14.13","description":"A NodeJS client for GraphQL Hive","directories":{},"_nodeVersion":"14.17.0","dependencies":{"undici":"4.0.0-rc.7","tiny-lru":"7.0.6","async-retry":"1.3.1"},"_hasShrinkwrap":false,"peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.4.2_1623520397703_0.3888387015084205","host":"s3://npm-registry-packages"}},"0.4.3":{"name":"@graphql-hive/client","version":"0.4.3","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.4.3","maintainers":[{"name":"dotansimha","email":"dotansimha@gmail.com"}],"dist":{"shasum":"240824a939c269d017f2922d5862740cd780557c","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.4.3.tgz","fileCount":17,"integrity":"sha512-LAo8WQQoW7+uVaVuGGL0kgq7o7jj3WE65lKYUqaMe6sNANHINih2yoHOZtH0+uQA2oj9HWMx6ZHW9XZ1w0XNzg==","signatures":[{"sig":"MEQCIHSol5pF1SW/Oba2dq9Oi0xwLHziqfzG7MQconUUC1DpAiAEGqhUTj7Jj8cFr3Opmkind7SIPXxW6Y/C3LZ+T0b5mg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":163948,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgxPlvCRA9TVsSAnZWagAA0ocP/jtvcgtTGUo4OA/IValp\nge1Gm+DCdd56dfLWYchEcczCP418/7Aj727Sy1Bj/zIaFd0FihPtB/xYXZxW\nx6YtX5hGETFFx65hWMLKbNqBPTkOnL5EDHmu21QUGfXW526XtAIFiMKvhuiA\nAGfMr7ZJqehlrPjWOhwQL5E1Tz/LFg//pFzcoerv+KH1yuxYYDoXwQgJN1qF\n3/+ZEdC9w0NQVkzHR2CFqwhXKi2PEimHitp3532EGpXgWyiyEO7AjLlI9hX2\n8hhOtArh+iMSu2U/kaaxN+F6dDvcguAaQwAJSPACdAnoBn2d2I063b09KT3K\nmV8js8srn9Z6wsDtLaqjgIvyxteHOZuwGRIsYh/OMkBkLCxNC1AwFLw8TKY8\neLC6gehrzzDytqmJ/5clNyCGp9BFSRVK2FVZR/uqvR/2zPEUQKiSeWhIAg6c\nvds2YXfDzChfvlEfNxXvVpvDSakZPXR4/OsfknbOitvIgNZ0MwRpfeDAjDhE\nOAv3P9vZzjZOI1axD+OAYcfmz8Y73ffrQUcf6xpLyXL2S/j1bumKUhrTf5jm\nO73EwbA9cx4M34nxvRcN1lBAL2spt35ztK0SX40w03vXMtONp2OG2VSBTA1o\nHZCs37SRG4AOLvlL4iw37eK8j1Udg18XfDcpyv0GawaZw4zqy1FRRt6aM9JM\nnPK7\r\n=JpXu\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.mjs","exports":{".":{"import":"./index.mjs","require":"./index.js"},"./*":{"import":"./*.mjs","require":"./*.js"}},"typings":"index.d.ts","_npmUser":{"name":"dotansimha","email":"dotansimha@gmail.com"},"deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","typescript":{"definition":"index.d.ts"},"_npmVersion":"6.14.13","description":"A NodeJS client for GraphQL Hive","directories":{},"_nodeVersion":"14.17.0","dependencies":{"undici":"4.0.0-rc.7","tiny-lru":"7.0.6","async-retry":"1.3.1"},"_hasShrinkwrap":false,"peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.4.3_1623521647326_0.8788388438419898","host":"s3://npm-registry-packages"}},"0.4.4":{"name":"@graphql-hive/client","version":"0.4.4","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.4.4","maintainers":[{"name":"dotansimha","email":"dotansimha@gmail.com"}],"dist":{"shasum":"ba381e94e6d2d4f4549d1761d3435038eda2a3a8","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.4.4.tgz","fileCount":17,"integrity":"sha512-EVlY2qiJN3iYhPKPBqsIwGjC9JGNNYv9Uw3D2JVkEbCg8IprTXAPJU1njRFVCzoZQqFRahmpS47i/OmxfRgQlg==","signatures":[{"sig":"MEYCIQCJ3oE5EGNLIPtl48I8DYUDTbSZSPeJCp1LMY+q5Tia/QIhAJUUwm5dqAWLgxIZmhkr3c6VxF+d6Nj6oSQuT9pzL4d9","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165496,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgyNQtCRA9TVsSAnZWagAAeH0P/AwPHD700B6E8zVFcjUN\nxXOYvp9aqq+sRQdfK6sVFULiOhdwy+iOpOCgF+zOazKJ3QuFhMUOitZct4lc\nVyhaqa9jyHULgRbykLjeejcwYcBSRkCNusPdtcbEz6sAVnjjiNhVNiBNUZ/t\n5o6vvG/VdJuqczSPOqRlFwEZfJbsZHIGS6gBYK7q+mzZMUA7dwrqr9e5Mxe5\nLglxik5N6Huae5mPhxLNeoeQiXa1qnZw4MuD40DH1A0PVO9nsj4xIst6yrJt\n+7+/c0GJZkft8aicQnXhad087iKGOUcRDZNN8PSdAYGRLCDhcmRexdf51fsE\ns7TLPFpAIhbnHJMUn2oSFiw4TK04zXMiNMuU/KZ4/YO3E+qFL8AHByk6J5S/\ndRjbiH4gavrFbz2VKx/19reB93DIs1wwbQhLWZ4g8lQlMxxy4KbVLvToXdvC\nLVWBXYMqWGeAEzAVTD4TZ/JjyP+Q6NRyl/DlMh3H5P+/B9ltPDxcHKD4UDZm\nn9Jx+3OBlOFXkK7/qD7nAQdjDWYBP7v7Dk7bQaLSl655NPwJ9LVFfixLqH12\ngInhwxiqBN05bR9xz4wM7tymUPazy0rwymBOxLo6IJcPvEyxff5KPP2WnD7f\nknQQelHiutyL99geS9AY3JbaBKSgK+3eSHwtYtcc2Xanl9NolhVkMYZj1URt\nDe7I\r\n=yeS9\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.mjs","exports":{".":{"import":"./index.mjs","require":"./index.js"},"./*":{"import":"./*.mjs","require":"./*.js"}},"typings":"index.d.ts","_npmUser":{"name":"dotansimha","email":"dotansimha@gmail.com"},"deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","typescript":{"definition":"index.d.ts"},"_npmVersion":"6.14.13","description":"A NodeJS client for GraphQL Hive","directories":{},"_nodeVersion":"14.17.0","dependencies":{"undici":"4.0.0-rc.7","tiny-lru":"7.0.6","async-retry":"1.3.1"},"_hasShrinkwrap":false,"peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.4.4_1623774253129_0.7512304779687293","host":"s3://npm-registry-packages"}},"0.4.5":{"name":"@graphql-hive/client","version":"0.4.5","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.4.5","maintainers":[{"name":"dotansimha","email":"dotansimha@gmail.com"}],"dist":{"shasum":"78c9fc5475ecfbb9fd6cde37b97733b555cc367e","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.4.5.tgz","fileCount":17,"integrity":"sha512-gxqrD0TyfgjB9n8cpUSDKu70V8+o7GPnPeNiiDrdgLoIh5HVXKhsQ2MWm7UzYHNId8nH8GJ6GzNgKZAFngYQIg==","signatures":[{"sig":"MEQCIFi/MKpTASIveJKeSmD6W55j1NIt5T4FmQ3YM/Zz1+5IAiAKmVpYS6MSt4nBtlwwYk+FYmrQJjN2OMzGH5kdbCIfNw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165491,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJg0aYKCRA9TVsSAnZWagAAVRcP/0+O2D7Sa7NPeGkvUtwJ\nPOy+8U2wrYJTOV/K0Ywx1f/gWE3I+EZpe8Pgk/DscHBUnQDKKnTa6lZmDDp4\nCQf37iSTKX9n0+2kKy+4M9XtpPryNh0kyT9sIGswougb3cK6n5NfxCOt7b43\nmUs5PoJuRjAd+8ICUdpCnXA/kAc33jzXt38J/sMPas24Yum+Gw2PW1e2XXhh\nkSoUjJsrUB659/sGOCDq/aVhsOpKt+lzjsK8Tv1ZC0+r51QEEHNWYM3srzrl\nR68c9/63IPEYYgKFlr3wVoG64xIRgVxl2k4vLUGjkh7p1sN5CA4kDJc2RU9S\njs3gD5XHbEuMvU22uLXaS8epWMBnYnK6QNdj9eu2jW2/GGBdXRd4aAylXQsV\n0ZpThWdX8Egpd3xD2msFSvJz1zDdzEbIAsD3EtZutAOCMDHp+P7OPXfXA1J4\namoS2lSc/noPWJencllWbvlViROfS3QrG0VkY3UK/5gZrB8btwI4X5aueF94\ndDDU/mIpqUIn1M1lx5uDHZl6iu0Dp8iWACpS/6X0DdYm2Rt0OwH2KkD1l6sH\n91F5vYaUj3KcSknRqO3vvpvO6PuOLwP3a2eKJYReTt9EDWvGm6ZbGnIg3Xze\nqkhaCHZrlqwmfp3yYS+Gu8bBiZ77et9UdOh6qs9mTAfMCPrJOpddyQ5cyaaw\nM7gv\r\n=LQMO\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.mjs","exports":{".":{"import":"./index.mjs","require":"./index.js"},"./*":{"import":"./*.mjs","require":"./*.js"}},"typings":"index.d.ts","_npmUser":{"name":"dotansimha","email":"dotansimha@gmail.com"},"deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","typescript":{"definition":"index.d.ts"},"_npmVersion":"7.15.1","description":"A NodeJS client for GraphQL Hive","directories":{},"_nodeVersion":"16.3.0","dependencies":{"undici":"4.0.0","tiny-lru":"7.0.6","async-retry":"1.3.1"},"_hasShrinkwrap":false,"peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.4.5_1624352265841_0.9342124246025754","host":"s3://npm-registry-packages"}},"0.5.0":{"name":"@graphql-hive/client","version":"0.5.0","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.5.0","maintainers":[{"name":"dotansimha","email":"dotansimha@gmail.com"}],"dist":{"shasum":"eb87c2c29e99e22dfa76606d639f6373da9e6139","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.5.0.tgz","fileCount":17,"integrity":"sha512-OwuM+e2Dg6BOI4Tc10laMAg623QD7nP+u2nP6Xxpmz1PFFf9bREHw5aYYXDp0hXz59vIuitCuCHxqRxFqceHdQ==","signatures":[{"sig":"MEUCIDxrQCkENjkXaSSGmJNy078Cry0zcyrPA4u6u0En6UV/AiEAn4KAzYKLbu0RgRkmbBhvu38BpdBWpQ6pHdI+/5CO080=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165789,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhElEXCRA9TVsSAnZWagAA3m4QAI+qf/SSHuItqtsZAJZl\nGgQ/6IkDLKVj3EHZz5juW5RPtcIxEbhFypyF2kx1COH3pNZ1LggIeq5iz5+R\nw1QMM7pGcBXQB79ODIH4pRCCEJtlP7juQ+BHsik8fLrpM0d2nZldSDvUPhYE\niYZvNPwDE7khzJ5U56So0fvxZu69UR6hj/9HXaog0JRWKRcsx8hzz3rn2An+\neW/Ykw4+YceW0OlTXesl0TjPRsEziqQ3vehY3CJ1CbDZK2303hn7ZNygslKo\n22DacYcrtpETjpwbphfwpwoJmE2MWWm+aI2b/Ty3Nk2abCRkzG9FwyUE9kVf\n6fg9Q7YA7RV/zyK6X95jMcEwS4Tz5++NvPbZEgqHuaFK/CyKOWB8HJGNR6YI\nSfYvO6oFjSfLu+px93n7ubZS1vdW2PQ8/ar9TRwgmAsTvJCkQciBbCPaZEEU\ns5Ij0r2pYyoXG4d75b2AuxBnUMPEXKT5oZy7omXDPQm/pwrOYFPgUORe5rTi\nIn3sjhOPc75berrGvkv5hc2aCe7Wo5G8PSy6x1LbBoW56I4LWdHsoly4xEnU\n20UHOawL+wHg+pK5COPzL8ilMjsQtd60OVjjdku5mBkApuRLmYnmofzbY0TQ\nVGdzpfkNxYKOcrlaoKGewBa1+ZAkgWjf9xE01p3+ygWmZDyVpQij9JW5MyEB\nsNnk\r\n=+dT3\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.mjs","exports":{".":{"import":"./index.mjs","require":"./index.js"},"./*":{"import":"./*.mjs","require":"./*.js"}},"typings":"index.d.ts","_npmUser":{"name":"dotansimha","email":"dotansimha@gmail.com"},"deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","typescript":{"definition":"index.d.ts"},"_npmVersion":"7.20.3","description":"A NodeJS client for GraphQL Hive","directories":{},"_nodeVersion":"16.6.1","dependencies":{"undici":"4.0.0","tiny-lru":"7.0.6","async-retry":"1.3.1"},"_hasShrinkwrap":false,"peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.5.0_1628590359119_0.4327918744987309","host":"s3://npm-registry-packages"}},"0.5.1":{"name":"@graphql-hive/client","version":"0.5.1","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.5.1","maintainers":[{"name":"dotansimha","email":"dotansimha@gmail.com"}],"dist":{"shasum":"8ce40b90929814cb0f1f99666cf7ca839dbb3511","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.5.1.tgz","fileCount":17,"integrity":"sha512-sppJUfYvahEAwzp3nacRS4XbzsVJqodOMhIh6D+QF87BGa3waq6DhKCb88qZ8cXneNwfznL39elMQ5bDJc01lg==","signatures":[{"sig":"MEYCIQCAzS6/UmHDYlYgWNr47SYUL4pwGoBinXyWSY1UO2NJxgIhAM34AYx6TLXLFXHT2DQihzI3mNXEA0Ud9hqSGJeRh5bv","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166171,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhEm29CRA9TVsSAnZWagAAqLUP/31N1WUB9TCBSKhWFrW+\nJlz2Hfju15R+1KfFroepfkzxTij6eQkbzg37tqdxBTwWxewnHkJyioNHvPt0\nkpex5nSXlFCWS35XCrymDELMg75ffjPaePxVndxCEW+xLQ8FZ4uZFGpbh2tW\nYBuchKNLHLg6XvmqtqnT/y7Rz+jwT5rbBXGWziUUgRoy8TFveV0oYBM8zwG1\nKDPYAsSmbDhVZJs3RxVP+DTB1IYuKTXm6+CjDRYqAkGnRDpnzLvwgAbivTMN\nUrGvUy72/JMsGzA0soIDlq3kV+BSM6glYZmhSWqAE25ARvSJFTmrWxO+Vl93\nuAKgprx+TWuOW7S7ZeT8ntcbHsFwFrCmmeV2OGdZhjbQ+Z3RjdfScgNHYcKX\nbJgVL8e3YqM+1gYqbtJEcQmW3DqRB7TbBrBeqmuQgE02QMB/cGPCZRhhIhOd\nmnSBCeYqwKhswaem3Yl5Ax4/vQkJLZstzZRA/xAvSn79BQB43I7uiIumwqhH\n5nGie3to9XW5l8wpwQWGEsYv8uVfsIY0Jg9o1abN7IA6Cr1EIjUH6/hSL1Ul\nmv55x3xk8GeGOSsqbOhziicYx/1ZszLPZAZqpM1L3Er/2OwwiIjP4e5jNKtZ\nLSM5qicNcu1sK5g/WYjKaNZ/rZ+slayqIVU8iYoTII+0ZKvLgQrWNrGNBRFp\nf9+X\r\n=Rql6\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.mjs","exports":{".":{"import":"./index.mjs","require":"./index.js"},"./*":{"import":"./*.mjs","require":"./*.js"}},"typings":"index.d.ts","_npmUser":{"name":"dotansimha","email":"dotansimha@gmail.com"},"deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","typescript":{"definition":"index.d.ts"},"_npmVersion":"7.20.3","description":"A NodeJS client for GraphQL Hive","directories":{},"_nodeVersion":"16.6.1","dependencies":{"undici":"4.0.0","tiny-lru":"7.0.6","async-retry":"1.3.1"},"_hasShrinkwrap":false,"peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.5.1_1628597693505_0.25609980152475087","host":"s3://npm-registry-packages"}},"0.5.2":{"name":"@graphql-hive/client","version":"0.5.2","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.5.2","maintainers":[{"name":"dotansimha","email":"dotansimha@gmail.com"}],"dist":{"shasum":"fe4c6b0f517622653714d07b9fbe80de2d692e71","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.5.2.tgz","fileCount":17,"integrity":"sha512-qnlvknIMRIiddWfUpsK2xcNDJYc/CydzRtqA3930HoASdaDkOav+CV6pou/iM1Joq3g6cxrNC6t3YPIdoCtMnw==","signatures":[{"sig":"MEUCIAOsn3cAD/iTwVJYkKuwjrj9uD+lcfiIWst1+qUMMPSlAiEAn513mg69NYVnOAHg85+3fFnA2tGcw6XGPYSYu/rVFuw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166171,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhFNb8CRA9TVsSAnZWagAAbikP/0O1/bi8tBujKvoBouAI\n2299pugFcrbBofsSnidpiNQl/0o0c+xx/PhL9k9jIJDR3liekzF3TAXh6FhW\naspWoA3tA8vmhn8E7hniC5EdaR7KL46x9iSg2A3R4EKrL9RDyHD3+YyhD7aX\nY4LrrtrZw9z7fi/3qYWa1ZR9kqx0JSApOAb/6nJmyhBrrq4qbOiH30Eok6KA\n/D/9osJtDFgNwFPLsf+WzBBi5jWVo1dN6zq69v2qnR//OQCNeiSb/fO8ZBV1\nNi40blRJpYEiCer3YQzRN9ouHU4PkoPIUtsH9qC54RYL+XWpi3CVrU9zYPfZ\n7azPGVi7HGcqgloACsK/SV/DToJ2EALujCVQfFQ/JkNVYreR3u0zUobPHXgm\np/DM+CsH4HXpkDm4SiHaRpDdvkhehiNmJZNxGmNaX1s45NGVdkV9ASdUj3e4\nky/6ITh47jD6QEZgUatKYy9RuxIB+HtT1XGbMxNpKVv7F2TcodBMSPVznNms\n/dc786T+uClNUqG7ozdafykaBhiz2XwOR36p1GAjGjC37dOMv+Z2PrMbMbCt\nhLSl50MgiH+7aWsZJxEKPsAAO/qVzU8qxQ0BjHMUlpKoSiOE90In+gqGUY3n\nMGqNr7xGS1koLwrypk2AWwOKc1nRJRzzXeANEZcA1yh9DX04ZBakquw7WVo+\n2run\r\n=cAJY\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.mjs","exports":{".":{"import":"./index.mjs","require":"./index.js"},"./*":{"import":"./*.mjs","require":"./*.js"}},"typings":"index.d.ts","_npmUser":{"name":"dotansimha","email":"dotansimha@gmail.com"},"deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","typescript":{"definition":"index.d.ts"},"_npmVersion":"7.20.3","description":"A NodeJS client for GraphQL Hive","directories":{},"_nodeVersion":"16.6.2","dependencies":{"undici":"4.3.1","tiny-lru":"7.0.6","async-retry":"1.3.1"},"_hasShrinkwrap":false,"peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.5.2_1628755708568_0.656615758316045","host":"s3://npm-registry-packages"}},"0.5.3":{"name":"@graphql-hive/client","version":"0.5.3","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.5.3","maintainers":[{"name":"dotansimha","email":"dotansimha@gmail.com"}],"dist":{"shasum":"550779226de550a5774812e6811a2a5a177dbc89","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.5.3.tgz","fileCount":17,"integrity":"sha512-eE9uSlaQFk2FNeNNH+xKEsED7EfrE4mOM98BmNGNdshsr1l6aevaFZ2ewyg6cj8+u8CdKBW18qEAmvx/g88jgA==","signatures":[{"sig":"MEUCIBP/bynZckc6KmLaOFivq66QtNpNcEM/LNuslOei7CnOAiEA0nNklSEn2BXvVzwLvkvlkPc8CWQW+ADH/kqbETngQRw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166171,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhGhVqCRA9TVsSAnZWagAAlQoQAKB1kgwytLyXgTu0c2+j\nnv1k/LKtN3l80I3R+y3XXU960S0668mNdMHGMRuDj/aZ91XHw96CvTdqUbQS\nuOFoTVpVvKEvaqsrrPgk1icXLTddgW5CxLP7MP9b3dhhtkBDbUfbgHg5YoEK\nq85pvcmfNWlJvgKgSAW6Apt8Fr+AaFiK8smUXZKpyre3Zaa0ApwbAsaY7p0q\nBlmlxZTJiEYT8vtgq0Zmsqz4YrTHTIdkMRyZyaERpiyPM6EYjZy9QXNHHUj+\nr15XjPgtRZebJrsZp5dsXqOtHJcJ0q0T+JYfTdOZ8sZD+VFHBBuI1Bx8s5hd\nNI7RpcXoK3Ze0YYyc7e/3WyZxx6vtXfvbLgtqsctV92Uv1x2Tt1OFN0I8J3z\nbvVMu1DV49NMKAj734fSlhh+xxQhlVu9G+fZQ1DCZLvgrWCGyV7aIiBfpCTm\nAmYvVBUP9/oENi6xtT9kGTIUvgxP9sVG8Eit/cEwOiSwPNS1GYqdUyWt5bjV\n6/42wG4aD/HQ49OkSb5mpJCCA6yjx49ZvEIoGNB64uuWDIZ219nUYk+M+9QW\nwJjxqoz7XLE9x7D9tqrjQQV2+1BYvzXbM2Q9tbXQ7dBF+0I+pqx59myAP6YW\nqAWjQ7JP/o3ZwAaXINACvUaBBQU8SUn6UQe+jPHQ8g7IBsK7Z5ubr7XDm70K\nAMkt\r\n=TvgL\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.mjs","exports":{".":{"import":"./index.mjs","require":"./index.js"},"./*":{"import":"./*.mjs","require":"./*.js"}},"typings":"index.d.ts","_npmUser":{"name":"dotansimha","email":"dotansimha@gmail.com"},"deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","typescript":{"definition":"index.d.ts"},"_npmVersion":"7.20.3","description":"A NodeJS client for GraphQL Hive","directories":{},"_nodeVersion":"16.6.2","dependencies":{"undici":"4.4.2","tiny-lru":"7.0.6","async-retry":"1.3.1"},"_hasShrinkwrap":false,"peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.5.3_1629099370686_0.48607707484798746","host":"s3://npm-registry-packages"}},"0.6.0":{"name":"@graphql-hive/client","version":"0.6.0","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.6.0","maintainers":[{"name":"dotansimha","email":"dotansimha@gmail.com"}],"dist":{"shasum":"4f622438bfe9722a7c5473a90169973a4a904be8","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.6.0.tgz","fileCount":17,"integrity":"sha512-GXV9iUQIcAnGrsIi5RG+SXiTZDmeV8kriaT4i/wa9DNjQ8zlLuXI+aS6Yxer68EU36laWdY8zIe8KJaYZdlG7g==","signatures":[{"sig":"MEQCIC+U9HcXQ5R/x6tGd+t0hqCdpXjeU5mXeRwYR5kNGU4XAiBzLQpFImkB93O/LM7aNpvcnDc1Dx7i/ON2HpvHPMtumg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":147673,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhHl0QCRA9TVsSAnZWagAARhEP/0g6xM0MGp/0WYxXc7OR\n+DfC4m3WXRM7+Jw9R5oNy5lTEEIwKCiWdxROZET41ZvCTHdZq5FJSBRVJdkF\ntxbGxIFPxKbh6WaZrZOw6Jl3Nm7xe6dNf4Ogg1iAw/FsID7QaC2lcWJkF9iE\nCt3RdLIxmakTEVjJi6cjSTrsxN7Y3pXMmoMcJp39BC9PgIzGV0eeWL70/ga1\n/hn7tgBtfbfl64Wry/U9yTmh+NenbetwgDjTIefU2vHRjDdQI1Yz7CQAQl60\nHihE1rDGBrfj9jpO1PrDCpClSzw+i+cIBPqiLnN2S+lutFHT4NHQsC9LB3M4\ntFoZ1e/mfaFvW5Fh0vb3N5TDpu0dmBB8dc/zmgraEXu8isgLpZ7pnEDcPewU\n7KrhHjBZpkN/R36Kyi1ZUR4kh2aSgA7pMPD477iOctGzedaI/D9TTu2rN8fW\nv4ePfcRMXrRgW1uzpe/ivrHO8hq9ccHKRpVuh6hfmknWqVMVM9Sm9DnirFOA\ntB5yimXEquINLjY/dbMzvvXGTEVilYKQoTLV4s9i1x16TLcyT5BGW9UwaIbw\n50iRVwpxvPTy0cH4O3KIp0xv33Z4Cb/WkfIDYe49EsrpCblJvCmmf70GQlmF\nS3ACSClyw0IDkWuRwMYkOlSk8rq5gAyzMXX7+g87U6YSC0Xbwqj+cisxZPCE\nkrz5\r\n=nj/Q\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.mjs","exports":{".":{"import":"./index.mjs","require":"./index.js"},"./*":{"import":"./*.mjs","require":"./*.js"}},"typings":"index.d.ts","_npmUser":{"name":"dotansimha","email":"dotansimha@gmail.com"},"deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","typescript":{"definition":"index.d.ts"},"_npmVersion":"7.20.3","description":"A NodeJS client for GraphQL Hive","directories":{},"_nodeVersion":"16.7.0","dependencies":{"undici":"4.4.2","tiny-lru":"7.0.6","async-retry":"1.3.1","@graphql-tools/utils":"^8.0.0"},"_hasShrinkwrap":false,"peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.6.0_1629379855727_0.8139939435883836","host":"s3://npm-registry-packages"}},"0.6.1":{"name":"@graphql-hive/client","version":"0.6.1","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.6.1","maintainers":[{"name":"dotansimha","email":"dotansimha@gmail.com"}],"dist":{"shasum":"4040acb5cf8fb291eb08233e1cb524af86e3aae4","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.6.1.tgz","fileCount":17,"integrity":"sha512-nn0JWWfjVbvEUw/3nIl9LK5oPZRRYT4xlNjhUzkOWjGiv1A1sw8HaixKXhn1uoZ888tcdrphwyPlbC184P2M6g==","signatures":[{"sig":"MEUCIGYDCujNP9igTI6x2aC7udtRvXfUGtMbz8vmu2cdSRj4AiEA+XmsM/QOP/K45UFhJjYgoqbPLPO5i+q0eek6E9MzTPU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":149278,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhHmPNCRA9TVsSAnZWagAAASsP/ArAEtfuwrPjzxi/lC2a\no9kO1OPt9Z/Ww6q95YPmigrI7JUSWDCOSLW1O0J/GoZEo0Fh4oszm6prrqQD\nv4mKqrIGmTdXdr6cczgdfq67xsh8dG8bKU8sPQvpHMQJAD9fWnu+gyMJlz4h\nNziBPkXDhN91JNr5k+Lit24crIosQrY+N4/7pQu6IJ+SyswOjUlEX5qWWcWX\nkUD3wtMQ3sXkcyt9OdzR2dG4OcSxluD+cUOVr2+w/waJW7svv+vLmV7pEtoE\nSYbHeGqhXXqdiMmBuT72d3uem2H4LtLXJFVMnEDRE+DOFu4yHD8VIXj+9Ick\ngdjJcIuYXmGOFN6RsiAfyg5uesDSNQlnXf49r4WyDm1fVJzZQH8Bs93KqfPj\nkzdJ+rkL5xZdktDxk4ls5UjYLgz+3UlwHToU19EEIX271s7NGyDpj9AqseNX\nnnNfj93h3BrdhM78NFgQcj6P2vuhRxAo4jIe1qH0U1d1f/1LK8TX77yladMZ\ndBBdrHRRqG6/NrttdD0PxQxF6sriqmsHq6tREs7DtTNLJKHWWTvU7921/hEE\nLe15BHSTXLcwnPKMOPh9nlsKvvrCozZX3b1jG3SgpCG1+PBkP/ggFH21eung\nn+724HwY2XRGRM0FdU/QepQKFkT0nYKMM9pN3g3Cs7tRRLT9MWtXG0ApwDBX\nxoP5\r\n=c6kv\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.mjs","exports":{".":{"import":"./index.mjs","require":"./index.js"},"./*":{"import":"./*.mjs","require":"./*.js"}},"typings":"index.d.ts","_npmUser":{"name":"dotansimha","email":"dotansimha@gmail.com"},"deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","typescript":{"definition":"index.d.ts"},"_npmVersion":"7.20.3","description":"A NodeJS client for GraphQL Hive","directories":{},"_nodeVersion":"16.7.0","dependencies":{"undici":"4.4.2","tiny-lru":"7.0.6","async-retry":"1.3.1","@graphql-tools/utils":"^8.0.0"},"_hasShrinkwrap":false,"peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.6.1_1629381581534_0.4270381888052508","host":"s3://npm-registry-packages"}},"0.6.3":{"name":"@graphql-hive/client","version":"0.6.3","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.6.3","maintainers":[{"name":"dotansimha","email":"dotansimha@gmail.com"}],"dist":{"shasum":"ee6472d0f1e6ab4b624cef3dcf5c1e44795e12df","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.6.3.tgz","fileCount":17,"integrity":"sha512-axTiruiIZMoF6vJ6L3M8X1uhpNRGRduU+GqwUNmbJaezPhw4phvuaUlwPy2usz/+xmxga+tKVARVWtvcpJphUQ==","signatures":[{"sig":"MEUCIEzKoagpKOu6uw/DnKkypFZao4JrNj7Y44CeSMOIB9SwAiEA56lIng7eE6KEd08rmcMUBHY8fyzGqOhuIs6wKAUl2dA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":151212,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhI1K/CRA9TVsSAnZWagAAgdgP/0cQhORfo77SOP7KBd6W\niTC2ZzMXF30PPATnOdqxh/aJuOJfsVLBCZuIY2mkNVkyPYFR7G44CaNGCGIs\nq53Dw/qWGfZ8e8996GN8HQphRNGDUaqknNjhfD7heBAZKBWPki3WPCPYG33D\nskQ5H6FMbDBzyEppsYVxNimTCokshS0KqJlOq8PpjBmm7E59XFW9R5nnY6Ar\nCS6PEffZtRPAwNo7wJEb03qLr4mFqRRvfP8CFQbicp6rXz7qyS9PAFUxbNvi\n4ziwNsUdjwcAFXuLkPO2SnEjtA5kPMMmhWs67fDB/AUHkMPUZAtfMPnIOSN1\n9GGLePz1JzLv3grthdMlpdnCOIa1nNGSZQhbixp5Pws6P5ICZAZ8KKs3Zb0q\nlDopgtRhXAwLCQg0M2S6pAt6gATmMePQrc2OzNQt0NufGUiF+dED9hlgsEEF\nxbwooJUkyoWa4EUrWxkK7yxCn2XMSujh3DwX7g7zASxiVnhC4arc6gXc+s+H\nhH7tbuFQASu3ZBuEnjZSQkj1xesi1AJ+KjWSKK1JZSuYdtfUFp7RSP3hrZ5X\nm/Oe2ivWRBiOsqc3rCDT3E/QolqvqHN2PGozJKuKT+yPLyEInCz15OF2Ebg4\nopkWpZg++MLGFpyD/BS5EjzhyfOjHpEk3y0yYZrgT+eMRtqMc2ImOnrIDsp2\nYB/g\r\n=cyjJ\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.mjs","exports":{".":{"import":"./index.mjs","require":"./index.js"},"./*":{"import":"./*.mjs","require":"./*.js"}},"typings":"index.d.ts","_npmUser":{"name":"dotansimha","email":"dotansimha@gmail.com"},"deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","typescript":{"definition":"index.d.ts"},"_npmVersion":"7.20.3","description":"A NodeJS client for GraphQL Hive","directories":{},"_nodeVersion":"16.7.0","dependencies":{"undici":"4.4.2","tiny-lru":"7.0.6","async-retry":"1.3.1","@graphql-tools/utils":"^8.0.0"},"_hasShrinkwrap":false,"peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.6.3_1629704895655_0.7811988837442987","host":"s3://npm-registry-packages"}},"0.7.0":{"name":"@graphql-hive/client","version":"0.7.0","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.7.0","maintainers":[{"name":"dotansimha","email":"dotansimha@gmail.com"}],"dist":{"shasum":"f23448fa2ee4d9bfd2d1e940e53baaffc809b729","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.7.0.tgz","fileCount":17,"integrity":"sha512-nFDmUOuWtGxqVMjn/J21L2Xk0cIjHwj31qg+yjNST1YsVFCoUgZlHJBgLmH8fEYrCzxu42e9kqohVu2q1FAi/w==","signatures":[{"sig":"MEUCIEJF4LcKL0s9BqipiUgEK6z51zXMQrjM2XtpfJ/yRBzVAiEAlRDd+X0mDsAr4UD+NIh9XanVYDfH5kgdER00rc7EHlI=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":151620,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhJMrFCRA9TVsSAnZWagAArzgP/29QKT6beVkAln90bUGi\ndKeu+78folrcNO2fvd8Hu2DaFZABr4Lub0aAwbzRCWUl3yuJzGklkbBRvkda\n3jlSUbVa7W9JHsFipLVQdZeePsp7ilTJCX4A5otsYbThfSqgNgTpsjlnbGOM\nhEzktCb9fBT81zmB2+biz8Wsb0cfaOwyPDZiKd86N6o36GpYB302mQHs9kjW\nqL3Ps1gHPQ+JqC85F5B7ja0mveCQSmu43ZGn4ll6ki5+ErsjE5xnmmFwaqjw\nUW+8A2t6Iz5d5Xzl7w1VzaRslFara2J9rKoUkkm1bS/RwVLxTchNGnMACzyi\n5gj5yukI6n/uYxMIh9OZoCDmLbg8UYEKdJjch4Jj20Xq1xx1ratni/0OwosF\nbn0lFihwAL1WTTXcDcBi3utlets03lqpiuKJyIRAvZFG7eqVsoJkhDF1giI2\nmVJysT4eI1JQz0UHhkMLPh+q+E8BFwFlMySVCogBNqWiWOCDYfdm0SLodQic\n9EcikGIqDj9aeM0Gjn3BiSAsKVlz6dIqNWU+XnL2d3AD/8esOVxnh3ao1g2e\nXm6kMc7+lLckiSPM4m3Ku6LCb61blGkhcZpA9c9uE6dydybi294G783JOYz8\nmiYgwTtBVKez5elVWghqkwBS++lvG/Sdo8ZRrsiKgnmNcTAe9SBjKHUGhNiK\nCYbF\r\n=1G2x\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.mjs","exports":{".":{"import":"./index.mjs","require":"./index.js"},"./*":{"import":"./*.mjs","require":"./*.js"}},"typings":"index.d.ts","_npmUser":{"name":"dotansimha","email":"dotansimha@gmail.com"},"deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","typescript":{"definition":"index.d.ts"},"_npmVersion":"7.20.3","description":"A NodeJS client for GraphQL Hive","directories":{},"_nodeVersion":"16.7.0","dependencies":{"undici":"4.4.2","tiny-lru":"7.0.6","async-retry":"1.3.1","@graphql-hive/core":"^0.1.0","@graphql-tools/utils":"^8.0.0"},"_hasShrinkwrap":false,"peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.7.0_1629801157836_0.37151472856578227","host":"s3://npm-registry-packages"}},"0.8.0":{"name":"@graphql-hive/client","version":"0.8.0","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.8.0","maintainers":[{"name":"dotansimha","email":"dotansimha@gmail.com"}],"dist":{"shasum":"92f9f406f89dc286b89e9c83a7dda6e3582f63ac","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.8.0.tgz","fileCount":17,"integrity":"sha512-XzHevuVGB0E3w5XIzsohLUz6Lov0j9KrdVu4rjJFbZBM0bF3BGV6lAopTSMurEnlh7G9IryVsCZqYwSVwH8G1Q==","signatures":[{"sig":"MEUCID3DQjzE1Ifdxc80AFzFeX2PMJKzFbmYydlS6jMcrESSAiEA/dPty63GlM3284RtJxNdR3JkIvi7JYQEd3LomeVTm1s=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":153979,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhJ2YqCRA9TVsSAnZWagAA+SgP/3O+WYqm5M1thcC6lmnw\nKtwZzEZmbZ/GBRHmZVWwtIcx+t3DADBLoJgdOK8mkLP+Uiio17k0waW/97wL\nTNZiu8tpAxf9Vf1ZacazQa8uOrNQXtA5K/L20qAfXmb8BKXM/VBaVtQCMoG8\nhTpKAs32xkc6nrLxhu7LRVYGR0ANBumMUtcv157/26Bije1AOsjbNCbzwuEq\nM4T3juc+hPoQ3TL00GfJ6wLjvtoBOJdKJ8IT7uB1i5PLLwmR9nJzhGA7+GbQ\nNa6ncCuOv2r1eQ9IV3HK5iQOD769dp06aIb+sPTlH8PqVBu0BDfeH8meS0oK\nHudMH1jr6xh+JL+7ok36uFXnZYAxHFeNcJa3dz/g14ocOES20KryP6q9zWRu\n2sk2dc9vG66MjvzozG1clGt5CebYzvnJoVFNuqUOWZ4Nds9M+rJn40tn0Qwc\n2HMVTPQclhDy3IjYYVCQjSRhah/jIGK+Mq5eZhk2XQ1GscK+onvsgIWJqjBg\n4VzslkWHpDbKK/kja4H7qV/abNdUBK5l5sBicISgTEhgW/NSaXGfducVUAEN\nGw+QFvRVnKWkIPmFJXul2CtRp/yphRQ58pRsHrxn+V3qBY8DCirbcCvVAtqg\nDgcvTt/KFz1K3n6eYSvtW46Oqsjc3o+S7pcTHzFHrVcf15vatHTDIduEKZBB\nvtxg\r\n=nh7h\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.mjs","exports":{".":{"import":"./index.mjs","require":"./index.js"},"./*":{"import":"./*.mjs","require":"./*.js"}},"typings":"index.d.ts","_npmUser":{"name":"dotansimha","email":"dotansimha@gmail.com"},"deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","typescript":{"definition":"index.d.ts"},"_npmVersion":"7.21.0","description":"A NodeJS client for GraphQL Hive","directories":{},"_nodeVersion":"16.8.0","dependencies":{"undici":"4.5.0","tiny-lru":"7.0.6","async-retry":"1.3.1","@graphql-hive/core":"^0.1.0","@graphql-tools/utils":"^8.0.0"},"_hasShrinkwrap":false,"peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.8.0_1629972009797_0.9965883451580031","host":"s3://npm-registry-packages"}},"0.9.0":{"name":"@graphql-hive/client","version":"0.9.0","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.9.0","maintainers":[{"name":"dotansimha","email":"dotansimha@gmail.com"}],"dist":{"shasum":"a3f637bd54d28e59a57500c4c661e0125bd5df75","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.9.0.tgz","fileCount":15,"integrity":"sha512-VN9YEi7SLm9ItIHIFTh+oCpLElbXpfWcH9v+70r4lMapis5PeE4Y6M4VX7QVpXdYg/LPJFEXlLXAZYZ9/rWHgA==","signatures":[{"sig":"MEYCIQD2pcbod8U6MTqAqAZ3jvw+eQ91WFrSJ+1JxzGrHt7XnwIhAMAKv1mQzdwkkk0U8vcrfIncCVGiQ5dsE36SNT5x0C5v","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":67507,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhQI5QCRA9TVsSAnZWagAAXrMP/0YNYOrL6W8J+JzSzwtO\nAZbOu2Dnt/qynZ4Bjhfm4UpiCcVw/tkfmgARaf7z4xbktH3DTK4RL4EMSvgU\nx5itvnxMb+/phy4bBmdg3+14G56UcUdMNqXgZyUFbaImbiVvLy7B3adKIL0V\nYrzayBYYSQYehwx5tKOKMJAWdwMpGhaLe+DrtyLCzGc5714+W5D53bIf4/Tl\nKQMkfLK1LVE2VQnMeWHuDDkfAr+Bfy3QJU2NAKIkGrj7oNf/TrJqG8lrecxD\nfdo/ROGn6uuzoxUB7WrAa43Bk4DrQRymGiH6ofb1uctVjH5NQUIuAGmGevhP\n/uY65gDgtxjBhF2wXeu1wBTs15k6qRj6vj4zE36SfRJqqekaKrRQ8en31wyY\nGlW6EiF+w1Boc4Y+ff5CpTC+Yc3JgozZLdDXxKOb166V5+oFJTvhJ4mlte+0\ns1E7XdA6gArev4Ry2oIO78OxTOxToiSDfkwIqxidEIro45axPg4073OThLhP\nKVnISNrez8JfXdDd1NDCATNIG5FLeT/bVEcVHXtpp2D9vXMW1/oAUmwwFQFE\nxB1Uo0Q6VK3XtncYaw/wgWbTq3Nx48lvMiRLiV9BVqwmo5OjGW3yuUKaieXp\nOnfwfPVe3rwzpxdKj1Gl18bNzlmA6R57t28K94o+ZawAtc70eYJOlJAqa1w2\nxAy7\r\n=Lgk/\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.mjs","exports":{".":{"import":"./index.mjs","require":"./index.js"},"./*":{"import":"./*.mjs","require":"./*.js"}},"gitHead":"5bcbbcebe5965ec155daaf26d2c86494eb31f9ee","typings":"index.d.ts","_npmUser":{"name":"dotansimha","email":"dotansimha@gmail.com"},"deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","typescript":{"definition":"index.d.ts"},"_npmVersion":"7.21.1","description":"A NodeJS client for GraphQL Hive","directories":{},"_nodeVersion":"16.9.1","dependencies":{"undici":"4.5.1","tiny-lru":"7.0.6","async-retry":"1.3.3","@graphql-hive/core":"^0.1.0","@graphql-tools/utils":"^8.0.0"},"_hasShrinkwrap":false,"peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.9.0_1631620687921_0.26998754328148444","host":"s3://npm-registry-packages"}},"0.9.1":{"name":"@graphql-hive/client","version":"0.9.1","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.9.1","maintainers":[{"name":"dotansimha","email":"dotansimha@gmail.com"}],"dist":{"shasum":"7005106c791bda72c2b1e2ed3775d7f8665957ab","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.9.1.tgz","fileCount":16,"integrity":"sha512-DYJwyX9exv3sNJRSzGKKqAWH3eJp7rWFs47eFcyrKIuq9VmzuON7Jl9CT9iw7ar57gG+6/ONEDmVIZmM0iiseg==","signatures":[{"sig":"MEQCIHoPcvMSh00hJqFdCK70Kg56zRBzV2EOUnYlh12Z0thYAiBq3i2Vn/xl7N+YMTJ2IKQp325aTpHP3ZVkK5GvepsEiQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":67602,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhQNLjCRA9TVsSAnZWagAA1FAP/2kSWbPWTQ+24mK3dcVv\n5GSdWubOIyJ08kBtXR9N3IrjLOOLraybbyBZFs0KZD7dCBOrGV6fkVXwC7ZJ\nzM3ztyLdwWiQhAnsYJ2xuT7e1WW/BbXiBAkaozLjp383ChQ5sujedTie0Jge\nnbvEW8xAmYGmFR3BEpjbHDhuYw+VtkwZ40tpRk5z25LSpmf7c7v5vQdlyYq7\neUDvJOiaBlYJa/WXwdWw8hMKFzo+TlhyUwF9M8HENmilx9tniJOOlZAvErcj\nEs+dUK1E5o4JP/lpN++NPuUys0Yw+q8sM1tlFhgLaWnCjdEOnr2pkCLGD17x\nFiKEH4tq2+pJwKOuMAvMjqJah+rTQbp0rAL4qCo8vLzRbJSgwQ2+xspPP6an\n58bcYVB7NjcouASHNdggznavdxT61Zw/ghJHqaMZ+J3Swb+5vnIPi6VlylBI\nhb1WP0MWXc+E+xKMvx5s8XL2/IPVh0If1y6tMXvomODaBItYQQhpYhw8HzHc\nX5EXtc95ty5se+fakem0gIW26eMZE9i/adRNplTwL/+WdWaRDvwT/1eyGULp\nXrRoBus65Nd3qvyQTDu0/WAqsQB7tasDlqdYukaBaj555efY8C5wCdd8Klig\nD634oykAuFmPO3g3mbceIJcYcl1DsLFGGMnAKliQsohfbyjKtpE7Zu77Y3i7\npAmu\r\n=llGn\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.mjs","exports":{".":{"import":"./index.mjs","require":"./index.js"},"./*":{"import":"./*.mjs","require":"./*.js"}},"gitHead":"c9b7064a8aa0c7d258bd34f6ba019c2fdfee1c24","typings":"index.d.ts","_npmUser":{"name":"dotansimha","email":"dotansimha@gmail.com"},"deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","typescript":{"definition":"index.d.ts"},"_npmVersion":"7.21.1","description":"A NodeJS client for GraphQL Hive","directories":{},"_nodeVersion":"16.9.1","dependencies":{"undici":"4.5.1","tiny-lru":"7.0.6","async-retry":"1.3.3","@graphql-hive/core":"^0.1.0","@graphql-tools/utils":"^8.0.0"},"_hasShrinkwrap":false,"peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.9.1_1631638243377_0.2557517145593051","host":"s3://npm-registry-packages"}},"0.10.0":{"name":"@graphql-hive/client","version":"0.10.0","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.10.0","maintainers":[{"name":"dotansimha","email":"dotansimha@gmail.com"}],"dist":{"shasum":"a7373d374f430e61bba8c52824a060f475d65c74","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.10.0.tgz","fileCount":17,"integrity":"sha512-CRK36D93WAoVs1FpgGMrlq0lrr1TQQqgfLzHTSVD1oH94loh7zGKGgPKSgqqdnn0aobX3Zp/nGFucAB9h2tdow==","signatures":[{"sig":"MEUCIQCGLmLphjB+fCJs6PwGOEJ0ukcBS6hNbhuSIjOGuh56hQIgXEkZV59T+ZoRk6LeauwjCT68ZPKQr+mXUK0sv3JTE/Y=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":71289,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhQibVCRA9TVsSAnZWagAAmWEQAIgn8Amm5ec57IgCJJQO\nmOCtZP61qMylP6RZhWU1j4ZC8AHj+38nMR24UH7DyfDtpjMI8YW4/V+n/Ath\nhb6NYNKe1km0u4rLkSgz53h8J/Ct11ak9v5KPvPSnDP3TgjJZYnQQlQS+j/P\nR6jZ1wobYESMUyIhf779Mr7eJ+vDr3zA7QUfhU0RAYpJWcVGbvn7Sk4sCLdY\n6QeimmIf8DtwVykSCrThcOIE6g7GU9fZi2oXtzDubWC2ZF+Hi4N90YFWYwOT\nM2j6jqZjqFqPryCBcdhHTIQ62ZccSxZ+uP6Lj6/ii6DCkY76ScQ5TbqrTYYs\nDNYBuMeTi/zTqfDpo7S85r+kcAhw+7cJ29GwDruVKHS3RRhVPirC3rHRE1Me\nf1tulNQp5nbH9on5Ee/nTkm8LwKkm3u8jVo3yiGdutmBtSVTzbHkXne9Pn7/\nJgMsB+iIn+WKwg4LchUCk5ajqp/I1B05fqLubUmhh1J8ppBgMzt588pleKxa\n/LjfGWkipZ7FZ3N8K007X9AP6KYohLHIK+2GKNFevVsactgjjeJF0f38JXLY\novXwFld6MNkTRF7iy4QSrm7uDoEwf7dfFKdmydyYE0AQ9lHi08wKnVO+mVWM\n+hI5AeDT7o/o7vvLPMS0XdEnFx+/z0OUoFoAyuc3jZb3F2+MwY+Ln1TIVgqd\nVfSh\r\n=aiUE\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.mjs","exports":{".":{"import":"./index.mjs","require":"./index.js"},"./*":{"import":"./*.mjs","require":"./*.js"}},"gitHead":"9c676852ef6946c58c840cc8935cfa69d00b79d2","typings":"index.d.ts","_npmUser":{"name":"dotansimha","email":"dotansimha@gmail.com"},"deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","typescript":{"definition":"index.d.ts"},"_npmVersion":"7.21.1","description":"A NodeJS client for GraphQL Hive","directories":{},"_nodeVersion":"16.9.1","dependencies":{"undici":"4.5.1","tiny-lru":"7.0.6","async-retry":"1.3.3","@graphql-hive/core":"^0.1.0","@graphql-tools/utils":"^8.0.0"},"_hasShrinkwrap":false,"peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.10.0_1631725269320_0.5190549708029966","host":"s3://npm-registry-packages"}},"0.11.0":{"name":"@graphql-hive/client","version":"0.11.0","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.11.0","maintainers":[{"name":"dotansimha","email":"dotansimha@gmail.com"}],"dist":{"shasum":"dd9a9fdf43aaf3248308861c1c8bce2c9d0f3040","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.11.0.tgz","fileCount":17,"integrity":"sha512-GgsTfUPt/xB65hqPpBz5ckKZQXPcXsh8moNDzwN9TabxLmlH2S8kKmtP7Or1CtYj2/WVVUwF4PhjpKqHvt0bug==","signatures":[{"sig":"MEQCIGPL1ILl+1jV4JLXHSK/VOzQfR4hBKcE2lF+ZVtfHKv9AiBNfKmPWbCQhA4yUWJxYnUCw9haKcQWk3eepHYk9llveQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":73521},"main":"index.js","module":"index.mjs","exports":{".":{"import":"./index.mjs","require":"./index.js"},"./*":{"import":"./*.mjs","require":"./*.js"},"./package.json":"./package.json"},"gitHead":"fad59aa71c9fb84e022115799ffe4c5884d71d64","typings":"index.d.ts","_npmUser":{"name":"dotansimha","email":"dotansimha@gmail.com"},"deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","typescript":{"definition":"index.d.ts"},"_npmVersion":"8.1.0","description":"A NodeJS client for GraphQL Hive","directories":{},"_nodeVersion":"16.13.0","dependencies":{"undici":"4.8.1","tiny-lru":"7.0.6","async-retry":"1.3.3","@graphql-hive/core":"^0.1.0","@graphql-tools/utils":"^8.0.0"},"_hasShrinkwrap":false,"peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.11.0_1636372280205_0.7745659475336428","host":"s3://npm-registry-packages"}},"0.11.1":{"name":"@graphql-hive/client","version":"0.11.1","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.11.1","maintainers":[{"name":"dotansimha","email":"dotansimha@gmail.com"}],"dist":{"shasum":"c1579196493260bfd2e33a83dc98ddc2edff57ae","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.11.1.tgz","fileCount":17,"integrity":"sha512-ENY9lh7gck4SIe9Xt+UNK2bkbkZZtnF3PqBpw/1jsQDUFotTaHhskIoD8z5yMBhcZ7VDSYzDkALkLeqIUdG4vg==","signatures":[{"sig":"MEQCIAt4+uKbiHDItW+Dn9Tl5IHfoD17sSI7ePexoZQtQuXdAiAYkg69mchv5v40W3wsJznCKnmT/JWQt2scIFwMton7XA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":73522,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhlkV0CRA9TVsSAnZWagAApzAP/1/y2IRZOBguJZK5Yvxu\ng21H0rpcUHpkLvBylu/pJMN8qepZCJHCjUSwiQg27fBeGr9Ktx542qOeLi+E\nQfzcm8NnyCuc2veWjE7NdQoJkq28kBtVs2iJuDCP84mxvWyoGYGIUvX2ZMJI\nLSlx2c53Lo/n8/9lsgOJTgSTJ0yoKzBS2kGoLLhTDc8aVYPAZkxFRHDgXenh\nDKhQLHWbJne7prsy21HQxYtLlLIkuzixzToLErgItzLDi61OEflQS3DWpiCL\n2Sfekkh8P0+3Kv0D+m/DKZ1HjzZg4BvjoIxtOUu/77Rwht0uWt2X40UMalE2\n9POhcjJwL5WVI4S8ybsE90+4NkSG9507dB5choNaiO0JpeDFs7zXQ14r0YRb\nxQ709w6RUIxGtO2JjUcUN9X1iOMuYSyByzbvNr3aCqVl7emld4YTSYUflyGc\nScqj1NebT3H77Yzw+VNtUThI0Kvp+GPYu3J7UkTT4e2a3R/12j5BKT413+6S\nF+IhrLK/uh13LS+FEfXIKqkm26iM5/IjyVOw1ppFt9uu5pjuxC4hkDJQ9Zxf\n75bML6FbsOnLVWrqsTLRGmh64TFdLCdfr4Megp8ZHAB1lR04X644NMjRWrIe\nTKkGmMIk89y4sI2jW3BrhFOfMSGFwEBVm5sKKGQHLcMKs1D0ZKxgfvPVaNee\nAxXp\r\n=FQtA\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.mjs","exports":{".":{"import":"./index.mjs","require":"./index.js"},"./*":{"import":"./*.mjs","require":"./*.js"},"./package.json":"./package.json"},"gitHead":"623b280e632afd71694dd17812f2099744a8725f","typings":"index.d.ts","_npmUser":{"name":"dotansimha","email":"dotansimha@gmail.com"},"deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","typescript":{"definition":"index.d.ts"},"_npmVersion":"8.1.0","description":"A NodeJS client for GraphQL Hive","directories":{},"_nodeVersion":"16.13.0","dependencies":{"undici":"4.10.0","tiny-lru":"7.0.6","async-retry":"1.3.3","@graphql-hive/core":"^0.1.0","@graphql-tools/utils":"^8.0.0"},"_hasShrinkwrap":false,"peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.11.1_1637238132298_0.11916746998826766","host":"s3://npm-registry-packages"}},"0.12.0":{"name":"@graphql-hive/client","version":"0.12.0","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.12.0","maintainers":[{"name":"dotansimha","email":"dotansimha@gmail.com"}],"dist":{"shasum":"90960be45df4c9acac648a8335332fc3a41e582c","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.12.0.tgz","fileCount":17,"integrity":"sha512-aQCF/KYO1uE/a/DqlU+Ni2kNrKba1gcMaK8Vpbbv2aIR4HagX+tImZnjHiO97CUO/TJNubvqJ/76G7sQwb679Q==","signatures":[{"sig":"MEUCIQCKA0RSpc2ec8Io6mKk2Zy32K+V1kp4xJz7h0jrIWsnHgIgSiDX8Ct4ov3joi1/DH5RO/F5bm/FKPQSaggPmJLmZOc=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":73420,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhsN+CCRA9TVsSAnZWagAA27EP/3Hp21ASEqAxdea1LGnA\nMS3aNqgNzuAnTUiRoTcB4J5pPuHjpO2hSm0hNOxBu7uOVjUmbsiHyJ2WczkM\nuAzWtfvyaWRBsnVsJBNbcNDwEPZhe4Vedb9PDxz904gR8p5gQtyf79wOmN7P\nzTbJxb/gWW305sxL3YjG2PeUuiPm2DYU4eGVNelzFngPgwSkj7mydbwRPO3A\nzwFivmP14QpUCwsGRtZFtIWeRYy9T2htBK3H5LX6R1KueN+gNkdIX5bqyYnL\n1H39GdMRwSa5GGugqp8y4LwwNCXDZX8QduGr7Csao0JGXxUTQf26fxC/S3bR\ngh5fq0RbOL3XMN8shhkYLx0Z5QJrozk/J3WdznrU1Bv4ILp1ACxxTyS1Xs6B\nbqA0JFVGdjtRFXtdhcZh9zwj7s9kqrn+QhY9LX6+Ek1ice5cXdO4yWavCmY4\nMm2H2vDii0wfp1f887SE19cFxNngQBJmiOlC31CrAeLsgWnWg95wkLRZMS3O\nUdItc2xRexYETPlYfcy/AMzxCUyR4KdIN71tBAfjuWfB9WalIYIQs9ZOnd/G\n+9S7RouQFui1jkNCiWJg+dIOtd5N3B8MWsUU6z1khRJuzEPPeeJVcJEYoi7V\n8CnTnlR3RLYGcBvXj4lpyVnwseQDO7tUkWEToDq/IXlKy+xldENF6l86tMtA\nHFNj\r\n=zwL9\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.mjs","exports":{".":{"import":"./index.mjs","require":"./index.js"},"./*":{"import":"./*.mjs","require":"./*.js"},"./package.json":"./package.json"},"gitHead":"cb333179a05fded09bb7e50c9b265f9527269be6","typings":"index.d.ts","_npmUser":{"name":"dotansimha","email":"dotansimha@gmail.com"},"deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","typescript":{"definition":"index.d.ts"},"_npmVersion":"8.1.0","description":"A NodeJS client for GraphQL Hive","directories":{},"_nodeVersion":"16.13.0","dependencies":{"axios":"^0.24.0","tiny-lru":"7.0.6","async-retry":"1.3.3","@graphql-hive/core":"^0.1.0","@graphql-tools/utils":"^8.0.0"},"_hasShrinkwrap":false,"peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.12.0_1638981505912_0.1526635139226642","host":"s3://npm-registry-packages"}},"0.13.0":{"name":"@graphql-hive/client","version":"0.13.0","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.13.0","maintainers":[{"name":"dotansimha","email":"dotansimha@gmail.com"}],"dist":{"shasum":"4f0bf564f913bf573d1d9a4040cec84e5cdca53b","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.13.0.tgz","fileCount":17,"integrity":"sha512-46Z3ohjqp6Fi6AYbEIWUMJWbpnqrH+A7BQjD13iTn9+4TddPQqJD3xJ6aj466xdmmxJTUk86hwCJm45u0uox4g==","signatures":[{"sig":"MEYCIQCI/VLVDM1v4WCajipCK6XPB4oj5nb6+4InRjRDKWxX+wIhALSobbXoQBtSY5YhKgv1+DxNZb0m9wxgNRxBPaYtp3ls","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":75364,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh59luCRA9TVsSAnZWagAAWeoP/10afK1jS+DsWx32IJyt\nrE+7tqiE2rH5QeR3wJbR69xAftYYL5dtLc0wtAG2+zj07NjZhgSwyos8Vjx6\nnQr17a0wuSexNfeYOW6xGMFBLeCcdx3Tk1Po0oPythSLXlwPBOVmaIPAAk0d\nXkrGlqGp4myeKTv1Ck7p5ToF/rcpsPsyIFSLl6vfVR1ZBJj7w0hnTAB1l/SC\n7gz1xU3mjIvIrF+AlrtjfPrxm2654KMYlKwrJr73JDnGKptJnJS8cR+q49cS\ny6T2Hx1e048M3nmgTmIbVUmstJlsUZe8UmrOEyjDhyYUak1FXs7nUrZa86a5\nKnVHMhM90mhkTSl20HnRwHQtMpTFv7iamGSnQarphhXU/Rc7b6cdZ7oZNu5H\nt8dG3PkXF3JVHEvDl+LXOKh42P+5mRMNiIZlWYVdWpfcZ+6eC+8XT2vgmD6F\ncOs9j3V3op8RowB6nAqcP0b/yohVhXy3fQFwo//uI5/KMgRYWsULur0gp+q9\nOogreU4GMHGrTvpkHJRAegcc9jNSdBZs/xv4oiz4GIcjL9Gfsx1kX/z4YUyM\ncLJZepOvLHvr9amD1/jJ5xr4D8HKxQ63LPLGtcjRuXZGSsr8/1S5K7v4EcLI\nsVVL5StybfOg8QqxMseNoFpkyCqS6JhSF8eR+uMqQ1tvvSRcRbS7Ke6GQeza\n3tMu\r\n=05XR\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.mjs","exports":{".":{"import":"./index.mjs","require":"./index.js"},"./*":{"import":"./*.mjs","require":"./*.js"},"./package.json":"./package.json"},"gitHead":"c783b8cf0c279a9e6e0ce30700128bc35516cc4f","typings":"index.d.ts","_npmUser":{"name":"dotansimha","email":"dotansimha@gmail.com"},"deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","typescript":{"definition":"index.d.ts"},"_npmVersion":"8.1.2","description":"A NodeJS client for GraphQL Hive","directories":{},"_nodeVersion":"16.13.2","dependencies":{"axios":"^0.24.0","tiny-lru":"7.0.6","async-retry":"1.3.3","@graphql-hive/core":"^0.1.0","@graphql-tools/utils":"^8.0.0"},"_hasShrinkwrap":false,"peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.13.0_1642584430471_0.3209036069027984","host":"s3://npm-registry-packages"}},"0.14.0":{"name":"@graphql-hive/client","version":"0.14.0","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.14.0","maintainers":[{"name":"dotansimha","email":"dotansimha@gmail.com"}],"dist":{"shasum":"dcb85e4fd4359da22df778899d58d0deaaec31c8","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.14.0.tgz","fileCount":17,"integrity":"sha512-K9hRyVL2wxJ3ENdBsEko30zWBpRhH4QcRHE4i9R0IIFzKx9EUmpFaHtL4OuKYbSxURFzz+tC6ed4ZvGNTuldhw==","signatures":[{"sig":"MEQCIGIbI7yxRX1TNFSaM3lNgVC2v824SkEWDkkVU9491YuqAiACIKyKPGXnc86Xhzgg7WW0ycqH+LtP3qcMXLjqy0bHiA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":79065,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJiAq7jCRA9TVsSAnZWagAA/D8P/ii0aXGFsZeKscrrfpUe\nVTcoWNskiD8Qow5NBdAYijB/N7BNy+Kyp/gBcIKtYrsMJqAeXgUb9709e7Dz\nubwF78pjEf2LAy5LK/7CRXCmM9Ua1ksXFkSisgTTmCVHSKAU7qwcbC0IDu+F\nmumRImJpF2K8/K37P4IhSJ8lmYu/qiFW+6l4mW1rzqbvy5yYTb5DVdyMEa00\n32KdVZQd4Ry9T838j7w3YLzU7sWjT72NeXbpkuCejjNrIjw3XioVNwsixzy8\nA/DUN3MDo23E7Ty9MoDQgsMYO7n2XUo/QBFBBqhoVjJ8YSOF4cM6rC561XaF\nv/J+0CPVkzxq7FYC37Km3HL7Qyo9v/h+6rU3ixO4ZfXtpqv3xX+6foD5rdGE\nAo6H0B04pLvKIkfEpKWkMX4zaU3qgQ2wvqtSI6IoNIg65XUZI3v7wl71xY4W\nabnVce8j8vqDa1JeE48oS6XBpM6NFF1jU/3bXczPzZU/y2FYKdfjds92Km18\nWf4Ftte3x5IRLCLLdyQfRoU970Kgb0RO7OzZ5om6ITvE0qBrSunzfX9Vf4uS\nxjEt2iiD+ONiMf80WB8H00xh9d3HFxILpZ77vfBcwZzOJFBWW5r5DzddQZM+\nX3sqKjRWmRryuc0ecacmZfHfqVsC+0/0SKxmX1+f4mXu3MKeJJ6ByukkU5xR\nTvb4\r\n=GTOo\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.mjs","exports":{".":{"import":"./index.mjs","require":"./index.js"},"./*":{"import":"./*.mjs","require":"./*.js"},"./package.json":"./package.json"},"gitHead":"272df41d186baa478d01bb841154bde14b16ffbb","typings":"index.d.ts","_npmUser":{"name":"dotansimha","email":"dotansimha@gmail.com"},"deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","typescript":{"definition":"index.d.ts"},"_npmVersion":"8.1.2","description":"A NodeJS client for GraphQL Hive","directories":{},"_nodeVersion":"16.13.2","dependencies":{"axios":"^0.24.0","tiny-lru":"7.0.6","async-retry":"1.3.3","@graphql-hive/core":"^0.1.0","@graphql-tools/utils":"^8.0.0"},"_hasShrinkwrap":false,"peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.14.0_1644343011162_0.16824863772162146","host":"s3://npm-registry-packages"}},"0.14.1":{"name":"@graphql-hive/client","version":"0.14.1","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.14.1","maintainers":[{"name":"dotansimha","email":"dotansimha@gmail.com"}],"dist":{"shasum":"f517afccaf55febf0786baa138bb50ac5ac70042","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.14.1.tgz","fileCount":17,"integrity":"sha512-Ulg0kTj+3+ERpKO0bU8PSYcWO0385o1sSMYu4iMzFVd/OKI/NhcO1AkGaVmYyPxw0jXa/McKqoz8bqvZeVmAXw==","signatures":[{"sig":"MEUCIEK5MxLiihxAwtuOGdoVIXL0QeuQrjBItYnsyS5gpb9CAiEAskFgudg5BBPkpQkANixA8Gg6Cn/OC841SM8enCm5Gx8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":80383,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJiCiztCRA9TVsSAnZWagAAPyQQAJQtDwf2KgGR+RWz1wPG\nP05mwpaRMBlCuLI/4aVxauDoY5oElE0Zh3rz/b6ypp94cTU+zqSOMo7V/fjV\nt51KQLpX5+xFli+D7xew3IUk5n8csv+8qy+/Lj4VahL4tZLqPQEk//n7UvkR\nsbaMU+SUQObjKjpZXlh1KWCTq0gH1HNAo+XHaGps6+tPaZxJOcsmrH5h85su\nDXv/cdnguRr08OeUrtCvMQ7yWkKct1mhpmoG8kKSuTd5NUptQSpx80PixNh3\niXjJj9t1P2K5wQodTCpcYVXJsCJZmXcTAVbxLHHSqHogZSb4SmLRWa+KtnZd\ndfdN1J9e9iRYzcs86fMddUDT6nlkE6InJqFHjsNd5fSdf2kVPiRBH1iL9jW4\nnMJnCvwaii1lQRW8vCjTf3yDxctry0AdEzy0ssyNU8hj6Uht9COjyOeoVetp\n/X0NQ64PPcOeX0GGxDRJilWVsWdijLupLR1QBl1a+DIllmXoV+rmUzDLeDBb\nr7fjJLQS77FeZWXrMzhxzIegMunM8kyfQl+QFV1MXo9c5Z6WNVE74Ym1gYGe\n/Vm6QjEILXzmnZxxXP2dIELV2B8+6tP+kqDqgjjL1xJSEdA5jRsv2XWrmyMB\n8eag4Y2/ET3MN/aTSQmKwro0t8qzJ6ZUjv+rja5bkXUwgjVzF4jhy7xGmS/D\nrrC5\r\n=FdBT\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.mjs","exports":{".":{"import":"./index.mjs","require":"./index.js"},"./*":{"import":"./*.mjs","require":"./*.js"},"./package.json":"./package.json"},"gitHead":"654ffa24d6e22723379d0225da56037117e67ac6","typings":"index.d.ts","_npmUser":{"name":"dotansimha","email":"dotansimha@gmail.com"},"deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","typescript":{"definition":"index.d.ts"},"_npmVersion":"8.1.2","description":"A NodeJS client for GraphQL Hive","directories":{},"_nodeVersion":"16.13.2","dependencies":{"axios":"^0.24.0","tiny-lru":"7.0.6","async-retry":"1.3.3","@graphql-hive/core":"^0.1.0","@graphql-tools/utils":"^8.0.0"},"_hasShrinkwrap":false,"peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.14.1_1644834029544_0.3003232801026965","host":"s3://npm-registry-packages"}},"0.14.2":{"name":"@graphql-hive/client","version":"0.14.2","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.14.2","maintainers":[{"name":"dotansimha","email":"dotansimha@gmail.com"}],"dist":{"shasum":"86fa9b335330760c8980f8a1a8c8df67721faed2","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.14.2.tgz","fileCount":17,"integrity":"sha512-5PEhXHBtLxj6SzfzOGA+TZP95aEiT0p7qMgQQ0/FE/qYOzTaVUG8v+EDmhmiJD17lkXAqUu2/PtfvEaQ/tscOQ==","signatures":[{"sig":"MEUCIQC8s/4lzKekcOilwyj5mI1z5ollNENI7+ggbtySntmuzAIgX8UBiQbhhp7WPkx4+lhPrLomX/HeGCVQ/Zy8SBcqwJo=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":80383,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJiCi8dCRA9TVsSAnZWagAA9HcQAJxcqTY9aagvc0l0homG\n8CyyaOzRbxtYI58rZWhU3ULmljcfeTbV+F0vMsqAOZVhOV5wwlNgAY63MU3g\nyuk1o+56NrDi+PhJiIAyVRpv7KuplM1xymNo+8H+QmknRdpMW0OLcirWN0ON\nDCtd6a2f39zZt+hPdes9RvvBf1w5bv+mbnwEe8TP+67n5HjSDVZMyJ2va/lO\n0YYWI09kr51pYguUgeLr1+C2U3Sp10m0oQAPKMol0GSTaQjgf0pm1p3b33de\nxzjTAHiU+6Wy2dVb2NqgzNxJgRWK+lIj4N5inohm3FupFdxZHq7JYLKlJ8sC\n6Kwyu+LQVSTph9ySTFWk2EKuzc31RaGOT8aOo92rSx2SlLa/lpZ0Xv8s2omE\n5T9Sv/Ls9yj2k3RWuqxe0Nq8MTUJDmAZMs1bujFsKVl7XyoQtD6JNHC3xnYO\nmjNhEdXd349eQvZADXpSjRhI1NygF8DCEVuPjSOneos8DWLMJeXwQkvpORzZ\n5PTXPOw2QC0SNh140613EfeJ9nz5HNpFIHNppmS7ksa/huvn0Elg3Nc1Fa6L\n0ra+p02vwvEywuoqIhu8cmaG9f2F1ZY56xbY/WEFUxI0T9aMtwp7aASGzVQr\nnbLt8BhCUNCdVVKESQDWGbOfdqJcQTU9oHBH5mpUanh4o3zOArx/OvUFaOv9\nB/Xx\r\n=K9U+\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.mjs","exports":{".":{"import":"./index.mjs","require":"./index.js"},"./*":{"import":"./*.mjs","require":"./*.js"},"./package.json":"./package.json"},"gitHead":"a49d1622e2edef454c30ca19dc32dc3c125efe15","typings":"index.d.ts","_npmUser":{"name":"dotansimha","email":"dotansimha@gmail.com"},"deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","typescript":{"definition":"index.d.ts"},"_npmVersion":"8.1.2","description":"A NodeJS client for GraphQL Hive","directories":{},"_nodeVersion":"16.13.2","dependencies":{"axios":"^0.24.0","tiny-lru":"7.0.6","async-retry":"1.3.3","@graphql-hive/core":"^0.1.0","@graphql-tools/utils":"^8.0.0"},"_hasShrinkwrap":false,"peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.14.2_1644834589602_0.2078817977894849","host":"s3://npm-registry-packages"}},"0.15.0":{"name":"@graphql-hive/client","version":"0.15.0","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.15.0","maintainers":[{"name":"dotansimha","email":"dotansimha@gmail.com"}],"dist":{"shasum":"735ee509663141936af721447c64c6dfab6a4429","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.15.0.tgz","fileCount":17,"integrity":"sha512-RLQHlrr6i8l+HcOxYlN7LqqcSWXvzdOUk77xuNZq95UgmQXMegK924brQvTG8u3BV4o7NObNRZccVXdgvUn4WA==","signatures":[{"sig":"MEUCIQDzzzMpdstPyBnJbpuQjug/HMq1LDIkQIe95QLuaP74bwIgLV0QfaT5cmqcX9oLRV7eQNN+ZPZCS/l006ZwHBcP2ag=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":80394,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiRvyFACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpSCxAAhQIDYeBLxiLKYr4erVdfqCVGrkAWCCFXAG3AYYsvlYFkFRJq\r\nTaLEHPMDj+WeYIb3xmCvBZHdGomqU7oY+VML2YHmd4bfFvtykSkbfH4GrFXT\r\nbYexoBQakWf1ayLWIopgKC0iV0ad0IXfKHdxksIimhjqs+Po/pB0Bnt4bTgb\r\ncBzNcM1vhhmMsWSaeOvDDzqc30YUFUw7g3PRBlwc15aPeZwmk+/6kbz7dOsc\r\nIncVkP65ln/daFsoYtPvxGYkRmU9Tn8f+X99n2fTeNM4JCrBoK01yihPXcuM\r\nCbENBQGAwJQWnvSMjPsA/IqFWA3S1N6DOwrCIzgyZQIoWmAbuhMdzwoq2U4O\r\nPauA7s6qkOjsLdj/REJmj4hmOVcYlPb5ES2djALFsJz/AjF+stcm9JCNigHX\r\n1Jo4N9e7UArogYGCrkBXjeFv7Yx3oLsjMfGhfskesmOawKjk1HyLnzW5mePE\r\n1Zr5hHeJFMOEie9x0pKu7eWZVi/5RXp18967Ehoi0QpJDY5YXScy3p11OxLf\r\nlZEMLS3PyYr+1GPwdHXk+txCZu0D4mxwv1dnUSl162bfWGr8K22ggbLdEW0S\r\nAYuZUI2/ORUxRoy8+8m8kayWdz5j23WBShkHvrDNJW1TtMHGyFOZDQMPR2Xo\r\nh3DHmFgbpIn08tstud57AVjRqg92CJKIkQ0=\r\n=Fj4o\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.mjs","exports":{".":{"import":"./index.mjs","require":"./index.js"},"./*":{"import":"./*.mjs","require":"./*.js"},"./package.json":"./package.json"},"gitHead":"d2542bdde559d59e5e32168536ab29e1ad52256a","typings":"index.d.ts","_npmUser":{"name":"dotansimha","email":"dotansimha@gmail.com"},"deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","typescript":{"definition":"index.d.ts"},"_npmVersion":"8.3.1","description":"A NodeJS client for GraphQL Hive","directories":{},"_nodeVersion":"16.14.0","dependencies":{"axios":"^0.24.0","tiny-lru":"7.0.6","async-retry":"1.3.3","@graphql-hive/core":"^0.2.0","@graphql-tools/utils":"^8.0.0"},"_hasShrinkwrap":false,"peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.15.0_1648819333706_0.5581471083673009","host":"s3://npm-registry-packages"}},"0.15.1":{"name":"@graphql-hive/client","version":"0.15.1","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.15.1","maintainers":[{"name":"dotansimha","email":"dotansimha@gmail.com"}],"dist":{"shasum":"b752a423055b95a420cf41328346f007f003e083","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.15.1.tgz","fileCount":18,"integrity":"sha512-TW7o2QEQzbuw+odmLsXzaytkYTihtCfGq6m4W6DxCU84E5JOE55KyKVGulLPxOQ07crr9q19bMFYrDu76uzDuA==","signatures":[{"sig":"MEUCIB/IrN3AtCxTievdhpZoSjPiRQ8Jo9XMoUhrrLu1/j/oAiEA12ybfZiVMS7xDr1eijntEk8t0Kt9Y4Mqg4BRnlSGxtQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":86143,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiX7Z5ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmrd+w//fXI+ACRfle8pti4BrmAOsQszeROj1mN29lZkq277FizAnO2Q\r\nyR2R/gD1MvE9oOmgm67A9/7t2T8ToNUg+E4MLjeQS6x9F4X0HI0fgu6dgebb\r\nR6HO4HKiv4/p592iUmiSaI5hiY0ICmthm9gGapAuQclnzoQKgc7gFcJcSHVB\r\nVzpRXeiHgZppYivC62zF+GFpX7bp5N3ghbyWNuCpvmVZJkOsq86flF9evzfV\r\nSJHHl67KDoiUyD/ukFtnO+wsJptYX98aXb7c//IC2VqwSH/CO80ATkww2R/T\r\n48Fw2VpNmEZNxpmIOvc2NK8fbVwhck26kNUfVJjErSOY7FZy8sThnNXqWepK\r\n4xR9kzi9fzn4JkiYAZsYlWKEIUVvDcLovtWLKubWyanfNODIgKuz7H1XddmD\r\nGUUu2PwLSqJ0hiZOTM2FDYeBF6wYaZlK+juY93hM+2swXqgwiCY7P5JdL8iv\r\n3YcU0//3T3BEOxxBfBdMrOiVV9eSJBOfefNhv+uYHLN3bG2qrFLOQJIabQEb\r\nyKCHF7YzEvGVyLq0wzRfiK9Ch1+WklMwATDwroV6W+6f+q7veJLkXFMvO+mF\r\n4lQn1tyGjjRfPPNJ19SSglX0sP89oCbkKxnvPJR+Th0KZQB6kEe2xm1bNNAJ\r\nuD9yie55kblp0jRQfNGrluifDvLRueH4IZE=\r\n=WJTj\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.mjs","exports":{".":{"import":"./index.mjs","require":"./index.js"},"./*":{"import":"./*.mjs","require":"./*.js"},"./package.json":"./package.json"},"gitHead":"60ead07da1ceb4ef08f38e8355b80fc21ae724b4","typings":"index.d.ts","_npmUser":{"name":"dotansimha","email":"dotansimha@gmail.com"},"deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","typescript":{"definition":"index.d.ts"},"_npmVersion":"8.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"_nodeVersion":"16.14.2","dependencies":{"axios":"^0.24.0","tiny-lru":"7.0.6","async-retry":"1.3.3","@graphql-hive/core":"^0.2.0","@graphql-tools/utils":"^8.0.0"},"_hasShrinkwrap":false,"peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.15.1_1650439800954_0.17958282479097032","host":"s3://npm-registry-packages"}},"0.15.2":{"name":"@graphql-hive/client","version":"0.15.2","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.15.2","maintainers":[{"name":"dotansimha","email":"dotansimha@gmail.com"}],"dist":{"shasum":"097fb2bb1d28015c7d5582422367274967d91b8d","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.15.2.tgz","fileCount":18,"integrity":"sha512-by9NJEyD00XIAczb4m7EYY7+XlDrCMt8ZP0GMtRxlsEP+mENPWvItS9BOkWzXIdPqmPlhSXwBxbalONm8p2PmQ==","signatures":[{"sig":"MEQCIG7OB/U2yLAnZWJKAdila3ouZUOHAeGgvJTjv4e7DBtGAiBrrxM3HcJdG9yD3KDF5Xsmg41U5s1U8iwpo6FjMeKGdw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":85332,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiYoDCACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqKvhAAmoMKdlkUrQlVP9zMYzESb0CyJmwRINoNs9diSZwuFYlNKnRs\r\nEPJTQvyQpzwpRMrOapitt8Cpe+3/tRLF1iK5ZPN3H8gFMXs3bfO+iH/W1Tlz\r\nvVCJMboOKxOdE5jM82AWr3C96zTzAGiw+ExwssMoTceRe7vicZGB+wZVVUnF\r\nyCF2QrkJFHwl3YnaRc9wvpBrO2s7Yo9YTzPqNxilBaAC8H976iC1uH9DkMc+\r\nCOSqHzMjxfyW3ARcM6M/ovnTcjiseVCa/EEenRFg0eNgFYQZovwpU6CbAbOP\r\n9IwWCwDjx8HXrkzV49+ufm4rxBQwvGXiZTTeZgUI/Q2/OxlYOkUzjK8gDBi/\r\ncSg8paNSZB32ZR1woI64dJsHGTTKWWE3/jyElypDYJ/3Evj8LiSHTR6GPFGX\r\nHN88+tQd06TyG2dhB9ge+wL+8UUiMQPfL1LKWrzF6umGEb36M5IBAwY35cDx\r\nnBg8s/D5Iy6xqGma/A50RLK1Q2FubdBWiDmchG56O2lYbE9Ar73z1ZCUN4GJ\r\nbT/dVHyVjtMSOIlgOzn7XDCAgBM+sq8HAOetJuC00swjECHkF2l05L1tWJOn\r\neWrvdXORZc0m0S8TjwMX8k9hYSH7B8Jb2J3320QVZ6qM0sLwP0dSDtNhwxhX\r\nxpxaJ1QHiXD7jaDqelz8W9xb/KKYznTt9Fg=\r\n=z/lm\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.mjs","exports":{".":{"import":"./index.mjs","require":"./index.js"},"./*":{"import":"./*.mjs","require":"./*.js"},"./package.json":"./package.json"},"gitHead":"ede807627679029ed6ff27848b592001d8b984dd","typings":"index.d.ts","_npmUser":{"name":"dotansimha","email":"dotansimha@gmail.com"},"deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","typescript":{"definition":"index.d.ts"},"_npmVersion":"8.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"_nodeVersion":"16.14.2","dependencies":{"axios":"^0.24.0","tiny-lru":"7.0.6","async-retry":"1.3.3","@graphql-hive/core":"^0.2.0","@graphql-tools/utils":"^8.0.0"},"_hasShrinkwrap":false,"peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.15.2_1650622657866_0.38517486272563217","host":"s3://npm-registry-packages"}},"0.15.4":{"name":"@graphql-hive/client","version":"0.15.4","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.15.4","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"91392e85a2bf40759a6347366d4ac4195f50b7d2","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.15.4.tgz","fileCount":18,"integrity":"sha512-oJuTKl9W0+BQjigMDxz4BaUUsONwdhopVelzLrp67Q8Bk/vQUXeeMLm8ucl4VrmX4Y/wT8zKcrjZxdIWAQTwyQ==","signatures":[{"sig":"MEYCIQCw7nohpG3tikwsFFJ6EdLZ7BFuMU8aR3MDckhY8wnbSQIhAO0SF4Sa2h/L4hrQplSwq6KFQJwDJyvN1kAEF3wrhvM4","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":84856,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJijjYlACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqIARAAgW3yjrPl57WYf673lwCF3107xfTf254yl1V5qyx6rakNBlYr\r\nlo0j9ShU/0MkqTRYHSgbcqS1KdWxXZZwqsnyB4z6p/Ri1eIXyVo38h04daSL\r\nRHBFRTwYAv/OitU7iXamzR5X6KVN29zhHcW1CVhTx66HPvMeGv99XScsa0ay\r\nJdVDAroKBkMjP2zi7pvfSBZ5hSwtS9DsLZ/fr3FdCAhOhcWztQZtly4EfQRH\r\n+pyuSuY64yse/CM7hMkxhQu6qcvAM49WLSVE/IpoMV2L/t91qlobCYNh1ptm\r\nYs1KOfYl9aCTlJ7hdSjG62btuchqDM8PQRtDBqAZ+/aOY4GOtM2QMXKkLmni\r\n4trgMeU4OGuJ3WdUDiZtdLmvyYQXeeQOiI8XJwQIg4/aix8EP/EJYEMe6xHi\r\n9cvG1h552DmaX3mfF7pC7bieJVTxgU4J/1C8iwhrAZLg9nCwET2isRYP/N31\r\n4iDTgWZRo6RJkja+LyOh5K3/mnEj327oARBqf6M6JG/6tieH0XLD/femVQXM\r\nDvsSaJo6u21501Wp+Iyw29EQccdSLf24vwkKvgGHK9o/FYzT63+tPQniLZSB\r\n9/akKvTTjL07p4y94j3qPS0l+q82HT9qOzvpOM5PUfFXCHBJUs0YsOFrE1eI\r\no2STWkaYyl2C1sbM9C+PeN0ckE48bI5vdgI=\r\n=UI5M\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.mjs","exports":{".":{"import":"./index.mjs","require":"./index.js"},"./*":{"import":"./*.mjs","require":"./*.js"},"./package.json":"./package.json"},"gitHead":"41c1f0b6da2bf412c91568791633247b2e828c77","typings":"index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"index.d.ts"},"_npmVersion":"8.5.5","description":"A NodeJS client for GraphQL Hive","directories":{},"_nodeVersion":"16.15.0","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.2","@graphql-tools/utils":"^8.0.0"},"_hasShrinkwrap":false,"peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.15.4_1653487141135_0.5206396733922516","host":"s3://npm-registry-packages"}},"0.16.0":{"name":"@graphql-hive/client","version":"0.16.0","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.16.0","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"e3470c437414953bd139a3470baa128eacc7e783","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.16.0.tgz","fileCount":18,"integrity":"sha512-8t9r0TtbsEPjcDg/XKxBzDutLH0iDnwDpUO98gIVZvFZm1lxNxmyqJumOFpz1i/SbG7twe+/CVv/V/KEKwht+Q==","signatures":[{"sig":"MEQCIFi1lwxDG35sfDPEuHaD9+mQCfdw5jCIs3a+dHv447A1AiAloZdx1oqgJmoCshhUjD6FEJzY6qObJbQ87VgJpNGyjA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":86263,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJitIYHACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpkVhAAjoTYO/nVM28Q5P9M0g0edNyJQT+ziTVVVk7FuwGXMEeL4np/\r\nCRsig9E41komIJQhFdrmWB6zadWS0aroTS/mVy0WYEEU6EzC7hE9rMfWhO2g\r\no+xmzTZ5Y7Enl31iQcXgDYQ031avkqMe4r/0Q71xzwCfUKxe9Agh7A9R0Xus\r\nD/OTWInFv9QGGk6IQv03v0JLpItwDLmoIbvKJFlLND+k0ncbNtZ4m/3HmooR\r\n0e3obUNBHTTz0TYvxOZynCGciBWf7EsRSjD2qOnZt3nUaLfwKYh/N8RlFg8v\r\n0V0//ECbkxveH5JmSjdLEgYjNLKEOP+A+IqqDG5SR02rEhJVLZNMSRQrSxDt\r\nP/3SyfqwKLo5BC/tYZ0RqpyRixGDw/oJlzcWucx5hR+7DxAN5htYzDvazd5h\r\nNNuQlgZjdBzWiFYnfKbq1VY1WhGFXRfilU++LLwizOCj90u6cUI1LM8Vp6ZE\r\n01DbhErtYmC0q1zuLZ/QQIePF7S6J9Z89BWjInj1GrRgdJh8JvYpVZWiJ1mq\r\nl6tMB10QQ0CxK6h6oWvnEHWKspWynGuCO5280IKtUyV1c/IdCUahFACt1nbv\r\nn3wavBCrUc3AkjP4AKjb/+zMjNyWGvRLI8idp5q16woSx31nMFPqFcF7a0Sd\r\nTkzySRPs9KCgQCsiPOJzgqIzNf+onSKqC4U=\r\n=BoXF\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.mjs","exports":{".":{"import":"./index.mjs","require":"./index.js"},"./*":{"import":"./*.mjs","require":"./*.js"},"./package.json":"./package.json"},"gitHead":"bb34743e3b6e934d40fc98e7cd423fad608ca3e3","typings":"index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"index.d.ts"},"_npmVersion":"8.11.0","description":"A NodeJS client for GraphQL Hive","directories":{},"_nodeVersion":"16.15.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.2","@graphql-tools/utils":"^8.0.0"},"_hasShrinkwrap":false,"peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.16.0_1655997958920_0.638481276081651","host":"s3://npm-registry-packages"}},"0.17.0":{"name":"@graphql-hive/client","version":"0.17.0","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.17.0","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"5d8774ef4849d2d5ba883c42cbe293b1a16c06ec","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.17.0.tgz","fileCount":18,"integrity":"sha512-t8Br1JaWtlFmcSWSuPrt+4s9LQKFsAXC7aJUqeaRE0WxLeqZSlq0w/OMJTvhVng+g9EpGRX3rQE9maa7Byj2Mg==","signatures":[{"sig":"MEQCICYRJ9HYiN0RrZMHNIAAoz4rOeiNQ5+xPNCE2XtaKt0fAiBfMILiyqxU1UQfPbkBzmqCmeF/fWzTqCwGfs6scCkWjA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":86329,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJivs6QACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqPuw/+M1rDWybJ+92dHKWMgnvmiI2NBbLrNFfFpnBqvNnBKeD1K4/Z\r\n0xTiKfLceB9PuIWQRdlkrdFWwdk/JbshnoRAkLoDXjdMKfy7861veG8O4e7a\r\nti3gRcLPaPcuCIJB4vd7Q/wAqWDWz7NY7ggHn1HbpW3Kl4g/BaPjstqZVRId\r\nVN9p5YbqNtrWiW7IzFGJhoz76F/dccwty5x1HR76Mq7CgPAW15IdlBqjBiPl\r\n6HbRFY0ztkxBztwDp+aCsjT2+OaA49xqVAmfg5PfjhVuitTFog7xjuYiIgGE\r\nYrA/9GChu+y64lKpViBW+7fjcg1F+wXY/zU682A6WhK/NLzaqN7HKcHzxgSt\r\nilj5FMDPj/3treovKbSilAk+gPTCc1/me5iZA/pukBiQTvuwGIGHIoI/wm4p\r\nHUDDUwInT4EYXpIKzmzUap1BQ2rAEqloO1M9pfa+IYJNqAFEvp3XJmpslSqO\r\nhEiO+RYg+EoCONDHRhivwEPVcL4G1Jxe0VENTS5CpRkkE73II6qkXmwdJZP2\r\n8GqoL6L3WQ2F1mH7a3eC4MQlEj8vbTMWPEiRVHPYjA12iNnKmc/T/G2ycA/3\r\ntrVwNJOUysZlJj6h8Yflx3HYAXv5Is+W/sq5fkMErRn8t1D19Ti2lUiCKnvn\r\nXg5bxukBRfkruPZwzt1G6D43TSdCgKc55+o=\r\n=+cPg\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.mjs","exports":{".":{"import":"./index.mjs","require":"./index.js"},"./*":{"import":"./*.mjs","require":"./*.js"},"./package.json":"./package.json"},"gitHead":"1d05a46077bc7eeede1b69a4fc84f679b5766168","typings":"index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"index.d.ts"},"_npmVersion":"8.11.0","description":"A NodeJS client for GraphQL Hive","directories":{},"_nodeVersion":"16.15.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.2","@graphql-tools/utils":"^8.0.0"},"_hasShrinkwrap":false,"peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.17.0_1656671888112_0.8293001811521703","host":"s3://npm-registry-packages"}},"0.18.0":{"name":"@graphql-hive/client","version":"0.18.0","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.18.0","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"c1fcd4660c547edad7ce0fa12646c777267c8a9b","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.18.0.tgz","fileCount":18,"integrity":"sha512-rzA6160GiqwWY2kY2VyFbAeMNSGwy+SBWYUWvVNZ4Xh1nbodC6gngxfIGHcWEL5pZZ3BZ0pUxl+sK83VzVEXZg==","signatures":[{"sig":"MEUCIC+GyAxc5+hmnC86J8+Vu1mNtX29Cb++otjm1S6KIYioAiEA8sDjZbWDych98ihy8UorgJHw7RBDVUxirBvznR+BIm0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":89540,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJi4Vc1ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqLqRAAlMXsFiJzNkI995IZUGefKP3IAElpvDHEvdMT2Nz/8B/sfacE\r\nQSsksnxrY2NDPuSOHAD2vMXgGfO2B3A0Nkf39u8WQmN/6QtYYyYqSpxxlNgE\r\nJHBzppdwAj3uG+oJFq/ZUs0xhTBGPEfptI5w3n7G2+zGio25MaILqey3HK9+\r\nNYiG/GDxvi466MuJ+sL0RlW82LKv2+cazSCslTnvV4yxuug5+JH2xmgjVRik\r\niVMnG0oAYMKjOQj3tnyhQ7e4jsIsM8gFV10Cq1UV/XtPu+IbqaoSu0IHNBoj\r\nASy6NmdN2EKkBID0+EJR5raTN8bAlDIj99BPObkpO0V+gJC+wGgAbKgBdlLj\r\n/RbwpRKATsy1IHaU3P7KTIM9FcxbbhzMlBKEposbnumQ7IBQINGLoVoBqUbw\r\nxV3rQHdyr4Dj2/+C0VbSaLMRjXFfZeOrD1vzAHEBkoXYSUfrd1hBPnOKUfGE\r\nab2yCyHUxISlpnNZ0glFpnr0ZVICMqE3Z1XmUAYsQULfeg8WNv9rlWc6Qkpa\r\nfZHYdvDC5LLs2BBthmxJijg0Zpz3afMhebrJTGBFxoV/FoGdptISnIeCa5qn\r\naqdZYaqlMNhqgyQjGUR7O5i9rEgo3batrooCsco0EkmLLKBwpX54Ge6xbAKW\r\nTBStKEgx8hoCVMeSJspHZmvoabxv+Y0QiW8=\r\n=7vDl\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.mjs","exports":{".":{"import":"./index.mjs","require":"./index.js"},"./*":{"import":"./*.mjs","require":"./*.js"},"./package.json":"./package.json"},"gitHead":"3a65f79a5ec25b516dd1759556264903c15e9228","typings":"index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"index.d.ts"},"_npmVersion":"8.11.0","description":"A NodeJS client for GraphQL Hive","directories":{},"_nodeVersion":"16.16.0","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.2","@graphql-tools/utils":"^8.0.0"},"_hasShrinkwrap":false,"peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.18.0_1658935092973_0.34264118648506825","host":"s3://npm-registry-packages"}},"0.18.1":{"name":"@graphql-hive/client","version":"0.18.1","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.18.1","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"e557d50c705cb3eec05d28c5d71dd2e23d21ca29","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.18.1.tgz","fileCount":18,"integrity":"sha512-3nofTZiozmW4bC3AlT9w7ST6L5xeyyZg21QTsUt83td5EVu9sYXk66It4i+uAv1ffyjf+FrF6cl7t3ZRk4UXLg==","signatures":[{"sig":"MEUCIBF1jlN288+Sv/oLF5FXAnRPdsDjBgrgGoH9hOdBap6iAiEAlotF6zxF6BAIPHk0oxmaevs1e3Zr1CNHCg1xrDtO5/0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":89910,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJi6kR4ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr/BxAAhkCXDOf3s2bc9BhIX2DtpWj6pZCnjvpVBzUX6hhCCZErvm5p\r\nZjXnkwXKVflWg4znHTdi4zF9Bu0NZ7KRh0hPkd5zwPJotZ0bipMo+xdLkupB\r\nu2wmaP2KESxDVhSCvfZ24rKHmvh8UuOjlFxcAxLkDEKY4wvi8Vdw2PWqy0At\r\nqrKKDmVp/ol05OqroknGVQdjsWUDose3G1WDuKkkPPilmDwr9Tfqjbattk2a\r\nM3TqOWNyr8EJgoMemFZmk5MiWfoUb4trhUSxopGH+KQaYgh0dlkdsXd1rGfP\r\ndJdQPzIhndVmFtrRRN1H+x9AqXqbEqm3xq+2jUQhKFBkXt+saHfhXqw6esir\r\n3aoY4f++yCii20W0Q9Z5wilkR06ovtE1WZ/tPXQ+4pBgPYKhFg0szemvEG1n\r\nS1zAz4jLiE8h4EvzBMFhWLQ5YIflPIKNku9rJjcjrB+lePesTDMXqI0ptFNX\r\n5RSNIj8k/H/frcWJOJ9U6EvkUoQaLW2ZVHWH0Cobb57mmb0XIGC6XoNVA0FC\r\nPDlNVHZNky14j/g8UvnFwwBHVfobREqt+TAR12CPHAiO6jKL2x6LA+2qy5yE\r\nQsc1KRLAUduTvy1ZkYKrOQ1yta8PXUg3Fh7pwE1O99SlTk0ivjzd5n6hO+Cz\r\nxL9FqFi067sbgbgGNrF70UqWgdVOz0smf1M=\r\n=t5uy\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.mjs","exports":{".":{"import":"./index.mjs","require":"./index.js"},"./*":{"import":"./*.mjs","require":"./*.js"},"./package.json":"./package.json"},"gitHead":"206f1ddcb43e9f212fe3e603ea5dfe7175cafcd3","typings":"index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"index.d.ts"},"_npmVersion":"8.11.0","description":"A NodeJS client for GraphQL Hive","directories":{},"_nodeVersion":"16.16.0","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.2","@graphql-tools/utils":"^8.0.0"},"_hasShrinkwrap":false,"peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.18.1_1659520120305_0.6313351806178478","host":"s3://npm-registry-packages"}},"0.18.2":{"name":"@graphql-hive/client","version":"0.18.2","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.18.2","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"6137f12396727945481d2632f545bb35e61efd93","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.18.2.tgz","fileCount":19,"integrity":"sha512-NS3WOtpLWLp0WxavHmqoOYzzxPfQInmItdyTS3mXAtQHIDxv/dpMvqWxpCaEiv9VhJWQYkbgn057dv8XoEIB3Q==","signatures":[{"sig":"MEYCIQCPa/L1F1hLDpYXZZ9vnf9/YtztiYfrICoTaG4kAawN7gIhAOhjZlN84Dz2MICE5/FMhkhRtJ/br3ewndCcMu6OgOgE","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":108190,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJi9l9fACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmq8AQ//TB+VjUkq8l0iplswfWt9toSgOsQ6ovPhJ22fyL5MvaCNcC9i\r\neulFIkRVo0m3BSD/p1SSg/FYUB8UUjuL4XLFNIdVnnVTrKqiVsHUk7QTa+wK\r\nK9BRI1PC20TP9B0idV5+pE0qmzXHS42Xcq3CfHIhNAWlGRjaF24zPaJmoFeg\r\nocPxNUg4HYN/JlNEcy2yc2MiQfbArNTbwhHLZn1Eqphg9AoDEcwLCzc9E0Uk\r\nB3gNmd5toPpZyHltGOHus2zZuwnA9uO8qm9ry7PLIyNRZMXi3o7IZpVSSNUQ\r\nyhEa78GaKdMdDZXLXgOFNdN5kxUXkVekbNjGwOVXKhNm02HSx1QpRDSU47M3\r\n+K9w6BsdqCjMBcpX1LC1yz72unHXZTr7LfapMyUzjxnWf37xVZOBFrHKavBw\r\nnqnOcPG/qPIF1svKzkRSlrUvdMkqOI5mdumdol4p2lgMtsjrTNtcInQZ3SXU\r\nr8uou7MXbvFmnBy1bRqYl98FQFOjkchcilQehkBejTY3wOtL08vn0igZ0Cbr\r\nbzOVd6TxMTyrtDNiTHY+PrVXUDKbUxV2XXOl5Wlpl70MINGrg+hXCn1XfJ3p\r\nteP43C7oeYsiziXeDnX/3pyKySev3rMjBA6vXADK2nTcaGrU0CmaeHNGrBiN\r\nhDBEgRP542MHctBKLSO7XBimFAu5Hq7Dgco=\r\n=sxkV\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.mjs","exports":{".":{"import":"./index.mjs","require":"./index.js"},"./*":{"import":"./*.mjs","require":"./*.js"},"./package.json":"./package.json"},"gitHead":"3bdfdb03648b2e322c7b46a7f6daef2bf226b045","typings":"index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"index.d.ts"},"_npmVersion":"8.11.0","description":"A NodeJS client for GraphQL Hive","directories":{},"_nodeVersion":"16.16.0","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.2","@graphql-tools/utils":"^8.0.0"},"_hasShrinkwrap":false,"peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.18.2_1660313439762_0.48337339951668246","host":"s3://npm-registry-packages"}},"0.18.3":{"name":"@graphql-hive/client","version":"0.18.3","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.18.3","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"b5608f52cd4e4499f305a72e324e884142b0cb03","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.18.3.tgz","fileCount":19,"integrity":"sha512-NMusgRwBZn8Q8uK4jpiNGeajlshR8PDvcahfmEwQ9eXjKch2r4AtOL0UiLfdT/XakU8IBqlK0sS6QyCg/jRP0w==","signatures":[{"sig":"MEQCIF0aZwP72jJYwaf9+t919gSs7KJYsY65hYkKDPT2D+CpAiBSa5fYyS6fnQeVjqaXu0ckzYZN+64kslYExltYS1yxdQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":109102,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjBNzzACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoQgBAAlTF8hwYub3y2s7BTOIQsLPViu5T7IyT9omSkBD/qmC2Lo5ta\r\n0dTEqtkrvVXL4fISIqLG9cXmohxQrXmvQjnSHiEUL57zB7BlK2q9/o7cagWK\r\nffozQyMv0WqkRQM98FY+8qU3y7IIVOMwxalhI7N+TelgTejukBF6HjKo0MZO\r\nYoAknIXkgOU5blhkFkyWo39oqBq0gXT83naRAlP4qr8JF3jNhY5LucoFkd/P\r\nVT41IipNlcarncg1z57ubDeZT4zTpeEoaGXMPLcQh0a/DBASAWk0T+sL6XJi\r\nJ/G9o9SjhubPwJJTdvm86w9cmm7eY+iQOoql7MGV03oKNGhQYnaPiuogGE+u\r\nK9xq1NN8KYj3qUf8nEwEmQj+yTPyL6oNbmy8ibmPcisaLHvM56Gq2si4n1BO\r\nW3zAKTAvHvy8bvyN6UqeH74htGewAlcZkcPTYbL6b8SxDptr1qoWPjzmC4aS\r\nef4jvGyaA94W4AVrxutCQUy4lLmhq54FIvEGDabZRCPgylVFJ5uuPmWstMWA\r\nbfNamJ9xTo6kfQGfS3q874ePj8s9TVZjtgtEvUdtn2PJO4MWvOksNiwgP9wD\r\nr4boW49Tlc/nlbYTful4S12uX88sp6r/0CWBFBINjCNOInE3QEMEkWa7dJha\r\nYJJ3Bqbf4wJFIDc2syjGO0XGBpXZ+CV/6U0=\r\n=HwCs\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.mjs","exports":{".":{"import":"./index.mjs","require":"./index.js"},"./*":{"import":"./*.mjs","require":"./*.js"},"./package.json":"./package.json"},"gitHead":"01c383e5a51544387493079e9bc28d60a7d8d9d2","typings":"index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"index.d.ts"},"_npmVersion":"8.11.0","description":"A NodeJS client for GraphQL Hive","directories":{},"_nodeVersion":"16.16.0","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.2","@graphql-tools/utils":"^8.0.0"},"_hasShrinkwrap":false,"peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.18.3_1661263091039_0.6516345948385664","host":"s3://npm-registry-packages"}},"0.18.4":{"name":"@graphql-hive/client","version":"0.18.4","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.18.4","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"d537e227b3a762745d10e92cffbc24847356a332","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.18.4.tgz","fileCount":19,"integrity":"sha512-7ZmC4Z6tPPLiuTf73LCcoCzLyr8MwYCYwTVEICaNXbfWHudXIO38Fas9aTY+0hhfSyRISe9mLsKHe3yg2+kNPQ==","signatures":[{"sig":"MEQCIGpWu6ctfE/rky/E9GsXk4Zs6c5rjA1eCBpLlsicN9qjAiBaPmjDgXXcnsk1e0JKaxqyr80ZuA14l0S7vz+02JYBiA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":118881,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjLEv3ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqBjxAAgoqkNM9EQmVvyz1fkLmsTTjGvnyD36ZXHUgSerMUwnQS8Kux\r\nD7HUhJZxCKUaVJYBRumurgYjWDwwZDfTa37AXgHydP+NpaknpaIfRxG5bEyw\r\nr7QwKw9a5r2g5z8YjXK56dc20mOxnYOmJnlMArLsiCMoc4B+osfimuZvOfa7\r\noVCgOP2wrafNNyTEvzrcXqJY6UgXn2xrhSafA0c1aaJKcwDzF7wNArqV3Jzl\r\nnbpv8Fg80fZv77acwj5QfXhItQwKK6xmnDSFB3OO4qo5dSlaRld4EJc/NnPg\r\n0s9wiqPyBW2XjwdXtIHS17jODfg2PbQ9YsTDuNZtXox4psxeRoSUP6QL6Yoi\r\njVGM+8QlriISjiRhy5LQw9x/Htqv5/nu8gym9I0c87VV0YJt90pxmVzVIwRc\r\nNPB1Ep+xd2rbD5vqaWAwas4nlL4qREOCLXT/grwkzVVFXy/hVi6NA5wZxVvm\r\n0Ab4WtIOehXhVjIlfTWtzG1wfY7IFrGrRoV3u7fO7Mtt0IqDKoDtGsIT74Fd\r\n16nMM196fKl4ATVveLYhDzkAEcartfVDu9IV4oTBVmwUr+CqGKES+dsoNRx1\r\nv3g9OtGl9HyjZSwgXwwOP/Hh6w4IxGNiPNKayk4i1AmyXDHmwTvWx6r5tWAE\r\niZxzUHcGHOGPqmeoZddomcuvnjVeiBRsIOc=\r\n=LrJg\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.mjs","exports":{".":{"import":"./index.mjs","require":"./index.js"},"./*":{"import":"./*.mjs","require":"./*.js"},"./package.json":"./package.json"},"gitHead":"50405d0bb3cdcb52e5dbbc102f9c8920b18d8791","typings":"index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"index.d.ts"},"_npmVersion":"8.15.0","description":"A NodeJS client for GraphQL Hive","directories":{},"_nodeVersion":"16.17.0","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.2","@graphql-tools/utils":"^8.0.0"},"_hasShrinkwrap":false,"peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.18.4_1663847415667_0.5070055143954046","host":"s3://npm-registry-packages"}},"0.18.5":{"name":"@graphql-hive/client","version":"0.18.5","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.18.5","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"33fab5c2c0ac9b4bddca9a209631eae1fa9365ab","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.18.5.tgz","fileCount":19,"integrity":"sha512-4O59OHhoOEaR1zrnIl6yhCjDc9Tn+eoWL4KiiEDkapGAnmyYOVExkvnXD6J6+ej3kIOsjyGSkbKA6I4QkGmjBg==","signatures":[{"sig":"MEQCIEEzngS+w/wSBSW0Cs3MyY0/sSZD6N6fzOSKVl0pbyvvAiA4gjytBR7WQDrS1Qj/aJxn8Y8xaknwBSINHtMqZqB4/Q==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":119277,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjLJmfACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoXBA//YExHG6Z3uP/Cqe6CevJ9mT5UfcqQBPMVFW81ZwCrq/j++QQP\r\nF7t1CA39J+EemiEr+LSPWd0GMLfViN1ThmxDh1x1IV8+DR1xvRrYlkb3zBs9\r\nr7rSJ6bCenvxf4yOPkofLwRkym3OMuJjWTKd/GN2kgkZTJLHZYH5vOWLl26P\r\nq+Jo0ykZng/zz7CEHo9l4Uiole4YXBCsOqZYMjHaTHQ9Iovo1KYgzFpdvem+\r\nvMyT/9O4sikbbK9sN9PJ+26vJ/a9ElICv20KOlRP0FKCKp9BXXJh7y0PnnOr\r\nXDQsMXrdHT0220pn85KyjCqESXJ/QQZ2jh+OmR0invah713EOjsi8dnyl0hn\r\nPeztmnttGLNMWlhLa3VUZDgltlGOMjO6S/MQ7vDvk5aUCeu6oGLTzUqBkf/q\r\nkAedjgtViZdTd8O/Ae4eJTqUEK+WXWUhxG5esQ2bk0AGPP+NjrG4H7M/LrRH\r\neSlku1q1k5aUmK6efthJmNjy9unOA9QU3bp5x08DElHWoHsU61M3CUT1prtG\r\nq+8tba9U7459QkZBTk+fpnHaBCz+4AeXdQ6URfF/SXZ3KwqLJzOVCFHInOU9\r\nkJGm7sauE75ccWtul542d0qVU2QroRrzfD3hS83Pyzuu7jaowzX3VVqhvk1s\r\njEXTEb0VsLwpcgMKxRoplV3hBrAvDn9PXnY=\r\n=Q4nU\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.mjs","exports":{".":{"import":"./index.mjs","require":"./index.js"},"./*":{"import":"./*.mjs","require":"./*.js"},"./package.json":"./package.json"},"gitHead":"733bc165ad9d4641c36ddc0b2692aeef3a7a0d8c","typings":"index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"index.d.ts"},"_npmVersion":"8.15.0","description":"A NodeJS client for GraphQL Hive","directories":{},"_nodeVersion":"16.17.0","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.2","@graphql-tools/utils":"^8.0.0"},"_hasShrinkwrap":false,"peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.18.5_1663867294848_0.3957336656350461","host":"s3://npm-registry-packages"}},"0.19.0":{"name":"@graphql-hive/client","version":"0.19.0","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.19.0","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"912712a6c569d5974465c4d10787ff6ec75aaa8d","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.19.0.tgz","fileCount":19,"integrity":"sha512-HjZX2+NMSiBp/Tx0A0gHDbr/D9EIjG15U7ruxFrqhkCE+f5BxutWnIQ6zCnDPBv8HqHZXxXEaMstDKB8bN5q2A==","signatures":[{"sig":"MEYCIQCNPCE9KGdUTRsHsGWRw+4faGEg8DfRnp8TRKPZNMN3LwIhAPlOrS2nz/cS5fqOh35EN4sSaV7U/vOzz7z0a3yW8QN4","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":122047,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjNw5IACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmov5xAAmFpeEgvzyFumb6XrBI4n1BX05E9NLb2Pb1VzYUShAqydeKan\r\nJ2WLdEOCrjSBV0wzgd99qvfd2MPKNzcYzGigujAN4VZknzM9G7xf9gNpD+Hu\r\nftXbqocc5rolFOXLpKwza50o0nD7ocziSKpJvNpjmbt5JR/Gv+UeWgIQ7aPw\r\nXGi97Rs9hfEYglGRDyx3V+TuJcNxoABKINejRN9SHanEeF4SAv+azWsMjGF1\r\niWEWJqPvs1bEPFRBmiv6UG9ImS8G0uTSuwziKPLPq+oBkGLf29zBW9/nIwap\r\nDxx28P1IDoWG8f6ylS53hMm95AF0fZzLNigbgWf5W9igYxllHTjXo80J+rsw\r\neVW1vjaa9+hr52YenXWVN0nX9se6NmQyNNjC/JUq8T4+LOrTxB5T6x+xvSHG\r\nwoOV5OV/gcKyIUNzLtn9pIVBEhq96wX5yR9VssPCj0pIiS4IWx1HrBQx7WFp\r\nbbb3vSLPp2vqWogHuwj8S2pEAbhcv6y592Wi8jXiYLWnCT6XLzkYLrIzRFnN\r\n2vMHtuefS4O9EnvyKW40Q9iI61TkcbHsLd/JEQZhZexXrFw5Cdk2dTA5V9By\r\nG3Vr8I3OOe9GWsMJ5/fipfldUiJ5uvPwe0unOC8uU05t1lTcwNmYWMIqE0Br\r\nD743OsjcM65LQ9uXi22FLQ/jmGIAkXINzBs=\r\n=PX93\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.mjs","exports":{".":{"import":"./index.mjs","require":"./index.js"},"./*":{"import":"./*.mjs","require":"./*.js"},"./package.json":"./package.json"},"gitHead":"fedd03a3c9cf9be724d7c7471eda969f7f0ca28b","typings":"index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"index.d.ts"},"_npmVersion":"8.15.0","description":"A NodeJS client for GraphQL Hive","directories":{},"_nodeVersion":"16.17.0","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.2","@graphql-tools/utils":"^8.0.0"},"_hasShrinkwrap":false,"peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.19.0_1664552520618_0.798901921471848","host":"s3://npm-registry-packages"}},"0.20.0":{"name":"@graphql-hive/client","version":"0.20.0","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.20.0","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"71ea8632e0039d9448e7665eebd5d46178dded35","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.20.0.tgz","fileCount":19,"integrity":"sha512-4BtUL/QErVTE6OGkIEoNAqXnq0H09u9FzmLoV5dOewMqbAWohlgn7FvUm6JwmjeUZjDsaog3i7lTAXnJNyqTlw==","signatures":[{"sig":"MEYCIQCsDR8/Ivm26h6ujQvRAO0NagWZYmsk+vC607u2jy5EYgIhAIhBfcqma75CkdHCqUngnLcnXfvHTnHUElg42G6HbrHZ","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":125966,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjTljtACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpP4RAAlX8Vx5ldvxJrJgnh0c1e/iNS+R2YIZxPmr4xcbKoeJIl5Avn\r\n5R6uER3I/Bale3CXpJEayFSynoW9GMVhfQ8aL6IU2VUoXOeGa7QyoEhsGr3V\r\nm/xoQ45KWcWz08htOfqGtFYAzU8cxk0/lTGqhBF4175Khalvl8Nk03AYQGwg\r\nL/13Cm/OiHpnOyJ0B9FfmRrw1rbHudJI49A1fG4MZXfj9AkukbdLoMvfzQyY\r\naTOD7GrJBf1HBh/WyqtaYqltY5LNfGWcBLGJ/odewz7dm5NKLVO06A9FiQRP\r\nXPEjNV+aaixf6Shwhii6eKTh3DWtoQA5SPuL2Csf/hBLtb5eluu7JcLqKSxk\r\ngTtBI7xM11meL0TlZfRoN6CpaO8V43cUw20MYISuvLdEM4BReOJYAv7iGHEQ\r\nWLHyxnVQwIA2tnNBlEvLiNLhofn7COYwLTjXV2bUIDpKOvQQHNLWCaFb4IIb\r\n77asyGjAj1D49pPfyNRmB4MoxLxxIWD6zl9xmtBjz9BXobe0TjFptpIngaK7\r\n0/X114DQGZLwfl5RCUVZMuZvsOO0UiRNPZRKytiUzgs4wG0psLBk3T2wwzpu\r\nZRZSgf+WQmeGgnBi58cC4nzMiWhE/6TkQoeoKhgMxcQn3lQfDAQalI2a51Kr\r\njms47eAWcRUh0d3Jndqi64fi61olOVF+OwI=\r\n=6dHm\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.mjs","exports":{".":{"import":"./index.mjs","require":"./index.js"},"./*":{"import":"./*.mjs","require":"./*.js"},"./package.json":"./package.json"},"gitHead":"e899872601fd5bb592ae4fead0fc364f4f483e30","typings":"index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"index.d.ts"},"_npmVersion":"8.15.0","description":"A NodeJS client for GraphQL Hive","directories":{},"_nodeVersion":"16.17.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.2","@graphql-tools/utils":"^8.0.0"},"_hasShrinkwrap":false,"peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.20.0_1666078957655_0.09581915005058228","host":"s3://npm-registry-packages"}},"0.20.1":{"name":"@graphql-hive/client","version":"0.20.1","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.20.1","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"fd29b58e10e36cb4c913538ca5ae96b4de65dd46","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.20.1.tgz","fileCount":19,"integrity":"sha512-86BvYcqifPE7NWeNDGKVqAMGbDTCQFBrYdROI0+JJ0tlcvu6XFiN16LYE67mjy6gRfVE7n5KkqnlTh9AaZpI5A==","signatures":[{"sig":"MEYCIQDsEzKJuiUnWODY0kNsEq4FjzHT4NmCvMDSnb4t0wbUFgIhAJEHmUrroFYUEQoqAa9d1n0YlfJhoAaIQAM3JmKCvkcO","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":125978,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjWkzVACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpDvg//WRiWC47k7fTImJ23IyD505xUBPEOl78Zg1sdmaRGc85KDZ6S\r\nWgQKr+e87V8l9+dOUM8GwioviwfNEoo6hTTe4RK+G95vOyLzOWUl5Xc5wsGL\r\nBQi0PoCClaJTw+mCj+hP2J7oVZCI+mEbQW6BkDsORJz7Z3d1CHb/DK44Hi9H\r\nICYGMc+O1nPJB/8JMLg3riY2BHo/kVuHeWOHqdcs+CufpIXUnS3NGOIqj0z3\r\ng393Fbg+ubVUpWAofqGwlqjGLZ7pfitpk53v7ytzYSukCBaW5ZW8quz2mCs9\r\nlQt+n5rZv3EjneLnvKopjdAurLdoN4bPZxQM5FgO3LYcjAIhLP2NJbT5ykgT\r\nwnXug7vlZkCwbkePY4DkwO9rd3wesucIcTesv6fvt4ZdIW/BsPY/PAP/conr\r\nHflVe3mU/5tMtvXuhkX945KZQ+xV+ufgy3SUEZXbclCWGyZK/5/RJh2WzDzK\r\n3+dhILNZbzoNAo/ZI3mqvwYlpTaJyUcPzXeDAIT8ekMCscJrqvzTl2tP7u/T\r\nnwLXOyfaYAjLv6YSipGuSKYV8wg8s3IYjM8m8Us+MTkj5io9dVJre4ZOu2GN\r\nrhHwqeCt2e13jid19GbqHW301kdj9mcA3XGhmMXSl6k73ANHjYo9aZYNVLn2\r\nwZWBsQZsT6fxjDl7csyOBQBfnMZ/aBx+LP0=\r\n=p4qi\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.mjs","exports":{".":{"import":"./index.mjs","require":"./index.js"},"./*":{"import":"./*.mjs","require":"./*.js"},"./package.json":"./package.json"},"gitHead":"c47df8338aa2844ca5083515978243a70d4b06d8","typings":"index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"index.d.ts"},"_npmVersion":"8.15.0","description":"A NodeJS client for GraphQL Hive","directories":{},"_nodeVersion":"16.17.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.2","@graphql-tools/utils":"^8.0.0"},"_hasShrinkwrap":false,"peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.20.1_1666862293236_0.4004348331115233","host":"s3://npm-registry-packages"}},"0.21.0":{"name":"@graphql-hive/client","version":"0.21.0","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.0","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"0375506fddc81f5ccbad49e87f1dd895d3d96f2b","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.0.tgz","fileCount":19,"integrity":"sha512-b7HhuBc0Ugepb58JvmCqqW8ptZDr+LZVi5ZAsfSrwI/zhIJMeN4JcnxZYZd7VFsU5cha4neVCFIn0w9lqF2GTg==","signatures":[{"sig":"MEUCIGVunzQL9gzYKTqNHHHQg1v3WI/4tHcgfj2FdiShB6sQAiEA32qTLtQL7ToZzFb56bzGxtMxHOBacuWCr7SAnD8it6M=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":126304,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjX5OHACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqScw//U+pLzLzXTGc5WAyAme/+9dfKCHjq9oEraGFh3o5eRSrFHLiX\r\ngA2X9ub08A4lmtZwzVUcsfXQl9qu80x/6wXz0zu1AWGeq7ib1nnV+URBFsXJ\r\nrWVaGlt2Amgeh+vJbN9Kpzmk21IdoSMtWuRp2wwcQDzLy4HbVFRQQBJHa7Lu\r\nI0o32h2ZEA3ZH9szsI5CYwSondctM5djhGTsoSp6ikAI55nUhtiwHCWZgvuX\r\nl4Eloj65H9MBT7UYnYF2m6Mjpm1mVSkWMP4ZHmm3MXeUrKB5ub69uxM3lGBT\r\nLjm9KGkNSX28X8Vs2IL5wBgrm8wgxTTuadbt0iNW5ip6HMhvwwpJI04y4D+V\r\nm498qSW9NYVikwrEcBP0gU37EpNJHpMqPBsgCFA18NElKo7gW+0OZmimClNJ\r\nZW48+VgY9JY25Ui0n9T2GYRHfF6oT60j8dbWjGIqj2bKVtitqvLIIXn+fdS1\r\nR706XjQpIDU0252bSOiLrx25x5F36dzV4fytUPyPHGd8Ejzjg1qcyTdueniy\r\n4POPrO7QIQ404bL56wh3nnFVv68eueZhOSwTOwT15y/ff+ryvYk4VizkpKy3\r\nbOZ5JMSeDhQ/0TltPa147pF126TZ4eyVYdpAUlZkt/oYdGyDRZ5fcWzHzSgc\r\nOKZYJw/QDmHS2UHIswAXUiXHi87H2BGXBak=\r\n=7ZJ5\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.mjs","exports":{".":{"import":"./index.mjs","require":"./index.js"},"./*":{"import":"./*.mjs","require":"./*.js"},"./package.json":"./package.json"},"gitHead":"80fba5fea03a6cc87ce172be66ae702a51875d1f","typings":"index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"index.d.ts"},"_npmVersion":"8.15.0","description":"A NodeJS client for GraphQL Hive","directories":{},"_nodeVersion":"16.17.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.2","@graphql-tools/utils":"^8.0.0"},"_hasShrinkwrap":false,"peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.0_1667208071632_0.6174405358493025","host":"s3://npm-registry-packages"}},"0.21.1":{"name":"@graphql-hive/client","version":"0.21.1","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.1","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"46f43d1b05b472a83a99d31a78515659306697ef","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.1.tgz","fileCount":60,"integrity":"sha512-iKhlLB2XiNj8MWG7eykw9zm3C6KT/mY9pGctys1mqf+qt6Vg7dQYXY3aOm2r56TCnBCPK07/j9rTs5PG6JizxQ==","signatures":[{"sig":"MEUCIQD7SvW58VHS77SBac/YVHeAa+MqNUnvCKABMOlUlp+CewIgF74Xx4KJca6lNE8veQxbyqGBBrOkXR2DqxIfLenPoOM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":163701,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjbPsYACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpmoA//b2EWd3FzkWkVvN99KlsX6K+6GzQVxsSBW6AV2bilZC0b6d2J\r\noX1OdQIGjnePB09ngXn2KsR/kAzVehJS87gbDyTvtvGyRr8Yxx7pXL1nfsTn\r\nxUkDqS5Bm1kxEJ6OrHWGOQXI3iE6tcAqV+k+MPIO581k5K9AV3GY83o9LMXB\r\nUENFqdb0hFelF5hJGkXPyONhVlqoA9HG+v+Idmp11mEmb/KtvEkc5Ks0tMBw\r\nPn5mXF5nicNvjFReHVdYWuMFQoenrawNE47C1jeESC6ExNjTlYL64hly5OKe\r\ndNtPrmdVbY8Z3IT+tGIIn2++7H64uwKZbuPCMCceXMGLWp3rra8Wly+QUiGD\r\nGmFGZeNC6XwUrV5c1aAKx9vNH+U34RZN2BhWzppgYC7Xxab5Zz53ciBpAj1x\r\nsY5SIGgUlXJiiR7gOFBu+JKwk0EoZ5gjrD+I/LKholEXYyGeyY1B1nSMmwen\r\nQY2ME9nhRAmX7ulVIRr05orX7lOz/n/mooc+l/f+TFC1EsryVQF2SsVndSkg\r\nvTc4U6+H5XlzXwV0henXWwg5Vfc2Atn3EBsVVhWkvp23dG1iD6oOA2VZ1Gag\r\nNd4G2iFXxh9rNkMCuiXRKjvfeAf7Dz47mEJJ5FD89Cf81EtY3s9uWci3gBy9\r\nqJLtfS9lIiGfFx3GVVNZSItQhOmeOVRghDE=\r\n=NN4S\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","_from":"file:graphql-hive-client-0.21.1.tgz","module":"esm/index.js","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./*":{"import":{"types":"./typings/*.d.ts","default":"./esm/*.js"},"default":{"types":"./typings/*.d.ts","default":"./esm/*.js"},"require":{"types":"./typings/*.d.cts","default":"./cjs/*.js"}}},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/a10aeefa47f877346b3ca812b3388b19/graphql-hive-client-0.21.1.tgz","_integrity":"sha512-iKhlLB2XiNj8MWG7eykw9zm3C6KT/mY9pGctys1mqf+qt6Vg7dQYXY3aOm2r56TCnBCPK07/j9rTs5PG6JizxQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"_nodeVersion":"16.18.0","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.2","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.1_1668086552765_0.7467403527517733","host":"s3://npm-registry-packages"}},"0.21.2":{"name":"@graphql-hive/client","version":"0.21.2","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.2","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"77b6adf5b20c5a6b064a32e34ee97ce90679bbd5","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.2.tgz","fileCount":60,"integrity":"sha512-gmK6LV59mKQYF4+PPu9Gbk4iR8aQ3OskpsRHpv5oHhVxKz21mwSTlPQVo5hOYeqvRAKCZfVPF1AHc+R9X0L2MQ==","signatures":[{"sig":"MEQCIGn/BGKnVuGnJ3+l/cT1Cfh+Hb7lzbJ4EFbDNr2Lck84AiAmBbK5THyoBkv7T3g4wiXQ84/35fASozKVijnXQ6Jofg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":164336,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJje6xRACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoKcw//TJ+bo0jOE8ZBnjLA3TbL3M6lDyVggP5A/vay8M0Czj4gSe6B\r\noD63hgoimKW8BXO6YjXCyglrxBn2YJ8M5y9gKeMBJ1Bn0r4VnXbVLpJzFD6D\r\nzQC7qPKpHorFz6H7HFBDUfbanf2cjwe3K7Al8GGHJWh71kJdqgweqBMte4si\r\nJUC7Mf2vvPR73SJ4FPPQyL421BScdS0bdpquINfLgXirdjKxUflT3x3maBGF\r\nhoJ1+10ZrjQd5V1k9MoSdMZ8QsbSXOG38DChXGh0H3GEV/jArPwhlW1kp1fy\r\nzii7xD2r2N1Oob+EGSNLxVunN//msEf5Suh+r1KT1Iuy++8cdyORa4PgEISv\r\n+5eo6T+3x0AHIrtmcV2bk6U+oGlMATOfFo5brNmNcKac+Kq5GQFCdozLRxNl\r\nJ5G7r/bpx4/t2ASzSnsyimUqW2xrM0wShD9Fb90AE0QQaXrvHQ/xKKuPXlLq\r\naTY3n+6kuGU0RiYWqKQ/C7weoxhbkFXtje490irR2Zp6IgUVXoCINxrPe6Tp\r\nULfsoD1gWKyyWqJ7O/e6i0P0jFydiKfeqDIeo55SuMAlfgQ2pOYlVRsgf55x\r\nEFQ8DLd/dK1FpkZXi8tH/iN1eUOhB244RNNw5yS/6S+WNXe8uDxEXqq9gfq0\r\nkyPgLqE5tCDM3Nq3915xbtAv6f8bcSadjVw=\r\n=vs3i\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","_from":"file:graphql-hive-client-0.21.2.tgz","module":"esm/index.js","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./*":{"import":{"types":"./typings/*.d.ts","default":"./esm/*.js"},"default":{"types":"./typings/*.d.ts","default":"./esm/*.js"},"require":{"types":"./typings/*.d.cts","default":"./cjs/*.js"}}},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/2c9d0741bffe4180e27a68a8a92c45ed/graphql-hive-client-0.21.2.tgz","_integrity":"sha512-gmK6LV59mKQYF4+PPu9Gbk4iR8aQ3OskpsRHpv5oHhVxKz21mwSTlPQVo5hOYeqvRAKCZfVPF1AHc+R9X0L2MQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"_nodeVersion":"16.18.0","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.2","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.2_1669049425573_0.21170974178961588","host":"s3://npm-registry-packages"}},"0.21.3":{"name":"@graphql-hive/client","version":"0.21.3","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.3","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"319b85e7da11901d5e6f15f653930a8b88e0d573","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.3.tgz","fileCount":60,"integrity":"sha512-Lud3/40gpoU0sU9LlCDkSP0fU86Xs2Ff6bXWLYXTxUZqnX+DCSe4UJf4MmvZT/rgzwffR1KBZzI3/fWOVieXCQ==","signatures":[{"sig":"MEQCIEI5W8JOcF5SC9Q99iBPjUOwVilncM6S8i51oCsPO6I4AiA/+rI0qI9qMqaIRuq+g3+4+gSOs3QQhGxmlxg+4RgDpg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":164535,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjfQX6ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmriXw//R5o3+DEeCTwi5QYGOz99fTJ0YC+PyHc3aBPC5GRDh0aQsyJM\r\nIaAyQcOccw6b836KpQP3z39pwwO82nF+Fx/VhizrU196AjhnGA5vf1/Y6g9x\r\nVeES36PrvVNe8wtuvgRfcM0noYrn7se73FJPHpcfjiLZSIXoIkh5IAOpbtYc\r\neuY/4QZkgUMJwUAfSWoajDnusHs6G7G1HJ7l5JO8bfGvkzL/lZKqg+chS+Xe\r\n4zdP1UE166FZn42wM4PwWWZOM3eR4CSKQyAiETbpQb22TKoqosrO4Uj/tMGX\r\nEvWHi9w/KCEoxTSndpMWMSSVsQpTg9eSsBgUud+zkoUfnYjLNTBMhdxUTUbN\r\nKMHJlicfyHiDlQbG8Ld8miv07KZQynqLOsd1Ed7YqbQoS4DQVujgaHKzofiQ\r\nBkmsjj9e+7U1vyMyNLI+46LdzC9MaUC/8tb0lS+DHJNym8K1olmGaNQ7LUlM\r\nJioX9olBHD8Tbpng6jZNTx7BdGNv3aCCoy324ONQKrKb7XrB9Z1c0XomUBb1\r\n4KYa1BPmX5l0eLsukDdNeFUY4FSJCmoTgrwY30BdmXmMODz3jrfAGxckO/Ts\r\nonxNIN4JM9lQfy3SNT2wld2glYNXw7MYzIGeeyWFvYykomAQUd2Ufk3G9hVQ\r\nQKQ/ofw9RHV4UnGlD1BgLCGSyYP3+hv89f4=\r\n=sPyX\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.3.tgz","module":"esm/index.js","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/a90b40e1b5ce7172857782710c2e57d9/graphql-hive-client-0.21.3.tgz","_integrity":"sha512-Lud3/40gpoU0sU9LlCDkSP0fU86Xs2Ff6bXWLYXTxUZqnX+DCSe4UJf4MmvZT/rgzwffR1KBZzI3/fWOVieXCQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"16.18.0","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.3_1669137914360_0.8019540929141229","host":"s3://npm-registry-packages"}},"0.21.4":{"name":"@graphql-hive/client","version":"0.21.4","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.4","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"639a0a17e27b099698d64764287ed045d7fc3236","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.4.tgz","fileCount":60,"integrity":"sha512-sT3b7LnACPVMg5azMgWKz1bC5BXTIt2UoHWPWak1pwvk3mbIU6M0jIt3iw1Y7OvGmBxV8m4R4ohDMwZb2HC+2A==","signatures":[{"sig":"MEUCIBloHJwRRhmz+a7IRfICz6YZmYhHnxVKFAtAK+h7CW16AiEAxuWnZe9iSLGxo6gLFTGCVbQGzTpnU7zTs4MitsqU4gY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165584,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjhhydACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoJdA/6AtK+pbe0IoADV/rgRCMzLt7Op9Qh56BNbYLSwaVArF3buEgr\r\nCbQrnNPA7wd10Z4ldTBqhVgr/n9Kh9jd3xdaJGoc6JNnGUxV7jAGO/WbZMnn\r\n0ziIstFF34Y14kwJV2QyTbsPdB3nPayrHdRVUUp42jnBk+T2f8j6J9mGviQu\r\nD5+n+HAyu+bUJi2XEr6w5NoMV68kerWwqeT9sofLXQO/b93uR6SDQNFxWfjZ\r\n05kpOC/cA+t7W8Z2cmG4G3HdnGiPT7TJLc7EkwgDo0a255DX2CsyYcKM4oHX\r\nN4FPr8PbjkePUay7UwebwrlmBY2quReQ/nRZaqAivZSxvwQLMejlPipMcLu/\r\nr9TFiLPil2G4aitdtwNo7im9uMCkZvYuyAVVaQKDSyHGWsPmAuPY6iV2sIqS\r\nNls5S9Yiz+mFOrZ8l9ON5PEAwt3jg6tVvuBv/k4AbdfzqSfswLObQKfSHjev\r\n7aTg5fsGZFvjjHwErTASjlz5cNjbdqd0bgsyYXehodePTnb8/Gk0SeyFNuKB\r\ndQ121mAZnqvzCkjMueep2RVC7D82rKLa49XUwxbICRGKBkBRfnoDKZsFRgX3\r\nu2bogtAw/sKK4IXuxVBQxVuV7w680HNDzWGlDxbbpjsQ7dFG+Z/iyISI9EGh\r\nzUmNho3ZSvgQc0r65/JM6aagSykSCPLimEA=\r\n=w1fj\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.4.tgz","module":"esm/index.js","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/bd133c2d236cdf557518e910cceee638/graphql-hive-client-0.21.4.tgz","_integrity":"sha512-sT3b7LnACPVMg5azMgWKz1bC5BXTIt2UoHWPWak1pwvk3mbIU6M0jIt3iw1Y7OvGmBxV8m4R4ohDMwZb2HC+2A==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"16.18.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.4_1669733532917_0.7807728526179452","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221220122847-0b3f830":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221220122847-0b3f830","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221220122847-0b3f830","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"81c33b31ddce950b62080f13bbf185e4a9bed9d8","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221220122847-0b3f830.tgz","fileCount":60,"integrity":"sha512-rK13j6rn/A60C0LStPaT6yfR/WN6ib+rO11Ge/JemXfrRhRhakih9FY3yWV8J34fG/Wv7sG91tPVwao+aPUEjQ==","signatures":[{"sig":"MEUCICUROmnxwL+Xs+mN+GFgwGT8iuzZ6bViPMTCUnPYkikGAiEA6k0KHUVef1PwR270UcLVoTk5D7LWcD20VW8YJ6XdvFE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjoaqjACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmrc2Q//dtIKLCg4BNy7UCpLJz1rlzyE9tbGHkj5u0QZN+XfT5D4zomQ\r\nOgXzwebVUZFCYG5DNVc8UKi1GV0iJ6OUEIVV9tDFDTfm5ETnrsDXEtFMz55W\r\nmvjTo1iIibSDG+jLexxX//3r6rbBvscCPav1gIpzpMexiygifhazlLPY2bCJ\r\n4vLbia7yyuVx+WPxakJH14dqxoQNzvzxGfnpsHdztwcxleQ1HknQ7kAvGf8l\r\n3i1qr+8mhIJrnNOmwavmR95BfWlop42c8K3/gZdJPsMV6eBNbcuDrd6KPZ0s\r\njQfC9WM8qcntMT0CtGx6M4gVzXjEp12+wrV/pJ8VSmzKJbjAn5KN7Dq2ToU5\r\nQu9uUP8LUj6uhElPn7oNrvzdkOdkwqk9BvOwhe9pAsKY3LvmL7T0Fdq4iLJJ\r\ngCK/0liL8ojrUClMA/SH2/ftoYlGHVPDDfYe8ZNyQSjFOTyv3QQ+GILJIutc\r\nsoBiFbsi2TxldX2OMKV4aLcqsl3adWtdx6miheAlYJYcSZote3rMF7NoeYi5\r\n0fgjtAeELe1HCHSI+z31IwDuQOJAYCT1NvNBc+ZBWHVbgtfJwz3aqPvSzkP/\r\nWrFmgXxQyTa+MQA6huDj0WedfkmIIJaDzgEekZF1SJoyn9zhcOF6nJL5ag+X\r\nwBlbsaJN2fTGQO+1id/r8TEiCycrhomkCSA=\r\n=2LoP\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221220122847-0b3f830.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/ebaf8663a9ef4e612e27f5a12954e8c7/graphql-hive-client-0.21.5-alpha-20221220122847-0b3f830.tgz","_integrity":"sha512-rK13j6rn/A60C0LStPaT6yfR/WN6ib+rO11Ge/JemXfrRhRhakih9FY3yWV8J34fG/Wv7sG91tPVwao+aPUEjQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"16.18.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221220122847-0b3f830_1671539363692_0.7190130223319182","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221220123315-e9e3ec0":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221220123315-e9e3ec0","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221220123315-e9e3ec0","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"ff1bfe40a444932bb9abd1c057cc0523e460906b","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221220123315-e9e3ec0.tgz","fileCount":60,"integrity":"sha512-VGlgRW29H9n+38ka/acEW9PnT1FAwl1Pj5sigq94KUduuAV6JX1nsMz0LKzeBqHrZL0w7CbxdRqtAVVMZf4PXw==","signatures":[{"sig":"MEYCIQCgnKlALXQ0Jg9h6VjeeFPPfItuPjIIDXQfveNR67BK2QIhAPPxM1V4HRPPfPmmljr2uoopxYDwfdJnmXIJBsjaIEty","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjoauuACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmqlnw//R/craCFSPGjIPog/4oxLYxZEGmNdpPGcORFUVLZnD/rNC7eM\r\nEcO51UyYHNUxKFVcGXktPDKS8Aoto90bQ5Top4/doXl+CnHLjVfFMJC5mIyF\r\nYfeo8CZ/I4nr6MFPLDY/iDxTbzQIjOs3XKAcHQ9AV/NRuIjp+VzgfUhttTAK\r\nYDBXibf0lEQC0k2s8aoItF8Zy4fl469nMHzkW3yjz6xZ4rLyiXQn2NLX3fYe\r\nddIz7eYp3Wd8TEZ8OY2L3DM/VBI8vtfdbCgcD/x5NGYvQ7KjoWdVKouBgAja\r\na/YqR39k6K9KjsQMvkAWGqykl1Z46bsiPxKoUsXmwQp1eNqArNPnuZTJpP56\r\nSLmvpO9P02TWfm3rZLDRpNsatnrL3bQztUlDPlptOefHIdYE/hRCUW0Fe4Uk\r\n+AwkGIs+SiEPVPElebkOLf3aq25GZoLxHZ504WQptJGSdQ/Gf4ahop8HFJAP\r\n4oYvTdD6FMa53qZdQKLEzpqa6WbVNJvsvN0eSWLKDROfQrd1VPqJY/zF39aV\r\nmR08VNsjIvFXuO0hpfFe6AmniEA1VGGZIrzy+ySi2fLaCNk3Is7gJ/3yTJP3\r\nlcJUzxfXinxp12dT3Ejt+la/hJgbdmpMiXHXIfRs4iyzyg+Vi7mEBJ033xBf\r\n8iJU3W569zjlol6vIiIbFBQTLIoWKiW7CXw=\r\n=KZT6\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221220123315-e9e3ec0.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/c635492daabd042d98a2e70ac56ed162/graphql-hive-client-0.21.5-alpha-20221220123315-e9e3ec0.tgz","_integrity":"sha512-VGlgRW29H9n+38ka/acEW9PnT1FAwl1Pj5sigq94KUduuAV6JX1nsMz0LKzeBqHrZL0w7CbxdRqtAVVMZf4PXw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"16.18.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221220123315-e9e3ec0_1671539630604_0.7758681584614064","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221220123606-037b8a5":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221220123606-037b8a5","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221220123606-037b8a5","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"f2128fb7ad12ecd3206df7883410f7c21941f5d7","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221220123606-037b8a5.tgz","fileCount":60,"integrity":"sha512-eWW1rrvPhqfnMZW9OM/hBPa/A8N4jr+IVhsM0fFa5UvY5M3Pi40c2CGQ/3HjGhDYArXyas1hR3kNpYM3GZmiMQ==","signatures":[{"sig":"MEUCIFiPWlwUZ2Vo7yE2VogFroIQCI4zaawLGvh6vn7/q2qVAiEAxDs1dLTM3yYE9g4QJVFqiwzg5fUNSiyC9H8zlyVIeNA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjoaxaACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpqIxAAkvuC8lX3DhXnILlEvicdW6fNBU0gvA5/1wN62l9VXtU9tJyk\r\n1MtFH3WsCmzx4ZveCBQnV4JwEdzpVz0xTAQgizFCedYFxFVquhNcrg9Y0PQG\r\nvsEfz+lExaGekrtCYWeq/QALJlrZ6RvthEr4I6DHcAOQagLtp2FP9Pgrhkl9\r\nFSms37v3lU2Nr+HPTzPoCnNBr4rHZWkXllMLA86RYYjyrSR1B+UTX2nTO4o7\r\nLvVIHu6ifBSh52ORuAIgOPu5VNpi89XPg7H/FLj//D/YkOMxDUPe8Btxe5OW\r\nazaey0liQVgIipQcKDE2kRCYJUpve8/yP91iI6NaC4bJvTZQgMMzuRcgX7bo\r\nUIlMpiNx3Id64RCD44xtPPaCTEe7Li07WbQqLbS87kiXHU7+1z5X7hAb/28D\r\neeplRafLnWw0nlCZ+wUHZSumoM5U2TepuWdrhD8iQ6ogINuNFykqu3JINwRc\r\ns3kl7EziJqo0fcoMAuLlQ8/U2giA1XaS4I8ADsPKVSmNKcIOpnHHghRaQ3Bo\r\n6YFX21eIst47Rax6UhvmyxZoqDV1+MAZtQiQbeCvqV464ZcbiVQvkf7xRKJQ\r\nMzJ6Xai3iMgXnocLCxFZU4z9Xjzl7GxiDoamco1xYO1sPk+v6zIVk5WfuIxT\r\n+CBIgd0PsU/ne7mAKf7zNfJTtkcNUrpj1T0=\r\n=NEE0\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221220123606-037b8a5.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/7f85b50ae26a5ddf98437898498e37e0/graphql-hive-client-0.21.5-alpha-20221220123606-037b8a5.tgz","_integrity":"sha512-eWW1rrvPhqfnMZW9OM/hBPa/A8N4jr+IVhsM0fFa5UvY5M3Pi40c2CGQ/3HjGhDYArXyas1hR3kNpYM3GZmiMQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"16.18.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221220123606-037b8a5_1671539801859_0.39045271508492796","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221220123922-b7ecc5f":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221220123922-b7ecc5f","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221220123922-b7ecc5f","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"7aba3832ee94ff47e370e1b5be16f12faf7283c0","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221220123922-b7ecc5f.tgz","fileCount":60,"integrity":"sha512-cY/99J8AXnGL0PZNHDXJY2cDjYxMlUEMvfs8S1ifeQjG3L88SEDTZzTrb4q9HWdVAlvn8ttm4WxfNg9FdYFUBA==","signatures":[{"sig":"MEUCIQD4ARxBu2M2OqKgGnYYXniZ1C+VNu/zX6JW96RknCZemgIgFUj3XPRjSMO+QtHOCXLQ4dYg6XeEGwwszpW3ApYWhCA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjoa0uACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoDyhAAhWNrlukzI7wfxhSUhPF2zAw2pIMvk23HIesm+xwGWXeCWJRz\r\nBUO1iJRMrjmHXrxTGmsRCKe+i9FzoT3E+z7u6DU+FhT8UdjnQQTx/aCBpR8m\r\ntSOYJFJYaueTrO/MXonq23kPyD7PLDPt3LpBx8p5S0qPIF2xWfdPOLTf/9w+\r\nLmPWHdbOdRf9kJ2pnTOmdbXWof5VMZdHsNcgLrPSQiXpG+wzUvNYQxN8EY6c\r\nypDpnOTmjlTW35AFP4ktYodRmfmCmUZfDZYtz/wRSqoSg1C2HCNRWScsLwoG\r\nwg+bInmn5KK5GEu29ZK0yh/v/eN1NcarqbTyF0SWGT1hE3aJW1DqI6xcrEIj\r\nEp0zgyf5kqsLqGZ+ltu6DsC6SmtkkI5GOPlDg8lCpLoE935WrvE9KyxixP34\r\nbrlG9hxdzp9T5KkJPX6D64J0K9FSzI2jIL0jmL/WIUXW6lL+2PdsbfuGIzJG\r\n+nd/NadhxgIO13hXm3v8iAnIXgKeBpOAS/9DZxS4j4B5LpetnYMLiNSQpjiD\r\nUPi0mThN+wyInNIm7QBFX+9Hk9wljguYLT/lsYoxJ1suWzTCbQSqnlma+S89\r\nrsiJjm7+z+9Sy4Nh0zYpYFbxInlH9eGESldNDuZBMV7kK2Ayygc/s2ehuPqM\r\nuSYao2FOM+VlYdtaY+dcSq9m38HdR0hn0e0=\r\n=K+yi\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221220123922-b7ecc5f.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/06108ed4e054c12f092f7ff7dc2e85d9/graphql-hive-client-0.21.5-alpha-20221220123922-b7ecc5f.tgz","_integrity":"sha512-cY/99J8AXnGL0PZNHDXJY2cDjYxMlUEMvfs8S1ifeQjG3L88SEDTZzTrb4q9HWdVAlvn8ttm4WxfNg9FdYFUBA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"16.18.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221220123922-b7ecc5f_1671540014272_0.21255786569731927","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221220124030-632f24d":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221220124030-632f24d","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221220124030-632f24d","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"68806111303824f7327efe2f83889cacf14eb98d","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221220124030-632f24d.tgz","fileCount":60,"integrity":"sha512-QJDA75EDWLE9c12Si1Wq8bjR4u77nHxZyy/IvZthr+o/CMxSb3eSgb1Dmn8F8IxzwpRRt4Qh+D6Xnq4W21lFig==","signatures":[{"sig":"MEUCIQDLssvEvdfoV3wx9orMtd/DtR4Y2oMoVw5RNqsc3S63kgIgTQxhZ99qX3qeHTjy3JZWTF1omuzmez8T1p9MDiFgeOU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjoa1qACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpVRQ//SuLbzV3jPLN/cZKSKpMwJieWcgFNEYYgPIlp+BncjLHJkYmW\r\nu5Iu0/OZzxamU14j5nYaJQpefGApd8eJIKZ0/KlPg2I9eCAGlcAtG+LfLWCU\r\ntbqlbD7x2D9dR3GhukHZCY5+9z0/wubGPWypcYVfE+BbYqBeihNCg3DGRrPh\r\nw1ociuq5KaYGCgyBU1nW0PwdhKMlk7EfkYUmr6JNJgsazqx7DLx2efGJbZvl\r\nbZJKV6nBbsCpfGV2Zej5HSIHMbqHBzoNzbLMuae2FBitn0JiwMHh6/yvbZY2\r\nYUBeICmT/dhwQa/nm5NmZPuwNAouJadVqRK0AOZN/qxza5G5kNFmsnwzc44Z\r\nrGfUcFIUujdDgmvu0ryqlmXnRojNB9uyI2E86Dl/o1CrQ4GEYHlQSYKjUfkG\r\ndLFxcCWlS4KOrpn6ma9fx7UzZAb7EBjxc8XWmF5CLiXKPHgqVQX6jyu7FN6N\r\n3O9KM62bkM6hnfy45j4W4celF242IthjLsQYAJ7fEmqIY7xD689gXLh5Czvk\r\ny5RVxEvG0rC2VgX0GjjqKRxVcxQqWhry11rs5Bl+fTYC2RNaHFI/LpwKibpL\r\nUCa8abDzTdY9S5Nt/RYoGkYUuwUQSImoVlCh8HpidnfjuJ+IS6lOHiVhFUAW\r\nWy5KRWMhJuVgXLOGkqNTMNnjFyHRKKuswCE=\r\n=gkPZ\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221220124030-632f24d.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/6a1d2c46254e57a7ed94b10ca8127917/graphql-hive-client-0.21.5-alpha-20221220124030-632f24d.tgz","_integrity":"sha512-QJDA75EDWLE9c12Si1Wq8bjR4u77nHxZyy/IvZthr+o/CMxSb3eSgb1Dmn8F8IxzwpRRt4Qh+D6Xnq4W21lFig==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"16.18.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221220124030-632f24d_1671540074637_0.9565241905967514","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221220135647-6ade6c4":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221220135647-6ade6c4","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221220135647-6ade6c4","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"053adba8e2ef374a89eb7c78cd538fc93242a2c6","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221220135647-6ade6c4.tgz","fileCount":60,"integrity":"sha512-mApetfxuVTDaCzAGocO68f5bom2Zpj6JzizdC/FotaaD6Q55V5j9I3G01sFRwYyqSZMFXH2YsIiFE2WdZx4glQ==","signatures":[{"sig":"MEYCIQDdfd9MDPaAfE9McZQZ1HgtfApzdkLQ73rCZMPldGKV2gIhAI86AnZlf6aUj8yqo7WuMrXaULdHSp96eb/QZ+RwXU7Y","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjob9KACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrA1w/9HHWUG9Xdmi6lIxBo4wcKSj5TsTIwfZVABV1UQAv1CwdZML3b\r\nGvvv1TtjOBqo5cnlRyYFDMF03G5hz0QlYwy6Mpu7XtXxdpSJu4+D8XauXvQo\r\nMTAoDIPQ5lJrNbBHrtHpxFlVk/q6Q2NnLo2g3jVxciB7QvZkZcv1gwfpzWMC\r\nHZUDk1afXxbDeSxTS+k+/kzISERUP6XCt9we2JJElVDALlwnSmkL0BTTSxOd\r\nvUnRtUp3cIJu2SO7slMpT0nWVyI2n76BleHhvJSs1wBG+XZeGvp2oelS9Snl\r\n5y3o6QnfKle1xkh/sb74RAyG7bscihvEp9A8vFbyYTuUFTVSqImCjSXw7m5x\r\nZpE8XydFH4yDmz3fShl7mJcqPn4B5ODgSigTvyTQdWF8lmpF2IQtQXYdnnRl\r\nh8UYl/534QedussWoZvbOl9aesp876i6AE7A6aCyHbLN6hQCzRSlJTrdsnO9\r\n2RgiMPbTY3i5BaqOPL7a5bk3+60KUEBIfmo3HTWVgmf+1me+00ALNDVxAfKd\r\nzNudnNdm9Farp5E1Sj9awkYgsLJNEjvvkTUzcQWwHrLXcduZEqN+KQjZSuQB\r\nlM/LkQsIiHOKupf8NlU+C+G40+h8/s1wIf/0w2z6VBG5Q0C4xQzFQzAFkUTZ\r\npo++OUSehTB4/Z4nB3y0tBdTEcqjyqB93i8=\r\n=rdYo\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221220135647-6ade6c4.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/b1077fe4c13c22d6db824b9af5bed829/graphql-hive-client-0.21.5-alpha-20221220135647-6ade6c4.tgz","_integrity":"sha512-mApetfxuVTDaCzAGocO68f5bom2Zpj6JzizdC/FotaaD6Q55V5j9I3G01sFRwYyqSZMFXH2YsIiFE2WdZx4glQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"16.18.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221220135647-6ade6c4_1671544650805_0.8143533764955313","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221220141618-b37f156":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221220141618-b37f156","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221220141618-b37f156","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"8d218e5c1930122d481db66a0cbd27b0aa9808c5","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221220141618-b37f156.tgz","fileCount":60,"integrity":"sha512-ErF0OPcfU7Tr3LIn2n0zdMWW+EMZCzpPRFfEO/j9rPmXs7cGUVR8ucw1khAw1eSBOTS3L6fZOXMCrCUnDawOOQ==","signatures":[{"sig":"MEUCIQCFUekRnTG4VHcqhzwKo8V1WVI4mPgAe+w1FlrmYNkTuQIgY/Tsb/8fGN90PjeczlozOrrsYpM8B6rt6BeN6LOkxWw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjocPbACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpIxw//SDkN0hjiBUxqEYgpUKJ42akxVIlN3qGx40oxq2PkJFfPTOnu\r\nhXg/nbSKSjSGy1AuP6rX+gwhmENuNGYmt0t0HzAE2qFXmHHLfxlywIj21p0r\r\nksLbDUW+odTGs1xt9YI/RqetLTPFAgP4oDFnDSSBRZcFZqLmx3m1tg7JWExe\r\n3o8stDpd6JHcKPA9OYzVdoHB7/Eu4WLA1Tp9a7k0bsp/nRoHomSyYfxNlTVf\r\nwNH4wKsebeE7Dz4G2xudeoRQYaF3KSkBkd39Aidyn9jG73NC8AsPURMGwSGh\r\nVNFuAeCGwZ7Rnh3phbVwNDxs1/q/eqivipWkKXsh5F8dId5GQt8LbhO2jpe6\r\nebV+bJn5xOKsvIg489ZMgeVpODH2rkgIwOY58HHuaOvuZxwfHoxWjetOqb+6\r\nJjNzNiCgSvltpFW/hC0IKB1dRL+p17IOQFJ3r14Lw4NjqRoqZDlW8gSmXTzH\r\n6M0ulR1UsGCNIMeDeKj8xALub/brQReSNrNABnUKexp27yC8MEDmW1FAbmEE\r\nbpRP2VRT+GXirHtT+cBK1OUSNVTavBnxvgegEWWwgqe7KxlThSkwovM0nR97\r\nj9VMfVAR/m0s6b3zRo+FowEtGesG0hJ00aMJvjkft9izSPVlabBloH2iNEHV\r\n+9KzJ2xlPtD1JE2E0S9VoYZUHGcgchFKbJo=\r\n=gi+0\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221220141618-b37f156.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/88417ae1d285b09ad322846e6c0da80d/graphql-hive-client-0.21.5-alpha-20221220141618-b37f156.tgz","_integrity":"sha512-ErF0OPcfU7Tr3LIn2n0zdMWW+EMZCzpPRFfEO/j9rPmXs7cGUVR8ucw1khAw1eSBOTS3L6fZOXMCrCUnDawOOQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"16.18.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221220141618-b37f156_1671545819358_0.4254200882794694","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221220143518-0296709":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221220143518-0296709","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221220143518-0296709","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"50f607c4d6e1e947ea85c3839d2e0df1295c2768","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221220143518-0296709.tgz","fileCount":60,"integrity":"sha512-fScgCii37fPeKJF9GcltQDqwGpd82DycwZBxWczuxO4hdWYfyoc700ooP5iqLxDAw6zrGwQle7sAp0XVVjV7hA==","signatures":[{"sig":"MEUCIQCor/jQs4MVzowEs3IlBmySd5xGJlL9rIKNxLTOM3S5DwIgVHKGiojxLO1z8DEctm7oAkDkGLfAm0jHPGgDv7XOwNU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjochKACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpU6w//b6KGK5C0b92G8K2nlQYlPAli04yPZFiqYhw9TbrCO9ICPAK3\r\nk0x3xCiL3NlmlgiO8PZsAULbZ+R1TptWVYtvf5bcb4bVuJktzsV29nr4kuuK\r\nX91EjC9LtRC2Yf0/Al60cckMJQcZHBMzP4+NQFocf6D2iFeGc9PYX7QrD1nx\r\n1RUDV5ksILk0sk6duWiZk6g3WPdERw//iW5spSsqCbEyVrsHKD51Bk40XZLf\r\n4ojIq6n1qde/sxwu+4EF+22mcQ4hBSHgl9oWpmlgCrAmFl3jTZg2DWWx/5JJ\r\n7ir3ofrw6gCQeitLAInDo7R7tgUgoXiv6Qx739McuoytDkakitzTRnpI9m7b\r\nG0JQpfTK8n+7GzILRvo/YO/v2WzjZuXfZfwyGquAEuCXZ/NO9/THbXs+nV3i\r\nreQ3vpEewpnVz+6oJVzwGpK4Lk+XNEbW4x4ZTUYhhCuszDIvLhq1NgymaRAA\r\npi/1eQV85A9zFF6SsKuRvPk/arBloMf/h5IOHrAJdNPlUT8mK5MSRfWefuO4\r\nTGx/On5GREnMnKojxmGN1aZ1HGZNWC2SqjhVfURbQwO6Jn6fDFk92ThSRCC3\r\nTNQj6RSQX7h7CGlwkAWZvMswiZD2N4mDx5b74ZlGx0hmPO+2yhMdG4/LqbxX\r\nSK6nwVM/Mld/oxQkjNP5lS6EZh6pV3vp0/Q=\r\n=7Y63\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221220143518-0296709.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/1dd20c68e97a74dc0f60b60d1c65baa1/graphql-hive-client-0.21.5-alpha-20221220143518-0296709.tgz","_integrity":"sha512-fScgCii37fPeKJF9GcltQDqwGpd82DycwZBxWczuxO4hdWYfyoc700ooP5iqLxDAw6zrGwQle7sAp0XVVjV7hA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"16.18.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221220143518-0296709_1671546954256_0.33914982010556316","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221220153507-c723b59":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221220153507-c723b59","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221220153507-c723b59","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"107cf9a6a0ef863fee3188eb380d8ecbac35acf8","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221220153507-c723b59.tgz","fileCount":60,"integrity":"sha512-3YXJCZp74G+hTQrlrFvOVUKFQ7Z6DAn7xelWEmmVhUx/M5r0wsINwwg+kelyTaxCydQu4e0r2ePlV0VIJ8ONqQ==","signatures":[{"sig":"MEUCIC1RgWnk8aarOECCp9Yzn3towam9xa+ul4rh93z/Vu8xAiEA7vfUIJERljMi8RuULRri0UVGaqYMuVKwUJ3IJzAULNw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjodaBACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmru+BAAhnegkvI/zX62wT4d+ctuAqsSkXNd8zYBm0lcHhx0z4Q2jIEN\r\nuuWHqdWnA3f5pv4Ui5E8DFTmeUG9wxCECHfvErVgeDxgSOMWjVI6D278768B\r\nrJ4LmR3EhLIBKZ9/UYDmrLS1nX983jMNEuEjenfxIAX5Mt4i8lffPy5Phbtv\r\nevtQyGoIymearm3FNGZ/GqD70jbg+HkAUTOXJavEbzpKKGFN2CkylCTyKJnG\r\neISMK4aCXalmaobCQsx47q0Egtjw0iDpE0akablT6xpZ5jU4hogQdyPHhr0Z\r\nrDbkP4A99gE0oN/uya9kqXdREMTWphnIpVX6OcdF1HdIgh1/gQG7+5ZCvSpl\r\nDtbpsgu1JXF3pEQZ2c7DMuYRfUy8vFp7h3eH2ZGNBGktk0CwKeaAzSVkTT9w\r\nJ/+VbuYl7PXO3tu1C8iR1TG5k65tG1p7Ur6Hf+Y/ETxquSCIyWsecX4gphns\r\nvbi9oXSZYa+JiW1yXNqqLe86yqaIAL98tcWXnIvV6dskN5FlKFHNYmoLzJ3d\r\nhUC9dKzdN01kp+7plP/lJKduRVi9phmJ/M7/T/vuCXbva/0tUmSsBh8QuXxf\r\nSxVrg4DNLZf1L+EwDnXpm6Obb80Q6XvZOWT8bwqsNeYnuL59J5AMUcTpAa/Z\r\nDwpqHKZtdDXt3PnSlZgg+XBrPdwj5CBjY+c=\r\n=YdZc\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221220153507-c723b59.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/745b06cda241360aac349cd64f2ce6b9/graphql-hive-client-0.21.5-alpha-20221220153507-c723b59.tgz","_integrity":"sha512-3YXJCZp74G+hTQrlrFvOVUKFQ7Z6DAn7xelWEmmVhUx/M5r0wsINwwg+kelyTaxCydQu4e0r2ePlV0VIJ8ONqQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221220153507-c723b59_1671550593031_0.34925148330255373","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221220154815-c0c23b8":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221220154815-c0c23b8","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221220154815-c0c23b8","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"ae7e2db909b58238ff4698f377f941b530a060ad","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221220154815-c0c23b8.tgz","fileCount":60,"integrity":"sha512-oLJrThU2VVUTauJhG3F+sxOi5enYMe7gLhlygNyH+LZ8WtPvcbl3YkcUUjb6HFF5Na7Kl/K6OhXNJlYPg/xyhA==","signatures":[{"sig":"MEUCIHfyGFeXZMeQC5fg9Wzxk7FwQlStXVM9JhM+LrcwoRgaAiEA4DXEnDPiDmnr8zVO3PQ5omkgQRQU6xA4sBt7q4dn918=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjodlmACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqmNw//b25P/p11awLFPsqENkgScKzWgCV5I5kJDSJPCFo6KI3+hpm5\r\nfoDVB7oihAqG2M6q849yOMptvRNFVgY7d2BDgsKinrs4I0Q9bMz9Fojtyeea\r\nZE1JXGWlCuPfrMgvtXp0l/nrbwCk2JCQQuFC1caNp6MpNQnvKCPLjE3psrH3\r\nuMa3XsBIWHIeXQ6PrLH4wgIiNN10Y8DxAQb5FcOvsVz6afH/RC5DzWVqk+Ct\r\nCkpliqTXqLLZumYkLfPoM/JuAOlx95HxAnvI/1Zqh2Aeotb8Y9Rnt4ymxLB0\r\nXEmewq5/kbF56U7R8UH49f70g/wRvsud9XKtyhg7dEaeTGDPiigtfoGnZW1F\r\nMoh5fQAOAMHYb6bb+6GqDk9z6RDFsF+8EPC+gIQsOlcbXHauAPu/pFqHWUkD\r\nOFAmDgBIy56IxFGAzB06WqThhTlO2PB7kb5+vFwQ4HWv9xdTYuVMmRGNQiP6\r\nUVv/GhoFszkunnhMA8XkfxTrY2gu2UBorr3evCTJiuyRFKRisafFycsgnFaD\r\nmAEZZX7WhJG2qrlNiMZqW1f8OC5i35zODm/Jj8sGUDEFzkAiHXMIEhebSiY4\r\nYiXGbIQuc2Esf/E2Ls8316ztbn6R1vKpdSQMDP5McFUkvnjvzLB7zg+BAo6M\r\nI71Hq2Z15ZiWjJbQFFGrF1zbQu9QvUT4CDw=\r\n=IvxP\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221220154815-c0c23b8.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/da3d590aca04ae6adb1a25d3260f460a/graphql-hive-client-0.21.5-alpha-20221220154815-c0c23b8.tgz","_integrity":"sha512-oLJrThU2VVUTauJhG3F+sxOi5enYMe7gLhlygNyH+LZ8WtPvcbl3YkcUUjb6HFF5Na7Kl/K6OhXNJlYPg/xyhA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221220154815-c0c23b8_1671551333998_0.039513396946304846","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221220160419-a8bdfb6":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221220160419-a8bdfb6","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221220160419-a8bdfb6","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"6dfb0c06dbbc2936179e124c751b5d1a74c4e3b7","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221220160419-a8bdfb6.tgz","fileCount":60,"integrity":"sha512-YoJ0AT1O18IMDsqAB6enIi6+Qw12cJJ2NsvDXzLWJhcRpueylYbocggIrg7jsVzGl1w69os+8IKrhCx3J68zJQ==","signatures":[{"sig":"MEQCH0UVxNgIsDXzCMufGyWpenuXPFJiCYt+B890s4CW+x8CIQCWADpTGHOGBZxOYmzahBcY7KHbGEYsy/ehNfu0RG4ELA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjod0lACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpOgg/9HxbMPyqafeV9wPsnDPSNtDI691GyK2n41QVM0UG24FL7g991\r\n8GhP9wrXOvWO4Y1cli0GeYU2Pb9brO51SpJYr9iRByxdM6NeXu+UIGyUqS4B\r\nEnJO61+3qdAzOEH657WR6HBOu1JKx4ifJH9QRA/TAf+5Dv9ZGVu7x4CgX1by\r\ni9WZ8nM5xoTRyIMFhznPFwXBWXCxQmFQmlaImQYUsS9AjQ7i6G8GJiP8y/Tz\r\nXuFD6PrSw7mkumwjNUbAziKtcH1HWG9oel0QZuJEqenpdBaKaTAQzq3SAV0e\r\nwrg8ccuVY8LDKyztjnYH+aMvZmHO4J7eutHHUYP8H4kL3h5a3WaPyQHPrLPM\r\nRTCe1WNpkkM8ScJx/wqcKlzJHDcK8IvmdmAev/NsLbeNtKWDCmNbrEqa/mvC\r\nOmux/019YOPYVhBwXvjCCLVBAwPWDztkrw2tHm1INYcj4+NOFtEcjuTZLN0s\r\nYKTAj5bsOFp7SBNWsVO2MmWvprZkfF8R2HYIlYdmAHkl/uefsiX5ZfdRAWxx\r\nzKKxLYFY4t3OkQvH6rOd4E0VzqaGF3/JfH7rz1enAJk3R/eT7OuHQZ6BhZIG\r\nzhjsRma71sbwQOYm4F+qiuXRF0Mh73zqIzt31Yxp8iOtLHX6EQ72WnF/6xPN\r\nJnBs3Hw8FZM+02ELlcaRO8yFXrtNgQuqXYg=\r\n=qZWs\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221220160419-a8bdfb6.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/7813d44b957158bd2ac2f74ad576ad65/graphql-hive-client-0.21.5-alpha-20221220160419-a8bdfb6.tgz","_integrity":"sha512-YoJ0AT1O18IMDsqAB6enIi6+Qw12cJJ2NsvDXzLWJhcRpueylYbocggIrg7jsVzGl1w69os+8IKrhCx3J68zJQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221220160419-a8bdfb6_1671552293740_0.10640894676061619","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221220163215-fc0e439":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221220163215-fc0e439","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221220163215-fc0e439","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"456f238292d2744ff4eb3d6999c2536c7ef94511","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221220163215-fc0e439.tgz","fileCount":60,"integrity":"sha512-aoJ2GQDVs/PEVP/ZbEcm3dkbIeiGu9Dn5/G2+NEA5+9UfFt6vjHKR1cYcNztHkGuXNDYiCleQBZm5JX5EJYbBA==","signatures":[{"sig":"MEUCIBO1dt817L3Ct4urr6kiUrJR74cT8JpV3PvEfToJNfGjAiEAxS+pPNziW7dm4JN7AK/Vbi5oj4AvpHcyi5VJ+IpOBSs=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjoeOzACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpN8Q/7BHHtwd7494SLqHEapBbENhh3fP+WiAjabyxDX9lF5u/Qomf8\r\nYt0TUpDKQiFQttyLt6FBzd2ZQfo9eXTvMs8OijCEEfHCWzUxkX43GzTNQRGS\r\n7b2kD25Rc3DbAqWidiBHLQZp1KO+FN/FPvky86ExcuBI7RiIv9Gg3YLdCLaM\r\nToRjGHf6jmGPRLYrZarGlEC/htETsF7MOe49U5uN0ZlQH/R/EK0mPRQ5t99t\r\nb8WCMrAtUKieli4QyEu8eltclzAL0efPue0dMF55vr3+JrqoihhWBayKIVN4\r\ngB9svEGWPVopU28IfVLgcne6SBVsQ1Nv3ACoqOR5ZQZYT6W5HPZE6CC4BbKO\r\nPIIEThlqOg1mdG4Xbm2EODzvtdyA1PbyoChblENPbsTU27YtFjRIoWHw6yE6\r\nBl7S8RDN2q6hyYgTPesEv3OjRbKk3qcthTXaubb+bdi0K18Fox8Fan4AqYlD\r\nroyNVbJj3t1QGbs4NHjtVKW44IQUiQtj0rIieGdoynOwRLLIi1Kdoe4iNcUe\r\n+7Y8CalzA9q8fjUKXQH5u+IM2c0Hd4JxyiW2vSIs/dSZVWt6YnbSMpVyMtcd\r\ny6a4XDA1ZxFBbN5NH8+5Rvj+/G1OLMbr1+izFJk+G7OST3GsnnHTReiApO0j\r\nSMwgWtzsnPKAlDhW+ayV5Pi0fMVNExjb7y4=\r\n=rJwA\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221220163215-fc0e439.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/021f7d020b4901e01f483f1d736abaab/graphql-hive-client-0.21.5-alpha-20221220163215-fc0e439.tgz","_integrity":"sha512-aoJ2GQDVs/PEVP/ZbEcm3dkbIeiGu9Dn5/G2+NEA5+9UfFt6vjHKR1cYcNztHkGuXNDYiCleQBZm5JX5EJYbBA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"16.18.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221220163215-fc0e439_1671553971076_0.7661505093518959","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221220163732-7b6b37c":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221220163732-7b6b37c","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221220163732-7b6b37c","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"81e9cf3b578eb260789a652d89c3a19b73d95e60","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221220163732-7b6b37c.tgz","fileCount":60,"integrity":"sha512-22s4Tye9c4JXvuKp9rjNYA2f6PJ2GKo/1zSZh6nmXJcvTQkTc2XDpGwpTH1nnkybsiFTAA+jVzIdvusalLulbg==","signatures":[{"sig":"MEUCIQCd0B9TD0Rc2M64K63VBk171va84OVrfN8XA3UtP3LvrwIgJcAQ0TnNHZrgXS+rdQIYjdF+x4+ZZvGwV6metz5ZuRg=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjoeTwACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoFzA/+IEOh0gJLoCnDGUqFq6QaI7O+hVjaTKOPVUN+rTizyLQCWKCU\r\nuOzNiAqdwH99+rClLLqdxlAFDL5VgCQLbnrGirFTVd/qovkrH4QZ87k1meJb\r\n7S0N++vUsJa3jqeNtJNREf0CPvrrC34tHFhD4hhsZ8aL0s0pKF9wGAzOSkQB\r\nP0+0PKTh4SYhwmGnpZh73ji6vhJ2MAdbxQc6sG8ybezl56PiGl6dv314M7Xa\r\nU7QTxuQiBce7WU2DvJgbqzcgF3hXec9QpUVSgfBhLwgUjQ+dfJBklaeNA9pL\r\nazN/xPwwmmgjlZ6UkaBTiO4TICElmVN3Vz46CvMdmD2VOnwu8Cs93EfD18Ze\r\nSxr2TXeG7SnN7ag4pVjO2Yn8/EtkfjA5KcYN3/qAQSPaOU6BMCiQoqS1Cll5\r\nNcJ5RenDnZnVSRp7IvJM7W05dPDZ9nBCZbtc9LI/3U6a7TJGv1H3rlUVUmcH\r\nieXbCyPAjaTeNx11YEwh0Ve0kWpRcH0rPX6VZbViOawOgsvRgnsXdSFAbuI+\r\nPYweSnScnt2V97pcMvz06NvQAHSDEERkKOxxnKSoTQUAOhpPyDCRNTKoHk6+\r\n7+On+J19i24ks4x342BghoOlsgwJBYCOOqhI53yy8GjdQu7X42AX812aSI9g\r\nthQ7YIKGIWSY3WmBVOfD/p89F66hoq661qY=\r\n=00WT\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221220163732-7b6b37c.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/7d5c2d6dd4234cc62d858d564cebe5b4/graphql-hive-client-0.21.5-alpha-20221220163732-7b6b37c.tgz","_integrity":"sha512-22s4Tye9c4JXvuKp9rjNYA2f6PJ2GKo/1zSZh6nmXJcvTQkTc2XDpGwpTH1nnkybsiFTAA+jVzIdvusalLulbg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"16.18.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221220163732-7b6b37c_1671554287803_0.19226373044917566","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221220163937-1645a4b":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221220163937-1645a4b","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221220163937-1645a4b","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"ce09e3a6d37a43490d5506809f52b9650b46a503","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221220163937-1645a4b.tgz","fileCount":60,"integrity":"sha512-HQXt6XC6cE0XTDrjyoKq2tG4hALb9Yze26w69hC0ec+kjtO7Vu374DugjOjdNPHyiPHURCHcYWAMOCFvTkZK0g==","signatures":[{"sig":"MEUCICFm7EYEzC7uTVOK/VC7RxWUicqwETmO0tpZTLiVNH0YAiEAyzvVZjnU3I7TuxkMxPLmK5JEjjV2tuNJBIr301ZzPAM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjoeV1ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmojsA/+IFYLSe+FBttT5hI5BiGK8KWwb00Z7I9xd+/4aZp1y7XtqAab\r\nN//AfyV5rv4bKwHcVtwmqCIMys4L0P6+f3BreBzHvdlFNNkW89PtqF1PihOM\r\n4OymAxlRwcwjYXhqc9NX4CcJbVDl9YEvX/hdsgpv1ZzniC9EHkCRiww7SlGe\r\nwtNgyrLTsjs9J30yivGzXYAdvj+mwKbKH2iTf1WyMiOpFQDwMETrgwqr+eyP\r\nHURbg2g4qOe4RfZ7+pLsNwXHiJ3zvadna4u4kKn2BQriORyNFhek2QavWmqL\r\nKAM3AzhSoAr8AIfil+vy4ddONAaERWmVWbOOEnFK+eOpRwgZg3tUHkyvCp5K\r\n3henWUp+T+nZGBzyo1eY7X4Iyd6XAYsYoYSYgEpBMLJSGA0Rn3GOlhQigOaS\r\nyGpRcvz9XnSZHYgNIKSS4sBmg7oV0WhpSBq7Jo5ffGktgy2nqOKCswtlhvfn\r\nKfq2XfgqZgN/P/Ab5UdAk+qc9vzIee4sgHH1hu3lTasQMMyy2/1H7OEbBl0O\r\nNFPJFHs2KfFoSzfHmxOwdac17y3l8VYNHfMqms8YsT3IRTxLz69CWFDV9jaH\r\nN4j0b/Yanz8+FMbc+ZT54boa5xWwjSz7MZiZjeteMtTii0yVvWerVRPeT9h0\r\ndwR7CLPKSxBSXlaXCxiB+c69fPbpohiX6kM=\r\n=JHjX\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221220163937-1645a4b.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/5dd00da198ccd0de377093d92c5899a6/graphql-hive-client-0.21.5-alpha-20221220163937-1645a4b.tgz","_integrity":"sha512-HQXt6XC6cE0XTDrjyoKq2tG4hALb9Yze26w69hC0ec+kjtO7Vu374DugjOjdNPHyiPHURCHcYWAMOCFvTkZK0g==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"16.18.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221220163937-1645a4b_1671554421444_0.5745398105652504","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221220231211-5c58be9":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221220231211-5c58be9","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221220231211-5c58be9","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"a72e50f997bc4f403ca54c6cabc69aeff0848e6f","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221220231211-5c58be9.tgz","fileCount":60,"integrity":"sha512-+sPl2VSqgXJycpMIvh9C7wGgJnf6IHSvIm/aVWCxbKQNN7dMG7SYtt8M7f6RaUr5DEPP6HTz8KqhJ1zeL4vMNg==","signatures":[{"sig":"MEMCICh87LdmLnYIs+ncwuVwtL464n+Xwe0H2rP2TQF5fTmhAh89ea2Zrp4xBaHiu2LZdwVFSkA/hBQv4/eglFjsHN42","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjokFzACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp/Cg/8C3g24saGh49ZfQmJQ0jGpcSt+7NDdYom1L1WV7i/QL3eAdUQ\r\nKQkB7nTsoJbBg7dO4/35D3zPMlfrqvcIyXifGU92158D5ZVQvoJMTLQ71buL\r\n9AQcAeR1PWLzzrda5prm5PJyx7tzaMhB8nOmXzGmUtDsYMVfL1Sf4mmEOZdo\r\nSfe0ZXOytNHIC6dN7i+3LfsU+2AT0pD9yWBqRRBmOU5Rz0pY4YB73g9lquM5\r\n0pFpc7b7urh3lJ+tZ8TQ9PRnq9snws/tqwn9SPremRBM98kI3SpeQjE9pCHR\r\nzcXoP/BTCCzMveJTPEF7kto/0k2idEJrRcJYFld80ZVKLH4+Cf/txRX/FeDR\r\nnQdAnpOZl8uS9kAW4rA+mnTOJQlqgZRcq8AmVCQnJXp9G0ioR+gWWomf8CaB\r\nYcZzs7ZeRm5XVaGnOv7dKPaiL985lIq+6EXTr/8b8hboACQzBNJcKa9y3bGN\r\nRewy5/XTjiX7NV0gjb9qjxlx45TGlm/wCMtDnFzju+VMwr5v1VYJ8uEJzbli\r\nf/GkMuRV8sU/vSCDvtNYaqsHBdIW8OeghV8n9Gq77GHM6941b//uBw3P5QTQ\r\nOUDPWo4SLkPLEK+7uj0ky8bMAWPUXlIV4wZ0I00DeVkQEmGSWG/TwzVIa+cf\r\n0/qzAl0iWNiEGeNA3acAr6kkCrZhidjQVs0=\r\n=nsm9\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221220231211-5c58be9.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/2f106304ce6622a814bab89edeee39f6/graphql-hive-client-0.21.5-alpha-20221220231211-5c58be9.tgz","_integrity":"sha512-+sPl2VSqgXJycpMIvh9C7wGgJnf6IHSvIm/aVWCxbKQNN7dMG7SYtt8M7f6RaUr5DEPP6HTz8KqhJ1zeL4vMNg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"16.18.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221220231211-5c58be9_1671577971783_0.10452586878091119","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221220231428-fec2f78":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221220231428-fec2f78","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221220231428-fec2f78","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"9e408e3e7d9a5aff73e19a31b56359ec6926e200","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221220231428-fec2f78.tgz","fileCount":60,"integrity":"sha512-WN7YSonrytf/YHZ3Z+ROvaNd1mDajZyeVFYKsXJg4U7WDOLg+yPr/lETlUQYoRsMcT4TPYUEeennGom5KOYYpA==","signatures":[{"sig":"MEUCIFj93EvoZ5qzlkSd/E3cppyZx7jo47/uLYkGqurn6nv/AiEAxvrR5+SFNuWN+8MhYDnXJ9KyDkg1Cm1RigtRp1VNDN0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjokIFACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqBLw/8DlJTMAMZBBinimFe407SzALjMQ5yaLTwTteLhLtFcGFDhi50\r\nmrbiw7tTAndlNwyGlrl2Yphc86/h5lO4LEOKpbNrhCHGH0WF1rs1EcWU4Cs2\r\ndEftW14hiShh5lrTbXkrQbkDU+kvUWfHcCDXdtf2tEmQ2wXpZTDdoQq9Ir7d\r\nFTbepXZAh4gT7HdsFHnZhIjtSE2aFzeH+A4OhjlHJB8SotgldMofEI29Tz5w\r\no0+/jlT4waTiJ3EZbfk5h1Z7lGddViR0/Zydgw9GJCpJt1b2BNLwDfj7zwUa\r\nSwwb9BbAltkHwDb1mSQ0TFJTr+xQOax6Hp92IDbL5nbf0y5u8+3dMEreNUTJ\r\nfK4KVLq1rSfD7fiTCGrlAdqafy7hxDS8mEzABNE7PStiaQ4aZrRBStxyh3tw\r\nC6kSdrBLoPw2+STcLmQky7jrj0XXVbSCImNZRd2enORlMQTI57/3bY+CMAB+\r\nKLVNM6Mi9DuF9Nsb6jrl3O+pFqRvtqhE8WJjsQl2ysxlnQiB30FCDsOr2gbJ\r\nmiD4CgwG70aD9VPlEJEV/gZSE/9RUN6jQ5sWAUuDhpObiEy64dtYvB7OLPZF\r\nZH0H3rXVYGgJbyTSAQWMr6JclPGuM9Ra7z3EVuqdJxdMk1glw/XeOtVD2UP7\r\nQBeRGuhQ4P2OCsE4UzkgCilI7xzOzrJtIxo=\r\n=4fNV\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221220231428-fec2f78.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/fa8cf443a5539aa80e340d9bbd43a1ca/graphql-hive-client-0.21.5-alpha-20221220231428-fec2f78.tgz","_integrity":"sha512-WN7YSonrytf/YHZ3Z+ROvaNd1mDajZyeVFYKsXJg4U7WDOLg+yPr/lETlUQYoRsMcT4TPYUEeennGom5KOYYpA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"16.18.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221220231428-fec2f78_1671578117191_0.5286100923535455","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221221020211-c861948":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221221020211-c861948","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221221020211-c861948","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"9b642ad24403a6c0305976a1cb5a6f3a8faefe3b","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221221020211-c861948.tgz","fileCount":60,"integrity":"sha512-tWPEXYcSP03cUWSurUKkqUwHoEsVfbjzVLddsfKfhTbG9WYoBKWs3sjCcsrvmTsqlAcsKdUPzyEYtUVP/qCcUA==","signatures":[{"sig":"MEQCICfGKS9WRugXHJif2Cqe0s1KgFPS5OVQv5QxzVcL+Ms3AiBD+wer/xFHxgNH9hRF89u/yxJPUQK/S/1ETlffc2258w==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjomlFACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpijA//Sv07b9MRZCEx3/S3/wsOvyI7H/+58xQjE7FFN36+Ab7TXDGG\r\nV1qXZNdKp2X77Mu48qqvhxwTmpZkH2p2KBTRDoKArFsl/9q1tAI7p++9aaT3\r\nRMydUxEqJb06SR3mk0B4fGtqCVcZasrNPER80tte+4IJeSp7qaohOTfjP0lT\r\nbR+OwrW5uUWY5TRhEmkrPepTEV1vidCNY+ChQBhuExe9pVZqRP2aZ21VRizD\r\nIorceMVvAppFWTmASalgWbOnHAyCwXy9apvUB7+VSxHnCbFmgv1LqoJrUsGv\r\nzpdUgPGxMxhmeEM6fXqbLqU0uJOp7+wOGnaJrKcetlRew920vPxf7V3mvI2X\r\n+wsLpMoa3xkPyOSkyQ4A52QtSR/40+ytvan3uxeB+qPXQHD2MpdhjjFYpWs5\r\nY2vuzkjnXGBuLq1AnvavtX8jwDaoaNz32HDf3POTlqMJ76oL1CPo1jUE5tN/\r\nByYLqXxNKBhvQo6Wej68ebiYMBBce+ew8tGGkBzzw4U9eOmNALxTphRbtaXs\r\no0O6C08UHo/YPXILYLmBigpwLye2fcMXV4iODpCknvY/lynCdbXXb+mfDvUx\r\njEThw3a2LfrzSm4Dw6gxVe0NLs6PSEOjewxV8QR0Vr0ubzjV0CKfzg6Czduj\r\npLTQUEW+Zk2lXtQPbiYdaW8COxQ9eoRzfPY=\r\n=iXFw\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221221020211-c861948.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/64ce477343ed525a793426ba21a55980/graphql-hive-client-0.21.5-alpha-20221221020211-c861948.tgz","_integrity":"sha512-tWPEXYcSP03cUWSurUKkqUwHoEsVfbjzVLddsfKfhTbG9WYoBKWs3sjCcsrvmTsqlAcsKdUPzyEYtUVP/qCcUA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"16.18.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221221020211-c861948_1671588165641_0.874833141635994","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221221071800-d000145":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221221071800-d000145","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221221071800-d000145","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"c3cec1a3e3dcd716e1b8c07a5bb00881e48fd7c2","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221221071800-d000145.tgz","fileCount":60,"integrity":"sha512-GdLOoRSKP2jdv7pOOhII3nQpzoRMMdmcg0nBmxCUT1yzDQXT/TQ3uSmsV7Cnl0Q7tNSKPoZzZXKS/C2qbXOYLQ==","signatures":[{"sig":"MEQCIFmqdGRuYqsBgifqXnVe9k9pRpiWAIUJBsq89bNFL74sAiAKIeDZqY2LRxu5eJSweGNPn0w61EQ/SPbDaE18+Cm+FA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjorNLACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqVKw//SCjEI9qCLrYSP8FzubGdVDu2pCwuq3AU+GkkLCWM58rEuzwt\r\nEQnGzA5r7cAai1G5E3Z6FOLQut2NOZycXwV24wuhXAR/v2Lywsbu5/47FsC+\r\nb6V61LYlGz+oxj9VjRurlxEdX3Qy57U+ePNLkmruV1fg6Sw9hgxT6QZCBJjH\r\nMRHGZ3G8vvmhkb1OcrRLqzwJW6jsb1whN2gE4aASZkzn9Jyqi6UiJMLz421Q\r\n5YV2U+VAdJY648XtY16+vKN0g6KNP+uhPeVzcRsqPqXPAiK5owjEZlrYiaZo\r\nOXyj0Kpm5d0oiu4/heG6lpvLWnVYyzdCv/uxbzMoqRlrxB6q7bwIJxhMq0BV\r\n7SVmJcJ4cl9cVqGv4KL2bTrHAa90nfRNl0FS6nld/1hssxVvRGlwTyLBjVAw\r\nwNHQF/W8KkYlbnVVEgXfGRSjB9W8epbIg4t+jq1U1wa9jHOfoCs6LjcFmw6+\r\nmmylgeQUNWDJXjLMFlhe+2E2RK4F6SHZ6mDIO8mxBSpvbCYg9yfPOHKPZCL6\r\nANI6v7bx7Rb//LTqEIFvDXZpAZLb/KnPmMoI4eyvsXBLIFvHlH1qQSvxxwdm\r\nqowF7ARUODUPrKz4C0LegC9OB9FuyvT+UEG0xy2V6rfWQxaAE/nXh/WRFfBX\r\n0R9qI1pJjk03mcqdQECHmbzd9OYquMH5G44=\r\n=Q2/l\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221221071800-d000145.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/5b9e733bdcd6227d0f3ca463a3e4793c/graphql-hive-client-0.21.5-alpha-20221221071800-d000145.tgz","_integrity":"sha512-GdLOoRSKP2jdv7pOOhII3nQpzoRMMdmcg0nBmxCUT1yzDQXT/TQ3uSmsV7Cnl0Q7tNSKPoZzZXKS/C2qbXOYLQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221221071800-d000145_1671607115201_0.08360270252269286","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221221073243-8a34191":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221221073243-8a34191","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221221073243-8a34191","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"78cc8c3ca1495f4d306619b9f2f7ba3a43c252c4","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221221073243-8a34191.tgz","fileCount":60,"integrity":"sha512-nYrDkQ2As6GFXzfCzwjFFF4WN74mA3LebBdQHD7fblVA5Kxb4V6MNr3DRMNTPiWt4HzEFWhn0g4mnNtE65k/Ig==","signatures":[{"sig":"MEUCIH/W2Sk5XVbzrejCRM6Xt+Ig66I8y9BYeuhglrtgd+uTAiEA2Gs3cOStmjGgnD4ROaoWYYlIrcVdBuLA/yoJIkrpbUM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjorbKACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoeYA//aD9pLHhek6/fzSU59cRWHnqmIkxXiuU8YnCaKyeRdZRkLCip\r\nmmX1GN0amcYmCwLY6cugsFxFxa10NMJxAF+n4hGIkzHRuv7CIS9iQXZhC7i6\r\nS5v4E/uUP0M1fJjinlHXEOXLWREG8sScBq71wOMd2NBpnoFNoSPgZFN1ujSb\r\nAuJI4ElxrBkdHf4qUNvU3mOaruQJySLq7owbGx4BIG2PDuPZ5pEnSOCxtYPU\r\npttiElJBpkdXExmG4D8+7foGfGsI0wTlFX/VYzpf16xZbWjUv1yn5Zwq2ON3\r\nrS/tSqWLIi9d5T04/TVzm24olaQlFZuC48y4TsdCbVgctrS/HDMt8MVmQLt9\r\niJse7vNoDbCS1HVqB71mozXWpYXMCvsPp6UU0GPQsHZstNqr3VdzWcXSf06g\r\nLbTwAgdli3eO/xZe2crgMAMgpXvDFhx0slLivFRNJXbW9lRGYfpm/bX7QJpT\r\ncALPARKUEKYBaCGzgN5i2JylQ/zO0XVN0dkUFLd498Pbk+DHH/TXH1gCcGX7\r\nlBD1ocnMQQoRwz/U8+TYHORElUhHxffHeWWFrmBucyg91L6JWMy1g22Ke9c2\r\nDpPJwIz98QLsbnlfSdLumnZxXoKVN/xnwq0XPp+ilndzWEK+pY0hLP2b4b3Y\r\ngWl9y9nSA3LmBFyp1AJOzJnG8bdrnPNn9ws=\r\n=TVbH\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221221073243-8a34191.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/1716094e14217e8f58a2fec9288d527a/graphql-hive-client-0.21.5-alpha-20221221073243-8a34191.tgz","_integrity":"sha512-nYrDkQ2As6GFXzfCzwjFFF4WN74mA3LebBdQHD7fblVA5Kxb4V6MNr3DRMNTPiWt4HzEFWhn0g4mnNtE65k/Ig==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221221073243-8a34191_1671608010701_0.5682181716433057","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221221080035-17c6ef4":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221221080035-17c6ef4","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221221080035-17c6ef4","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"7bc6c8cbf3a21c0429b8d7336ea1a8eea9a157f3","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221221080035-17c6ef4.tgz","fileCount":60,"integrity":"sha512-SfJGfv5NvwvFgUQ6EePwNBpcwNV3e0WYVCp/TARj6xMgRO4SIrTNPDpl3zWn3+36BuuTaqj2WiVXmuevQv4d8A==","signatures":[{"sig":"MEUCICrcHrrZAe5WXoMHjjDvX2FB0I+c2Cxsqk2M9cAa8aojAiEA1uCMXO3Jho2wQIlcdSEaV9bZYH/hOKkBXMHZ2Ahg2+4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjor1LACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqKSQ//VU2XyTxtHUPNx/S+vBapR6uPxTWwQBkmOKxozAhF+OmMw81+\r\nIk/G95KkFklNuHBEvXUPOSSfeQAvsEu/Z9swhCZH8Bi3xwfb9o74z+EEGHtt\r\nXefeAyMzc/yTlo3lcnnfM9zgSU+evvaFGd2A+Jj/moZRa/OdQHznz1GCrJPk\r\nXEMmIBaJxMBFwZ2juwqUNNszqwoqhm+wgC9ngrQ0GDTR2WJwxGH9CzeyWG3M\r\nNhTy6oDWAEhKChE0xmLKy/hq+//gmcMUaR9B8JBk4FZDisk7XvmuPuow0oKU\r\n20jynz/wNtHUXq7bwN2/MbFpZQk4qllylsU41td/qDEFMasgDgBpzqvUbX1U\r\nc7mfhrh+CcXlEASdWQzC2AH0eYcZb5x+ailds6YScr1duXrBDOX/pgucJ3X/\r\nlwUDxCAHHilvWOXyaaEn+GGeGWjYt4807xZiVbTn20XwBRtLZvEpUswFBkKE\r\nd2XKXtw+WlUL1l36FWK4O8URAoWQm/JqPZWxCn5JpXYiEYmDE2qs2SSRt8zH\r\n2vljAPu7sQZzkAIzUJH+JCT7pdQsK1Af/+mtjf9+ShOwQWIIQK79ggjVpLjn\r\naK8K0iASAmIsqdv11h1kVMDLS8NuqoRhW6byOc75XiEblxriEAqbbVvICl2U\r\nrQdQrlwmjgwI4clmFHTkqxwwk5RS3e7Qbl0=\r\n=sEfH\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221221080035-17c6ef4.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/6ced7721474e9cd6de1ee834e44d2fea/graphql-hive-client-0.21.5-alpha-20221221080035-17c6ef4.tgz","_integrity":"sha512-SfJGfv5NvwvFgUQ6EePwNBpcwNV3e0WYVCp/TARj6xMgRO4SIrTNPDpl3zWn3+36BuuTaqj2WiVXmuevQv4d8A==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221221080035-17c6ef4_1671609675752_0.10340242365768204","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221221083450-7f91b48":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221221083450-7f91b48","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221221083450-7f91b48","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"d10da8cbce0ecc9ed1c7f03ba6bedb4180d6732b","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221221083450-7f91b48.tgz","fileCount":60,"integrity":"sha512-1rihNQV3lzVLK5HfiqbZ7yH5JkHCfIBXhb0Ld9tPbPjM+4m9xIRw7TFCfgubg+VD6pTEjc1e3gjFhg0eXiFkZA==","signatures":[{"sig":"MEYCIQCkXxBDV5oDHIINMpbj0gDyZLgrWxcZHClhxF6fotKQWAIhAMzGb0XsjY3fkCJ2DUPI0DUWcTeiG9tXB4n2C6Cbyk16","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjosVMACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp+Dw//REL6+sIeMLrIDIkMC9KUcXCb+SoN6U5vbhiEAWSSW6M7wHXj\r\n+Ifsoj/xnQsvCr4/w6h/3agLzhbMx8dyJSgO1DdES/ha3iu5akXqfQDru4BE\r\nAPtvR/RlWvTMBREjE9sg3IO6r0VUEwupXDx0mNuxrgkylvGyYuFv2UExYsjQ\r\nIR18zQ9jIxvWM+zEez8XWqoiQ7DTQyfTedBxGIvVmLomBwOwDWj7jCFCadPf\r\nYMpJnGqmHuxuApML9Y5RkP5gd3+bEB3421b7i5EPbwrKL3NDmuYB3uB/yUzk\r\ntEnxMtbp3MHOuk5fLHf5MwmGrGB0wHcv0taLwxZQcQ2hETXUOnRs5/WYC2JA\r\nrr55QAPQ76hSd4W/5gvp7N7XIgTa6hL4xYwW7cMZXXDJj3zHjDD4ylGTR+i8\r\neeCZw6daXz39MYFWiCIqcv4yQISkj6VafvgDs2BxCTqLRQQ+kelv/WKVld/v\r\nS2Ee8C8rYzjDWXA8rzs/YXb3h7qyNwqkQeLmXK5qspn4q20TH8sAx1l/qChB\r\ndH8H+xtTvGjbpcRNV+cgS4m1IkvGu3mwgTdHz7VWpBcWAdicFoeFj4rSJU+c\r\nRAtimKWYDk4d/Rc5JnxtBk749b1/jL/jLIzWiP7Xo6ygSWhRjK+ZqZpSqbRn\r\nSqD6yfqTKXxNsbmKN4qd1cgaHMW6KRQc9OM=\r\n=RJee\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221221083450-7f91b48.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/941cea63b6fe68860af849051a3333c1/graphql-hive-client-0.21.5-alpha-20221221083450-7f91b48.tgz","_integrity":"sha512-1rihNQV3lzVLK5HfiqbZ7yH5JkHCfIBXhb0Ld9tPbPjM+4m9xIRw7TFCfgubg+VD6pTEjc1e3gjFhg0eXiFkZA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221221083450-7f91b48_1671611724221_0.630131590112673","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221221083947-fe6e502":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221221083947-fe6e502","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221221083947-fe6e502","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"c03f6387fb756426627a2247e9f598503898d99a","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221221083947-fe6e502.tgz","fileCount":60,"integrity":"sha512-EJB/PZSHTD7xN/v9qDfelsbfE7yH+UgE1BvlhrahilFpU5Me1wb5ZRSC3/4j1cfG3MjXvAKr54RXKOTKg6V0XQ==","signatures":[{"sig":"MEUCIQDTHFBU6iat2TFzYF2S1XUCCDpzeclnb2WyviBP90jVkQIga1fo9TkTgtzAMtcX+6s8zdEvtk9rnBDVN2bImdVGC7A=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjosZ1ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmongA/9Fty1VFfaZ4f2cpTTTk78ixMAoby92h7UKLKCzetGQkGLmayJ\r\ns8ty8b+OyHwxLnDEUZoFeJxp5EzdHu7FRIow0SGLcjbmjN+PSEqYIcKleJYj\r\nEDhmBLXyEnFpKhyDuAVkp1Dmp1TI6zh8NqI05aBO06yZzyt18gmcafxQHN/T\r\n2J/3+hpDgP0BOrTDymoDmtSj2uqRDzO4LEBhswmx3rudrywBGGceYkkSN+vg\r\nFYxjEfAcb8fLEVKwvmt/dxph0rA6BpofUqMD3LG5U7ET48+ELKKK/VAlnqKY\r\n/B1KLNwPZSMgEk0ONw/1lcwbvgL9b5avGvNUfd2v2TnL3HrGZyUAsRTIfZ1A\r\niS9S9AT1rbJBJwutkRqQ44LnYrFrDYQzhN/Sz74gbDFkGAtIMbqPrU6Q2OAL\r\nqLuxuDa2HkuOPUFsyv2ghtK2zkCLW/665JOIR/uN4DMOBaRE4HMl1+GmvHNn\r\nYfWqwFVhM+GGDD7W3PFN64Wts/r5C4zxGOJSQp62NPueijqEx6q4SSMuOhhV\r\nLaHpP6qFSM7EHEZNG8Q2GeOwn5Wly4YMijz+UlXnWzvoW/7N044hKKRvLHy0\r\nvknZ0TWE+S22Tg1MPkMBm7/u84AFpCchd1hFaQtsYMBBdJngpBdv7amrU6B0\r\nIpWRt2ZLTlPhhTvx13nNGIeye12Ggwqkee4=\r\n=lC1U\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221221083947-fe6e502.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/30d3bd464187efa66a5e99cbf95c25b8/graphql-hive-client-0.21.5-alpha-20221221083947-fe6e502.tgz","_integrity":"sha512-EJB/PZSHTD7xN/v9qDfelsbfE7yH+UgE1BvlhrahilFpU5Me1wb5ZRSC3/4j1cfG3MjXvAKr54RXKOTKg6V0XQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221221083947-fe6e502_1671612021638_0.7509957345329015","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221221085011-7f15a60":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221221085011-7f15a60","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221221085011-7f15a60","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"099f14756f99d92b6bb2a5efca1cf2e51734e450","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221221085011-7f15a60.tgz","fileCount":60,"integrity":"sha512-Qzrg/FcoJndY1ohfIHr8tb7/Q7pL7bzWC150hObWsTDNQbr5HPp73l4nsv21mge2HZiXqJAziuPvdCC/Vnw5tQ==","signatures":[{"sig":"MEUCIQCgUfioOpcnqXsdbrVsN62XbmLJpfUWsJk0vOlJbLauiAIgfArRz+i0CL3LeARwbyRq4DOFYMpu/klxJx4yqTBT2Ho=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjosjlACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr3nw/6Al1P9BGCBhSZT7xcHpsrclrg9YfGk5XrsDYlp7JOba0yp+Ql\r\n1EDbQOycVtj+vyFgHAci142mgfLAYLGaUZhLvPr24eQNq7RHhMmG3KvNDN/6\r\nVSuwMPygOnObZiYv9ZPq3IXCBOSzyoP658k6trpILduDZyN4ldpw/gGynuO5\r\nQos9rq9i8cQZIVI2gCiF8EsELvWxCSe0GLFtpNd9nJfgOrxKkMRbBZbB8iJx\r\n/ktSDrx35MmkfA/N4xZD+O1b8DR6aoFCEiYEuQwfcJudostPT4G1Y42vP9x2\r\ny33FdJEbnQYkOROVXhJTDbK2GfEC7lPBmzLC3IKLzSCG6MWg67T+afUgeH4D\r\n6q5WXqaSFOgICaqMFzvIuwEPDmeARWR7tiGX1GsR1i5mV1vZkQPvwwpwmbjd\r\nG5ikBtYC9QMTYWHKcekMuwNkW/mm3ZCGs067gKpZNmQ/4ahnqqknhakKI+P6\r\ninqaXdlPx9BRV1GD3Uc0gSBWqi4JYbiAgXZkp9HhBVgLaQxWVEwGl8h9fNwl\r\nI6ou9SX10lPNnHICA/4I+qHkaiFkW/sanVA9F324sYhRsREEpNePtxRHzzEN\r\n8DcWaxxjSY33D2sn61eqqBcJKMkxtcMu/6LoNkYnpsMuM3nDAzTNopu91zCh\r\nPz/8iGz8dTsbqac3FmCRTeyXP0XrcxSoH+0=\r\n=CIBz\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221221085011-7f15a60.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/0860f46399451310a6a5430a93aa4b2a/graphql-hive-client-0.21.5-alpha-20221221085011-7f15a60.tgz","_integrity":"sha512-Qzrg/FcoJndY1ohfIHr8tb7/Q7pL7bzWC150hObWsTDNQbr5HPp73l4nsv21mge2HZiXqJAziuPvdCC/Vnw5tQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221221085011-7f15a60_1671612645114_0.15886989129972084","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221221090804-384d9f4":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221221090804-384d9f4","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221221090804-384d9f4","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"02a1e2c81aa9dff524dfcbb5357eda0c97db1ec0","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221221090804-384d9f4.tgz","fileCount":60,"integrity":"sha512-d+gYHNxohlsO5YRzsXb6FFrRVF4uzPfLk4lOISJoizuZ4nCfAFS7NhYiqUxF0Pez6d0yRx7Vtlo55ccFdmV18g==","signatures":[{"sig":"MEUCIQDtvpj9QRZmDXQYnTZULYFA0prc2R/5s6zRSxYxz+UPOQIgGcTLBlav3goT2FjEXEbA+ZpohYWOaLbzmS67BpTDZAw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjos0XACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmq7cg/+PXVvi0kZdQZaz1kvGgvuWBbQ+Qojd3iNC2A98iNHYv3t/u32\r\nWY25tr9M6eAlPjpDLORU0BrabKvlL3yzTAC8E0t4KRMoi58JTCdnrFWQPFTB\r\nSYTvSi5RGtTESQgYBLJBn7p8rdlrS/ONxFWdTCoycb5yj8Q366vMRzzWNKFM\r\nHuiRgsEVJZXHlIG85CIR6i1bOj+UV2vmQ8HhHVLz8x9nXuUGJ2sKHl/SO5n6\r\n2y43+idAfE6CT3z+LNwfLnicsOUQIGZ4rEpxdbOodLpgFVT2UZJ6Xt0yyJQy\r\ntyng/BMrJXZLqR9Kgp6d7T4NtuvzC8w6ATQVJGB2vHuLApfntZGdZtHdpRM2\r\nTlnCeOF3gswS6ZsDcAmi1N/q8QxGeHzzObHN0IUJQWINYHCd3RwLDo1YdSAm\r\npiD3lJo7Zz9h5Ovna0Rv6s299e6YSpXBECFBZKfr1duXKt4rcqjS9vD1Z7+J\r\nICrSP+vHWLPUy15DwYcbA3DWYmCMgDtZt0e5WtijhS7uPU8w1XeTAiT8vyxk\r\nzvnkKDNGmmK5FzT5ghjZ5E29tA7xZebMXlt5wnQGX7SklFTnA5LeD9Hc5T6Z\r\ncE5XQ8MKFTeQ6CEHChVOYfHv+wi5EpYV98wj37+4hyNJQRoFvzw+Byv2WwTB\r\n7fohOK4huq8uR+MEuyxaCFlN1eb5DHjCCkI=\r\n=Cqij\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221221090804-384d9f4.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/a36c74819941887699a1c570c68d3074/graphql-hive-client-0.21.5-alpha-20221221090804-384d9f4.tgz","_integrity":"sha512-d+gYHNxohlsO5YRzsXb6FFrRVF4uzPfLk4lOISJoizuZ4nCfAFS7NhYiqUxF0Pez6d0yRx7Vtlo55ccFdmV18g==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221221090804-384d9f4_1671613719293_0.17099459838472741","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221221091556-ac5eb9d":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221221091556-ac5eb9d","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221221091556-ac5eb9d","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"a25ac35907ffd90e9bdc9d821dd43d98c2b7d117","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221221091556-ac5eb9d.tgz","fileCount":60,"integrity":"sha512-W4yZRhOVVVIVHjz32vZyuUy3QQ3LkAv0pAt0VgLx1Ry+gx+m+3qLxTkJQywWrBBtSwAFUUweDlPTA6qX9QOeow==","signatures":[{"sig":"MEQCIHigLuEsf0JFmYIuWBiQKIp9Fs6dNyFtXdoFX4xj+HTcAiBYwj0xFpzygRy7tXqR+sciiudTXPdRk3WI64m8V7gYCg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjos7uACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmphBQ//VhGmYrAeFK+KOX9PGV+rvo/9/NxdU1kIxt1s265blSclPTR2\r\n51qJIwbGcIaPJDF3N+Zfr+dSaYsParjSpRmR2JDJ3D8NgCIliLHg9+5dFc2X\r\nO/vqYimvMncb1Tv99kPUsF8906ZaWsoWIJ/vY0wQYD0daW8+l90dUFBhQXke\r\ndXiREajeQrxZypwyjuxTlM5yd9gIwZW1qiVldqxMqXV4Wjtflq3P20dfrX9x\r\nA0PnswxUeddkmvFvD7RnShW2roUWj+2KjIw7thSRBDsVnzhLRIS719wzH+qo\r\n7UezGJGHbW82yCMaw2E4q3zOfFFZzZyaBzKHSdbwWsh+L5QOSW7lOTY1yvs/\r\nv7Laqk2Urp7bnNqbrB4FWsWVg5mQiDp2g0nAKhnxeb1AJ6YAsbEjs9R/tEv6\r\n4kZ8MfTSfiLjfIQY/8Rg6paAMCCw366gSR0z1wr9Fjb56ZbA1JNA7Svr/dYH\r\nhh1LGt3opxvCjD1EKN/gSV9Pwm2rr0y+/Bbmf/b8NrtszQXrCNgcP1K+yGlH\r\n3QJ3IOv4UYh3q6J7JWcRSJO6HIx7H58mwZp0BL4UVf1gAmKF0DzMzpllaJGK\r\n+6/jP/rfNYVIEB8v0OHvnAJ7MGBRlX0HUIwrki0YE2KrOZm7RLo4FaQ+HBck\r\nmcvXnzsweDuDQtx8pbfH9csvk1rzfCicxd0=\r\n=6mB2\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221221091556-ac5eb9d.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/acd1454258d02833c42c3bb0c6dbc10e/graphql-hive-client-0.21.5-alpha-20221221091556-ac5eb9d.tgz","_integrity":"sha512-W4yZRhOVVVIVHjz32vZyuUy3QQ3LkAv0pAt0VgLx1Ry+gx+m+3qLxTkJQywWrBBtSwAFUUweDlPTA6qX9QOeow==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221221091556-ac5eb9d_1671614190622_0.2888340557957292","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221221092617-e418294":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221221092617-e418294","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221221092617-e418294","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"7871ad5185d1c8ce46e3b7182ddcab42e07cb27e","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221221092617-e418294.tgz","fileCount":60,"integrity":"sha512-kYp5Tr0l8+CdbtDhUUeD+jQnIRFmCBM1mo9H+Guv5v4xd6azK668QdUqNHNLN6S+/Dw7L7TRx3OIGQgIL7Fb9g==","signatures":[{"sig":"MEYCIQDQyxSsidep/q6TIuAAobr2faesHoGYIZp/pShTytMy3gIhAJidPzy7KltnqSg52Yxc/40+7/8NedGGneJR3as0lwIG","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjotFjACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp02Q//ROmNbPl+1rh7lX0gFA19mysJzikfk+jfUSidrvFuOIJP/MCy\r\nzd47RxiWEfdzfkAmABy7ZNm99qLqk5TnRF5aAasDnG4+jk+H3vehfex4kgvy\r\njJNfkzbZcieGyBsLmn6DkpCLIMvU63ItUKfwqP+kc7co55BO3/rqsBYWtP75\r\nluWwOZP1HY0KRReg+AtTkKKfS40mZaabD1dP862FkgwU6t3VsQFJJOk1KiVs\r\nsaJ+OnhVRx/lPoqwYTIS6ZQZo3CRjSN2abKehuO8dXLDaf7QQtLdXjSSJPil\r\nWg4MXrCOY4SKJIHWaKHlq3vcxG9ZrFlu1UDGDtgAVK67ZsaGwwnnm4NJBB28\r\nLuaURDtgrW2YYonmrpp5Lqww6vadRhLjCRjb9WazPebcEFD55IOd/WpBVsL6\r\nv7gMyVkwc18S+vlTgENEhGohs/6vMgue9GOeKOrBZv0H1UpcsHDInDP5Vql0\r\nIw75+nIh70Evz4FJkrLxCgFkSxJgxPlzqs4+UIXNbCPU4kSGTvKArUWH14TS\r\nuwi+tJck8FVRYFj8SodOvpJVBLnQe1ygCRA6MQhrYMHR1k3JdbISV+EznG2v\r\nu1nH7fT1jNc6T90+Y+fDWZbJF1+MKHMf4sZKrjqIFh9JVvj/yQjCGpONqcND\r\nwXPyZotXbxqJi5Do+4/6rctHVObRv7Za8UE=\r\n=VtW+\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221221092617-e418294.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/2562ead4e4483e9e25a87a32a6046d97/graphql-hive-client-0.21.5-alpha-20221221092617-e418294.tgz","_integrity":"sha512-kYp5Tr0l8+CdbtDhUUeD+jQnIRFmCBM1mo9H+Guv5v4xd6azK668QdUqNHNLN6S+/Dw7L7TRx3OIGQgIL7Fb9g==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221221092617-e418294_1671614819005_0.7221849922380501","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221221094949-51ad7a8":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221221094949-51ad7a8","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221221094949-51ad7a8","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"aaf3675dd2b03894f2aa6a33ee2ade555e378085","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221221094949-51ad7a8.tgz","fileCount":60,"integrity":"sha512-Ca04+gTFjQoFGS78/6j3a6R5GdyZmvofzDpp5hi1kXqc6HYqcjwcWjYJCX7KTxc3Z8vpgwnr2E4IvK01rQFAFg==","signatures":[{"sig":"MEQCIG2aoILU6uv4wZTm0lt47tXj9JQCKbQ3bcmdhpgJYwXaAiBgdiTiYz4JWGOjtIDSNQHGDy9LSmx4oFFF2MNrK/g93g==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjotbfACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoveA/+LAZtHw9u2muS0zh87s3HhHYhmHAU3/dHbmiqYIuT8cd9cPjL\r\nrGOuwP4lmo6Xlsgw8TvitVB41q7TArjyvtuod5gmcsbWKiJ5v9aMvNTdV/mw\r\nNCoz4MStnYbaEJ+EkLb9WS3S6pSt7CAbxJ69fCPZn8+lSrp3sDGN0hZCScPB\r\nz0vnhKnt6UMUNbPjQbxmQh7zxd5NiW/zeC+oMIX+vnAxo20xlGOQKHH83wqT\r\nwLK4m4GCaWRhK9KLXxMeu5wgp+fT0a1QOQrEGAXA4vWguLcfuJvVV7vqIGYB\r\nPDGmXwQ0sFza76UjJKV/Z+uIoDRVazrPTbA6LVuIEF0iTT40btgfpVNU6ZZa\r\ng2gsMrQF7oJ7rMfGDf45EqLAjDR2YvQRYk312xvJ2Lal7sj8dPLYZmALpb/F\r\nQv2FI7RgANpiw6ukbLm8unsqIzVDI8NH2HfOUOED6nXroA6e++ty2wEnoQoC\r\nn7GvfxDKHXFZIRrVRGvkkaOOzH114KfSOLRA0MJ7eKj5DAuEI4xJSK7Fjmg7\r\nWsPXCzJcA4jKJDFK0eiwevaYklt975VTEFaK+eBSMr6BC2tPhwP6myRo9dAk\r\nfhio4UbUpDXhuatl25D+Week5bUeImgM20XqngOSV5CQ15yzC76a9n7RmwuI\r\nY5VZz1gON8tn3YiFXp3mpq68mSMSQuk1uWc=\r\n=gBMe\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221221094949-51ad7a8.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/565cea90e95b3f96256527f5ee89f23b/graphql-hive-client-0.21.5-alpha-20221221094949-51ad7a8.tgz","_integrity":"sha512-Ca04+gTFjQoFGS78/6j3a6R5GdyZmvofzDpp5hi1kXqc6HYqcjwcWjYJCX7KTxc3Z8vpgwnr2E4IvK01rQFAFg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221221094949-51ad7a8_1671616223331_0.559703523279379","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221221095413-0245cc1":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221221095413-0245cc1","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221221095413-0245cc1","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"b52e1ca81618ee7fee1b567df487081158eca58e","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221221095413-0245cc1.tgz","fileCount":60,"integrity":"sha512-YKnwXB6gPZJjMl4Yu2l8AIQXL1SDgQF8M6WNaNN/heKv2qFEvuprkLnba4hGS8zYS/j1Di4ULc197nEcykUiOg==","signatures":[{"sig":"MEQCIGPRan2njKNYk9BdLdg3FZE1TOKweB8ont9cpsrFjBTqAiBhsS+rmVGRML086T2LolCU+VuH6tfAgWiREXrMoCZYng==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjotfpACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoNZw/+O+VL1xcuKjCtD1jL77fyp2t+/NAorIAJEaRtUB28Goaeb0fI\r\nf1s3uposnrRrdVJVvhSZor5rsg1KM6t1/mJmQ6/cL/bZll1kUBqOp5JhiP0M\r\n6RRcubflq+6y8IdI8Il7h3Ng06x0GVSiQ8ZuXpQK/lqn+CeERqtVZQt/Dzkm\r\nh2n2b8inn1YaWk1WQii4n5vlVWY5AvjSIAsaI4RXoNZucdOs1bkVsKlzVAO3\r\nwThHICJkjq9rQZTaXUHCH0T92T2ylW1Jr2uIn20FnpFH6ot1KSRbKa1EdBfW\r\nO9b+KZST/jm8rp5Y6A4srcKak6rQkzz+W1Ix/gTqjcY1e1TGJnGJNb4xmm3F\r\ne7qVQrxz17BDP90TDKM8wTbfZkYKqWDMBYJ7k/TE7RsvWGBcW2Rkn84Q75Xj\r\nM8izkAs9w/pRdybFaSoxvJ3TiTydjeAHLbI+6aFlTNY6kX0tnscYCUW6BnB+\r\nHI9Es0oCfSMwhbQ0K62Pg+yMbM2oL2WTJ/lBZP9tN+o3zBYv5aAws4IeZFOO\r\n2oedvhSuotSNY3XWP3sWr4Otnz4Enix1LBetxLmG1tQIpAAnHQJiiFH5A8p0\r\na/CBMmEdVJqXKm+p8efR4xbiauOFJx35+gOUMb3WMF2k4BdcUSdzItHdEdGV\r\nWrzqKkb6CnkvRy7yaLRtePLN3Z+U4L6ZlzQ=\r\n=jVHN\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221221095413-0245cc1.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/d8c09dd238636233d0889ae4fc102d1e/graphql-hive-client-0.21.5-alpha-20221221095413-0245cc1.tgz","_integrity":"sha512-YKnwXB6gPZJjMl4Yu2l8AIQXL1SDgQF8M6WNaNN/heKv2qFEvuprkLnba4hGS8zYS/j1Di4ULc197nEcykUiOg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221221095413-0245cc1_1671616489774_0.41077289885895785","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221221100835-c7f3bf9":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221221100835-c7f3bf9","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221221100835-c7f3bf9","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"8b1b676a597cd371a482e880edc75ec56f0589fc","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221221100835-c7f3bf9.tgz","fileCount":60,"integrity":"sha512-8eWSr1255tQZxmJbqktGPLuz5HCEV3CH6ebf1wghAfKYMRTT6OGcfRntwyng7Eq4EFDDmFQBbBIia1ZWSD/TiQ==","signatures":[{"sig":"MEUCIQDYZJwSRk9Ekhp8Wx8NaRw9PzK7Ob78wyb9X+UWO20QBwIgCCzEK00qMBNA/g6DGiiX8bGzi8yj4xVAjJL5/0fdmGM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjottGACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr40Q/9HxrCuVs22zzdJpSX7iRaJzNkuQfljsA6o30volfWo6E3Virl\r\nq6X9JxrskxO4Te5W8zcdJ4ZW5wK9UcTCh3/4T1w5RR4ucBBDJKkJw4P+U3xo\r\nKqLPWRwqXISBU/7dZm31dAcdHtFsVxdc0ysohpxPP7gEYjO8ae9F1OKAzgtj\r\nA0B8bTZjODu3AWnY7vRWx4n4GbGDVQ3kbKXvZ3bsEnv7gTkeMjfYk4IS5MbO\r\nDj34yZgutdebWyXoTDqN1mIWydLjImItO55u44QW7Qt8ChVrPkiat2HBQY7X\r\nsSgf0tfUOgeaLSEUairpJk1YMQZCXRtogIn5xYYwjwA9G4MqWMuQPPWipSMg\r\nPZaYWvkv01paBpfrhuGq9n1bJP6Hvkmm2ZB1R9ZWBip1uVA1xwHPvfC5aAMN\r\nXYMdsNPnLA5s3zk3ApPLVhnox8o6DUjw6aL1yjmM0dalSy0lmQCUoHzkaV9C\r\naZ3N4/M+jDoS9Lga0L4FTZs4F/JEtHf4Y+znvdp0OxUCsGMM9y+uCc43ZVjL\r\nwOnzXNgdAKBjRcb3zwOIO6aDAJjJd6+8jb0VW+8BBZdavYdUByt8K5Zah+Bp\r\n3hkb7E5vzoyD+4RtzxDVj6JyQjUDd74V7SI6gJiJhbLdSQAoK1ho6URL7Tj0\r\nLK6JEI44rjw/0UPF94kNR02O5cSsqqPABhw=\r\n=jAvb\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221221100835-c7f3bf9.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/fd7cd86cb7deee5556e6f57e9f0d2c3f/graphql-hive-client-0.21.5-alpha-20221221100835-c7f3bf9.tgz","_integrity":"sha512-8eWSr1255tQZxmJbqktGPLuz5HCEV3CH6ebf1wghAfKYMRTT6OGcfRntwyng7Eq4EFDDmFQBbBIia1ZWSD/TiQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221221100835-c7f3bf9_1671617350245_0.5465209411009062","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221221111529-7031b28":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221221111529-7031b28","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221221111529-7031b28","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"ccb8ad25bbc6ef755e24e54aa48e7e20a6e83dce","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221221111529-7031b28.tgz","fileCount":60,"integrity":"sha512-Mq7eZ+OsYWOTJS81ciEvYHxF9XVPkaPU3njP6aI434R359m6X0NnnD6fSxkfHMujNHWbz4W7Db/92ic8YCQAxw==","signatures":[{"sig":"MEUCIQCOLNucIpfnN2agSbw8EY7roNl7PoH896+6/QpH9Fh3+gIgNh6YCmPzlj1kGBE29v7Oononm4eSmLHfTt1qPjfe8x0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjousAACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoXUg//Wed0hr3S82vs6s1AEarfqugAR7w8b5dC5VOuRnPFDK6OKcPk\r\nodNUS1iJrXLGl8GaeEZKrXpk8BYbbBNLUPQxCU/R9KuAMcYdAS/qPewDjbZt\r\nIskNO1CfxIytVbaQbsiHK6fMBZQxmsRZw9DYT8yqChRj/ppkiJ2xJ4QU5tK+\r\nW3ym8Foq7cwI5QK9oIPgmUuBu44Hh/w2dT/VebeTOtFwGQduvB9BWWqy19Ww\r\nHPsaO/kRFCDMFtj89jrq4v2b40q3zX2t/vXXgMGc7T/RA6aZVwu/U7bovqVU\r\nZJjbO2yxYLMjRUPX+tVTXBsxZNEPKE6HeM6Kay+00AQTmGNQtp9jZ45ChxEp\r\nJ8NJyb11S0TRepKyg/625H3dyJKqmKfIwRKQpen+HzyB/5Smwd8+q1hcotZb\r\n6YGMUTN7sct0tmUzS9+IzV8BYZlIf9uPYjLx0vanwKSQhN9jNHHaZ6rOmOYF\r\nyMrBoUXjmSJw5WPPmppThfgaQ/tnRYO0juzfeTdANLZ6k6nM9xk+hv6lzcJF\r\nsnPRHy3IKDKG7cBrbtwmXyTq2JS41tIxQQxWW+zLG8TnlcgCF079ulfN4b/p\r\nFx2XAYdEb+TYYiWzOpkDJSdpiCBIz6+R/AjJGxcSwKKHXlWPrEUJZtaVYXUn\r\ngxBoBHH23Ht3d+VxGPTftb0sBTrKXzvKlIM=\r\n=MWrV\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221221111529-7031b28.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/553ff4faf845d47a71ad200d9af95cd6/graphql-hive-client-0.21.5-alpha-20221221111529-7031b28.tgz","_integrity":"sha512-Mq7eZ+OsYWOTJS81ciEvYHxF9XVPkaPU3njP6aI434R359m6X0NnnD6fSxkfHMujNHWbz4W7Db/92ic8YCQAxw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221221111529-7031b28_1671621376029_0.8254014141167494","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221221112122-56a2395":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221221112122-56a2395","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221221112122-56a2395","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"3a492f2de45a915c4e53d9c83c5e241d05b43ee2","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221221112122-56a2395.tgz","fileCount":60,"integrity":"sha512-/WYhhI0EqVkQFVBXCGIcNesMh4Z1A5orcoP3T1F/7Kwg/1WcQAQvG0fdsT8RfT8QOnc+bs/KduSDmrcnovVSfw==","signatures":[{"sig":"MEQCIEhE+iVE3mi0+/qjJ4McrbwsIlciyG8z94DA16bKZQC7AiB+VBZWtCkmXJroRe1C52yG81JWIfHDQav9gWjJzARzrw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjouxaACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo55A/+MHTDf5bGD1ciTBaZVXWdY7RggjDoIoR28ZJIbxZ77ZkwRdvV\r\nLYCbSHPJTvOY/xGOjBGEQEma/3Vo+GIAY9ZtHLLiUCuyl2kcYpj5cfVVyBqV\r\nIVu/5l+PYIclNK4CMhIdUewEEGkhqLhEOEAtjPajwWe2IVxl9AJNWw76QL4u\r\nFCs7riaGmE0DjPsxtKFzsSkhnuFMuTYAn5Xr+2gf96tqejv2cj3qb+uEreKR\r\ndbCD3WES6TDZKJ6NGbtoeL82p6N1EOWzgvhGQjw/28VbP6SJ25krjkN1bl0w\r\nmkf+ydY84LPthc8Bh//9ZAqUsc37eFbe6GTNrdv1rpCS4IRwHSwZzPiXodn+\r\nEB4J91zDGxEnecERQGLXpzXcXie6aZX4uYAEfM/X2rHM5s01I7Os/7/ylP9A\r\nX4oV+yHSDLMhS9ImUx2RMn6D4euXJu9RyuHoZni82q4fE6IbpiS3obZ0FZn1\r\n3at1uTL9z9DEUkKk7Jeex9xU8SG9d27ZGwdZpgLHbb5nOcryPqmUX53WbJ1Q\r\n45L8E0NdDUPpe4mRYDExExYqiidVGdcehPBTflK5Fug2E6prcPWk+C+4SCcD\r\n+uJqUYMpPyLLWcA3NvhOPwagrasSyZAIF7SO6l7q7d7+yd7nJK1T2xdHdfvf\r\n/pWUXM3FcDaM+AgWtctgGXsOdK8P6ToqgQo=\r\n=EIsB\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221221112122-56a2395.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/2a63910fbbd9c13d043001656d1d2669/graphql-hive-client-0.21.5-alpha-20221221112122-56a2395.tgz","_integrity":"sha512-/WYhhI0EqVkQFVBXCGIcNesMh4Z1A5orcoP3T1F/7Kwg/1WcQAQvG0fdsT8RfT8QOnc+bs/KduSDmrcnovVSfw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221221112122-56a2395_1671621721902_0.6429755545348133","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221221113112-c3129af":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221221113112-c3129af","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221221113112-c3129af","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"162e4696e815273da0e16f39f2e7d515ef78a015","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221221113112-c3129af.tgz","fileCount":60,"integrity":"sha512-jKiX2wLs5HFTF+6bKI2hW0o0d6kdpO7WBzomwvfXAnhCG+BpVcbN+Q5si8uCOZLlX8nEpvWkftonomiEahanmQ==","signatures":[{"sig":"MEQCID6dvsqMjn9Al6y6/8jEKTdO/tpoAo4ay0rXV7l/fZqAAiBs8PftubSN6KBBo/mjSgL6YfAoQ2TRe7zXlxO+ltRxVQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjou6iACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo/qw//UALubFj9vCBddgNorggwP1zTZQvv+YpjmNGMTyOYcL2Ci56f\r\ni9+l8PkoT145euvgMX8kbLQGopqrAF0b3Ww5RN3gSAVqWmHUCeB8KJgcnkmT\r\nsPmffSf7BC6GFJL3C+k3n6+qRrDEd0F6CEUJmZS50kEJ4g170+uTUO0Af0wd\r\ng6SCswAuIaMYY/vfhTpKaLrKNOzilu5fHnNk/KYbCEdmwfUhTOasEXnGSuhC\r\ni3gZuBcxL3FJ0QsIdlwpxH0y0uzfU3Wlq/d0LlqiUt5ii0tVYKUjwDBRmaui\r\nH7OblcXegm461m4jiFhwrjRmhijVR9atRzeiZqSPmGOY2x1HsdkVXjDuJeKW\r\nrrgxass1UekdccNTOw6HmdP33e8NYc79DJoMHggLQjAc5j+r9JIhlrEWfWmO\r\nwE0jMvRsdTb20bmAdX6srBp9HFWjgYR8d+FuIJ6/pB8aqqZy214kiKsDcqLX\r\nupckYn9xj4dCTrSSOMK0tyL897w5Tx71Q3q942LtbCAXxgyk+zoUBtftMjFq\r\nE+nKia94ij61HMrDzmDYPB1DggOcXrP4txTSN2yfeO5F42O/mAe7cdo1NXjB\r\nG0Ap9RjWi96We8HoKjfg2gAfmmITkIJ0oFT7jLnbN5YDzIg5jQ2KPwUMVVl7\r\nlw62o9gKqhcrLjohnYRS1FER8ejbTHYRFG0=\r\n=285R\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221221113112-c3129af.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/6b0ef098859abb84e2454a1d23fdee18/graphql-hive-client-0.21.5-alpha-20221221113112-c3129af.tgz","_integrity":"sha512-jKiX2wLs5HFTF+6bKI2hW0o0d6kdpO7WBzomwvfXAnhCG+BpVcbN+Q5si8uCOZLlX8nEpvWkftonomiEahanmQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221221113112-c3129af_1671622306116_0.49396813933842765","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221221113331-5dbee78":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221221113331-5dbee78","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221221113331-5dbee78","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"cb65914a84d6023586660f29b3a6006a08431069","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221221113331-5dbee78.tgz","fileCount":60,"integrity":"sha512-1wJigEJgtlTxexcZx0R5KAAKuPlYfglnIHb5dTve4SHZIwjz+MBH/6x1cGl9f6YbZQAeE8hs9egbxcOaQV9aLg==","signatures":[{"sig":"MEUCIFg1JevpcYbh35tgzRIfZ9zzzH3ZHj5u6cbVcnjMRXD+AiEA8LB+l+8hOFZuWT3TF4bKLRvqYw/FzA+j3FhACM2RHB8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjou80ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp7ExAAnFpzrWCy/BzTY4r/OXOPnS1SSatTL7hUV4ylKmv61cSdFKUX\r\nH7AQuxbmztSmdxqvWrT6BrEu40TuMqOWR8fYCAI6FS45nMeLQR5UY0iuIP51\r\n8Fc7tjix9SCkGbj7nJYZ3MXc+zTO88h0kJ3hai8i7EqJJ9U1qdxJYXtmALMb\r\n2bSIGvI7/LIXpDpOg0Zi6WoJ7dRm0IDnqe00urIvAkyU63C2niM5DtmRJYD2\r\nf+QkkcI4j8cNlnMPAT+GObHKzwkoOcQlKpIYKCaKOG4MqhaSCPFA4tVfcAgb\r\nF6DI1qMvmT6AyOAnveZ3Re2YP0zjZmNuZEMtblkSgAA1LtpqJ5enzYb+wxtD\r\nPraAqZWG7+rsgR1pIIvDg3Z/pEQWmjEWqQf6dgOT4nLBsoAyJJJ7mRcX98PN\r\nDu3xNPnwAmYkW2n2i7iBY2j/3vlohOUHjmXgOY8V2yBMPYjWtgvFeFyo2Zf7\r\nhIkr7Eij6YI4SB0y02huxvnBhXd3FZXFo1+h4MWWZ8asaTJ3su8ulSRoVJdX\r\nu8bAA9j1jwp+ksuvRuXfdA0Ut7dg4Zw/BJsnulAjNJZriMtkAja1wXnz+5NS\r\nRP+QdVhh8bVTuUvdaBqqDIIzkvwCGx/a9MMGLbk+NIEnuWG3BCA3RclDI2ic\r\n2TEMsA8ZeRQiK7pNtqOcHEQPVZ00xcI3qeY=\r\n=ONpV\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221221113331-5dbee78.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/bccd7e7ebb1ae2e21a02a86e0ad7adb4/graphql-hive-client-0.21.5-alpha-20221221113331-5dbee78.tgz","_integrity":"sha512-1wJigEJgtlTxexcZx0R5KAAKuPlYfglnIHb5dTve4SHZIwjz+MBH/6x1cGl9f6YbZQAeE8hs9egbxcOaQV9aLg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221221113331-5dbee78_1671622451869_0.561074348720489","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221221130732-dedb201":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221221130732-dedb201","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221221130732-dedb201","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"4699802f71ff92ebd9d3c26204988bb07a5515a9","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221221130732-dedb201.tgz","fileCount":60,"integrity":"sha512-cBR4BOwHdc393R8/QeAvAkMrHEoGm50O9oXBmkwyXSfrZjhzXyzrvpfnyM4GQp21Tbk8IAlDFb+Lj7voUMUX5w==","signatures":[{"sig":"MEQCIG3T2W5Q4AW5Ikmq1yRy91W5FptgfnAE0ILf1jpPzFZAAiAJxSmRz9kzLahmYi/I8kopHaZikDiM7nuOPxsfv7EhyA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjowU5ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqFBA/+LW5KzBV1i0y0gwaOwVudo/3q5w7krFz7p12wcMgquYJfbSl/\r\nSqlioieSAzXQRY4LqesVZ2Dao9zalk23ZU+zLUf/YnN8/aMduNr1gmkTtQ4C\r\nu6LiLDu3mPV8FocPk1XWhaPpxiJhM0v1TWoTZw97GBGxOV8X9B3G8bX1IIWi\r\nEh2zg/vebgLPTcGLce+zcTf3mHWobnsY2ctLXAW+dwgySRKQWVy+Azih4zmz\r\ndQmQebILj5vuLeqYnRatBBqHJK8plDWBVItOrJqOcAzk7GgvA8Ux+vz6Zyeo\r\nvA+sHwZwM9dPAtGqZ5tRJrYmBeZAvshV+8ViMC2srlgkNhT4Hlo80tGfemQ9\r\ndUU/1Xjq/U2ew+AQGcGTxIMpfGPndl31phoSyrqr/UzQSTb9zDTSmvXOlr+d\r\nxaEieJDgllgCElUPWeFatiqLOzkK21i/HqGulOv9gsIYacjNWRmz8BvNyBYr\r\nwiHHvpIv5lRXw5NSMcVCwWsJhuJTQ9vuvUtPHT4CpFd/G0ifjcBYs6lluor1\r\nA84YqGM6LBBZMrhOsHZ1i+PxKP0IPByRin50iIOGktQna2eev5tFg0g3bPHh\r\nXQXlXnv9zBlByTpuIydYbx4ctZwzLUoKPSoAlnY9yVQLGIDHQe7NmRNlTPS6\r\nDmHZah/E338cYqlGezwX96HYPHPCGdmOgo4=\r\n=iZDQ\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221221130732-dedb201.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/e3515e5e05d8adef1fa7edaa4346f37f/graphql-hive-client-0.21.5-alpha-20221221130732-dedb201.tgz","_integrity":"sha512-cBR4BOwHdc393R8/QeAvAkMrHEoGm50O9oXBmkwyXSfrZjhzXyzrvpfnyM4GQp21Tbk8IAlDFb+Lj7voUMUX5w==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221221130732-dedb201_1671628089421_0.6885745472512728","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221221131208-9ad8d7b":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221221131208-9ad8d7b","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221221131208-9ad8d7b","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"acd2cf945a5222b813493701e343de7ec10b6f16","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221221131208-9ad8d7b.tgz","fileCount":60,"integrity":"sha512-j9gtjEh71cWK6HeCKTCTW3mNnobWbCDCjj9rJwVv04KxWucAawrV3x4VY+IZsaiGlsmcrs1mj5CbH9628Pk4aQ==","signatures":[{"sig":"MEQCIAdGoSwSDoYetuOOsttJr3FHP8tUynvqUnSzclrKlxnKAiACMNCxFMpp6Eiu8LcYsi4SpIbkXl+GzXU8TrTarBx5eA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjowZPACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp5QA/+JBP1+U1wC1e3mb2grlTsC8Lda8CwREH4RIsTu0Ya6+qhkk9Q\r\nf25+9mLgKbU66C0cFpgJz/NsMvF7eb7z8u1yoCDimj+O/qFqWvoCI2dFzzI9\r\nTsseySR4bRQ3psMt/Bgf09bX6iWSyldAxmAI8AnXJey+OBZvp7wFriGF0KWv\r\nubw+8sA9VC1aGiwea1RQlH+HQBpIY9XzaGdVpQ26h5TbMoQkI6CNu4r9xtHU\r\n5R7aZrZ/i07ExKqFlBtHJqxeNwHObevA2KCMfRIwChzouyo8om+liWnQc/nc\r\nu1g1H0w5J9OvaHxk54IOlZSuUDYb51t1mIfS2f0QAX8OyJA5wpbmUs+mObOJ\r\n5wdULipNvG8NuzF1D6LlkxIO47lmJR/LLizZL6eTx6moCX0XTIqoBeH0WK6/\r\nmvt7Tbqfc7UpaDeTNcSZWGKjJxVM2LPcZDUZLT6pxolDXOtzvqiieN5ssBTA\r\nkRZ4YrD9FmWiuA/dYblljsuV7+nbPzwXBW7OAupqotY6iRmhqeg1WSuMM8/U\r\nI/d32Ws6sn33NWpWs3H6BYq6AY0Bz/ROuRAXREEGyNnpT9oXlpOcey58XCeO\r\nUolRW7/rKzS6fy2HkT19Ae8ykX37cdsVxPkdIVreKkTPIugYggsxnZw30zSO\r\n/TbK7Xs9nNwmDFVyvwpw1aMa0wie5UWx5Wk=\r\n=7PnL\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221221131208-9ad8d7b.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/4d0a5aa595ff76b0ff412136f82a7d4c/graphql-hive-client-0.21.5-alpha-20221221131208-9ad8d7b.tgz","_integrity":"sha512-j9gtjEh71cWK6HeCKTCTW3mNnobWbCDCjj9rJwVv04KxWucAawrV3x4VY+IZsaiGlsmcrs1mj5CbH9628Pk4aQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221221131208-9ad8d7b_1671628367771_0.7889032575848711","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221221140151-07b6ed9":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221221140151-07b6ed9","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221221140151-07b6ed9","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"79a49db8881bb35056f9c4ab0e35af5fd7c54453","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221221140151-07b6ed9.tgz","fileCount":60,"integrity":"sha512-nGfwybH6SiD847FxhzQdASHAm4tVLubK8/1T3jdOQ9GYCWPZMyk3KUGM4PkbZKJRWOLIodXQmh6FCDLdHxZHHQ==","signatures":[{"sig":"MEUCIHh7kYYewjngSJaAClb/I+YZgLv7H+UX/kGfIh/PAXG0AiEA8EXOJ1/SAaSko5ZIylZ5wOIjTXXOIB5h3RCrFRKfK6s=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjoxH3ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo1Ag/+NTrp1sliBxPy44pLI/vIljovSX+ByER4eJ4EGOglyhpubOUd\r\n//3a7Q6/tHPDz8kMup0ib26pB2wJc32ZDlk4XJCjzIpg8WnG/FAhonfjmFhr\r\n6zVQGFJ7yqRyOh5aely9iWsGEDn9z0zoXXavtc4j+BmWPHp7XEXKZ+Qpphqu\r\nPgx68+iTPaGcM2dAohxdMy18Sr22yQAuPMrbh/R3teKE0omIj2Zf+VA5s0aG\r\nQ9LphFWUQILDdjLs9PgBLhg95pBb1uDCjqxjNdI2jQnfr5Vx6rTv0kgc0uNz\r\ncG4YhIFjM0OdP4Q33wVwxZ2IJAiVzwkvi1N+WnaN2pkaBHCdoeaLbhFIRs8/\r\nOnl80hJtnQ4k0Dx5mG95DhfG4TeZBDqcWmwI8CnCCS3LzxQRufz1E1tDB8wk\r\nSM2HX1WqiTpuH7YDK6Z6LBGt1XrBqGZabCmmfQIjXxxv8JJtBa50nXDGZ0jc\r\nicC1y7X7etiQcME+zuLr5dVCKuseoLPxvnXQ85Wc0d2ypER9qzPmM/HLFjJy\r\nVkccGpFlCGxsUrWR8X+V/GmXl7WnnDGg2ISCMsvLDMySXzXE6n2ZlBc5COWn\r\naoEvg6X18UhBpb1eLvVRnDE4Vv7i8tM6UjljNfLwwckm/OXi6/92GNwme3T1\r\n3+BY2/98KM4bV6w5t6C2RVe1tpjw/hRllJ0=\r\n=ZPvH\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221221140151-07b6ed9.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/2114cbda17b6955f3de28efbbea2f472/graphql-hive-client-0.21.5-alpha-20221221140151-07b6ed9.tgz","_integrity":"sha512-nGfwybH6SiD847FxhzQdASHAm4tVLubK8/1T3jdOQ9GYCWPZMyk3KUGM4PkbZKJRWOLIodXQmh6FCDLdHxZHHQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221221140151-07b6ed9_1671631351536_0.21949059888820632","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221221160921-36c76eb":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221221160921-36c76eb","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221221160921-36c76eb","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"edfc70eed76e559eaafff0144bc8d87a08ab360d","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221221160921-36c76eb.tgz","fileCount":60,"integrity":"sha512-2QSaxyjA50Sb9LnucA64UMRhNWCIaoHOGEmMmn+PobXC/+XVCfTG9XDSXNlMfr62HAce/aM36nHTsVl4nGYK7w==","signatures":[{"sig":"MEUCIQC/AtUG0hQA5qrdXix2iwa3GO7qZ4spzj2/UI8LqCstbgIgHdOq20E1wJSSXzaftguyXgeeQ2gWCcda7k9GkG8QBFk=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166009,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjoy/UACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrQ4w//eFd62a0dgq04j9J9My+vPNyAnH6f+7tD2I/UVz2yWH9BGOef\r\nRXthfKC/B/IokDl7jwxp/BHdOxCFfPln1AecTL3HfJcDIuITwYamX76AAYE+\r\nPvIjDBETE5xFKSWVB3KYrfOrKvsFsk1nqjdpAc7ttHQzXs0/lufjKKAzp0Dh\r\nss6EYtKgTbF+2H+D9SKbzapBY6svltqbpgRuja9kAQf+uOQr/t4AROT1LasW\r\nPYJQoMiykB65mA27WRD/1orhNRO32PUiqyunnufe0X4qZQ56dtT17dK4qa7i\r\nsfOIK6D+FWKHsuRruMaoIBswZRqDvd3mPY5bGGcH0l/5Wc2W2Hs11I2E5GiW\r\n2I9y8ADGC3c6QBbtGyqvkXs+9I7UmK7DHtFeLUQTRt6wuhkY9v59Zh9ERj+8\r\nqMifbE33+pOiB2uS6V5qb2xU5j6OjrBIvcc9YLGHxDvMYnOATpJYLI03T9JM\r\nRwxklk6d80VmXxlVC1DrPYgYeMxhbuJp3iZxvFn9vcI7TOm9CAF4Gtq5fmJ9\r\nX6utEN1lJNqWhSrr7I8ZeTg6QAnI5RoHdxS7gN41FwwiXLq+dTlMOLBWLwFi\r\nKsWLYHOjt9uXcbmkZoxRqlEUFztYM7wS0LWJhN+rlbvqBWWkZvtVW3aeKIg4\r\ngDcoavJBnq3zfijUGMx+fXTE9EXvFrVRZ60=\r\n=DFVX\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221221160921-36c76eb.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/cf54162314fde9cd1c668e87447af97e/graphql-hive-client-0.21.5-alpha-20221221160921-36c76eb.tgz","_integrity":"sha512-2QSaxyjA50Sb9LnucA64UMRhNWCIaoHOGEmMmn+PobXC/+XVCfTG9XDSXNlMfr62HAce/aM36nHTsVl4nGYK7w==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221221160921-36c76eb_1671638995992_0.8571745267674515","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221221162420-167811a":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221221162420-167811a","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221221162420-167811a","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"ebae9b4330d99d3fd1fa2331cdfbacbdcdbd7ea5","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221221162420-167811a.tgz","fileCount":60,"integrity":"sha512-oQrZw16ArFxNSvy6iCvctxvRnbi78Z5LPJ2W40zg3R/Y1lq+auxSXyoZ4AR+SgVdrclRtMH0VtmwcP86lfWMAA==","signatures":[{"sig":"MEQCIBQVTrzlJ6nouZxD3jxLgE2Sfx7ZXetxtf5s48/42wYAAiBji/Z5Sz9myLuyrlES3XYMzbabPKhQmhDVJiWUNqBmhQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166009,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjozNVACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqT4A/+PmDbwY22xOCEkoAhu3hc0Kwx21wjUkqxJbbk1xypYK+cZSNQ\r\nU4mgdrg1fte0wU7JOm/5IUi+XV/8jdJrY1f+yALccJ109qQAbE8ncWdGkIX8\r\n8bUzZu7CPzgtDAGmyOjPLU7CHIzdUMK4/BA34cYHmEigcm7q/uz+8RCH+ljD\r\nAsqzRsjeE3bQ1KVBlfcTCO0O8KCju5Xu1NgvaQBIcvdAMVffvHaME5mDM8gM\r\n4sOhfeDjR9qX/qr+WUTLW6OHnV6l5bSS2U5acgbwCevXwLnhK3Xq8U9/kWMe\r\n9CpvSTecTQDgBUbBQHXLloou9WjVznZSGf3PiaCPkWRp1jS68TBFhnEfdF9w\r\nV5JhLbfZG0z8rZaZd5NEwhbEFvs0joMLRO6XcOvU/GFdrW6pXQ5bPNpRQrt8\r\nuWgX8gcuPaUaB/09S6cAA2rp+tn6AD8npilTQ5SBkfLuZs36PcqlfJ5d0u6h\r\nZKlVeoptCl+siycEZ64qjqOJTTRnHQSM+oQtBnIecg6FVgLZoKTvOqDgtKaO\r\nKkfDNH1jLNIheApAVOAt1UiT5RSpaDABSyGbbw77qRImXjBY89uDsBPQVBCO\r\na6B1is2O8QHBwXbuDYxHtA2xcO6mOlSSNhGJod1PoBrfNSDgma5UWk08Hilp\r\n7vzkuF9aiGy4/DgufFGaJ/TuYj611fKQr9Q=\r\n=fGJS\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221221162420-167811a.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/daee1a3c10a493e9c86622e0ac81ee98/graphql-hive-client-0.21.5-alpha-20221221162420-167811a.tgz","_integrity":"sha512-oQrZw16ArFxNSvy6iCvctxvRnbi78Z5LPJ2W40zg3R/Y1lq+auxSXyoZ4AR+SgVdrclRtMH0VtmwcP86lfWMAA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221221162420-167811a_1671639893762_0.5972301425393662","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221221162902-6d08baa":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221221162902-6d08baa","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221221162902-6d08baa","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"39360339b29a0d1eee1d58ae49fce5c65a026c75","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221221162902-6d08baa.tgz","fileCount":60,"integrity":"sha512-9NoBijL/bgZryOQlCFNpSJYSdDkBJS7Kk7Ap6qLvTzgkxVbTPf9ggRsDIx1FIKnHiiGpFnG/OSrOxYumfsvl3w==","signatures":[{"sig":"MEYCIQDhbarEE89AeU2BvjE5KogJqspchSyz7SwHJwAdypDuOAIhAMG09hfsmAy6F7y0BywE9sga4Qspjzij7O+C9ZqX/IX1","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166009,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjozRyACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmpz+BAAhWJER6DDX8R5FLiyPlwv95UKmOmWlOyRxcyTjmpovOUeRcQ0\r\nixixEOVVJPFr+aiMlEX2YrCZONK9UsIGodt6l+oA0niGpYDbv5xwsUsayJ5h\r\nkIU/f5z/W3XOP/HBhukyypCptCBuU5hseN+XhkuZCCQUxuPuW2q4Rt1qwkyl\r\n9FSj7/9lo8AS4RHL2wdL2WejWjFlEk+G/c6kjoqqBtmNwyUtcedO6dIBhn31\r\nL0yMhhzU4swgvY097hH5ySTSvcWy0OULizpf8R4cre7Vs8dtf5TX3mhR5vx5\r\nzx5MLz/M5N2W2Xr1D3K6Qo+p79JCNngSYWvzr0CPjOFcqeP/c3f7iGgGChga\r\nMoBBKMA0zCNPzzjlZQzln5lPRC81AorsC8BUTJLbMUGMY/S9U/Gvv25OaYq1\r\nvNGiVOaH5ZIXr9LrLt88JeudDvJBID88vaHy6BkRuyoORXHpw8vOVG8dS+Et\r\n44XaoARMgQU2E8gMCa6jCyVq95L4TnGetYLIAqvqwJvbhyaNjBFwI7EtUo8g\r\nJJNMJpupR97kWIszKZCVio/OGIjQF2Lkg7ddiEc60oFomg38EO/njUOL8+xN\r\n6Dac2wVTWQIgVeL91JHEDto46K618BlpFYcJNRsM3YDH+xwX760SSzs/W+q4\r\n/pcpsUkUYjHi2yLaqjmZd7/OQCpMTh1Sx6o=\r\n=I/uH\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221221162902-6d08baa.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/b43683955a56e4d65180262b0b64a607/graphql-hive-client-0.21.5-alpha-20221221162902-6d08baa.tgz","_integrity":"sha512-9NoBijL/bgZryOQlCFNpSJYSdDkBJS7Kk7Ap6qLvTzgkxVbTPf9ggRsDIx1FIKnHiiGpFnG/OSrOxYumfsvl3w==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221221162902-6d08baa_1671640177938_0.3351751288728282","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221221173857-d596ec3":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221221173857-d596ec3","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221221173857-d596ec3","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"e21ed94b69a7a95a950db15bd0b3601bd16d4740","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221221173857-d596ec3.tgz","fileCount":60,"integrity":"sha512-CM+YBRNVk/gYi8sROsywEjqXPTa0bR10gcBDBf6uy4MgUjuEjdRjJQ5244o2YAmQM6Nj93TbKc/EeffaVv5tvQ==","signatures":[{"sig":"MEQCIDfXu3G7kG/u3rAU+72g439YgoQU7TkfxPBTI/M8WmXsAiBypEKw+q6EKDPD1WZAHUoFrjx2yizTA33EdsO66itbkA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjo0TWACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrUEA//WlfGcwDoDLAsHQVM+Q9VZjavmj1iBZcJSKrbRo4f7ULESUzQ\r\nEeX0z6GghZ8iIcCFjesqy3ox8pcc2e9WZGMKDUPJHE1i5dUmhRQ0ZD5m9hzT\r\nUIdRrG5UVYdwIU/KwpDxXwBZfIIDkwtboRqQOhjMp9SvIVY7l4ycAgwP+VnU\r\nw5VDPvp9XWEkoFsG6g/mZ28Vp8CR6/S0MxeqWVZ4kwjSbk8ldVzAhEW+THmL\r\nAKluUNW7PowXYmFVqWJaL9C27ZivoCLTXzRgc4kPLesTVSFW0Zh9QYsGp8vP\r\nwUwzZOHpo/iCGBMTpeUgVkhI1FKe+Ty+Uo9BU429whX22ymwFV3gYmHcy7yK\r\n29/JhZS8BjlF+me7kUhnqc+ubgT7mLptB15KwRGyTvc3/MPMJ2boo/4css41\r\nFnlYxEn1vMoPC3/lXs0kkKHnpsmyCaxdXEGQOUZJRBRMeYBjq8n8Od+kAzAY\r\ndU9D9ZUbtFUJBayk4sU7RSgRV11uMOCMkkcXfYBF8/yCePYBecMUb/T+fQ/9\r\nGE3L09njwcjMeS7d9qjDGBLu2hQsYqitWFoq58a8pmVFqzIjSDpqh03bwZMW\r\nijk8Kun93+UT9HIRP2Y3g7CaH1kcEBcOckGXcGmL8XL+sciqh1QimmvAxca1\r\nRjWPPBC2XQjyHMmAezVpsUedGfXU+WwTQsA=\r\n=l9Dt\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221221173857-d596ec3.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/5375f8897bde8ee9f6bd80768df6c86e/graphql-hive-client-0.21.5-alpha-20221221173857-d596ec3.tgz","_integrity":"sha512-CM+YBRNVk/gYi8sROsywEjqXPTa0bR10gcBDBf6uy4MgUjuEjdRjJQ5244o2YAmQM6Nj93TbKc/EeffaVv5tvQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221221173857-d596ec3_1671644374144_0.7304001839715264","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221221183618-3856ed1":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221221183618-3856ed1","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221221183618-3856ed1","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"ef4c2a903faff5e7ded726ad81b42e9e40506a12","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221221183618-3856ed1.tgz","fileCount":60,"integrity":"sha512-xh0Kuxza/Cp26OdoeYT2dkC7B/GCyP8nMmb0njoaNkSjJvdgg0glGbVUX6ixhMYk8Aeeg/LTrNcTWeDvzyO9wA==","signatures":[{"sig":"MEQCIDSkmLuV9pVmUzCLQAUOb2zEl6Oi5yKMyyjZCy/oxunEAiBd6onoSdBA1nh6RHN55Z4aEp0hyVPhXOdcVnfGxGCv9w==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjo1JFACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrOYA//TgN6kqJUyWxNVoxkx/y9JljAVCQ6o7Wc//WJHdmbarVXvU85\r\nvHsxqtZB45oXb/+YdYHXIN9zx3YsQiSNaYHOWyOZVL3d9AmnfznWp2E9o0fm\r\nIIrkWldH7rAwXFHTBbdqCg9scWhqGMcOO4MxLgWkMWAGp49KUUpY7U0RrL0o\r\nNYEi482mTYJ9tZqwbrgIEL5qAlj+mEYBjhvjCVhaw9/joVdCoGdttvvybNrQ\r\n9AD4Nx/iSqLoU7NXadlDl0mdwP4hapHNp16vgYHiAsOceh48bWnO47IsM2Z4\r\nt1AY/Q11cvZZEDbCxEUo0NZQzzIz1AdMPvCBLEMLmRf00BE341uwvl1oMO/V\r\nn4lv2lRusn7A1q4at1mtKvdoqGd9d0P4hfpjTq1+d5dYsauqE0LiOZ+iOuhB\r\nqV93OzG1JBT9ch/cYLtjIl6gUJNnaPtwxTRLpTrvFdtHm0BjM9/tlWvWHKxp\r\n5XeUoh17F7BdKpy39svXlOMQPSBkVGLTkmcxr9v01MW016ChGQsWZ5n+24l4\r\n1M8YbZT5ZL4i2C4Wa+n3gTdAknTYAxxthWYHPvsq1kKI0b9fg2EGlPEg+Ktt\r\nojQgtVh/tMQ8jReTbQyTe7tOT7zg4S2K82yz4shuGMkHXWA4ALtIEKfto3xA\r\nlbQSqPVHG2cjMsvSuxevGRxJsGEaA+eW0Ac=\r\n=xmCc\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221221183618-3856ed1.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/b1b775bee5424ac95add1456acec2807/graphql-hive-client-0.21.5-alpha-20221221183618-3856ed1.tgz","_integrity":"sha512-xh0Kuxza/Cp26OdoeYT2dkC7B/GCyP8nMmb0njoaNkSjJvdgg0glGbVUX6ixhMYk8Aeeg/LTrNcTWeDvzyO9wA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221221183618-3856ed1_1671647813624_0.2698091745370419","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221221183941-dc6aeee":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221221183941-dc6aeee","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221221183941-dc6aeee","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"fe98237c0789711b864a0537958c67d0394d901d","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221221183941-dc6aeee.tgz","fileCount":60,"integrity":"sha512-81yE1FH+2YR+VaUX3lFWQt6Dkhf5loTinM/Kb8Qjb5PmecUfycHdIbXh/2LMLoBKWji1VqFsShO3Iq+pzLfqpg==","signatures":[{"sig":"MEYCIQDVBrVdXqNFA8MAb2nKCQ+hsaC/eJrCjbuRqTJTHQW3/QIhAM4OQ3LSGyh/0G+t0BRMSNp88oaffiayKaDIeOrZ3urd","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjo1MRACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmrqdg//T/VV9WJcGUq0hYoaC+nwc6RTsRVwKZYOI83EPpeIoF7vPpex\r\n7BfuFAShk4W2225ywWxONLMFGhoWbC27vnpZHrYzZrB8YgdDcT16Hk+wtr3i\r\n4El85AcqU2meVuAGIhwkp3BBzJWrKD6Urawaqmc8g0VTK9Ibbn3CbcCcB3IG\r\nV6dmCv1m+ReZl3qjUhgsiHyp38EbGwRaGVRWa+HD8WekyX89i8uOztzV2C/J\r\nJAODGlTaTHcDjahV7bhDFf5DERUXU8IGWOKkBGcCMuOi6wE+iW8ylq4SmToa\r\nhhItpQCZbMTapqcLu96/PGd+fmMxii/nY7jMXVB7Osc4t3MJ8jY5Le6mFr6L\r\nAMIHrcANdfrDrQJtvGbvVc6UekZYV87FAosd+krKBXHGHBEL8YmicSp0SQ9a\r\naLQsUoUgaPpmPF6sclZcqALOq8VxHAbh68/vArYrM87hwubQq3L8JwR/6hRw\r\nmssYS2Ykdq7Mr9nOPZpv1zvThXvYGatXCs/PO5RAHNnP8xunJ7T036TKrdAY\r\nRDGFUwTjy6BNQmctQb6TteFVkkBEDiEDp4lXO/W7NEuFdM47JnMuxpHiVRh7\r\n2IVvfMrqNVInuraLnHOZ6Uop7p3nmUT5ybMU1Nzf443Psw9P10JlNqaaQV5Y\r\nCRSJamnro1FuOTNIOQObJ+qhi15Txtk25SA=\r\n=83rV\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221221183941-dc6aeee.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/565ac653042e4c9e08b43c839d886b98/graphql-hive-client-0.21.5-alpha-20221221183941-dc6aeee.tgz","_integrity":"sha512-81yE1FH+2YR+VaUX3lFWQt6Dkhf5loTinM/Kb8Qjb5PmecUfycHdIbXh/2LMLoBKWji1VqFsShO3Iq+pzLfqpg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221221183941-dc6aeee_1671648016910_0.040629052585993364","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221221184012-35d6449":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221221184012-35d6449","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221221184012-35d6449","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"2fb7d6662c2ef53872aa2d294db6bad16b01bd00","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221221184012-35d6449.tgz","fileCount":60,"integrity":"sha512-k/euvU6Ly/IbJ0ypO7xWCJ4Yf7NoQ6rzPyKB+Mv/rrTcrCrG+OBuVoBUkESFRXgNtZAWsvjsdtkm8RTCSmqV9w==","signatures":[{"sig":"MEYCIQCkW8kIFr532vHdivuDHfg+d8yClByVsCHanQ3GF6ImnwIhAMHslLIBmC/h2wVC+NS6eYtFgC/efjVqahjAGexrqnlz","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjo1M6ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrkiA/8DbM4NTJJWiC1k10bi1V88hKkpKGhUnKxtWgi2vJsnbap5U8w\r\nkgjwy/TWm384b3Vngn6rAoCWsyg6g1SfYo71GTDcQRUWLNHVWWICtqxuYfJZ\r\nE+8a2bF4Xi5SRAeRVnmOBsAKVjZMulCyk42kjQweScffnrLeRWdBgpvatr2L\r\nnjlN5tDm7C8mU9Eq0Irfh8IupeZWzoKWrX8osYVvNgK7kQrp0nbDeH5kcRxD\r\nzE0L8l2S08TeKbWeuXL7Al91Ofh8lQNF42JrUVMZlYIaYY6hZZyxjL/Cj+78\r\nb4ILc1duR/U17m+BLs+S3LUlzlXUgD35dAzpqysxPXdtHDsrdwxDWL9z1wHb\r\nAV28Isu7iZpMwduyRsj0CrAXKS3TvbSYkKWlStNUqgGkdwcbtlAWvVooRzdL\r\nx2OCSqnV9wEZgHKZn3TXGvHQfgoBRTays+BuW5SP1S6C579d0LS7BkPp0UDz\r\nKrBZ/Oh8eQ0qFOvnAE08xUBVas1Owr4zwAzMpYdje4xhFc5htUCWuH1jpuLt\r\nzpWHAyQNl8ZgNABFDAIQC/CpUlO+UktgXjf3hcMcTvKTF55Ml4xa8IVC99sz\r\nvs5PtCyo40DXkynMQx1emjcslN+TFLnAkEu20zs47dxhT1MZWKaJIKRyMMLX\r\no7iavQD7MnN/5cd02xRwrJTWZ/GI8F0je+A=\r\n=9Brk\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221221184012-35d6449.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/eeb4539a2f7f2989efa0452528ed371b/graphql-hive-client-0.21.5-alpha-20221221184012-35d6449.tgz","_integrity":"sha512-k/euvU6Ly/IbJ0ypO7xWCJ4Yf7NoQ6rzPyKB+Mv/rrTcrCrG+OBuVoBUkESFRXgNtZAWsvjsdtkm8RTCSmqV9w==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221221184012-35d6449_1671648057980_0.8145446617872723","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221221184506-fb6de72":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221221184506-fb6de72","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221221184506-fb6de72","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"1deaa462971d433d34c9650b2f005bdbf993e4de","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221221184506-fb6de72.tgz","fileCount":60,"integrity":"sha512-rgvWD3AfRVgJV5U7tb/TttoYO2ROQPbHPKAoZBtVJTPwOcbpPpNRMKMkz0hvkP2K0AHBU/2N5gOvfMFY0Ldy6Q==","signatures":[{"sig":"MEQCICGSPGMy+XRnh8oUpGlNhjYjw/7eD0HblcyK+2R5sL2/AiBiBG0h7pfdwKg+4mNaDEN58zyoV6hfsfevkxEfsZxZjQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjo1RUACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmqp9g/+K8t4GK6qxbo9frLX3veLcgjsrWQJu2nY+Pfy7oQZDmuUQAsK\r\n22ykMS/4eMk38yc4DNu9Co1ZYyypvvnF1O0xaNDyRAUGMWsnoxQcjPRpWuKE\r\nOAbdyrHvPcL9ssWAX57bHJML//REMMnhvGBxA/lGgu9ITl++d9TitwlZ/uOK\r\n2mVpEj1y4DphI5jHf+1400gA3j0675Upi9x/yNxz1Kkv5tDmACDRMIvxsw7T\r\nNteW1wxvb8w48DQw+zxnPfJ+/qRUCzlk2nE2tGx3P/NAtvifbIVrlTAXiyt2\r\n6otahXiIZm+SbAMiIh/37MQMgWzCyxZrzh/wszxXygHIoZFs0FaWV49UhuYY\r\nAOLuKedJhNNDOetd/ptlD1j9/5Csv1nFXzkFmY+zsbAV+ELxpDts2b5NNoN7\r\nK1lBX8L3+mCkFoxvDcBtwPcZLsullalU9rlQKhif1BE5Uwq4YqLLZmZ0zs64\r\nGVln402nrYhB8Skk5zItNbhnoh9vdKguqkI3duw1n2IakAL/7H9ATROG/QYb\r\n5h0Jg83IuTupHZ9hI5/5RtUuLnoTdX/7XJgmrSicwJqCbrGITijroDx7SS+B\r\nHsWdxpqAmW8JAdSweyLGjK9FnJXgKoJudM5UbWmAgaaop1vUZb3Mg/gMjZ9F\r\nJsAsDDFRnuvbK/wSqRpnsXTxVRcOXrRK7fA=\r\n=VpX/\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221221184506-fb6de72.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/72cfe80ad716fc28bb08557a84571a6e/graphql-hive-client-0.21.5-alpha-20221221184506-fb6de72.tgz","_integrity":"sha512-rgvWD3AfRVgJV5U7tb/TttoYO2ROQPbHPKAoZBtVJTPwOcbpPpNRMKMkz0hvkP2K0AHBU/2N5gOvfMFY0Ldy6Q==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221221184506-fb6de72_1671648340439_0.2743437411408589","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221221185021-88eba6e":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221221185021-88eba6e","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221221185021-88eba6e","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"76ead847e095b950f6cd9bc780f8b01f5f6e46e7","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221221185021-88eba6e.tgz","fileCount":60,"integrity":"sha512-d02/WfqnHSigkNxrn5oe4zNynjRJJ3eSh8eVo30nMhkrANRByR97fC3ai3Zn4d8iHNKW7amEzqjAjmPKsHfHOA==","signatures":[{"sig":"MEUCIQCmoa3lyPBrNisus+sZd7BAC4pywip5DzWqWOrJjHS/tQIgQztJMqrE2pzPaIafZZ6cIZ64N/6DOvVTa2LxakpvcwA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjo1WPACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqvhA/+P7GkwpueVFrzkiirMqXJ1IGfHJe/ImD5m8LRg3hTP0djATbX\r\n7vynYb05oa8jGGBZHnZHy31wYwZ8bFxApxLE78GtIwdxk+7iur/8Ocrv2Gip\r\nyzirJAVxzaaNSXvlNvI3bEpX+s8F9tuPvla2O8SBljraujP+uk/6e3slxW2f\r\n70dYAAdfz9gmTtvpwn+ion2OUPvSV2CqhfzoZ/N1PCoC+i2gv9nqsTYL+We4\r\npRgOd7JiAUyGhEh0dw80byPO4yAefSOb80Ngw7Ba3Q114u1poxFAyI3NS/72\r\nei1aNP/uroTK8Rxn910qMVMoRDvzrGXr16lbLbOFhI4BN5ECXfpCr9mAeu5k\r\nloLyA1vLvYrhXB3tUw8WUrcw8CWNLdUVyDn20iY86QJrLffjBmESQbpJe+3z\r\nPIp4BXEAgcO2Y45AePkAvsCxuVfRMKwqJKBJ8McK0S5VKzZkmHH4/imOB2fQ\r\nGKkYH2gxDBLgKUBNKb2yWsc29TRkGbOV0Y95LxB4nSW5/MW7+sTUXf1zX5ur\r\nsumqM0sSCzKbYD19V8QPWvcethAP/VIwe9NUOALgI581g5xcPmkZ6hqYGlmP\r\ny4l3eQqyM26RUtHhEpCkYuOvRWuW0koCkcH2Wm5hybk0Q7I1eJ+ttrD/QTGi\r\n+Brm21uny++LBRFGg9B2W0q7esvy3oZsrH8=\r\n=nAK6\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221221185021-88eba6e.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/0f9bf1e62dd646d8767e1fd9140d825c/graphql-hive-client-0.21.5-alpha-20221221185021-88eba6e.tgz","_integrity":"sha512-d02/WfqnHSigkNxrn5oe4zNynjRJJ3eSh8eVo30nMhkrANRByR97fC3ai3Zn4d8iHNKW7amEzqjAjmPKsHfHOA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221221185021-88eba6e_1671648655073_0.8543317964162875","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221221185654-327304a":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221221185654-327304a","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221221185654-327304a","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"e7143882efb3d49a430a3def6d3a12e12a474288","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221221185654-327304a.tgz","fileCount":60,"integrity":"sha512-mmic8wMUCuWTJW3GRU7IvCBwqYmcPpwSYR2SCVuvMQAVxoapXLKCyRDLCbk/pClWf9bgIQ6es7Vc94/gLod6tw==","signatures":[{"sig":"MEQCID8tPi+wFFHkBqmz6aXLURj4olD2c6e1MmE6DnMWiIozAiBayTVNuIedyOKpRhj4pa9lYHiTKpLwLWTC2xJQAej50g==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjo1cXACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoIUw//ai/qLr06I/HnDjiaaywQk9FzrLNXiFfZSesebZvc0+hNe7QL\r\nq55kcx8khZHmDwEtfjpUWFuOfTd9u+QqIeWQIdwB5FSfz2sQ3e4WxGgDYt2Y\r\n8lPrzSR1fh6bBQxxO2ll7CDStKh/LP+s1BSStqV1pNgn3V8odfu/LO2Sv+cA\r\nUn1HiPEicz1aKYPGBEGnqAtU15SdHtmrF2VH4j49hOsRQ/orQEn2gHTB7Gf8\r\nTgugcJ1NsK/MhEhx3ttVP4b+iuuWRt4qyP3QMrltI1vt0jYOcJa/QSowJ2by\r\nXBUcjtl2iEZxy4HYRxhow3t8G04Yn5qEl/7uEIzDrQoLPsg956IKn4IxXiQL\r\nvUneJ1Pnr2uEVoSA1R2GsMHJLwVkXWn7SqrxNXcrZX0DYdso1uIlFlPx4FSn\r\n9UDwRn3l9EqvrMPdNF+wac9ablqOAK69wnyj7fgUwiBpUB6afn9OIX9RyNpk\r\nsdUya5X3/iq6I/FP39obS0pFGPK6jdO4KMe01n2Hyc9iynI2SxzV5iAtuxvj\r\nMGnfledoo5KD/x0gOFLOLsRU08rS0ZtAs1LB6x0ttgQK5JziKETwUF50yj1/\r\nFzF+4TtJEZKKY8BK7BIJcS9yScU6kNGGNlzU2z9VWx0Eoj1JYqgzpgqf4ZqM\r\nfyalfWgxrEPqZ5f1jWbA6H+oSDykDU8xU8Q=\r\n=zwxn\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221221185654-327304a.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/4a9946b16837f5c3cfe046955617c1c5/graphql-hive-client-0.21.5-alpha-20221221185654-327304a.tgz","_integrity":"sha512-mmic8wMUCuWTJW3GRU7IvCBwqYmcPpwSYR2SCVuvMQAVxoapXLKCyRDLCbk/pClWf9bgIQ6es7Vc94/gLod6tw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221221185654-327304a_1671649047758_0.2446010738795712","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221221190321-e289808":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221221190321-e289808","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221221190321-e289808","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"a825f38211d8319ba707c5835b5978d3ecbfa6fc","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221221190321-e289808.tgz","fileCount":60,"integrity":"sha512-TLwLCEEdsoj10Mcg6Jtnt+t/SCzJvwfGk39NmXonVUWNUX0hzMk0y8aVISYK8gZzDN6lYmpP/lVJUjeKvEE09Q==","signatures":[{"sig":"MEYCIQDbxIOMeAUGq0w3tvmm0+FV+wczWSWZqLcUpciu/jic5gIhAK06+l0NuefB1DA5N8PsG7Aem6vbAB8LG6DGGNphEkHd","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjo1ijACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrAXg//bNzQDBd/I38URFh92rbESrxLpF2NmQY6jDDQnob3i8tzDX0J\r\nWnwOJkOkjkkO2TyZ+kkHFr5GHHxNdyE4++WlTwHCkO6pYXeXBbC7hJVsbet5\r\nlwLNhQxG3kwSrWrEvUdioqJAzPj/ajWIE75WqlGNa7YGKVoBTx+eecpDqt7u\r\n5dM+OoTlxlGYDsVwXN2zMfQEawSK2aNCEjO47OaZrEPxiMBH4IZMKduVHqlw\r\n9RMTWgcxQ8wc+ic06zCUjV0TsVz+a4j+yHwfrD9ztmbz5LkYhGBbMLln8S8Q\r\nHbtopjcN2L/F0wrrpWIY3jwIUJxzjyR6L5KmLLZCkDLZommFnZix9sv8Ayya\r\nd5A1n3vWRYPg08MwTX1NUKaeU886wX6bbnHog60cj4Gpx/WpfUIMcoNKm9K0\r\nmFAXeKjdNQHJC8fBZxmEqvLySR5NFTZQkAmLC59+mzwp7Ti3bNUc1UcWul5i\r\n6ji5ym6BDfPlD9VBSUqlX7GlKjXuwKv9Oagq++rHEgO25awPDKqQTpndKZQ+\r\nkxIrGS06SNAnKEAySEqTNQcnz9os/UNImP96+RmEvbMEJLOzdtydnMVxMAsf\r\nd98WwoymNXWP0Fo342Rcy8hS1TNyeaE4NkNe7y3LsdH8JIMzCcCJDp5cEkvP\r\nluF6GbOHKXVjJmraDFMjkM4IpAk23ntoNco=\r\n=SOVi\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221221190321-e289808.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/86532df160a18af275c52dbd8f30bfc2/graphql-hive-client-0.21.5-alpha-20221221190321-e289808.tgz","_integrity":"sha512-TLwLCEEdsoj10Mcg6Jtnt+t/SCzJvwfGk39NmXonVUWNUX0hzMk0y8aVISYK8gZzDN6lYmpP/lVJUjeKvEE09Q==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221221190321-e289808_1671649443694_0.0018982427865239515","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221221190530-54f91ec":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221221190530-54f91ec","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221221190530-54f91ec","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"c14f1787bbc3a5d14160b72f2a5f685d4ec85520","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221221190530-54f91ec.tgz","fileCount":60,"integrity":"sha512-5b+bwMW+0alB1hYazWqTb1hV6J+f+NyGE+tFIcoMZE71o4EdHw2KUW9BcMOhFhvx7ehpPlxzylkNN7JKxSn1eg==","signatures":[{"sig":"MEUCIQC/RqxYng3N442UqyuvwO9KcVJ6ZJ91jymtVi5n2EOllQIgZ4fAB3YLcFz5nVRVl6Yas2TbMCyCIT6rIQ4eZGxUhj8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjo1kfACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmq0sg/+Ls36CVltuvfhX5E/Re4k3xxYE7zpqtl/xPooaKMtTO6dltrT\r\nNo6+VC5buBtSRxrAxmxMWHB5orueMSACxO3L6ipc8eeGKVP1I2pdUcuy5Y7d\r\nCxmhmBuZ01nLixSLkbhqWaqUPL4W/4TJs6xtFrLVlzjodeod+pnViPeeB9Et\r\nLEgm7jSwQ/A+SwDewbHVkWqobi/CbcBKq3weiy9PjgSqbVE1Yh0FkjG2l607\r\nPYECi9rghJafEuRZl2okshzmNzbVHm7vhlkJcOVtS2No9Wb1tGxOsHniSOK5\r\nougTM16F6tFu3YcqUXMBdQj8V2FCrLyDiKEM7pAhXePV0Xt/yCYaHRuqiMuU\r\nVi6H6T1TtLFtaQnRqG4GvMwfcSmEewemH5A8/kffj9v0BALNCLW73tNoW6lz\r\nwpjqn+LpbYXgQa3XkPv6b5nLl4ghlhFsk7S4FZJ+TlT0Ry+1FfRwLU83g2WE\r\nlKAP+gOdfVKb9uXPZjqmZlX3T+PwUwQyZHyu7SdThs8JxUJifyaOKl807DFl\r\nWtWzdpmYZSwCUj76MP+OAwsXZjFU586Yk10zYtY666Tp9wXb4bJ7rnOUjOcw\r\nHjSR6HG9x99T7mSuaF/0pMBDwRXA3oleKa7VvtwlrBT4+ognht/zkfKYZ/kw\r\n4FbjOKBjlHcKIeKWDAhgK1RhTSEbnoj7bhg=\r\n=7vKV\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221221190530-54f91ec.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/2bb37d76d1c4c1fe9a144de7965f39e1/graphql-hive-client-0.21.5-alpha-20221221190530-54f91ec.tgz","_integrity":"sha512-5b+bwMW+0alB1hYazWqTb1hV6J+f+NyGE+tFIcoMZE71o4EdHw2KUW9BcMOhFhvx7ehpPlxzylkNN7JKxSn1eg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221221190530-54f91ec_1671649566879_0.8004332151910358","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221221191038-31bb04c":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221221191038-31bb04c","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221221191038-31bb04c","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"bf576c1e2b5c3319d1823c0d06824071c068ed4c","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221221191038-31bb04c.tgz","fileCount":60,"integrity":"sha512-ue+VYiYoTJJ6kr1Z40hzULZtmz47CnLZCemvCB52Pmi+1w6HNvWFeX6baKqB6mjhsn6o6rSuYxAxZl/Ovs4j5A==","signatures":[{"sig":"MEUCIQDwqbw+f4YYrhvylyHzAm5n2AblegDOlTVfVRFi45oV3QIgf7szmCJqQYplmwx4c2382+puCvz1TQcx3ZDpUR8S92c=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjo1pQACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoaJA/+Ju9FZR6WKZPrOOKGAazloWVH1YeOqskJoKqcocvu5QjYz0mP\r\nB0Nf4BJIDlHmyNH3LEz3ARG+ioHZHRkCbkWVBq3ZzPdYOnL0nP4z2jlBpx6/\r\nHV6J7HuxlJcvs6DRRcF4mUyl/iDXQXVZk0cs/JBcYABZ+VA7PQMQIx35+mY/\r\nN8aGGvDgLyinetarusKV/kzGRGhvxH5Dt6kUkcLZ2pKEoMaV1e1nan+pPnzr\r\nqd2J0h7NVXQP+FAf6Q9bILBcSPhK3gxeYTcymhvFTzKPoRT2koSi0nogX1vX\r\nVBulwVg4xu31SHAwrFwkFMDXnqNDdiZyYU8h+5AUS/YkRagdS+hWyU7wuLZw\r\n/czUroh2+rDZkMf9Z4PN8LRk6HBu6vMx7WQhyY/+T0whulUowMyGm84bsmGD\r\n8TX39l8oqGl+E2bEOdqiH+A4lkyNli9bWi+sLwDXfRtiSIQLHk97CRz+xqHT\r\nRO/S2wPrMzo9Rz0qpovxzklc+gTEPXURYzSIZIylVN/uKuQf5MCqkCAUxAtP\r\nYQyYQHRM98bRRCpQvdZk2fBE5yu0i1WdKuVcTJA9WlLo3tHOHaoU7r2ckkoH\r\nv1LFHY7N/51ab++LuMBTD09XO/ANQo+ZjoWeyu8nu79ifqJZd/sFZo0kYxS7\r\nix5fpJqPhou/UXTeHxN5PqidykW9vcjiZRg=\r\n=0a73\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221221191038-31bb04c.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/a8ea2b3a318f927c4f3a61081d6b14be/graphql-hive-client-0.21.5-alpha-20221221191038-31bb04c.tgz","_integrity":"sha512-ue+VYiYoTJJ6kr1Z40hzULZtmz47CnLZCemvCB52Pmi+1w6HNvWFeX6baKqB6mjhsn6o6rSuYxAxZl/Ovs4j5A==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221221191038-31bb04c_1671649872097_0.12177768624706098","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221221191551-4136d2e":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221221191551-4136d2e","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221221191551-4136d2e","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"3ad17eb7818fc3111b843565965bd17fa0fc0e08","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221221191551-4136d2e.tgz","fileCount":60,"integrity":"sha512-/kVlwcS23XSlGRfZHbYnfHpTNz4/HltjlEhgRiPHh81HDlTlTZxtf180MHAujiPZkE3VJdQXjvddalRF7lVNtg==","signatures":[{"sig":"MEUCIFcKeUJCGo2sJX2VQ2GVVJKn5G5LhWBo+/dvnpj0XrqDAiEAhBBU4IanrFgHT2g/lTOV1vIxVv2nTR1tBa7+SAop4BI=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjo1uKACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmplAg/9FYpZFHaq1EafQh6znfbdxjBNaMmiwNorteI6+kt6iEWRHAYZ\r\n8KeezxnevvmcGqa20egHRtsXBHSifo6H0clwihhmRVHMb0u8puVaGwZ5soI7\r\neJKHgyJ87AU7mYRN0Y6h900gC/pAKORp0KQIfJF02LrNAho75MAL3Vaf/r80\r\nsNPp7Mf7YX3VQ+T5dFA/JNpyg4cIjB3LMNtcICcS2VgNIU5VvzPyD1ssL7OU\r\nIFIfTPUEitEz8XgptvHNvU6UfpPl+irjFvrOkRcOEBEHuUbsecHBj8CSp1UO\r\n06AfMVZbuednHmGDwMu+AfAPdq3KMVSQWWjrd48sHqHaxRCuoTpmT9E0xXzm\r\ncP/afLiqHEC4J5ovCHZf+fcGEcDv770WLTyDuuq8NMBIW6ld2sZnaxHn/R3l\r\nh1cQNKx0atkDHnzTgeqRNzWKzy8QgSbuVvSYaWSSIoeVDqOCw86bZ5FDbIcu\r\nK/pmMH7qXjJFFAoPSBSVvnYeAvI4QDuA9TA1u3W+zCn8+cz21zQmeHHT4aB8\r\nebJsgrW1j5EluoYo5iwCIdYiCz9ralviIBxoaiYOsbKkJWxbw4zk2PIAPbOs\r\nPDyts49cc6KcaqroT5+iNA0Cg1cFGycWXSs3O2CZv3zD7wKnfouhiZmvsBMf\r\nQ0Kl1f9OmCErTV2YKPBc99VmMtp0YQoEB1U=\r\n=l5O/\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221221191551-4136d2e.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/a4e3e17949e6f86da972a39ed6f4ab65/graphql-hive-client-0.21.5-alpha-20221221191551-4136d2e.tgz","_integrity":"sha512-/kVlwcS23XSlGRfZHbYnfHpTNz4/HltjlEhgRiPHh81HDlTlTZxtf180MHAujiPZkE3VJdQXjvddalRF7lVNtg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221221191551-4136d2e_1671650185821_0.4036865605013822","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221221191843-e4e82ab":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221221191843-e4e82ab","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221221191843-e4e82ab","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"3c6fd9e20b49fbe00ad19059dd2255bf7175df83","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221221191843-e4e82ab.tgz","fileCount":60,"integrity":"sha512-88pzJe7vC4l/sqecTGP3t4TlsDWo+NlxMScW5Jciu/nHDYAtfrX0stYT0iI860WaLJz7wBYHJ1n2qmZEp1M0Iw==","signatures":[{"sig":"MEQCIAT8RbKkPo08CGiqmNUAs1Yz9a1/5bC+9qMohotjjx0/AiAUpqC7rUCCCRgBTHPtGYjapG+lbMtoLCUPOlKpneGhtQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjo1w2ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpEFg//eyYhBdlEdRp81gPHWpIPoyRJajGoVNsd24HPxhCeYnVEIz14\r\nBKW2xX6dGim67QY3iNSp3nFRss5Apidjg2a+95Vy6uJtRD4X9IhZ+RqU6oZ1\r\n2pZ38ftr2neNGmVft0nKLpiU6wGelRX5H39TQL2b6dOW4OcxgSk6nGcoDVh7\r\npwDAuce6mfzKPNXA8kmv5ZktuUEYKk+Ia8QFZ0n9qsx6BHI6h9U47DGUydWr\r\nBKNhdp+Fh4vAXWFisEAA0dSLklVn8KNGVKjwJVTUsWHlCfVoCYObOykl3CZI\r\nrMzP6hkVXIsyPMdINWP8N25WJVYgqMNW2DdpKnGZE/Gnl39rnittjbgWUszK\r\njZoA3J1Uolr0mkheBPyMMrFrq4lpfg3M+IW+TQgL/HzXvusrwUtfuKE87jcb\r\nsK9sODhfthrSv+s6XzkF83dZXjAKKhMvv/kfF0T8fUrNyyar48AOxlkrQDZx\r\nTmQWlnJZmzFsgLa5f/Pa68fdSEBb1j2H2sRp/AB7l9ifxC8vg4jsE6FD2jOB\r\nfSKQtdXLU+JP68f3ndK1vSuqjl0mNDKKD9vYxefeyQMybbhBDnN9jjUyVyiP\r\n2a68vgb2kUXyaBqGLM38hnoMIYRFeOINS8CUf0rV860YDM/3p7qVTaYbHD+1\r\n5Qxlmc9RncteXtF4zP24Xz0oXVkEtDMViXo=\r\n=p9Ch\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221221191843-e4e82ab.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/cce8e1f26de6e9444c7862d84a4bd80a/graphql-hive-client-0.21.5-alpha-20221221191843-e4e82ab.tgz","_integrity":"sha512-88pzJe7vC4l/sqecTGP3t4TlsDWo+NlxMScW5Jciu/nHDYAtfrX0stYT0iI860WaLJz7wBYHJ1n2qmZEp1M0Iw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221221191843-e4e82ab_1671650358183_0.9117378046821225","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221221191848-0f3a610":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221221191848-0f3a610","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221221191848-0f3a610","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"0c6bc6e82494da24def3643f163afe356fcc2801","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221221191848-0f3a610.tgz","fileCount":60,"integrity":"sha512-+CaZRdyCsPsdo69UgUx6GKpe/0krkg0lB1HIvEmuSTOVwoKImAm6bvzmKVVSJ3HHywgMYWUL7MvbPK3/K4N8hg==","signatures":[{"sig":"MEUCIHymI00qxMVDKxgtSjVzDDr1Wx/r7NAFSPEcWKU/I6IJAiEAi6LAWlSWjRNGAmGMyHS5BhjsdqWbay3PuUTxSJZ0GCw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjo1w8ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpPcg/+IZAmi7lS9aACj98hk7cNVOr3ddA8Diql/9fR3wevoNHODq99\r\nlX4LkeN/6pF9yH/iuHDSh7yIm19VuP8KNKwjHniiyyEB5uhpk5kgdLcquUl1\r\npIOajMGI5BrgkwOhUiOmAaWTKMN0J5huJR+tbXQBIejeMBGfwGyIOeDb2LQe\r\n3yuFmALN01UGCQY7Yg387ljsj6zdnfUvfK1jI6bovS7jC+oOZ1Z+DYUUoPHh\r\ndhOYG4oonyaNsLp5jszqi450AMwMkRqr124EmImPSls5hhlL4Rxh3JouHtcj\r\niMi0NFWWhsnhCbcE6LwNyZrnPncaaPyOFyDXi9uk7u921vzu+B2wHX0Ym7AX\r\n2i7BZFckGRoF2PPKku4/2pInWi5PMe7oplOD2NTrK8NOuzkvF7Ru5gUGNEAn\r\nS4PFA4SxeSUwQWGfj19H81yV0b6vMCuHfIlOTzfV79xw18s1wDi5DMISqdFt\r\nFHh2Hc5GnLix5hOkj0ac/yjNSgIHDRyqCiS2qxoFezHnQXsmTiPxEU6pxOPN\r\n85d1CL3qVPtTeZkmIE9dnteNLXK6/lvaCpIH+vWQJODwMnnmVW6wQy+IV3Z0\r\nCZLE5nEPLxcZD0I4GjRzYGLVO13COKG4eaUqPtvsOl+YDSID9SRm29M81jpS\r\nSAteqBeVwxZBkbPguL64ETUdBHE1iAu5z78=\r\n=Ql86\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221221191848-0f3a610.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/346d26049853cd1f7a0c5cca51ba77aa/graphql-hive-client-0.21.5-alpha-20221221191848-0f3a610.tgz","_integrity":"sha512-+CaZRdyCsPsdo69UgUx6GKpe/0krkg0lB1HIvEmuSTOVwoKImAm6bvzmKVVSJ3HHywgMYWUL7MvbPK3/K4N8hg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221221191848-0f3a610_1671650364266_0.4774229202911837","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221221192421-71e32fc":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221221192421-71e32fc","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221221192421-71e32fc","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"23c9471ac4c433a047e99c30c1d205435846fe38","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221221192421-71e32fc.tgz","fileCount":60,"integrity":"sha512-2S3CCkQncWpWeT5zgTYGKIWGDTw29aJmQ7lGmUU+CB+vRFdqdP4sLM2u08DDs4Mk4jhWtQ5IpVhtVEPVt2buhA==","signatures":[{"sig":"MEUCIGQ2GG6X5Qahf429z0GOOVdvJcgp76igS09zJCxRxBCIAiEA6+SVYsKecEMRyPiLXDPF1VJSOU9Gw1sat0ynpO/uPEA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjo12NACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmojJQ/6AjrFxcBmv3nRGPWaHK79DMOv7PmEh9PrF81g0rfyy7AmS0fT\r\nR6XEyPjL59n79SwSogfBAkRjNApArghYgP0/eQnunslCIcQtCJMv7h7cPUTE\r\nuKhQPK3NKd/DzsYIJLvcbFnUkuhPLJ7iqX7odjWhMFlNApm3hQMpCca2Mm5L\r\n7xvGbZajHOBrfe0oaEHsqpjt9MNYm4r06KTsZHHU2kbqDuD7xtEiH33zteYS\r\nDYu7XQ2L4uB+jImMkZpIlbb5QhKnYdvBp/P77l341MkRy3gHyPz+CluZ3FYC\r\nWneRjzNzoAMEZfLZF5OLoNWeVP3qkTi9xIq1jHNtcW4ssdAMNb8h0+OXa1Xz\r\n2P7xFvlGWHZTJJju7qoYrSMbDe4G192OYQkwrs/S5AMgxyGLe51HudGEeoio\r\nfeVmcKE8wOQvLClI9B6/mYN/n79rDMzJosmTt8vBXhoYVbFIzkt3DdM57bxz\r\n+krUzpqAmMLhXm5l353XvWPxqHDfooFIG73o5eScQKsJMxMePSYkodg9Li3P\r\nDiZqPvHnhHolwRGkSUvWG/dxljOIa/YBaoqqWc8L8RtayXrq0tJhZOx7ucMV\r\n62PYGBca3CdKBdhsbjBMVK/k8AZyFQ8OhQa8F4uoEDK3MRrUrjv6AcFX0DfS\r\nRUogTgdCUyFOgRCtR1HkDtbU6UQ4UN6vRBQ=\r\n=vTXs\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221221192421-71e32fc.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/6f5c71ab3eaadcf8f6c0a2e2cb01a00c/graphql-hive-client-0.21.5-alpha-20221221192421-71e32fc.tgz","_integrity":"sha512-2S3CCkQncWpWeT5zgTYGKIWGDTw29aJmQ7lGmUU+CB+vRFdqdP4sLM2u08DDs4Mk4jhWtQ5IpVhtVEPVt2buhA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221221192421-71e32fc_1671650701242_0.08067067112226955","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221221192927-e8a12eb":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221221192927-e8a12eb","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221221192927-e8a12eb","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"92f567086b36820d8c94540fb132a66edf1f60fd","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221221192927-e8a12eb.tgz","fileCount":60,"integrity":"sha512-pEOA0zrJaavqHuIsOUgb4GtLLSQ1Oq+f84H5h/l3lN5GTxgmrXgNE7ZkYMP+kk+DxXVFAElgD3YQGWH86qqtvA==","signatures":[{"sig":"MEQCIEn8JiksNTMxTD8gVNIr5k8JgTKtm+weSqXijb7r5M9wAiB6XBPgNXtA99RWLFMLosBUTY0UD6iQp1vVUoNI2i3Mlg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjo16+ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoH4g//fh98KZWtkdyMnjjp1OCroava1S4VbLXUYZAfVq2GoxlibREj\r\nBVcNWBJVtWCLXIi5mzOixHypmKXGVdRahSFLI94QODZ8vMRrrVBApIyuFlAO\r\nA1wy7InupwY+wirnEprWl0VMSeQ0Z/DvqNXcSrap9U9f7d913vMionvY25mO\r\ncWl2UGLnc6b1bP7jpvrEw/jjJMVKZS5/waYrovBwQnNWxltVIxO2J6vygbOh\r\n/k9lIIHU2wPhCVMriAn7JjEspwgOI5Wbp3W1KZ5iOBrjmyrBaNtflMfxkjJ4\r\nBDQ70jcx/1VBgE5IzhV3qyYbUeUj2UdVPEffYxe7urhKa4mZVNyAd8ypEcsS\r\ngnbe7LkVowlfILAUXt8RFBCdKL2n2tsOuLsDAK0PEOSwbujCc4n/dcn0zG1V\r\n+TcZdS73cj8X+BRde39AC7bRpIGRjciC8CtPqyvWRDpzXwW9JHSykTJCNMnX\r\nNiywWSfAqN7fcVjNQoELxe5bc9G68tyvncsil4dJyAPlqbMYzmIhYL4YKApB\r\nYdGGzwnRE0k3JWTzHTQaWl3ti+KgItm33PRrsfjyQuvzSgfyw+RzelnfRf8X\r\nNayvqHVhWQWGUMK7z4uRSgM9UajH/9lL6kNwDFlHBl+Fiz76JvZuZOIRw+Sf\r\ncRbTiJM/rEipmleBfMsxxQwWRWbk9uBZCcs=\r\n=e7ij\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221221192927-e8a12eb.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/5d1565ab28c948db95fbe97112c4b552/graphql-hive-client-0.21.5-alpha-20221221192927-e8a12eb.tgz","_integrity":"sha512-pEOA0zrJaavqHuIsOUgb4GtLLSQ1Oq+f84H5h/l3lN5GTxgmrXgNE7ZkYMP+kk+DxXVFAElgD3YQGWH86qqtvA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221221192927-e8a12eb_1671651005955_0.26158382322625817","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221221193950-fd8d3d6":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221221193950-fd8d3d6","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221221193950-fd8d3d6","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"0531e6bd579761611fa3f0daea7866a9febc41ce","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221221193950-fd8d3d6.tgz","fileCount":60,"integrity":"sha512-xdiS0K8KoBAUu+P/qnz9zDPZRTN3ncR5pfm/y/ePMto3wN06S6cySyUcJEBXPyNHtN4ty6im7ovUsCtSfZkZcQ==","signatures":[{"sig":"MEUCIQD/shVV0A0+IXZmSzPB8zE10i/KFg3odY28PO7wGsebtAIgaseCFjWHGbxT3eWzIRzLxMFpcTvPusTtd2lhpTgKBuA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjo2EoACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpB5hAAlYJm6+zu00y9gsAFc/ibN8nX3L5TpsYnmmvxNfsH7PK32UA/\r\nx/dEms1ryCy1xWW+H5vk7OJ1DLaPqRGDEF5/UuXKIkA8A5RdWKK8q2O9v7E8\r\n7PoS1LlTYFzbixOHRXdnsut8pK5XAGi7mnGsW5Ya0OTpTUK6EgnxyTPLzxB2\r\ntztSG7KcrodFSdWbM2tOFqirriHkMhbYCy7HCjEXqiNFNyb9NdJlJB7I3o2Y\r\nEVgYDaJTFveLSMCL9lzLvBqKUFzwbYIsEHijoVqCclVWmhpXIeIYZKvI9Wd1\r\nPAkhHg5CTpe3OBaHWRnijmOLlt96PwuSIOR8JeplsqdW2RuFFBLYpSZeEYeX\r\n3RW+7pKVEIU/VBCNlM2kKBRYJ50noqu+7oPz6llHOZqEehRtuSHM3oaQQ6qb\r\n6fpWUQdXK6ZD9n3NV3jgihcTuEhgfkonjlNFuoJ71CROXO/utNDol8RqHSOP\r\n0DAVNt6lhf5eIHNRPGWe3MybzGJbyEqYlolpVilSNjoY5a4FBQnEJC1JJrOX\r\nNr7Yfogn7VzccRKLfdJyTtlDT/8QWuzoHA97ONDoSf/jqCoA4dLNWVls/Id3\r\nm6O85Dxcq09pm9nczwQnS++5e0MMWxsNMyPSw8zoGeBntYoaDosjlxynIesn\r\nYfwgALpa0vvmS/mmY80t+TQOF59u7YEHvaE=\r\n=P97f\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221221193950-fd8d3d6.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/fdbf83abac1687eb941e11f15e777e50/graphql-hive-client-0.21.5-alpha-20221221193950-fd8d3d6.tgz","_integrity":"sha512-xdiS0K8KoBAUu+P/qnz9zDPZRTN3ncR5pfm/y/ePMto3wN06S6cySyUcJEBXPyNHtN4ty6im7ovUsCtSfZkZcQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221221193950-fd8d3d6_1671651624133_0.0574865672615692","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221221194501-446e963":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221221194501-446e963","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221221194501-446e963","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"d87cc0c2eef134f517efbe456183d8c596389b77","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221221194501-446e963.tgz","fileCount":60,"integrity":"sha512-bVreUPD2qwsU0d6MHJtfhpZRzT+GdE9H/+nvazS3FA2oymTo0MAtN9xBGOjxFQk2+ZjVrczmg98AoUdX1Yhbjg==","signatures":[{"sig":"MEQCIAQV9r7nfV7jK/2Sx1mqdDk8Ez8p3xMb3VkEHm5jv4LnAiBM2LjGXB7dWB+PXhlbDAbdDga8ssVSiZzA5b5Te5AqgQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjo2JgACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoT0w//WhZ/LYuf8IOL9M7AEwkhY0uvwgNOIyWwWr9FS/vKcbS85ucK\r\nNvDxfiobOZhytME7R8BiESZrhc7DEbrxO+Ua3BD2mSRV6RH8a+/N4SursoqS\r\njKPoOh9ZOCFWvGicU4Ncp7LScTo+CPt0xGXtqOGWaOYkDfVR0J953Wct+spQ\r\n6SZIC9KDoRun4ZX9JcNKoN804v5Q25ozDd/pHzx47w6v/lvnZFgxg4LgMOET\r\nqdGFUoY++iZzP4ghc/n5DE3uSKzTWZndyEebRxa+Mqjxd/Ia/EeNTBjfjRgD\r\nBv5+1RwU7Uhv1PuccltB9DHRHsMnZIe2P6UkoJYymOVSCbL23Ilj+fVCNI9Z\r\nPr1ZcOW4OJmEQ61ybH3hT3IPsYNA6dOO0xjHDsyn09u2gBXjP565L6HVRIE8\r\nyKSl8moKL965LlC/qgHrzX0vXKNAOJK3ujeAdzhESTihe70y/799OuzR/z7m\r\nc+qbYxOky1S6jV5yMYSMzvMEzp3bHknENuiSdoktBIbJCig1ftGVIbl9YTMB\r\nJEdAi0euqJXh7k2a85ZnunPAYsjKYI6fMNsZabCDHEYJhUt0m9v8e46pXKve\r\nKJnGLxRQHxT7fa4v28JpP/+LGYOykg5tHmWOZ5TeyD5mywEu3gzdIgu/IU7S\r\nOekGEMLbV9WVyUlpY2LQycCDxm5rIjBQH90=\r\n=iGvy\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221221194501-446e963.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/23d72c7a6c47f945cf281632dda02e3a/graphql-hive-client-0.21.5-alpha-20221221194501-446e963.tgz","_integrity":"sha512-bVreUPD2qwsU0d6MHJtfhpZRzT+GdE9H/+nvazS3FA2oymTo0MAtN9xBGOjxFQk2+ZjVrczmg98AoUdX1Yhbjg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221221194501-446e963_1671651936769_0.7974192373682136","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221221195016-ca99e63":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221221195016-ca99e63","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221221195016-ca99e63","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"e2eb596edd875e8ee9af14e1d5d9b9d535b56e05","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221221195016-ca99e63.tgz","fileCount":60,"integrity":"sha512-0HKD2rE3JlLxVhw5Ch2N83BlqFmHKAN+qBL0n7dFouklxMEIpLrgKa5BQYZzCkDEn9U4RFPuQm4JdCrZYUupPw==","signatures":[{"sig":"MEQCIGlvoUaT7jGVSdHBMp5VVYN6z+oKtZVRPMSDbxtw8W7XAiAQ8XUOgstlnlStHfvAUgbYH28W8+9CDZEOVIe7lDPWLw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjo2OeACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpWdxAAi31t5WqtMoQ62567nmGQPD8m7+8hKYToceJDm9TlnQPa/MQA\r\nx25GYcTI6xVGcfs6A1I7SudxZg5u9H8Tg7ihVzK55amm99b1S7U0U+eNYpN6\r\nEdO5qp8hR/j5LUPwZRcbjoJDI6Ghtmt879tRbad5ZklTN4V1k+fzTnvP1cBM\r\nrPYTZ30wRkMQKcMiKUzMDIcs4aWEqtoCtrzrWqqK0zyRi/2HaPGFdCgC95R5\r\nH6+kREJC9bG/D/g1iGGSlYqvlqH7Rm/ko3miMUYT4V/0Y9MfS6VO3CNq3taz\r\nmUvcLOLYtnlB3WV5lcStt17TDIGCvYYCBssxr7/OPg8CSzpzOWDrCp7LMReh\r\nr/OlhS2SQRJ1XHJOMvTDGUDQHytQJyr4BQ7p06zEr8lgLeouxx5vkm1VM/E/\r\n9MVxb5lJfZIO4Bg+oTnqZ4yQfOzehSUlV2SIj3imozgpUrMi2UzsP3HV3yU3\r\nn3cU2M8k1G5Jo0h8mMTWlVnTW2Rbyk0HCwY0tFPZxWxcd4FmK2TwLh175uK1\r\n4rvc1HTa7dKnzcocYooHqUnJhQHimNZC1NpP1WgrezfTFpqYi76h8qshK2XC\r\nce6/8xDq9cJ+/fkKbFDH79wXZ5sJo2iUk+PfSH70VD3OccJA0G9RIwnIbwvM\r\niZ8U6GKWMlvUYG3GaOKSRO0NkzlRflTD9aA=\r\n=St9A\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221221195016-ca99e63.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/178700b1dac40d93d9f21b7fcb039340/graphql-hive-client-0.21.5-alpha-20221221195016-ca99e63.tgz","_integrity":"sha512-0HKD2rE3JlLxVhw5Ch2N83BlqFmHKAN+qBL0n7dFouklxMEIpLrgKa5BQYZzCkDEn9U4RFPuQm4JdCrZYUupPw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221221195016-ca99e63_1671652253871_0.23303339612164753","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221221195207-46727d7":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221221195207-46727d7","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221221195207-46727d7","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"19d0705e1ccab19a7a7c448a93cd85b508f6d3f5","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221221195207-46727d7.tgz","fileCount":60,"integrity":"sha512-nBhimlwpoYuDr0NlFxshN9qvX/j0Qdiu9/Nd31Ximdl3omIAH2IcQALK4iLBTdcAF2VcB6kxaGLhvLNhHDWbqw==","signatures":[{"sig":"MEQCIEpyYjoIWPVXzpuzC9GYaZ45LrGh20RWIuNuo0xSjD/pAiAmefVwZ+AdX9/UTVipvvpGQnz5kqbMZxVj1xm15OLKvQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjo2QJACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqEjxAAilnqL2xlrKDOAws0ggvKM+L4ny6eqmPK1qx5yr9GpsnN87TF\r\n2nhzJWC0I98xNK0ibCjKuJGXb4EtUrOD6la/WlGkFR3vfuOiELV7Uimt0fzX\r\nGkS+9LV0T9WqZ3cOY9e2PIEv3KyT/A/TNE76aekHi40EuxxuKvszhtXVTb70\r\nsia5hF1KJfRIBHfc7AWc63G0P9fyuQMsVwlf9ZXeE6eRyf7fdYHc+5BD5gDj\r\nE/ot/cxDo6nthmfpGzXM/XpbQH1PeYUzVZpjhPofgyQEeWYdH4Q2O9rG0jL3\r\n/ROL2PhBGQ90rULzSfnUbxJemwLhh8BeDTFm1YYCE03Kx7jZimWnmC+BPbnx\r\n9+XWhSRc5alB8dHY37XwaOxTZW4YAI4ov+z2armoafIiFvX2GVpy5rCVaRgR\r\n6JzULZfTWNt2j7KRn4gAzMSsX1HpELQRdrbeAf7GIuFUgtZ6ys+3X7aiVzev\r\n7QWLpIYrFxk8VV9HkE1Eamt/vA++yKCWgyP5Hk9MCXU0Yll1EzttwlfFBrMs\r\nZpQYia27StResDQhct7dksYgYs9ReKNEGh+bgRcTAyYfRcGcbScb1ZmOaiqJ\r\nBNWW1iFIRhPWCTbaAELxWXxEm625tV7L4mhUYxY3rsdDf9ThoDFAztNIqqAN\r\nns1wYLAJ0oUE+t/WEzFstzoocgFQ+XDnZ4I=\r\n=b8es\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221221195207-46727d7.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/b5252249f62641a6f00b4b3fa3672a31/graphql-hive-client-0.21.5-alpha-20221221195207-46727d7.tgz","_integrity":"sha512-nBhimlwpoYuDr0NlFxshN9qvX/j0Qdiu9/Nd31Ximdl3omIAH2IcQALK4iLBTdcAF2VcB6kxaGLhvLNhHDWbqw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221221195207-46727d7_1671652361502_0.5955351778936226","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221221230406-3b89db8":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221221230406-3b89db8","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221221230406-3b89db8","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"bd25f2e122973c1f639faa87c8f4234b83e16e28","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221221230406-3b89db8.tgz","fileCount":60,"integrity":"sha512-SuVID1YDKt1bipiUhOptUW6e6enIkObbY0e2WGBUihKhGxnDbh4l5cwr3TibVxFaSkGSUAN6ujhL7dJCq33TTw==","signatures":[{"sig":"MEYCIQDTppk6Z9qcW+TNIxi1rgGlZV/SyW4WHK331Cu62osoMwIhAKkRB0Iu075QZGKF+0YZta14XmAR+ZJcILP8rwwcffRp","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjo5EIACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoM7A//UPHQRqjdaSQmRH7URK7vB1c5a0oXt0iS5DjwpXK/hyfrs8Dp\r\noFUJsb3rBbMaXGMmsrIJ19XFvTJ17RjbqaF/DQQvby8aWljfNJAqPX0T2H2W\r\n9BRCwdo7rSLZwwcGlojZPwmuHfmk2nZ/HmIIXWgXhkz3mb484z2vEOfsLrsn\r\nh5EZh0kJk4hb+R7aj7qHl3xtWd8UeRTSqrPASiRSTVZhGhETtIf+X+47klvr\r\nlRvZhx6cS0Sa+HNFR7PXmWxqsaE+nCPJ7o9afIQGnMAcxudJuFNCMkWBArLS\r\nmhEr4w51Q8fQWH/1AhlOKzGQc3RP4S9+Bj8trVklgjhq2TDr91i1j86CP7x3\r\nuhJ0DyMnTH0ro2qMLD7sF8hXELjZHq1lhrAhLjeUpW+0FRoJof4192lROrtz\r\nVA96JNEWAV+Pwa5pJU2KBRZiX0+OZ36qhvydhdTEK+TsZiDg9So/w8xTqQXu\r\nQTOif2VepOG97cnkNcU8adSQ49i4/HZ11v5U6KciCO7RhPT/6Ikht0nyeAlq\r\nZ3FwPi5bPjArUJD8UIwaIBtsKEDu8/DV33oa4b4SU9McuW/+rhHwyJvw8IR1\r\n0KVWZqrcIup24JDp8SJHz/b8gy2J/zBGiUs+vSRkHdKw0A8krMI5O84ZlatV\r\nb3YFJ5KqUMak95abYgCNq11OQl+vyikgYqY=\r\n=o9WD\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221221230406-3b89db8.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/640db045335d81a378907fdd49d92c6e/graphql-hive-client-0.21.5-alpha-20221221230406-3b89db8.tgz","_integrity":"sha512-SuVID1YDKt1bipiUhOptUW6e6enIkObbY0e2WGBUihKhGxnDbh4l5cwr3TibVxFaSkGSUAN6ujhL7dJCq33TTw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221221230406-3b89db8_1671663880669_0.5258043496510889","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221221230409-9d749b2":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221221230409-9d749b2","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221221230409-9d749b2","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"a79561b4a51d08ce70f23dc5cafa36fded9033c8","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221221230409-9d749b2.tgz","fileCount":60,"integrity":"sha512-SLa8Dim4J8VHpTXSGrrkMGyi5O7RKIBRYawCiF14QqatVU8oKcTcE6cQSgwdjxw9IsZMIfShdAfKMjJ5aRXS5Q==","signatures":[{"sig":"MEUCIQDzSM3guun7mrjhFgiFI7BcNW942D3WAz1NqVISyR6AtwIgS1BSa08uoF30lR3k9XKZ7CjHn9OdXM0mVwf6uEF38fo=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjo5ELACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrL1w//Qo62hHsUccxVP+jI+zMW6Gbrp3s0Aiy2vb8+Rs/+nboG44dR\r\nIIckLSUR3oY+9RGKma4KV27NwycoDQdOxwyO/sZ9ZFg2lwpkv4EEoWjsvUyr\r\ns+pUr9cPJr1oNafm5r3Hn3XHpnmCjGNCavhfVPFPAohUiBLTOdXZ0HGkS5cl\r\nva9YWHVJoSjGdd0aNCjJZdg41invvlWrn922GY3h6WDtBLg/Tz5qYPeoktsX\r\n2zgEMvLgng9gPpPBmJjFOmTh8wEKMeDlg0fodYg6KY+imJaIgG+8KOUIy99a\r\n0v1KX70/zbGXsPZN7hS5jvts9rNdhOuWjIqxVAGIJAkUe00YfSvlzUsKUcBV\r\n/bWQsIc8Qv/evaHo8spzJ+LLi/Xv3L+gVMBbhgQ6gLzWRKrXi+zdBss1+Wjw\r\nlcTi2+dz+7NhXS58JbxcqC81F/JnZ99MxGSi0Y4c9f/xqIG6RH28vnKHUB+K\r\n5/0PxKuIzVo70UI9A2SxZxXQz8AlmDEkNN7PXl7c7Ipl2tUDv0G+MYHlNvlu\r\n1no4EvPinFyt136XGXyP2yeh0lAXzZdB9SOGvPCQU2hWvpxlaH3q6hQGkG6m\r\nDD4gtRQgbVXpY6hBZHsnyio7CHtSAQTtr0b27gbVLDGlwV0WMkflNNZKAOdR\r\n1+bgddm3fmzVBkCDW+VBtnm6vRo8yrc2Bcg=\r\n=ae9x\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221221230409-9d749b2.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/6d506b9ba13d9494c1ea99af275759d4/graphql-hive-client-0.21.5-alpha-20221221230409-9d749b2.tgz","_integrity":"sha512-SLa8Dim4J8VHpTXSGrrkMGyi5O7RKIBRYawCiF14QqatVU8oKcTcE6cQSgwdjxw9IsZMIfShdAfKMjJ5aRXS5Q==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221221230409-9d749b2_1671663882910_0.8708339142732011","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221222012353-90aa482":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221222012353-90aa482","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221222012353-90aa482","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"3521bccf203ddf581e79d623db9023330f0f153c","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221222012353-90aa482.tgz","fileCount":60,"integrity":"sha512-fCCb3GYHb0SMfLJC4szKQ2X3wNZFYXI/C0MDs948AywMvvODRbZVSHksY6V/t0WhWw4FKXqnLfRQnIu5ZcwyxQ==","signatures":[{"sig":"MEYCIQCeQHZhGwxZ0XItaK6Py8+4qJhY0RVS85f8sPxT9uNglQIhALhhcDMDQQDC5xekHY0mYmzSzGFCGEGwQ0sBFqUis2cr","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjo7HLACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmpwtg//SxCoXAq48zEcXpOOuCv2+lu8faTs/mhUS1yM39X9A+js0Gnz\r\nfsXRhy2xSof81ssv0mZ5trK9Yv52eEXixPWy3fOC9XCNEJGJzrqLeiZU7N4R\r\nfgASrn5aCiZl1Jfg2jRPzZ3MYxU5ovCX5kNCIlXxmGNQWviCSXao1V5RvYy5\r\nKDC4y8+bNPvsha3M2D7ZlYpVYPdHowFPvGiJ4EZy6TTmXPwG2WTgrlO75JxK\r\ntTYf9Se2Oz/DZxH70QU789dI0Yk7/3hMjV10LwkTdF5XZliVetnGoIFV8tV5\r\n2kaXCMXmgZdDeKRtxhOPvYwjRcl+JPc7cvUJYZbM2xuWwC7w37a6RP9TfUMM\r\nmos3v2vK8+4gFUKnfSIH2+/imNUpsF6B9RByxO5yX3/t0a09C3mVZdNqG3nM\r\nfFTT6Cgxk9qzjPrDEnR/TiorUTZub9rGi4ENSJtaz29O/X6QEOkmQDY60rwG\r\nTcZ4bOwayWGn1dxtl9FfxPx5juTtw6qsr+OOpFR9CMcFmLnLbU6KL0xbK0pR\r\ndrDSF3/TQvCJYn/YiUgPm9aN2K1uO24BkBva1AOT39RSgQ+hjh5p03nA7XqX\r\n8FvG5fPhxmXPKfqJvAfXPo5RSTIPaWZaqmSiMD8cXxD9+GwpDB4rC0P+lIt+\r\nmpNhFwvpI1fMwarj0Go8MUxt2s4WAdVpjt0=\r\n=XHDt\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221222012353-90aa482.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/cb9b40b5c80d12bf65437079ce1fb1ac/graphql-hive-client-0.21.5-alpha-20221222012353-90aa482.tgz","_integrity":"sha512-fCCb3GYHb0SMfLJC4szKQ2X3wNZFYXI/C0MDs948AywMvvODRbZVSHksY6V/t0WhWw4FKXqnLfRQnIu5ZcwyxQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221222012353-90aa482_1671672266842_0.23369214552017858","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221222012356-40ddc17":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221222012356-40ddc17","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221222012356-40ddc17","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"5ddbe58145d309fe25b12ace5f65eb2990dd2d7d","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221222012356-40ddc17.tgz","fileCount":60,"integrity":"sha512-yQP2OeN2q+GnJvIp5gk3gmSYClONGgmdskGziE6xTkp3kXqjmX8tRcxqAdbbq8UMIijDpRCxsGwD+HtNG+xFqg==","signatures":[{"sig":"MEYCIQD+52V9Uhk9sd9P/yrkKGaqGmFdlsSYT2edTCSrHxfKrQIhAJfLn2GNigxhnx5IddCyXkie87p6rj7VcjzqrHF200/8","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjo7HOACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpYChAApJrUucMu9FEfSLvfP5Fwrw9atH8X87ErHWFnLMBwkC0T/GsZ\r\nFJbYLaj6uzVUqFV40Wo4bJSW2EcYBDty46ea1Eusxbng2pKkRj+GEyJd28qQ\r\nqAQ3O6CRQR410tg9l/eRH3N1hl9QSTVIOg97tBtjY8DrT/UDwSVjUYa2rqO2\r\nzqdwY4KYxYIU64xTR7wk8ZDgQ5r72Pr+nlPnrwE9QSNHW/WZ1vzA966RYbwP\r\nitYe3dEghKD5LTehEYiAGmBkFuw4+fwG5APQ3o9JCoG2SW4s+zc3PCQr3bzg\r\nWadETZE/p0Fq2q5K/8Sc1wFnGlbfNdSt4fncDtqdI9YpryNdqyUZGkDvsE/F\r\nyk9QOWjdOdDe8mI1WsrW19sY2n6H/yQHh2raRca9AlVWvN6hiAP0U9ZctYrW\r\n7RWK1vW0z2A0CxsJbDXuWv/1DWdelAbTgbiOleyjf/v1nW+RAzee4RKizhqz\r\n33FAiI9aPpkvuExxilUsUFPvw9+OvKjH8Kkdax9lsmyBk/qB3h5FArvff1OG\r\nj1zYbOm+YZPAw9bQmNu1Gvtp9qrA1yYBpK8eK486OEILUz/dLI/loVCP7ger\r\nJdBp/NLcGJ4bi0nMiVStFhFBaJJFVcUIEIaWSa6nuBbNjEJrV4p913D1hE66\r\nm3RBGox4oW9Gb6VZRtM9SFaYScYy7qFsW50=\r\n=AF7t\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221222012356-40ddc17.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/bfcc4706168fb181583a4f6b254135b1/graphql-hive-client-0.21.5-alpha-20221222012356-40ddc17.tgz","_integrity":"sha512-yQP2OeN2q+GnJvIp5gk3gmSYClONGgmdskGziE6xTkp3kXqjmX8tRcxqAdbbq8UMIijDpRCxsGwD+HtNG+xFqg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221222012356-40ddc17_1671672270388_0.3789267944096617","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221222042257-783a413":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221222042257-783a413","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221222042257-783a413","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"d4d508fa9464b7b71ce7870d3ef9e4f8878b0fc2","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221222042257-783a413.tgz","fileCount":60,"integrity":"sha512-+phdpiyuGcVzE3mgur7BK5HM2rcDwdMlMtqy8ws0vsqi0V6UrVG+kGWoAuXEM+98GJrtkZD30Cj9eptV7Ac6DA==","signatures":[{"sig":"MEYCIQDss47Qaz+tWuAecOYLtKXPBGr0oONxNObjHTdZRrS7dQIhAM7xAjfqv7LahwaYsZnt3A/OkhtyZn1j1AevUneJXOV/","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjo9vEACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpRAg//X7Bh/AUbkbZp0/XX9I7a69qrT1+MvIe3hjSywPHAKC9IS008\r\naY4Ge/0MChNciTWHk1IG3lZoTivhsEHXCQBRvTfziwGNEv9BDirZ/Gbfv3Z8\r\nD8LaF6Mrm7XdSqnUOyn6D6hcYMNoXgI7ih4L8xpIKAHSxGG4QzsD9dmPMtYC\r\nf5/rLPcrVRHcQMa3mn/niHEFe8vjJppyWRA1C5zHoIqBQdEfAinXKCDT3ySe\r\nKm0UBYnXHyhwkFEfLr34GEXKRpLxXV7Oj33Bl9cPXsz2l+0K1/OOJUAaxxOx\r\n6rk/gWWWBjaMibTSgWcTrfJ2v0fR5XqInyhgNz/GKaWu0vJUVkJv9IsDDASm\r\nZqGps7iG3c5xXlmp3zT92SAWShX3nBoTMJwaLwx1Ra12arqSKiZpK3ViEjTC\r\nwxou7xLZ+L925ueCr/jLkDR/1RKM4dYjVGPqC9XvXPwQhYB0f8lgjhry/qIA\r\njb12yiLHTtXHs8APKqkypxedl6zWbzZfxQtPOxxsofByR0yDrmsLL6Gv69P4\r\nqyHxdquq1bsalbC+Ox4nxSI6G4yDPnkG7ROCzT63lXKggV1h4W8FkrW2H6Ic\r\nxX+opI+FRe+fpzHpLEt3usDYrkb+EYgUXcYQPccvDqR3MXJojyuWSn3IDjmv\r\n3waq37reI5BY/42P8/62iFUNv2gqwITJ0gY=\r\n=Xt1B\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221222042257-783a413.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/afec9d5d47845fbc39008281cd283dc2/graphql-hive-client-0.21.5-alpha-20221222042257-783a413.tgz","_integrity":"sha512-+phdpiyuGcVzE3mgur7BK5HM2rcDwdMlMtqy8ws0vsqi0V6UrVG+kGWoAuXEM+98GJrtkZD30Cj9eptV7Ac6DA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221222042257-783a413_1671683011846_0.9943699096814922","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221222042817-10dae23":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221222042817-10dae23","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221222042817-10dae23","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"ab1fc4022c233b23891a1972d4b25a9a84cf2c5e","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221222042817-10dae23.tgz","fileCount":60,"integrity":"sha512-UI+bFr7NXh+oZVtrzQgS50rfsJs0RaCm9KJU+Nv3LNF5ezZjHe8rT4Bcqtz1w7AAokX1vzX+7HDS1zvBxWiUWw==","signatures":[{"sig":"MEUCIHDLF2pslsPSHQaTF3h7JdyCM0JC1re0UDMyLS+TsQOQAiEA6qj1GlSHOJRP0WVKv8wVv7pd1FRhP02WoqjA1fd3cqU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjo90DACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoMQQ/+NvVsMDlIeEN1/EpG4xY9tkOzKW9H1QzjWH3Q9h1pR9lSsYFx\r\nYF1NHUQ3z4BRvv6Jr1Q7KlwgOk7qj/Z8ZeBBykunZPmonE/V1buVMRk4AEiW\r\n2jovo4Xh7Ucm2Kz0g3gfJJ1aN2g91kHT44veuoazh7dd9aD65yq4egZ4V7Wq\r\nBZKm2SMF68RP1BxkQxLJZ2SS6APegjfgUSFyHHjYa53RQx+0xTHhzkIHkc0U\r\nU+jXBoU821MczY2dzr5IEDgERM0OFmog4gtJUNjuvSSkvkNbvUWTT+7rAWmv\r\nnF7hq9XZBXvNWbkjocC/o0yg7y7qdw0b87xNgAPCwL+YFEkxy0QLsRVQnPF1\r\nhdP+Ttjd0dLz4vIewrN6YIX1QXWvyOxFmNUdWoNn1EAvhpT+gFzkHko67SK5\r\nv1WC5nIKjQ5bj6b/rEw304qA1NuXF5AVaNg6Gfq1v4qazMEFyRu25PuIV3tt\r\npnQGfncoHl33Oy57fb/QkiRmlPDnEbncKtsoTMBOEwlsvC9S06/C2r8PQagS\r\nnuejHTBL22hxucq7tetPtOmY2C5E7jNhexFT+D2c0FyG9XYwRY3ttw+KGfpQ\r\nnuy9xlvyj5hE0zsljLcoJcexgiDSq0FhQByfmpEGCVal2s0SkzhY5WJ9yUHl\r\nww/rY4fQOAir7KS91udRGJ8A0HLGzyZ0uAU=\r\n=HmMw\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221222042817-10dae23.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/22f082c98cd3aa35c8268c30a682c2e6/graphql-hive-client-0.21.5-alpha-20221222042817-10dae23.tgz","_integrity":"sha512-UI+bFr7NXh+oZVtrzQgS50rfsJs0RaCm9KJU+Nv3LNF5ezZjHe8rT4Bcqtz1w7AAokX1vzX+7HDS1zvBxWiUWw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221222042817-10dae23_1671683331244_0.9004199147064238","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221222074533-d1ab1a7":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221222074533-d1ab1a7","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221222074533-d1ab1a7","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"16a94209f67bdd13d900b86ab8b5e461e4f579a0","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221222074533-d1ab1a7.tgz","fileCount":60,"integrity":"sha512-cZyy2Eev6UmttNOlkFf/KbjToa5Tc+ViAHdAujZUGF5djEaStvfkrXTjPtc0p49AvYnZQXsdx3r/uXuUwaIXqA==","signatures":[{"sig":"MEYCIQCjwRYVYEI1sZAVU9GstfryctsAVmMsnzqvIXK1BHbQRwIhANQGBtNsX3SG/cJ9sCtyLYpcH7wV7lKDfiGPvitHP0CN","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjpAs/ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpaUQ//elZMoSHAEq9ELQRDtxBA3ktoZS+DSh9vlmZ9ibmC41HUb3eb\r\n1i2ksBPRTsMwZY8k8T+PLMkas0X8i/kBvJU8MALreitvJrfhonYxxoycLdcl\r\n87wia7gwCyScgiGmTtAnZwq6KSXBz76TjpxcsPZl3zMBjM6I8ltm0mBgsNox\r\ntu/3u5CDx4lMcccclRbcsYq/ew+6wyubIr/13oJO9DbK7YIxfbVwDjPcmjVY\r\noULohguEngY+y6ujVfkFo4d9vnCc1gOwG7OmDU0xSZde0s83v4pTFKTKgfBT\r\nOBfxODLDPncOfYAnbaakgsqPFrQ+q/21QPkPGSdiDWIABqX/MWrD0aq+h7Jy\r\npzGrL7YmpT1Urin69CpVkzwUVOc+BSI6DqYkui/nK1yCJxOajSSFQMpy+ihM\r\ncnMHSIEYwD8EJ7lRP+0+pI9W+qm/NxlZnqjDp6BfIW7csG53ZKigCyfosdqT\r\nfO4f1un452KYPRerjDnlHj16fs4BASPpvHaCGzY6K7mH9kwjJ2oahnRqPPvl\r\nRVJHVAY7gyNRIbCOuXfy7PL5aXIar8BSJC3ybLw/MykjzWGlsI930mseM64K\r\nvIPsAD9lm44aFXZQ7Fhk/v35cAhrAZVusyqlng+xW1OV0tCtKWu3zGeOnmYJ\r\n5NjfQv7OSLUs2Tt0SkWYhGFPtwPexf1CZ0o=\r\n=NDHO\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221222074533-d1ab1a7.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/b9a9d03b0abcdc4fea4b5111beac5976/graphql-hive-client-0.21.5-alpha-20221222074533-d1ab1a7.tgz","_integrity":"sha512-cZyy2Eev6UmttNOlkFf/KbjToa5Tc+ViAHdAujZUGF5djEaStvfkrXTjPtc0p49AvYnZQXsdx3r/uXuUwaIXqA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221222074533-d1ab1a7_1671695167544_0.33920785465477965","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221222074713-4bfaf78":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221222074713-4bfaf78","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221222074713-4bfaf78","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"066f6733e1622bbc39e04552dce01b24688ae8c8","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221222074713-4bfaf78.tgz","fileCount":60,"integrity":"sha512-jbdUaXmBKEiGhJ/ivVLu0mS+AwjdiidIL2UPsxYWEb5LSogofXDq4WKUtQmfx08CjODMohyaTXbLKB6bzX1JXA==","signatures":[{"sig":"MEUCIQDir6Hm0mwtM80xUYtYRkIYTUqt8CuJYAXucIC/PWwMuwIgeKoN2kQOmGBbQHl3DKZ5ayCJA9oyg6IlZ932WYq92uQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjpAulACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpLahAAg9z7WNDTiCt+uK2US5au3QCj1zSYVADNLgyontZ3x9TDvUZz\r\nbnTpQLFEKlbuzisGuCrPIOeq1lQldz/Z305LcbOi8tbgwSZt9q3cywXbo+6Q\r\nlPghcH34UH3+NDcQlPihaowoM7yG0FJ2UHLOAsmlMhsMx8vucT5hZ75augke\r\nX60axAyOPIW6u0razw72InIpd9+XajnnTVvXNJ+M0FVW0QgFqSKaIFII3bMz\r\neORO8Prd+iPE4Q/Km3Alzs8OTubnu5z4yqSkPtMfHFKv1zXEJKILKoLS1BXE\r\n2FkGH1VvcaN9iPxMfEl9Be7HMO60qOxHqBilJNoqev2rhVTNYqleh7kPMcAv\r\nOStgks7RpWIdpeJBhBbGcCe+uBtll7k9mateJBxHFiyrXFAi+IrUlZIjTNpk\r\n3P8TMrR4Ts6SRooZznOqsb0zSpqzMBTlawMltWas2StOPJeIni4J/JKK9LJC\r\nqjCerTb5iDIRYXoF7tSukXyr+p5BSB7327Il2uPT3RK22HCz8AbEEoWmVWW+\r\nuvqHhD/le+hbMjRuBy9Xho6mN9iwPZT7BqBXBbixihfR6Xk+x00NSUc8j/Vj\r\ndvvrqfFDC1nJtWyxOlz0wpB4O0MBSTdA6bbAvMnQwBg2rZKqlKec07RC4sZ8\r\nj2yBTs7jAQBg/fmYySaZSMx/TZYlt5LfbiQ=\r\n=IntB\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221222074713-4bfaf78.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/16d978af7ac087b1860fc3d04fbe7fc4/graphql-hive-client-0.21.5-alpha-20221222074713-4bfaf78.tgz","_integrity":"sha512-jbdUaXmBKEiGhJ/ivVLu0mS+AwjdiidIL2UPsxYWEb5LSogofXDq4WKUtQmfx08CjODMohyaTXbLKB6bzX1JXA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221222074713-4bfaf78_1671695269729_0.2400370987802174","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221222074725-9ce1abb":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221222074725-9ce1abb","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221222074725-9ce1abb","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"b47a45df57b82ab227106cad324a57c7c8b64c83","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221222074725-9ce1abb.tgz","fileCount":60,"integrity":"sha512-4jLSaKEfDSDOjL5lJvcew7fMWZuKjyNTRx6rMUmDsJiM1NfZmRYOStQCJ+tLwnjRUfrqQV2fhq3de9usWrnV0A==","signatures":[{"sig":"MEUCIQDZkU7ps0ACbSsNQ0Oa6D0FQzTzOM2vl+t1rqIh8bqo0gIgPC6InUVtjs3aHNUnj4eQ8clr4NaVRkrcn/x9ww0vSfE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjpAuwACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp+wQ//QARWBPZyDsLumVwf0PAb2YPvukviEc7KBldnh25sEImE+1X2\r\nvsv/tMdZuDp7wlFzONOOJcw1SxsWaorLa0N3SQcqXvInlm6lAsm5kbMoyUGD\r\nt6mitIXlDPDEXLq+husRYJ2gDhXqJ5z4gZO9FXCH5A5WN4qVYacQlyznQr+R\r\nts9PnCZFsCBAZrWCqvaR44GZ5DMH3PY805R8lWAFQGyRXMcYfsDd/hUuLpXT\r\n+vIMB0CQ219aSXzlYgXRy/3ymOeLaJNbk3WnyelH1929x9lzliiNCBKHPevW\r\nrLzr/s3Gn4HadZdSVGXhI7bLAXHBYGfNnNzF71vnjBECCtPTDCBfh/s2yBvU\r\nTZhtzbjRfqzh3aXHm3eF/lU8XktpNpKEMvNEPmEI236lhiLmDChRIQrk01T0\r\nOMuX+vDv/949Y4VIn1kwgWmbA6AUmvFYpNQGkTXELNVW7OHvTcmv7MZo+8ln\r\n/Edlaq8pU7kTmJxkSAkI2u073p3/thFUTze5fq5j5mfX9ma1z9JlbsXV1b29\r\ngtMdtEg6nkeif9qnrs9O9JbF5ionndwkMb6Mopb4x/Kyj0kTHbR10+JsE8f0\r\niskyUZV4fKmISExovxXQxF9KzsScXGVjY2lLw0YWy1H1GT0rA5ffuyLtem56\r\nIsbGmZo4dWwtieAm/3D6MptROp0l3DH85C0=\r\n=yx/H\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221222074725-9ce1abb.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/a504efe390332d13f697305d99ac178b/graphql-hive-client-0.21.5-alpha-20221222074725-9ce1abb.tgz","_integrity":"sha512-4jLSaKEfDSDOjL5lJvcew7fMWZuKjyNTRx6rMUmDsJiM1NfZmRYOStQCJ+tLwnjRUfrqQV2fhq3de9usWrnV0A==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221222074725-9ce1abb_1671695280489_0.37987916707905267","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221222074732-61abd91":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221222074732-61abd91","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221222074732-61abd91","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"2a6faa3a6ecfb85b7a1163b8036488e7763492ac","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221222074732-61abd91.tgz","fileCount":60,"integrity":"sha512-P4k0jD0y25ppNBPDTccERu4f9b8O2VmgO1NoHnRZyrsFNsuuQt0iRKgkFFNKQGb4fYPBQRyEr1fLLUxNSwZAYg==","signatures":[{"sig":"MEUCIQD1vAiMSmhVKsQE1b67gJ/WDJ5r2MsEesZHNIG2XDld1wIgYRxKvHXiEXBkt0pOZzRfdU7xx7GO4iV9KRVC2UHu1PM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjpAu9ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqaKQ//SX6AWYiqXO4QYjS6UJctZXGD6gKzU7fK8AddlUqKoCnTn6y/\r\nz30x/gRijuEPTde5c2ehcK7ye4j+/M5hXkrZGoOA57Q0E12sOBemWktQPnIZ\r\nQ/dRAEhVBxjCJPlTt9WFdNYqY7dyx5P7TDlX/d12Si2DzEgHDrt/56Uuxw7x\r\nbfzl23dlAMi7Cu2Qprh94l0QXuczCKASffhM/JRtGyD19qSGY71ggHzTS8mX\r\n5clxLAWUEMirKc3OL7ScsEa5p6Uk2gSv6h57gofIRrW18jowNcK/zHMT46KM\r\n6YVsvipVaFhCFQCwzg495JE/dwlWwZC6nAP3Ip1fisUxcRybnPLhSkZtr2QU\r\n3KY+xzLvWhBlUMwcnH2gyNS96pi81KzP62K1QnhMw3XBq8U7E/tZZnKvJvrc\r\nxWPFbxjLHoQT55PVXlpL3JNMj5e+M34eX5GvqataQmFHfsLitlw1PxB27YNh\r\nkn3tbgQmMtxEpqFK+Lu80Iz/iQBD1YzeyPJVIweP/aK/E22oucEeaSJvEmt3\r\nltrnFtYR8U1wC+JKG26pP4tXAnMbgVe8XzAsb8Sg8itdTvEZQRcUokicHwH6\r\n6HaKTNBc4l1JdMuuCOaj71DSq//mFGHex2++tgRUQmK/nj4OhQYBvj02iwBJ\r\nJLhPZ3RPxztxumvoUfv778QRL5zoF00wF5I=\r\n=bmOK\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221222074732-61abd91.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/e0835ded747d3500fc8cb9f1e0731f24/graphql-hive-client-0.21.5-alpha-20221222074732-61abd91.tgz","_integrity":"sha512-P4k0jD0y25ppNBPDTccERu4f9b8O2VmgO1NoHnRZyrsFNsuuQt0iRKgkFFNKQGb4fYPBQRyEr1fLLUxNSwZAYg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221222074732-61abd91_1671695292781_0.2816370278727722","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221222074941-81aa4ca":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221222074941-81aa4ca","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221222074941-81aa4ca","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"32493e67e8570aa86f72e55462ae2d248eeb2d87","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221222074941-81aa4ca.tgz","fileCount":60,"integrity":"sha512-mJHaj4N19V9XxmNhcho6YGVTO7oc7hG452at6cZGwpALAl3enwevzJr9j71LRREQKMjBvuWC9jvbBxC9DZ6FEw==","signatures":[{"sig":"MEQCIBK3qGzkev34Bp2ZnQEKLVcMSuCPrF4jHxqmTeeUom+HAiAA/3og+J4Sb2Vov+fw1Rg9f40j7XWiY/YXzETnL9CtWw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjpAw3ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqqOA/+OnM15OFDlPkG0E+Bo+8pswAUrPuL9nUN7pWpS4nY3tq+quM5\r\nl9n/8wS3ibh9Bvn3JI7MWRQP/NYI60gYtusOXBz89M8YdQihpzEmtbxNdVej\r\nRZmqrWnn31ye9DOLYnLAytZUWCF65lH1nP4KKT5sQ5NEiNijmN9SmqG9jxgU\r\nzxav2gashEbq2ROA3kPqd6PeNgKzUs1d3Hot5I7yhYuY/BBUylQ0zvEgL2Oc\r\nCkWH1Y/j/iGCrUhm/UqqDaRvVXSIX49+K9J9N5BmijM2VznZWdWRyT1PEfxt\r\nNEidAFtbBClIqLKwdvVwT+TXoUeJP/qWpPyp+AclASqZn54Xq9WFHY0MFYd0\r\nQRuMi72LJ9YfyTLfgSP8sHiHdIaUMIID8UgN8vzYV39UHmw/g8InOVcL24AE\r\n+XWYNq7A+/etuKFbYjmOYJ/bOyiytkwfutri2KgJuK05VQO/sNnQwnGyEP7a\r\n+acGkhf/EwJGXUiYhi5oldGX8gFtaBk3KKcuYORmUTrQcMbwQMkuQ74vRzV4\r\nbcHNi7MzCwVU9iFn3Hm61chwoZ1vXFQf2+Zbmy95OMeo2R+KJ3HPCN1i0KvN\r\nMzhlOEAdggou5DX3spDGkvCU6wEsupZOK/BhGSgjAOxW8hiyhtzZKp1QwYv3\r\nZ4XW3q/+dGRLuN5zapmJmMID6/DngB2shqQ=\r\n=UjVl\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221222074941-81aa4ca.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/3fea1bd207b98739c1669bdbba07988c/graphql-hive-client-0.21.5-alpha-20221222074941-81aa4ca.tgz","_integrity":"sha512-mJHaj4N19V9XxmNhcho6YGVTO7oc7hG452at6cZGwpALAl3enwevzJr9j71LRREQKMjBvuWC9jvbBxC9DZ6FEw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221222074941-81aa4ca_1671695414873_0.07960056364960377","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221222075218-7886548":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221222075218-7886548","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221222075218-7886548","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"41ba3998bb51b1bd4bb4f506056c2eee7aa7b97d","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221222075218-7886548.tgz","fileCount":60,"integrity":"sha512-4wYA/nrS0xWYY7aiOxJ1l1EbgmQBabjA7febZaJLZ4rbCIuUzPIyaDocc1SdKOuH5aJ/K8FcaYU5f/Nhrw0L1g==","signatures":[{"sig":"MEUCIQD4CsjOe5wFsnNbC8VeJiRbVwsfeGwd4pY3I8kYN4KrKwIgIgGykKdeLUw+SrqBNrjbWyfqYpkIj/SAri3VY4Nw9gQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjpAzTACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqdghAAkPt7HDfl9sKpGJCzJ2wuECECG4k06gLuyNQRTCzibB7PbkTW\r\nQqA8//7KDxGg1Hmd2RAeDgN6fL7aNuSy3MpLMywTw+e/J8tVJJDrADzxTqBN\r\ngXmozoO5dI/DD4buGgEmPNMG/GKNULqqlQCBKG9LxjK7b/T8rOvFv8ATAHbk\r\nvQAtLYPINGjKhJC5gVueIf43ISiKmxAraNqGFG9ko3aJV1VJe1mrxHRa3xrX\r\n80EaJOh5QcWKsjUiyUFyyNzU2QkkTMh/vYpODd1qpyguVwJOblzKrIjTALit\r\nkYgrjhTeMtxLNgVgcdI7WAYXAxCVOH1n/2M+XnEzQsOsyHkH8AH1FBFIhYcK\r\nJ543Br4hXO4RLUuMbv0taRxNiKjlTcsWSw2N8mAuVtfZ1IPsl5ZvgvtgJatm\r\nLJXxlfBHDgUTDG9LdKLhDBArvbw7lRGGDWDrejNBippy8y0HtIhrTzsyeODz\r\nJi192d7/IZvWV+ugvxpmCCXkQf1jJFYGXvLBj8JSFEPw+x+5I4Tcka0q6PvZ\r\nP+P+9E/iyYT2hD20RmbS4LAut2FLykqcjc16wJronyp7F8EskFjc3kyqasqy\r\nmSFNvQbIXZDE5nZQsuOGSz2jtLhneOzyvqnEeM5K7dHSGzxN6QKlXSHbw5Oh\r\nHcKeA1DDhDx7Zg8Hi4lTs8qRx7Rwc3/aiTg=\r\n=L7Wg\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221222075218-7886548.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/b99a976ec80657604637c22eb07a6be0/graphql-hive-client-0.21.5-alpha-20221222075218-7886548.tgz","_integrity":"sha512-4wYA/nrS0xWYY7aiOxJ1l1EbgmQBabjA7febZaJLZ4rbCIuUzPIyaDocc1SdKOuH5aJ/K8FcaYU5f/Nhrw0L1g==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221222075218-7886548_1671695571180_0.3368747120208371","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221222075244-5a0b29f":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221222075244-5a0b29f","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221222075244-5a0b29f","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"32307590845a56714ba831a70d72a6ae0fabadd6","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221222075244-5a0b29f.tgz","fileCount":60,"integrity":"sha512-SZXtQA6iU81xvT/FbzZZTj3fqAoQXftrHgzyjcFjjCKNVggUDnCjoaVXg6Kcu6vXXfmzg/X/INqeoyhBWijO9Q==","signatures":[{"sig":"MEUCIF3pQexCCN4+Vd7vE/FdwUICsrF2EzZND2LWBXN5WQolAiEAxdxluNp3OQatX5zULWgjspn+Q8XQB3OsHSiKpf/v65U=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjpAztACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoOxw//QWZo5q32JwvwGy88fmR9uk+7xr741AyhHgx2u6cddO+MmMg6\r\nzh3o7mMDBqWTipgLdNlQCYxBgqoGJpk2ZCJI4RHg5+E/8QcY+419+zFKCMtN\r\nHG+vWk7vth0W8b1DcaRkggTXCWCCyqK63gKS7nVevCZGsA/wg2LmVQUDQOfI\r\nJOV4OXkNJnHYyQgCL7BmrbqROqgz//9U1UjBcVckCmY77ni70U5BfiZN0O2E\r\nhOhJm/f0RZB+mX7Sg6QlELTySown1WBYRye/TEUC8GArYCZKr2+00ysyIV//\r\njnYxPig7QW1NSZIo7nK2xOyBcU/6SMWRDlM/daDLhsTrQ/FHjRCSRN+N/PY3\r\nDgLfuZM6Urus/6yE1hXCfp/JR3g1p5vTMn03f30eKyJJgirblWC6g9yuDW4b\r\nj1MzEyTqkIH1SCRRj+3zB2CN1tftGlnn+PFUY6WVjg3neFJP6Ew2ObvxK+7H\r\nstoaW6DEMobxAlCSqI9PaECF7Kpd/09JVJD/yuwcjmRDrStS+rWbeosJbXeG\r\nejWmKUhZGsBiDqlsLuhdIuwI+8ccGbb9fYfdgd2IGhJNj78fm8q9cppfODwZ\r\nS6I+g06V9K8JP6RUh0K65bWw6o7XVqkY0aecdAVgxZOXkv/9NMIrhQMFXmSt\r\nurIHwCA4e9BdtgZZQNN6adoHk8FXUzCKdKA=\r\n=Ni3d\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221222075244-5a0b29f.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/90ce49e1039011b304cc01e5245599f2/graphql-hive-client-0.21.5-alpha-20221222075244-5a0b29f.tgz","_integrity":"sha512-SZXtQA6iU81xvT/FbzZZTj3fqAoQXftrHgzyjcFjjCKNVggUDnCjoaVXg6Kcu6vXXfmzg/X/INqeoyhBWijO9Q==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221222075244-5a0b29f_1671695597480_0.6490885248686551","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221222075434-7256011":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221222075434-7256011","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221222075434-7256011","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"69f6ae5b2253d48fab653388329662a8cd4f8deb","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221222075434-7256011.tgz","fileCount":60,"integrity":"sha512-S1zorc/wbDxS+Ew38mH/6sO8JtXUtxuTKFWdMnLHI8nbvSbIbOTqXV1FB/u64OIfBtFILN7FeGVDAc6WKEFxkg==","signatures":[{"sig":"MEUCIQD1U3Dsy18PmiG8y+1Izr7oCXaIb8k9Q0Tci8dp4r9RigIgdTyuKzBEyWgemDkC073/ErfUnIErvrwglohknROyUxk=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjpA1oACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrViA//V9fgmCI5pxCxkjFx4nZCC345/vttXi15+V4NmE4ZpG/ckp0p\r\nbYZ7WImcQHyi58n2WeZy3SwmxmD7h0qZv3SoGYQ/vQcj24Hhcro+uxdGk9+H\r\nXWRwSzbtc3+b+mftlfDiCUiYh0+QgDkbgmyXd5eWKjMwrUtCCmEAOhHL3y1O\r\nexckaKKICyi2kfXh2jgpY09YMRyfk+JDhi+ujWW8669r1dwc9hecVkIVMfFe\r\n7j5UIC932Rn/55WMjxFxtlrSpVxFJKYqMKxWKMl3Br6lOpGkh6DZckxjjWLA\r\nbBGGkhyX+yKw7pjTJPq2UZazapnBJ1TmHa/4T2IGTsxHuNRGICMywUBU52Pp\r\nYY5I+xWfbXJHzSNjjHIZxHel7xqRxoUNJn4OVXgwbBgqackXr+iPft9wI6hV\r\noGLzWTaMVu1SL51SfNuTzvrB3oGcXbjPPrP/AtGrkaXrXiTIShV4TOEQY+0m\r\nOEWeyh6gR3ventqomBXByHxPLwjb53Rx9aww40hMiGTmUOdZ/kSQVCIgc9nJ\r\nJ8j/6IXwd/lIdTKyePXh/dCiJtgRtgAPRJ0bo4XKuBb23LM4pWhNco8i4Rsd\r\nuVcwSCsOnYXTA2ZNhFs8+rAAecbJo5AVSS8BjMWov/jmqYdvycGmHksDMdI2\r\nY64jiMuCtJ2o5Qaei3M1N6Me7CtqZJD1mn4=\r\n=+O5W\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221222075434-7256011.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/a8bbfc4b1e91fcccad9fff6375fd6222/graphql-hive-client-0.21.5-alpha-20221222075434-7256011.tgz","_integrity":"sha512-S1zorc/wbDxS+Ew38mH/6sO8JtXUtxuTKFWdMnLHI8nbvSbIbOTqXV1FB/u64OIfBtFILN7FeGVDAc6WKEFxkg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221222075434-7256011_1671695720008_0.2248564690156032","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221222075830-402133c":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221222075830-402133c","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221222075830-402133c","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"078967fd7178d7c46d1e0fd3cc1fce2036e904c1","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221222075830-402133c.tgz","fileCount":60,"integrity":"sha512-1RWfShkD7ftebljOOyRf9fBCmgSyf82Gdl5hayyXqIW84QQ7FeRWozRipe4BvEkiGco2Oc8OJiKkgnRo56KpOQ==","signatures":[{"sig":"MEUCIQDi8nepPxfh7AG5tqy52pchkG3XOu+jRhd0g9N1tChdVgIgRlfNFY8IshA6gMiVAq24oALz2vvctMOdsOnaeqKGTfQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjpA5HACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmozlw//V51R6rDXcdkf51rDyXD5ArKb6QQ4nfJO7ep46ruC0iQGRpeD\r\n3R2XQMbNpiTSkM1rnfZ1zhrSEIMbQVE05vkf+Qq+rJNV/NLXy0Uj6ldGWhzp\r\npQL/sByO42IYpoFIHE80ONzxTSUmOAa9pB1TXCf78UCMNQ5ia+P9RXeSsGNG\r\n4I1rQDfy9pf572n/m73axIlWQUHG+zySL0kdDnsdncDHSeFADpbtWUjdIjS8\r\n09J8coAcSSHwncuIvsn26qyKZMGsN4JQ9GQLtfdEHindYqp4ktIpgF1xvHay\r\nhGOFFaaIMfVLqkmzt1BI7gt35GPdB2SQwdxJ528N55Ma+jzOBqszkNooRtw8\r\nApWlYb5K5emgcOa6MWGVtyQW3pgfMZJWvb5tQW6va3KXlmjV3n9SVR1wNIjo\r\nG+eYP+v1FvUDsR9u899JZV4HsvRmGdVYIhQyK65qi7YpQp0z0I7ghdHS4oRp\r\nsrMHa3HWvtai7GWJzrgx3iRjWu7uY/BRC1YTWYLi4f7jHS13E4DTBUaNqZDs\r\nJoi0hc9AD4psAnEfcs+iZwAGOULdBHTsNcqfL6hqy+lBKczXoNKfnEVTsC0F\r\n8rzoKwVJfFu870hr4Kn5W8e0Bsbsm+sYLfKD2F6dN3UfER6D9q6KsO5boAAT\r\n96eSY3CFewUENDYxd5OoTqQjLLQHxNWfrRU=\r\n=ArlW\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221222075830-402133c.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/92900532627c98e38124897e0e485dd4/graphql-hive-client-0.21.5-alpha-20221222075830-402133c.tgz","_integrity":"sha512-1RWfShkD7ftebljOOyRf9fBCmgSyf82Gdl5hayyXqIW84QQ7FeRWozRipe4BvEkiGco2Oc8OJiKkgnRo56KpOQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221222075830-402133c_1671695943643_0.18308841387660535","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221222080415-341a00e":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221222080415-341a00e","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221222080415-341a00e","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"b27e6f127698e72493595abcb2b3f58a712c2ee4","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221222080415-341a00e.tgz","fileCount":60,"integrity":"sha512-wm2CkX6i7PD+5A/V/BxA0hu1++20MYhKCpQ421SqAC/M28ijLadrPYtaBS+oizhIn7kAYwMNPqSie6ALrIeZdw==","signatures":[{"sig":"MEUCIQCSuM+eQ8Reuw00h2V/1wciVciHGp2tcebK0nSw9gAKFwIgYDs1gAVza4U7ifpn9ubE4J2OZGpyLG+QAvUCwhLc3Gw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjpA+gACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmq6pxAAi5TYtuZByM1qa6qU+0z2TSwtwsQv0U1paqTdWCBTpwat3ugs\r\n/EbEDQOm+02CfJhg4depzgC8ke0Nuq4UG2fGVarKf6m2FsBInxPebb0HDWM3\r\nlBGCYjIhh/5bKmWY70AQJS8UqgGMoKMBeiKb1h8o6isEC6CEwGpWKyaNmRp7\r\n6q0yC/jWXY4r7MuG0YBedY1WBVMyUE0GlK69CboL0/KP71XTa32dqVYfC3vJ\r\nZX6r5S51JokdO7Wm7THmUke5nuSyA8AdI+L+oOc0MFFFfLcEpKzRQK7tecVv\r\n/LoZ10nkjIR7dWnuvFRg9TlXZIDSmwjvgnGSWRwmLFo7doipZCP/DZFI2Sh9\r\neGxoYKsJ+YH2ygnpU5CNkmp4IQtKFFUDcdYJ5xvKdb8DrNm9gwLPVyI+Yhxw\r\n0U03MQL+f+9+IUfLmwkoX0JxqmBmMXFdKDzQIZP0Hpjy1uIjFdteG9hIhcCx\r\neMKPn6Ag+QxvPkiZzqXhMtwviCnrc6W73D5uWFbQ27vcOouHwHqzc0c5aNG4\r\nDLrBNr4R8uHodgiUimppiY8Tc9PJt8rTWD50xz26lPZH2o+Rk+HkJdOsDcvi\r\nhpNef6zYp95ohFDuHUeKF9sHGoCn3hN+l0s0BNdqGYTVIdaZXvUgNlErLslg\r\nXIFakj+RQRKM0hBpUqETaF6xo497oqA8zao=\r\n=E13O\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221222080415-341a00e.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/19828e90facc1d9e4e24d15ce7eab86c/graphql-hive-client-0.21.5-alpha-20221222080415-341a00e.tgz","_integrity":"sha512-wm2CkX6i7PD+5A/V/BxA0hu1++20MYhKCpQ421SqAC/M28ijLadrPYtaBS+oizhIn7kAYwMNPqSie6ALrIeZdw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221222080415-341a00e_1671696288724_0.5436097188769646","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221222080935-5956a87":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221222080935-5956a87","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221222080935-5956a87","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"f1a9ee5b20bef5183ca806de355f52321c52f611","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221222080935-5956a87.tgz","fileCount":60,"integrity":"sha512-ZAgsZN+y8vEyamGY/GSfk3CQnlPJBIsr3ebewLm+QCvzRpK0gWxEx+B6h+qslBs78zoGRhC8SWgivXJ/trVm4w==","signatures":[{"sig":"MEUCIFIB9ZhjK7dc/38iIiLKJEPUVS0CD6IQNJoZ61yg307wAiEA55IETU0EOpAN74V9hEho3FK63/+WR0fJjEuEUbgnI3o=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjpBDhACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoCJQ/+OfxGsQH7YO2sSbqLDpABHxUPZ50GOX8TV2H2TJ7Was/YukLw\r\ngtABiM5VK79ceqk6KPntdjca/mPcIoN+QM41Ro+g71kCqsXmCeANeZ87rckH\r\nj/nIhhiLPkz+6f7ORK7f6DDMMpDThn+z+yCaLREJH+02YI9n9lYCStaeEJwU\r\nqqrhZD27SZ0sxN+cwRf0x5pZjvTYuHnufC8AWrApy74JzmxOUJOvIewSPhfX\r\noqcNq4gVOcBg+7/lDLgJzPKsyHuoH7enpFpG/TnMkb24aUmpJFYDgz8IzKqT\r\nBtKU+ODaHlsi6qzMqmWJrYPEtr0qd8WNjj0ufvIoJ5L+36zba2kHBkHDaVrJ\r\noCwKznf/ig4TyokxQGs1/VHNILUbABs0AReJ7eCXkvWr5Emz5EX71hgqDmq+\r\nVD0x44JwB0dQkJ9apBgnllMxmTA7xE1nTISX8BBt3mdYQzi1WNHQOM+oSiyQ\r\nPQWgMwJUu93nOcVfwSZSmwjlmKC7oXSw+UzoQnUIid+VofBuqN/8lq/O5HbP\r\nIFiBHbIEbBD3kRaxH3qd8+C9OyTRDUZc4cgIlhb12YtewmhlpXASKL2E/kaK\r\nGk1/q1gUkfUbPx1DJPB4A9A3bwKPKDASZivkGpJa3lV85WWEDMDXp3dchPzt\r\nkdVKcMS0mRGhHyRaokN4RzQCd76vrMiSTm8=\r\n=zgQi\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221222080935-5956a87.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/c703cd4d43862c42e8e5ce84ce37ebdf/graphql-hive-client-0.21.5-alpha-20221222080935-5956a87.tgz","_integrity":"sha512-ZAgsZN+y8vEyamGY/GSfk3CQnlPJBIsr3ebewLm+QCvzRpK0gWxEx+B6h+qslBs78zoGRhC8SWgivXJ/trVm4w==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221222080935-5956a87_1671696609431_0.7524709881976632","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221222082741-b4e4376":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221222082741-b4e4376","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221222082741-b4e4376","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"776025f29a84045c52c0c0c9f34b2066c1fc3784","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221222082741-b4e4376.tgz","fileCount":60,"integrity":"sha512-sCxRK24EYfyS6HbcEWDM+z6O25zBOnkrJPZ/mUfZ9No4+BtUxDT9LfwcoUvKhvhjcOmqOr8/e5KQwsHwJulnNw==","signatures":[{"sig":"MEYCIQC9gStuEGX5ce4OA2mK1+5rBWjIWYEgdDveDLuihYXTxQIhAOjMYJrvAAL2gpmPP5h79GX0UHtzMsOSz6zfc94o2YZr","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjpBUfACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr9kg//Tr8F+wL2J71vW66R8qQAMHxhAjYy3KZnpo9hTDpATpQOjlwD\r\n+kOPZQuZaknBY12CX2X+BLFLNBb+g/9fMe9mk79SKviv/bE1bM3D8kQNNCP4\r\nuo7K3hpzd/7Cn4ePS7X133D62ixKYg55J3QGFTimidmWrVz+Dqe3NT1WuMWl\r\n3fceTPIR7gfnwyQkYi+RFXsBcbVETe1jhA303ZxDfmUeRD9kcQfzIbZ0ZMcF\r\n+VMMqUGy0UwlMMhOTTcc+BcY2GRXyHnroS+0p1jcRnMVY352JriLF+Ag5vM6\r\nRbwdKi+bhhkUoObCmVB6I3BbsAQ4L9ZVx9ftfFibSJsm68QKeoRYKVSG1qcF\r\nyG5G/Ot4J66/+/ybs2PUdoiw/EpI4FT9K48hXT0tQIPoOqIoPubVmmfw4ldt\r\n15SXIEN3/aCGeckDD+jQOnDmrbtk3mx8mvV8gXZzozek4Qev0e214QfqqaFu\r\nVIP4Nb86tltRw9BfoYRLZhIM32ZV/YVtj+zgBmV3Z7wL4V9rMF/u9lcxXyVL\r\npJRtzjBhcsF+1spPlgsnL7ljDlnAb0ruas2SIb7sitka9KOrvWOgAEZBflxm\r\n8LYGJLtYl5cQXd4+byyDIIe2RTYjbwZZsbI/v2KqjM07wgE92fGzfkjPnmIt\r\nO4qmguy5ohH/T3X6Co//FusaJKkhWERdyV8=\r\n=f8Cg\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221222082741-b4e4376.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/00f115644ad9b927a95528b66f742460/graphql-hive-client-0.21.5-alpha-20221222082741-b4e4376.tgz","_integrity":"sha512-sCxRK24EYfyS6HbcEWDM+z6O25zBOnkrJPZ/mUfZ9No4+BtUxDT9LfwcoUvKhvhjcOmqOr8/e5KQwsHwJulnNw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221222082741-b4e4376_1671697695368_0.3393374695152038","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221222082745-029b4e6":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221222082745-029b4e6","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221222082745-029b4e6","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"01dd96146659d57ea58f564d807195dbfa0bc551","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221222082745-029b4e6.tgz","fileCount":60,"integrity":"sha512-t1ZRS85NoFR8fFdiZ6489HIfHg+CEXaeiczjdtBUQrZFXO4UQvyeK3bdC6VB7h1a6Wzezc6YKM0WE1LM98xCGQ==","signatures":[{"sig":"MEYCIQDQssJA9ha6GrIWDRNYKT8D5PCriE9G+RH8Gf0VtFGhFgIhAMIutk9b85WshOkdMoXODOKwj+8ArYx/QYc9kwJOKpFC","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjpBUlACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpYoQ/8DRiURJhBjQGmtS3ukNkr5+I4kaJQ7DUx6aTbROt2wqsGxkDh\r\nvr6DJF6eSAG+xwh7+0bQ+ZD0RfJwPjIKdIOfrYa4/wdm7RC8RcZXLuZkODne\r\nXWqQSTft+/7SESfWFey4+jJHEECJkeQWbQhjeE9XBTJE3RLkEsWzOBORJR1p\r\n3Fth99ZwkN6drS11rqNJ5tvaZupcTJKI4XnfNhSSp8FpKZ5yQbh0LtpNS/2H\r\n0UUgDMWiipDjtpY3iyuNK3OXG5oDfJvwBqbNQCllQA0S728YpHqgaWnjR09j\r\nYcw0bMeZJUcFUV96PAnS11mYZXR3673YgkovyWjY7TzJ6AiZeEMDu1jSPvzS\r\nV+evdaT5Npgc9Qu+kwDmVmu/zvT+LXKIwkZ58AqPKVTfqNc3xMIMTb4jve5f\r\nnfKSVLeN97mkfsxWyPCTylIXI4BObMxnR7B0xPlQYHmp3rSiB+EEPOaatxwc\r\nyeuq9vteRtlh5Dhem4ndVdEejaTaCRrep9Pmcrj0uZDsjOJnbflRXTjFs43Y\r\nW3V/gCr2gTIUeSeGrq8eocwS0vVFmK8Uwi4w6U5CrjWCW96HTp0vfM1AyVOR\r\nJFhrv1yq/e2V79CCFXG7eYbnSq+9wMmTmkLTWtd3TyCdOMc8tT+hRWGV54++\r\n3f0+AT/mXHvwcFUN3p8siW54BeE3uywCvHk=\r\n=wNtL\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221222082745-029b4e6.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/00d075646273f1c1f1da986acd14f00a/graphql-hive-client-0.21.5-alpha-20221222082745-029b4e6.tgz","_integrity":"sha512-t1ZRS85NoFR8fFdiZ6489HIfHg+CEXaeiczjdtBUQrZFXO4UQvyeK3bdC6VB7h1a6Wzezc6YKM0WE1LM98xCGQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221222082745-029b4e6_1671697700855_0.21240518556709587","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221222082944-5489de6":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221222082944-5489de6","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221222082944-5489de6","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"ed35bf086e9adf9064b339e91a8c4c6cd1f5b32f","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221222082944-5489de6.tgz","fileCount":60,"integrity":"sha512-ppzsFpebm7ecD4EEuOQjpjrGvhTiPmNl0jl6zNjms+ZuEBtil/PyhCsBvHqyc3HCuR2xEnQYEp8FTXOSB75iKg==","signatures":[{"sig":"MEYCIQDC/9OOKganDqmBt+9YgPgY5OxWkfHbiF+/zmn+FEJ/+wIhAMfGjKxrIwmDTpi6Ow0nZZ+xdIbCsfzVPme7rWC88p7b","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjpBWaACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr0XA//f7zmiTEo0Eu+YT3M9vXr/bRnlp1qJaSJ2B0i8c8MaaTwVrLV\r\nAy3QSAeFRTK3a5BVukOnODEOWfo1zUdM84B6a9X5gwt1cuQUEw+Atxdtw/U/\r\nUFwU12Gn38cJwAIFqrxbuUJzQ4llDod6Qq7OuThorPtLligxa7/DXyo5xjKz\r\n51MzmuXUmLut5CbBsy4Piwzx6ygVDiMTlLafw4gl2r7q1z3ZudDIQ5bpCwWN\r\na+ybU905jReFa/jrJBOUOqowAl2KTF2HhTqlFF9SdXuRD1jVOSdwLhYKnMaW\r\nbyC+FtVgaJQuywx3YMyIo8L7nAj789NSiZQss5ItqtoMvDYy1IzJoakoEm/Z\r\nHX23GeHyYPDauGUTUYNSV1bs307smiOMfEul3gLTr4HnTV6JzAH3O2IEN3mR\r\nyrLtxmOpPrWl6+5p0sb+2/SA9XVds1jJnAuqw7r8x+UJsO6+iC20ER1F4czX\r\nqNIs+uwbDd4camHbo7YCVaUgWZCJ1/gLtYxUk2nWceFrTPErArVymkfg0L95\r\nRO5Q/XNrOK+WZMKCa8J8gnDGO8Wu+E68jKAzxy+uRNBi4R486O9frDBxhC+R\r\n3v26VoTDpeQHaf9aassszkqWmNtffNUYqbt9niWGV3hPscWzOG4BBulPemr7\r\nsKpxpGqXHaeB+tndjrNY95alotBurMMbtEI=\r\n=V319\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221222082944-5489de6.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/548c7b7de85ad12c57233a8581a43888/graphql-hive-client-0.21.5-alpha-20221222082944-5489de6.tgz","_integrity":"sha512-ppzsFpebm7ecD4EEuOQjpjrGvhTiPmNl0jl6zNjms+ZuEBtil/PyhCsBvHqyc3HCuR2xEnQYEp8FTXOSB75iKg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221222082944-5489de6_1671697817901_0.27289158773735345","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221222083351-984982d":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221222083351-984982d","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221222083351-984982d","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"6ea662f698a5fd9523e40c87177f754c05338a33","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221222083351-984982d.tgz","fileCount":60,"integrity":"sha512-7KT76SgOaln4+qt1mzHV9HEPWGE4OgPmXuc4nQJF+N4HxzR+hJYxJHYAoDvRlrVMixE/+IDh+VPpvlX1t7EOMw==","signatures":[{"sig":"MEUCIA6p7nzOzSN6anXBVsOEtxH/YotGRtT5fh4e/L6L3qPBAiEAps4kjsA/4FlTbBnk/+6URe6dbS5KzSxn7Nr2Rea2xeg=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjpBaXACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrynA//WhmcMHTUVEnSovvqPJaNvWmWYh+DDfMT31HB4854n9C77dyr\r\nGlmvjW/NU88PIM8AF9oVLaoHJz7Pl4qat6ektaEXGKMcNMKYSOGEjGA3tLsH\r\nTo7QS0PMmLELjYfWw5KJ5OJiVtc4pVdvyIW0M6zqi+N3WMgSqho79u5KrfVf\r\nDJP2F5zb0qrMKdYSFFR5j1ahr7CsRrTieXs+5YdQ4CcEKjfvUAc3QfWBnXLf\r\nMNWo1voPcTcauuw0IYAxbmx7Bf/z+jjR6PTMWfbC+4hskh+EgeA0BatDOIqk\r\noZT7TpQAUCl5338r4dEfV1R/7Fdt/dykoxpJrI4A8lbBc6Akn2YcHabBDdvu\r\nq8Offv1vW1YL6Njrt5GxQ33YDkFC6BAPnMDNvJnh4fOc40fETQks6Lm5wNFi\r\npmgB+vceV54lqU/TeFOb1wVa2rMDGknamqLB3Ne13xH1Qt7Vc1OOyZvdRMyT\r\n7dBAShM0reJ1b3ECpNSdTkpFpL9JnNZye/yNFRuCMzTPjXW4XwzjE27aGBox\r\nHk93/cp9pg8PvxKpooBUxFdUMhEaZ+Cq3UdPGkzX/zWYiXpSxoeR7/+EWPfO\r\n89g+kZ7iU88IWoD+hbcE5fHNfGnDQ3XHvej2BmIRwLtTQ0VEldqrEbnzqBCA\r\nDduDnvFWErolaSxFWQQI/wdnhPr0L8CjfNU=\r\n=hRu5\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221222083351-984982d.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/cec13ced7fd2ec8f2d5d96edb0ba8b23/graphql-hive-client-0.21.5-alpha-20221222083351-984982d.tgz","_integrity":"sha512-7KT76SgOaln4+qt1mzHV9HEPWGE4OgPmXuc4nQJF+N4HxzR+hJYxJHYAoDvRlrVMixE/+IDh+VPpvlX1t7EOMw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221222083351-984982d_1671698071513_0.7653601690825043","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221222083747-108007d":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221222083747-108007d","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221222083747-108007d","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"f526e970494bcc757d9da7edcdd6675c4c781aac","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221222083747-108007d.tgz","fileCount":60,"integrity":"sha512-SPDq4sq65Zo5NbIk4604GcSIIA3KZMatMUGHkKIMt/D/kpG9j2nDJahYJiFm5nI3CWJVSzYqlWJRb49einFcGQ==","signatures":[{"sig":"MEUCIQDZQpHZH/kPglo4S1CCtaiyOHgB3TuEaLYuMp44BBL6YQIgHRAbAUuhXa8nHhsUff1q23yt8EjRW2cAhsqaGgyXVmE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjpBd8ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrTiw/8CKKXdEi9hCo5R2cylmKBqUU6SpZCdo3curCeaiM7ooPNZ9RW\r\nHrErhH7sAXb2ZGkQ2dYWkSTBA8cg5XCORiAWRP16bkPPlcNR8bLuTjIwH9r+\r\nzBSSaE20BJXEu/N09b2ieW65GAzQC3wchUNb32r1DSet/c52KzmXxBX1OcU0\r\nYhkBS9cVq0gTkmfc9DyF6msnD1g3v8F9Ju08/CQKfcxBdiziee1Ap8H/fQRj\r\nWdlGB4FKYzUR/ennxPfpQ9MiQ2aw4i6VAMrwx6j/wLtDlrMj24F7gMg4mREY\r\nerpGZObFZTHBFBh8yKQVtuYatZV35sxm5oVeHVSKLnBY6xq3iJgFm+Azoa6D\r\nWJoYU72VhWPjKktJIQjWBWPbBYAcl9k7L1F5eHizQatNLBcXhaauDXwjFVwb\r\nA/1QtcQBZ192wJAKyosnp4bo8l/gXC+z3Ns/zlpAKkWwQX0UgUyNjiQOoMfs\r\nV1Dc0+c2BEWovJIICOT3PtkFeFPkIFflkK8zCPTQCwiQiyFyQttPFCBYtUd/\r\nl5l/lY2fYA841RVyNddxtXB741IYe4YFEJVy8XA5g6eh1pi0bvJrUPmdE2zm\r\nJsMKQ8WSAzxK+bFfqM/fu9LN/R2SW2dbDUAkeEyNpmDaIBELanhj4XsbN2+2\r\n43zyi4o3amc3Mq4ooxRLaJgqiV6T8emiv7U=\r\n=3IMc\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221222083747-108007d.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/d9f69d95c97d13bc1dd3c71f67e90723/graphql-hive-client-0.21.5-alpha-20221222083747-108007d.tgz","_integrity":"sha512-SPDq4sq65Zo5NbIk4604GcSIIA3KZMatMUGHkKIMt/D/kpG9j2nDJahYJiFm5nI3CWJVSzYqlWJRb49einFcGQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221222083747-108007d_1671698300538_0.41269582493980983","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221222084548-c397477":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221222084548-c397477","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221222084548-c397477","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"64870a0cf4d04d917450e813f9b4d31fde727eb0","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221222084548-c397477.tgz","fileCount":60,"integrity":"sha512-X4tt1g6UY8N6Teb8Oh4/K2FugrxSQpF428Fygw4gp/Y9JWSAUXXcU0TtVtQMWoyFqKCBUuRwX4Ns2+aPn4PmKQ==","signatures":[{"sig":"MEUCICJbd8omfluMPy32+zRajy3vfTk3kSdmucmgrfAoTiH0AiEAiytE2041imLcA0lA/1kdUlal140UnJvpBOWPpq5VHjc=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjpBldACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqLmA/9FewfRAcAWzYxzeY4VAmKJwZLI3b9sLuliWWogtJWIgGOxapy\r\nLr6ZrdkmHqP/mRDsOq5WH9I5xwsZIrlum9j5eX8I2Vu6N/gu/qSALz693p+J\r\n4TepVaYhXtsbWsnxFokGb//G3C6g80dP97ULIbE3xRceDBso+vCrsrsffP6b\r\nOhwN7U8S9D7PA97/pppuSvKDpGGnhgUr55E3s64ho5RHR4SwNONdsgsTaHno\r\nY5CiHSjo1HMsfsGA958zRIl9a7OZeFPpq24Zr8hHBa81E1WUZTxAjdrpY6YQ\r\nJ8e5BtUzvb4Bo5J/Qn8Z25OM8hga233F8r8EFv2RWzYHVASts243ROqeZw2f\r\ni7yMwRTKikzFXUCfnrfaRIFXj+zjromqLrhCw0en0i6rz9iKAR7zEZVBXOZU\r\ncdBlEz/ZfMXz7E9MNK9YcB3ZezFlwaUQXkbo4z6A9P5AaAenZ06nUITW2yBP\r\nljh8G6YbRFFP+KDECKjtyQZyvB9VfioBSIq3l/8o7+nJuP5dgfSEYccBtyAy\r\nL/9W4iprPH7rX1cpZxedPYZrrmYxg766pjjZVS9XoCvaQ5DYUgyEN1AgXZWs\r\n/21hEfNtJ1nFb0OoADfjPdRjd5IEwY7AcKxEw/hozodTSPQGSDtWPtPS6BHP\r\n+UlQj72yhhmJpGAugIUNTxrHVkuFnYHHYXQ=\r\n=EJIX\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221222084548-c397477.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/0b5d28d379ee69a1df34c2b690a6b6a7/graphql-hive-client-0.21.5-alpha-20221222084548-c397477.tgz","_integrity":"sha512-X4tt1g6UY8N6Teb8Oh4/K2FugrxSQpF428Fygw4gp/Y9JWSAUXXcU0TtVtQMWoyFqKCBUuRwX4Ns2+aPn4PmKQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221222084548-c397477_1671698781357_0.3915160314483481","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221222085025-02104d8":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221222085025-02104d8","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221222085025-02104d8","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"0bed8b8e768c43e57b50d6b2f72ffeb9d9c33cb6","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221222085025-02104d8.tgz","fileCount":60,"integrity":"sha512-rsTa/AODdhEPs1QqOHclUM2kMps/wYeN0yBHynupf0WM/l6k51zKuehJPjaw9zcWRv43STM+q8KCDUj1kSVV+A==","signatures":[{"sig":"MEUCIDUoCgP/qBl5HdaWxN336/MmtsaOFTtBUx5o7+Em5m6iAiEAmGUaKngyqfHqJAEfgHC6kz2LInUCtGAQ5TbuuA97cd8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjpBp/ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrGfhAAnVIe9oMUQWSL+6eCBnkE94kh8iggDNQlbqkVR1DzmEUDxn81\r\nU6Y3AikiPku4feQDGGRn/Fvvvr/kZIKFv5nY54PChLSQIiECtNndxwVSn4J0\r\nfcLQjBIknFjYmoYq8jDXfBPky8+sd7FGz8ysNDcVegn9yL8HGHOvm1SWTXpj\r\ne//8CghqI1cE/CHQ2gPn4YSdOE9APNBcd79IGkD7DiU/zjWz7MJBFUEyc+iw\r\nNuw1If1jHdeE3c2s+FddZzPE5Af/6ckbjs5g3CHut0XkI7+kaqoj9+DLqOJs\r\nP66Szd+Oyl3LQ016AT9uqTxGeSE3R8gzpYCnvco6GD4rU1uBgxwdNvFpdnSh\r\n6StIz892Wdc2tD98mUNR9moT0xYnb4/5+a2p+riIBgMrrtHgL6fwUlLAK8nE\r\n7rBwmDQiYmXh9uDAyOA82pU5aOqBhc4V1o7812dHdykk4JoNFGHjCQltrtE3\r\na/U4ZLD0meInsFVQkaXETk6Ub+Qf/8J3TA/KbnJqbS4LQC07NgGGLHIuBcuC\r\nVfTpD6bmDY2Vcx33W8ik0/ldLYEKKsWh68BWS8SVSxQzHoJhR1pauKGwiKd5\r\nQSgtXpEW3bXYT5wYWChYm9IgNkko1Jb8LczXGRPD5YBOJPtRlxTrW3xou6A2\r\n7P1W+D2lYG7asj/mxp1U8NRE8PiXpuO4/vw=\r\n=jZwN\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221222085025-02104d8.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/a95c1c4462b413193256ba7a51f28763/graphql-hive-client-0.21.5-alpha-20221222085025-02104d8.tgz","_integrity":"sha512-rsTa/AODdhEPs1QqOHclUM2kMps/wYeN0yBHynupf0WM/l6k51zKuehJPjaw9zcWRv43STM+q8KCDUj1kSVV+A==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221222085025-02104d8_1671699071487_0.4901861797099618","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221222085222-9b12bb3":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221222085222-9b12bb3","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221222085222-9b12bb3","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"977b48cabc86ccf5114049b4042dedb92d6039b3","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221222085222-9b12bb3.tgz","fileCount":60,"integrity":"sha512-BvhCC20qr8LzBKGFZjwZgxTNpQSdvOoOq8lJP/xPsG6G9ZKg450pAEAgtP+aBEuQAfpwTYVJWqy2OTWgPqZpwA==","signatures":[{"sig":"MEUCIQCdnZR1Ala+CQ+CYuiKtqE+UiI/jFQtRZsAjzP3ItFWNwIgfueldCcUPdBnKchVmqPrRi/ppppefb4WfOOhP/f0rkA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjpBrpACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqGtg/8DC3P8g6UadDF0p4VLykBfcgjHs9kORiDBaYU4Opp73yPeRGP\r\n0qu6pcualFVkPq5DCtwQqxMNkdyDXJMGeUIusqncWRCN2tW/Auv4fxtCpEc2\r\n65/AOTbvnByKzMXW2h6Z8P6/rHg4IJrY+2U/r/XvWbA7jQZXT5Sk4omEKVwm\r\nzpgGpSBDtTEQDjEEdtSIV3aSQ1EjiLXY71Or+cby8++/HKvtjnX1xzlc1+8C\r\nrvhOSAZ1JwXmVO8qxwFu8VwJ06+Q/xm/mbK+C3d6bKmvZdsPSuoRamEqZtAe\r\n5TtZjAiQV5L4n07puOO/aM7c4xqyOEni4MW5elM2hoG9d9IVIzsluhQFNCeI\r\njmH2FC9B+V1nZBkxD0Lt3XS7AbYsNG0rraFWtaSkMrhnL3do1SzEeEhfWZiM\r\n/hGXd46mbD35RJa3CKXX6nbBlI94jiv18DbN6OMUiME8NzuAedOfpW+R44im\r\n4CS3bcY8s0XeuTpKhA3ET51xATRIScw8vn/f3gYULfN2K2xtepTaBRG3K24P\r\nHNpau+gae/vBgS4KQwm1PtrG/6YR4bsksFnKxkMmcSCKoytR73hikeX1z5uH\r\n5KZ9UOUEHxwJMBNhuE6K36fV32/Fl0gmcrbFgIFTgibG+tv7w/oRsT9GsRgZ\r\nm8Chm7kapnRqlsuCKYk1Nt5ExgM5jwzTXb8=\r\n=aUP+\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221222085222-9b12bb3.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/8e187a21da06a150db2169ecc052c77a/graphql-hive-client-0.21.5-alpha-20221222085222-9b12bb3.tgz","_integrity":"sha512-BvhCC20qr8LzBKGFZjwZgxTNpQSdvOoOq8lJP/xPsG6G9ZKg450pAEAgtP+aBEuQAfpwTYVJWqy2OTWgPqZpwA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221222085222-9b12bb3_1671699177015_0.925414777539912","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221222085355-ca22871":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221222085355-ca22871","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221222085355-ca22871","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"cc483b1db673c70fc4d8abf84d36d84f2fb713c3","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221222085355-ca22871.tgz","fileCount":60,"integrity":"sha512-eXrFyDf+O4rqvPvMnFyVFvREIR8WdDFXhqkMQogNFdHnFMOgRyGnj4v2x6BL1zR/rR92AiTV6BXCPAOmfFKPmw==","signatures":[{"sig":"MEQCIEW9rZSwmLW3/tczcaUEvYUfmtRLxz9ZXhOfhcp+ObajAiBC/nloXQqcaGf/iUVHJfctQBmJu3YMNscXWmaVuTVmvA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjpBtFACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmqgug/+OZSFUhBt/p/qO3yTO3deext3+tMvNQqOaNywsp5xpLIaEtjM\r\nuEtp8SZJmeFaF9+j4eKSzBCso9RieIk/BqYQkHuvJpP13qE0VeMXDs3aeVgo\r\n15r/+vlBiRFonDvQnsuD7yFBJg5GvjriZnGpHMvKJtSJDqfBK8HtDpB69VCo\r\nIPfirlWYVcwIpDo4XH2QaZTvXZiBI+vPf6XFlaV3781YPRdBwEc4eIViE/nZ\r\n840kV2/uU61u0mNUuMN6rF1foCK5P10a0JtKGsXAVazoCSjXil63y0cQoS6U\r\nVD8Hh51kWBro7mXY6XcF9/m/TRQ2+BiJD0RzGvjQRjb8TjNz8jnv/ZycFpjr\r\nxQtUWu2VA9I92CO9Ylq+CV8LJREzsgGlfZketD8/jVrlEiwiqlOLPwOHqUBQ\r\nrfJm/wVj1GIGqdo+5gVoifVpf6tpHaRAPK2Wd3OCydk/FfqaaqFcmm72biXz\r\n5GGDvsqgZTX2AJ1A090tUKzi5nI06w1xiUCTbV7BVkpdgxNQ9oFB6MAX6Gw6\r\neI0fH6/bb5uj+g0PQVqhVD0XRZSEl0cciQ/CW5aXHxNo7ulqozuXBBMcC8eQ\r\nwMWzgIFP+TubfXtYHjtB+8Jcr8KbQB0GKSNL81Q39perH5n0tG9tzBh/gydv\r\nYjQm+9L2rdFpa+4dPQAylWVzwgx9anMvYv4=\r\n=DFTa\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221222085355-ca22871.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/89c525e2db64246c1fad3d2c1f9faa40/graphql-hive-client-0.21.5-alpha-20221222085355-ca22871.tgz","_integrity":"sha512-eXrFyDf+O4rqvPvMnFyVFvREIR8WdDFXhqkMQogNFdHnFMOgRyGnj4v2x6BL1zR/rR92AiTV6BXCPAOmfFKPmw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221222085355-ca22871_1671699269201_0.03756105875408733","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221222093223-9592eb7":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221222093223-9592eb7","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221222093223-9592eb7","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"18a7a892d52b7141671f76163abeae3142f7d0b3","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221222093223-9592eb7.tgz","fileCount":60,"integrity":"sha512-m3Cmd+KeV5+Aecd/ynWwu2GDdpjWQsMiKpGLBEj/K2p2UWTCm9M4Qgg94wDOQI8Lpu3W89l2W57gJ0m/B+EL8Q==","signatures":[{"sig":"MEUCIQDsXVaALEnB2Sq02jXQHPw1cZt9tqWuqlULmdKjhL5Y5gIgVSZlvjM/ajnIHKFDoIYutSUvPPXTpO1N5N9j3BICCmY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjpCRLACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmphOhAAkm2Z3I0OIZGkD0WpH9StMdnQZLLQ0T14GCR3OuIySYkOt5Qx\r\ng5Q7aq8shRZFAJ9IslJfawQd1C/DF0eqX1t6bX4QORFj/Z9qWW/lTkPOqyFg\r\nU+8c7w+DqFsb9hrx/zuLzlntDZWaGX9KeGWk6A9bNUnWndj0UflBPDrSGdlh\r\nL124ho1E+lwjk+OlhuHY96HLbSJciP/M0/ccVoGafmdM+8JJTReVuDt9hsqm\r\nRbcshykbz/xMd7I7v66y1aNMo8mqK/LchqHfDbCZ8a5qtZ+Rrv00Q3cai98Y\r\ndQN84W4CcjRbSNp//CU8wn548QSxvamMYUC5nl1Mjp6WK65u5aM3rIxW6f65\r\n2IBuPpbc4k4hJG404uQO/I4F/qNqQz+lbYVuVDVGtZypzwZOH2BmXDZDMFp5\r\nU634T9Qm/ouZKomBigpanXpkvpLbLPR7pTVzCfUu26VPT43Fsd7hF3iC+0sd\r\n1gydEfUqHU4Wcg2vDTMYDuStSBITs97Gm3bWWs3yXqadkIl0xg+QkRoKcNmi\r\nn4IBOmK5tlUt8UYr+sR6jP5EJfhqzWGLFUg4CIYoMieicCS9xWNp6TRnJSXH\r\ndfVEQ/NAUbelFNaLWNPk5XcmH9hI9ckusHQ2bdMLaZy8Y+X6RQqahr/gF9d5\r\n8584B9glCHVqS7OjsohtEsSX3yXK0IGISQw=\r\n=Uci1\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221222093223-9592eb7.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/ebf1801a1565a4c1e287c22d757a02eb/graphql-hive-client-0.21.5-alpha-20221222093223-9592eb7.tgz","_integrity":"sha512-m3Cmd+KeV5+Aecd/ynWwu2GDdpjWQsMiKpGLBEj/K2p2UWTCm9M4Qgg94wDOQI8Lpu3W89l2W57gJ0m/B+EL8Q==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221222093223-9592eb7_1671701579562_0.23007459911516093","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221222093809-65be1e8":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221222093809-65be1e8","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221222093809-65be1e8","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"bd9476fe990f307ee3fe3547bff8962887122629","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221222093809-65be1e8.tgz","fileCount":60,"integrity":"sha512-JjgErQFLqsONJtqlNWyXA95LPQCrxwgt47ttpDIIgHObQ/h0wH6lJbI2XagELcmkbqSGacsPRnDs6qoDYd3S5g==","signatures":[{"sig":"MEUCIQDacklmpM8rps+HwEC3GZCXYf6kwjXrGjG3rfio6M6TdAIgU5/V3ETqlOWmSqr6Q4thSzZj3AycQ0fZYv7BHzxuDVQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjpCWqACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqeYRAAmySxrpK+FqjPgTH4yN0vISdDbTa1Nv5+tZ7lj5CRqOwnVsDq\r\njckX4y+itgQoiCXtdKMhl3+JYICk/w04YMWdg7OVyAKfHhx2luxGezQi9WsF\r\nXW75qt3Oc6DwOTFjE6uzAKWQjOgy7pfgckzeJvy8l9OFI7IO561gxuwTn371\r\nS3zeTnO22r+YRXY2621qcbyXxh2MrfuqSLSRRm1hI18CL7bWuekRIU3W71RU\r\ne1npuj8OrYZHAjAQ4xqegB0/leHQTpxZB20+cQb5caKnfXTNglesWD96BFZA\r\nbK828FNDkl2lW5rbqkjxWwgwEdhmZRoE7AXZMBW6VqCxiyh5U1LtEhVSCvqv\r\nX7CxsVhZ5I/pw3N7GlZ5PA9AaHT3Hy8psBSFkgjx37D8AkA/PXlb6uSkR1F6\r\nhr/t78b6s0vStJjIRI0eJEXJF8SUGb0hRzCHQc2/Cf+F3WiD3N/s2uazXQip\r\niA9ppN57bcXIkWdNfI3fzlR0ja/q1T77crNExFuVuaaWD2xrs8QvTiXXClWl\r\np46m1BqZqk+ELDaw0Y3pRlnksETDlHt5IOpUhwYcQulPiFSnEAM5XYAc5AEj\r\nAYf8QlP24fXplGrFr3h1s3ZFddgGpzeUUcvT1qs0S+WuhldcOvEV8+B+DUTo\r\nUc6jYkq9nV2Yzipi3wg+G9PitctaiV33DEc=\r\n=/Igl\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221222093809-65be1e8.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/3168db17181fbfa3da65631da16f644a/graphql-hive-client-0.21.5-alpha-20221222093809-65be1e8.tgz","_integrity":"sha512-JjgErQFLqsONJtqlNWyXA95LPQCrxwgt47ttpDIIgHObQ/h0wH6lJbI2XagELcmkbqSGacsPRnDs6qoDYd3S5g==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221222093809-65be1e8_1671701930237_0.37895761954381113","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221222094306-970bac4":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221222094306-970bac4","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221222094306-970bac4","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"24de9e950046f833ce7ac026f095b9e9ec2c28cf","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221222094306-970bac4.tgz","fileCount":60,"integrity":"sha512-r6A1h3U20nLJA3k7itvfkqK4Oy9NhRt/NjLI0hyyoAYmSIG8kRIsy4ntlY2xyTh0SzaETKnCl6hPojHGVPW6YA==","signatures":[{"sig":"MEYCIQDH8p3tzWlMlSgJZ+MEOtjyGVKrloJUcaXUEcfIjKs7hwIhAPWYPkEHT87UhgIxYJ/2yAaY3sEqvgrlr6cLWhcmAvqv","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjpCbPACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmoj4g/8CoZxW7rsxh06WXlwmm7VdWyR+nYPrkonDfBaarrU4TJpNPCw\r\nLg175huM3aomh/0SZY/d94m6aYQXjSGuaPFEr920v7+6y2crpINhESUEiT6u\r\nyCFQI8qfJtfqXBXBfjbaDfP9EOGP6fcVVFja9NU8iRXEzPr3zIFBs7amcvBx\r\nluySOrrvCuZaMuftfbouhp6WIYFl88fPYYOACpAgDVt/DSMx9sF1XwjgzYn/\r\nMqjnWz1ZbneHGeg6+xiecMtgnlDDzl7E6Ieg0xdDgMoDMT03K2lAqvsUi1ql\r\nXAMT9gP32zQEA/XN5TIXWaClcq421WpRKx9ml7oaDQP7izYRtTu8XJRsazjv\r\nhXy9VHnjKmBAP+EvBZtoREXI5GFlpX4hIKhzDYayBbnAN6OHg0qQRc9Xj0Pp\r\n9hX/Oxm1+lBajKeAYITP9kcXHqsUzifjSFo3pqA+idhAYfgXJ+5HNHpNzybx\r\npkryZHkrZRp7KKAYdYjC6DsX5LG9p/mqoXDHvgTDfjttCGe6oeI2bSm0iJRx\r\nwhEgbqcFERg4zi2PbZpVvNk6gq9ThWn5PuTtVMwpm1IQbGWsgGgnNroPUVlL\r\nDY8ARCWqVKy3c6bsSPj0DxGNfc1YEF1yhmHsCDHVTsMbEvv8CoSlIEKoFffi\r\nHwX9k36/rJ73ORlCBvAe5PD9/lwJRWXpOBQ=\r\n=IGRh\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221222094306-970bac4.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/fbd1573b2862d66a102eb2bcf05b9861/graphql-hive-client-0.21.5-alpha-20221222094306-970bac4.tgz","_integrity":"sha512-r6A1h3U20nLJA3k7itvfkqK4Oy9NhRt/NjLI0hyyoAYmSIG8kRIsy4ntlY2xyTh0SzaETKnCl6hPojHGVPW6YA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221222094306-970bac4_1671702223703_0.14774600420477713","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221222095322-ed5940d":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221222095322-ed5940d","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221222095322-ed5940d","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"6943512331e423717e92cb9d30dd2c15bd3bbacd","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221222095322-ed5940d.tgz","fileCount":60,"integrity":"sha512-oVFgOl0PlUCe2DIiEdAT7ylzVGuPZoRD5Fo2JWNFsybZ8nExCaf02GzF8cQu7nCL6gdbxwb1uuJx+YO9QFt52A==","signatures":[{"sig":"MEQCIDf6zFrNYgtU6y17MzN3Wg6s0etKRJ/zNSQfPdtnFHvuAiBANRHkN0QwW+zkUEAU2/79F4gJ4YaHCVt9Tysh+K1wNA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjpCk2ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoaqA/+PF0RBnqPZi+HZLT+ubnKM6N5a9/iBIDyymuP/q727eLHCzwI\r\nmJLTIh3BSpXQhb6r90rCaUALYFCcr1ehqPAQLhaLc1zb5I5OyERSzmQ6anun\r\n9zIEPAs1s73Cv60w3+dEun5efM5OqPquIspaP8Wnok3G371lY8IqRcrYAkgA\r\nN9EHHAiTuCRmJqhxW0R+1wdvURzG2UWjQ6Ezr7v/7mxV+rl9RIrTTKtHWMl9\r\nR4Ti6znOTP9HBJYs1vLIbvNZiNq5I3hpk7CYd6M7XKW2DXAFJ3VMC6lBvBe3\r\n4yTp2t1dhQJRjvt5Z3roXXHAq1tOtUeo/FdVTgdT9hQlpE/E2t09MqU8JbM7\r\nIZgjsNyzKHxPVDbkdgDiyFO2BTbXgV5MPDII3nlKbF2MGvpxfoRlleQfD01z\r\nqsehAVaNLcvDaYB+h1Q14ZFTk4apJPQgP1gUAV1eXMc5SOB309JNjH+awbWX\r\nDWNrWsqfP50GDO22Jv3UbNqG/qVxvE558XD0upbiMbiD75bLkoQn6uJrBzor\r\n9lWpMC4lJdCtATEzR8JGAm0u0uAnuecWiUapkt2kydTRsdFuhiEnTHVWFali\r\nglSWMRTpOuolnXy0IhfGz7a+zVMQsV41M6fD2xumeokoG0x3Xy2DtelKs3Ey\r\n+ostNbpzTxLPlib4avX8BbRrbJSYvT8GIWo=\r\n=D+cE\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221222095322-ed5940d.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/eaf76f663d1980fee63a4ed981bd5680/graphql-hive-client-0.21.5-alpha-20221222095322-ed5940d.tgz","_integrity":"sha512-oVFgOl0PlUCe2DIiEdAT7ylzVGuPZoRD5Fo2JWNFsybZ8nExCaf02GzF8cQu7nCL6gdbxwb1uuJx+YO9QFt52A==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221222095322-ed5940d_1671702838359_0.44184604062466026","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221222095410-4902c5f":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221222095410-4902c5f","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221222095410-4902c5f","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"2a47ef0e605bd5b8fed0d83e394c06878d943770","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221222095410-4902c5f.tgz","fileCount":60,"integrity":"sha512-dIhbj6xSxthHqmWUxE6s1XHYUoc0NvTgEsVzGJdx5prnYC9lKYmhR8m+8cyACjRweJet5Khe54qHD38WNefPTg==","signatures":[{"sig":"MEUCIQCbyad1s0QxvgscS94A/epqX7wpVyHyGZCOgNsndICr1gIgefe1KJzZFBqOgdApLNEfTo/i11gjxMpuMkCjx4z58iA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjpClvACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmpx9w/+NNk7bfNuG/UuLfNK7avy+Vv7b4Rt+evIlYa5m7+kh0CHhjXj\r\nnV+rsAK5CERuAxdWiZcbUOEej9ZF24Z3jONd5s9kOdXiRm8Tl2jnlsRDSwTL\r\nma52SSk3l9n3qf/bh8Beq56Tklm0/SJHtMxVbvE5JkYgFnkrE8O/nC91YZ3Y\r\nTO6wbSdwmPJ8B7MB4dUYTcix2av3E82Zw/gwtm5fvLeGS80693tdz2cJzH77\r\nUvNNa/y1caQESaui+ceGd2ypdo2eGy3wAt+5/Ii7MGXIqRgY0aznU/Awltqk\r\nWoV/sl+/ICSPPn9lJDJOBJ1dURvKAmgd50cuXrbtaIqL3SpEj6AkvkmIWdGm\r\n5KIOo1fOEH6MEfB6n0C/8bEn7KKYw4VMSEZAWNzLcaTkX9lGOzLhmVQO0G1a\r\niRkO3lq5nnfQ0HV4adfo/2Vsf2xvTxxlnDFqWz2Qk7B9SRjovj3oL20JQ/d6\r\nxBoLkM6iUo3nY5KTrLmokkwogJxolNSpmFsOS7uVT8iJsP8gGhNJqNpoV7Us\r\nkdS0p4qX/X1ArqDkoPVV9an13TDdMe8MXt+YDMy/Rr0lb7eFwBVsBS6NpTjp\r\nZS2r9KuySExSyk7OAsEdxLdTqHdI4kIeC5H6XmwWUK8l7W/6ZqYI9WD4jYrk\r\nJOm7VZ2w+6v9j0hUPAcFHJa2kJaf/v6YTnI=\r\n=eb3P\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221222095410-4902c5f.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/e1eedb2de0c992e45a3409f7dd812f90/graphql-hive-client-0.21.5-alpha-20221222095410-4902c5f.tgz","_integrity":"sha512-dIhbj6xSxthHqmWUxE6s1XHYUoc0NvTgEsVzGJdx5prnYC9lKYmhR8m+8cyACjRweJet5Khe54qHD38WNefPTg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221222095410-4902c5f_1671702895462_0.9954278058851953","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221222095610-acc1db0":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221222095610-acc1db0","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221222095610-acc1db0","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"5fa9901a74ec1f53570fc7fe63ec62e19184b6fd","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221222095610-acc1db0.tgz","fileCount":60,"integrity":"sha512-i2083TTI8cajVpWmUU18Vxe7aV15bMuxC5cEE5zT5+aDfcc55dxWyuuX+3HwnQrK/yDLs4l22WWfrZ7C4gIZaQ==","signatures":[{"sig":"MEQCIHWSHJKsXsjQPBBSfaaNSZtNe0BDch15ReNJ4KXgZsVXAiBMmhhpSqRgaVMbXM6W21SDFAx7LP42lLxYWS0t8lNSAA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjpCneACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmrrgw/8CjF0IgXljrEEA43VZWXm03y6hTroraWS4KE0sKlnpgOCyfIJ\r\naDr4quJy6vFOxf2Tqa8gsXBcMFV+0CgKPwWIWXk6/Y55xzT7YAIReE05V1lF\r\nqQ1Seo05sAhu9090jAL3X3dQlS29EcL38BH30+3S0t4rp/462gBVZ5wiSkPj\r\nsztZXnzjGNYqvQFKFj45kEMTglyuPnbK+TFKVn1nmIeN91J2Wu6DApv3UcZX\r\nrMSfmTStp74/ViyjjBtMDSMElTUK4AafUaJAZtZqoPfAscFi8fI3vFdLXuFP\r\nrIC1XCy+zipB4foyQhhdcUd2W4GgEMH1mIQfwz4beRvdh3Sa5WYJjKV85RSE\r\nteadFuLrKWdB+8kt0ccnohjVO/4ybEztwtvZDAwp41/T7ZHluY7pZ+/7fgT6\r\n1HjH4tbblvr8h/nJIJnGvbRdn7Z9Ymrm6UJb18N61pGkg9g2a4gT46pJlmeW\r\nSojTL1gu8GZuRjzbwC64ZnO1PvOHH+1Ku3mkg9o7m59r+qEGwE3xOv/omKpr\r\nLXluc/jrsph8Tdo9gwTUd+PRZtDYwjFY9ZKGp1NjogmcbYjomrwzbD2zVTUm\r\nNrUNL1I3fS41YRdh1IjrVuUUkhtA+4dP9THRjobxl9D81jfkzyz0nZXc3UYx\r\nqwn/U4+W9u2/NeWzz6n5iw/nWnaZntVYin0=\r\n=W1y6\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221222095610-acc1db0.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/1c2529fc6bd4a9db87f3fbfd9a78b952/graphql-hive-client-0.22.0-alpha-20221222095610-acc1db0.tgz","_integrity":"sha512-i2083TTI8cajVpWmUU18Vxe7aV15bMuxC5cEE5zT5+aDfcc55dxWyuuX+3HwnQrK/yDLs4l22WWfrZ7C4gIZaQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221222095610-acc1db0_1671703005877_0.47183611126808955","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221222095832-c0e082e":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221222095832-c0e082e","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221222095832-c0e082e","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"487d95c6c35be9e17264cba224c05ff4b2133fc5","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221222095832-c0e082e.tgz","fileCount":60,"integrity":"sha512-Htoby8y+ySCaQfm2gAKGaCkVYkT3j/nEDnEaKmImwhEdRt9H0l1Uec7oF03BhR5NvUR2XxOevwxoFdT1IcouVg==","signatures":[{"sig":"MEQCIFAD5M8kou2wsXlyW+rX535Li0LQarLK0TLwlCOv3Jp7AiAK7WwgXSx0ejp2ys5cGkDXFYAvZp0LFNqvkGFkgf2ICg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjpCpzACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmqwjw//U2abvZnVzH1LcrMuvGNvNPuD91jHlB0HE/KZGCUqAFISSkBU\r\n/Rp016eeq0X78Cz/DPwn8TZvM1IeGaUzsGJ16cKQAWMQm/gFI3ypu1beqmDc\r\nPaWaJkONXmgOZ+qPGZb7BVQHfvcWtlpxt1jehaY7B7Pv2mVA2nDvS3mKVSs5\r\nBTzSKZsW/8Khz2uoGVLdyLa639nQvCietDBwbPeiLK3J+goeQ9AqMNLp9Uvx\r\nk9wiNumPzCzAPnt+i0lNqiLO/hBQFIGuSnl37PpTdyuGtbW2KH2zpAwmRPz6\r\n1GB1a21IMfQME7ljd2M/I28VJz3fInyjslfMzvxspvO9nc1xBYQlytLID8kR\r\nEeaNiTIqnJG2sNMvxNkQB8s7QZCoB7W0aHJE76sG6VrY7xWOafIxwuEowebC\r\nhfokUoCBbwlOlPa0XVaudWEePPFSgBSHiwu7E3KRQQcxrSaCD6we3rk8v8a7\r\ns9ubc7ZDjZMYJ+ElC+5llvKuW+Jt/amupnGdUr/ZR9IqH5Y6hgTMnccNYmZL\r\nK0gDn/zpLWONRwtXF8o+YMKJah6+cm/32GyKja0ovYso+HTehIj8hzzy/9Y1\r\nJRl8myY3K3ShWot2Tqouu4obYyZ0lEsVSuoZqF1ZMkYamAckALoEAA7v8/Xb\r\nC2TM9Mjt3uFSrzLztfRM9FlAS9PQ9g7iu+E=\r\n=nGHs\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221222095832-c0e082e.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/cadef8b89bfcfb0809449464cc596e5e/graphql-hive-client-0.21.5-alpha-20221222095832-c0e082e.tgz","_integrity":"sha512-Htoby8y+ySCaQfm2gAKGaCkVYkT3j/nEDnEaKmImwhEdRt9H0l1Uec7oF03BhR5NvUR2XxOevwxoFdT1IcouVg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221222095832-c0e082e_1671703155017_0.4536238128959318","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221222095947-a60675f":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221222095947-a60675f","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221222095947-a60675f","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"343ea291037e4e8bbeb05e1b8f340324816c17ad","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221222095947-a60675f.tgz","fileCount":60,"integrity":"sha512-jXyrP3SpzggYjSVx7xdikicAS21wnY7Vbdg2xFWSdsSn+oq71+H5MDjoXxqgYXVfPQgP62Aot0Fv58TiyY8jew==","signatures":[{"sig":"MEUCIEf0PWIcDWkac8tAakV3WEc/M5eQxGTCvBlWHT0NQho1AiEAkVpp09O6XtUEDDn8kB2D7V4dc1Go23WZC3xGODpmArs=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjpCq1ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpAcw//Z+W8pKW9N9uffZFq8uTLUXTFWQDxUjPw8rAboavTajDlTPKZ\r\n7jxbNN02Lnn6p5ktwRQWLwYOTQgX2EaNtNensZ0AUQuRDulws1x37T9O1pN8\r\nvwOZO1cWOGJjryjuiu9kKwbuLgTnO6E5cU0Urb/E0wd8mGkwNSwn5x5ml0j9\r\nG2BjTUjsrhS7TtyubZM6QCp3yuGhnpG7Nr+19GrsyMpZ4Wg4OHPY/Ui31x00\r\nqecFZ0tU1Zou5b/GgIwOJDGCG85fc9n5hWaaSClofVNEitW3KDjWLmqZltqJ\r\nv51+QMjBa3mSyMTBcM1g4vSS2giK+rEDajGdm8aMfieJlFUhgC3IFOFS2+sr\r\ndXe3UC4i4AYdd8+w64CT6G1M9wGjPq6BYho7RXnx9TLKVxEOYlAcf6oyOUvn\r\nikEFcakG6bjQUQEnf+RDCzON3/+i3wM3081MjMmdaDySB1aOuKcllIbyBaBp\r\n0JjEQX/M02dMe6kk+68LaJEGFNQcp4Hs8DamCW33PxpWrE9rWPJ16911bS7U\r\n6lv133z6NjaB7EW0KrZekGBDKBkgNzAD1z0xNmB4v3KOshSVlvN5xtRJerCt\r\nlfb7zjqos8zjAKtDkNMQVJSIUju05PLpu4yoqn+K4qKzRg16yR6l1MB6vDgp\r\nhId/r6oKr2FVSDoDT2OeNvX2wOn1PcKrV6c=\r\n=77Pb\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221222095947-a60675f.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/378bd828f0cd9ff46cbc292543aac434/graphql-hive-client-0.21.5-alpha-20221222095947-a60675f.tgz","_integrity":"sha512-jXyrP3SpzggYjSVx7xdikicAS21wnY7Vbdg2xFWSdsSn+oq71+H5MDjoXxqgYXVfPQgP62Aot0Fv58TiyY8jew==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221222095947-a60675f_1671703221008_0.18160202925019364","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221222100733-865d119":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221222100733-865d119","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221222100733-865d119","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"e08e0ff2a2d534fc1b38b2d20e6ab8ce7e107f6a","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221222100733-865d119.tgz","fileCount":60,"integrity":"sha512-H4zlJZBGFvbTnYn7b5r/iR30jM10MJSBQekATf6/8HiFjsPTn7KFtTNCHXSZnc1xL2+9DA3YiK368LGSp2Urvw==","signatures":[{"sig":"MEUCIFBekTlZXwc1rQspAchZ93btFeufh4ZR7utc/PL+MCzOAiEAwAekN2nR7s9CQ+u9MlkD2l2UDA24NuVSVLfKS7XEVvw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjpCyRACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmphog//Sr4pfWlVggTUDu1fA7Hg9NX65h9y1s5RzkLLp75e1YqRf13C\r\n0drNX/IRWWBWkvUmWto+wqOMLWTmsMqbgaud1QoOGlEcFt272OhwtAWgAEvg\r\n+Yu5OkFSng5BNwJZFzQRxZY5nOD8BO7L4VOmzwLzZlVkAh76cIye9RZyaDzd\r\nvw0hUng3br+K1+93jnGbTWrwArxh7+Lt1y7ByyGYERQgNyd58sUQlsHBE6Ye\r\n23lXXHm1TjPnDvnZKekwJaTfEcu1w50ZNwQWboWPwfe0N1g3McpKYXw5j1r9\r\nUn7LwmZulLOam246h5DeCm2uUG7LZiHK8CFxUAkpF7MemiN4TqfuUt/SwfaS\r\n0JR+uMcfCCfMFmXXy/ytiY1GiDaUMCK75CxZDU82J9M3QDkrCwz1wG43RphR\r\nLbuQGL8uRrXxSZj1/PhvM/Uzty/WI/QGsE+pYqcUiXgxiGKTO8aMantUNoor\r\nv3kMQeGvO8XL8enwDHsn7s+o4qDCHV8cSq18IgkPMGCMQ1cGqiVWdIUXA4IS\r\niiXVALGS2zy3OVYsgX3m8vc2xMCOaDIK13sE8+KtEf/tpgGyHA07riSHhK2+\r\nx8ct/bK8TBVm/rj+bvYxn1rS92CqU6Jx0UFDjX2iu8WAzd5OvllD7yImqete\r\nnbYoFKUjNkB9BMbXzTsU/umiwWvoTsa1Iv8=\r\n=dqzu\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221222100733-865d119.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/57b2f78ae585dcbfa2846001b2fbdf2d/graphql-hive-client-0.21.5-alpha-20221222100733-865d119.tgz","_integrity":"sha512-H4zlJZBGFvbTnYn7b5r/iR30jM10MJSBQekATf6/8HiFjsPTn7KFtTNCHXSZnc1xL2+9DA3YiK368LGSp2Urvw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221222100733-865d119_1671703697624_0.9248518267844388","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221222101243-f1e4aa4":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221222101243-f1e4aa4","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221222101243-f1e4aa4","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"521980677c08eb31acc298c845f6716760b3fc84","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221222101243-f1e4aa4.tgz","fileCount":60,"integrity":"sha512-RISp6RFHIodnLdG11aBZPHwund/sfOjtadIT3MZ59Rwb8bt3g7trzH2Wdm6RdNUCbjNGMLII553xRKDi+rZedA==","signatures":[{"sig":"MEUCICuThFAtIHaLP9zfH5SToXZFhv+Ay9uGcx7WPh+F3II2AiEA5HsGUovUEILc+euNXz/Xe3HKkvAP72ZcBCUnmF+hyRg=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjpC29ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmq35Q/7BX0TN9LoeI+mh1K5/l3FJIdWa9jhIZz9hFJy1htJID4pDGPX\r\nZ1aJ8xSf6283Jbb7VFGD9qHm5t1hdiPmbLONfywlakS+ssrQ6e+fUb/vz/6c\r\n5ZcJhZULtq/u8n5a05+wPE6P5BTDImNjnUWM+hHEyEvmESjGs79+u6uYm0VA\r\nHhnnY4mOUkFIoEvWiXRDhD+YKwrWMmG1OHO33JokJYuwmERFgtrx40TgeahW\r\n5JpdieoLUXBIG6RI9zsi6ro2ryjGjaY7seMhP+trEhLSQ3RK+orBuw1Gxhs2\r\n2KpSVcStOA+hZdRqH8qd79PSVqAwqWUfVMulKUtnn3V3rWL0khzaHhXoucna\r\nxyxxGQ9oKtHLvdGvevAnVSLbzZrGpQyyPPV51wkrQJbnVrT7uKVjHEcmczcp\r\nggqihySElCgft9J798+X56h77tMGtuFuQVcDjRyHV5yYA+xTBM6Kf+6wkzvL\r\n+MeqvnmUicPsNIU5wiX3RiYuxpSZ4Ag2JCQaG13QDAhHJtK+lXbrHSAgz/4E\r\nlOI96igz3OcEc0stxdI61hrr+p6c4EvTmLyvvgJaZUAMQHxMcBbD1H5utohj\r\nQGK4P6jK0qpq9uailFZXSEBFlBcF0uhd2rWEP4j5YWoiBsFtHL1Q6mvE1qXq\r\nGBI2qJXAcgmnklxqH9kLAk9avGbdD3dKysM=\r\n=e6HM\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221222101243-f1e4aa4.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/b505b1a258ce3741a17e0fd0325ecd7e/graphql-hive-client-0.21.5-alpha-20221222101243-f1e4aa4.tgz","_integrity":"sha512-RISp6RFHIodnLdG11aBZPHwund/sfOjtadIT3MZ59Rwb8bt3g7trzH2Wdm6RdNUCbjNGMLII553xRKDi+rZedA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221222101243-f1e4aa4_1671703997704_0.17463234714648457","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221222101754-eb1c238":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221222101754-eb1c238","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221222101754-eb1c238","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"dbc6a3ee30c8c8c0f1641b73cfc48f69cff682f6","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221222101754-eb1c238.tgz","fileCount":60,"integrity":"sha512-aBpeTXReaakSdvcZiXUdwYSpFxUX15OBFsy1TWVlLe+qWYC2HRc0kzlDkBa1AvCkl82lwa0Ri1K4P+cSdTGEMA==","signatures":[{"sig":"MEUCIQDdNdXR7fuUHHF402LlSaovt1BbyNkvmo5S7ucA3u215gIgH20xzC87725+KRRu0ZKhUBr+yx/JoS6WdJ4QPSiNMhQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjpC74ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrSQw/6A2JgRDO8lmJdkrDLNXrdnFtJAnPPr/GV1WZGvOrRDkVLimHH\r\n485ihroVXiJZZrATebTYVSxVvMEpLkXRKU0XK4Z9kEXug9tf7ONEsDbE4MY6\r\nAw+RgYyvi6bq5G1t4l/pRORJrY32t+qFgFSps8yt2u9rBJfjSv39pMDy26R/\r\n87x4wQ3yeCVyJPL1gajssfajvRt8TwZ1BkcCklRoBwnOxB3X/kYbIXEZlV/e\r\n8LSXpaqZ8i40OnLI93AEtXtWqnAIM79s+dF3YkyRNCc0Ca3HehUNvwFONZ9G\r\n3BryDh00MqV7hunCip2tewzn7u3BTbxnS5ubPp2iqwEFUyYDynIR60JdU/8b\r\nAa1hVf+aDSySWYCwn90Tz221k2IkQgxMgEHx7K+KOQntmYmf1Spvf8LAfMhP\r\nuRYWHVB6cj8V8/88qNRfjJAtyMaGG/5xPEyeSqC9/5m0MxS6wHkBfKIujekJ\r\nkSfROFEd6cUmkXwY8VAkMCw95SEIWMLxMewPfOoPv5HPrcRGlIAJoeRxIOeu\r\nDLQH19MoXlbYOP+5h15P+EcX7pJe1VHmafV2wan6XWmZIUC34MT3WsKUCDrt\r\n653X4DkNsle2DgUPM2WwehU5s7FYEGvZfT1Tb5Cn2xQaddqMyjpUZN78OkLg\r\n9fIH4qPVHGQ2nyBkNqujRp3LM9VFgp0vAHA=\r\n=O3/3\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221222101754-eb1c238.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/ef033e134649e94d2c8adbecbc8620a9/graphql-hive-client-0.21.5-alpha-20221222101754-eb1c238.tgz","_integrity":"sha512-aBpeTXReaakSdvcZiXUdwYSpFxUX15OBFsy1TWVlLe+qWYC2HRc0kzlDkBa1AvCkl82lwa0Ri1K4P+cSdTGEMA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221222101754-eb1c238_1671704311918_0.6431853230181335","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221222105058-9fca3fc":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221222105058-9fca3fc","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221222105058-9fca3fc","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"ca0724faed057cd71502a6acde9adb230254f97b","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221222105058-9fca3fc.tgz","fileCount":60,"integrity":"sha512-bJBsZE1Lz3f9Q0E7OsMKKJNqLbif0dxiaYLr4Rds/lK0ynBAFgcYZxntpxqYTg6U0IRhInvm3PEWZPlRXI1HsQ==","signatures":[{"sig":"MEUCIQDE22DFGUsZ2o4OYSs8RRaKP3RrgloKldUUDsBNrfmK5gIgZQAwayU+zp7m9Gm8arSdaHfw3K5YD4ix2vR/yWTajw0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjpDa7ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo0Cw/+KPFnLSvaxIiJawYyvIFND5wg1kHlhsPDXVhPX9k4YRhzg4/R\r\nC837FzXVae0Lbro5RDc9nWtElwmi//kkvwjapSbPBcZkV1FxQeEgIxIdlBou\r\nYn+ogK6mFURUxnB/NRUu3nO19lcw09lbHxOzXPb4izPPoG8faTRm6HpZtmbo\r\n+2BPtVON2y5t1BDH4x7442tfUFAXECpD7hke5kH1tyemWxnOsAme2wac4N6/\r\nuZkkML4tciFDJUc6WAJceFRreaLIGhvsbFRfvUKtVz3n7jT4zSzJYkrFkNiq\r\nFsVVWq4VSLh0C+DwEQhqjIPETxtDi+Ce/KwGlgoNHPCOTH3W8iTRU7U9JkWT\r\niYbLqRXFvWwIzSQPNamv/ZjbRUpIxkzfzNrhE1X/LRq5dUeedrOMHE8j/X0S\r\nc9/3HWW9PpKGSmkiLQpRHBX11NrqeCacpmi0NqTgPMGIEVHZJP9KRxA6gqg0\r\nxUVoMiK/HuiEm7IPw6t2/oMWz4TI2IOLpDq0OsFmDlmaIH1/E98KGzigcgGy\r\nwtHRaJMQAJG6PWKqVef+ltex9f2LuDzud+dUKrqNdUJDvfk5JQd453CiAyrb\r\n6BPbQmtnyr80woaUBEVXTKsiveI5puk98QFQBCja+zDBBCWhtEQ9CujrPpb+\r\nzUlLDyp7Yra2luhCPtQwiqlwmDAsznMp2qY=\r\n=Lj/K\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221222105058-9fca3fc.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/a46449e3798db7a393f89d2e588e014d/graphql-hive-client-0.21.5-alpha-20221222105058-9fca3fc.tgz","_integrity":"sha512-bJBsZE1Lz3f9Q0E7OsMKKJNqLbif0dxiaYLr4Rds/lK0ynBAFgcYZxntpxqYTg6U0IRhInvm3PEWZPlRXI1HsQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221222105058-9fca3fc_1671706299311_0.7762235810790767","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221222105419-ac4edb9":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221222105419-ac4edb9","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221222105419-ac4edb9","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"1d802829c3cc7dfad6f0f39d74d84e9a2663c6ea","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221222105419-ac4edb9.tgz","fileCount":60,"integrity":"sha512-hbIlfCuqwoN4t4na/CDcKhC2+7Zq7CBgaXgtFlMG5j1HcvTWG2arqFELecQwvLoxVPz8ceG87UDjtwcp8Q195A==","signatures":[{"sig":"MEQCIC/ITj5sWWtmL+Yf5vZp4RXkYOTIIyqUz/qLPiGGeeogAiBiMzXMujUmaOqBE8/FvoQTmVn++EosKWfPpW/ZtUOP4w==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjpDd+ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrJJw//abIVnW5HQoTSn+1E3+yg3/ILvMpvDPhFxlTKBfbUADJg+4GR\r\nwAXpUZQ7aJxbSEPoinZMMgkX9kplqWwKWA5Kh0wmQlM129zrcRYN1yXjUxlR\r\nhiz8SZ58WLtn+UBrkFYtEqOsXGLh5qPsgporz0GE3othpkpvVm+Rl2YYM66F\r\noQNtt6VYnXWERnfyTz20qpfZGgMmg8GBEG0kjcdj5DzD6sdJT2UD2eZS3wn/\r\nLjcdimTD3DMbjcERPkgOCTLsX4hnlmxg0z0boPuIPBbpdsgmjud3pyw+nALX\r\njt6zTd22n4+VGp2GF9hgOEoS7hGsd6/jjGKTes+7DIX9uTCHuCc2n1Y/t5uD\r\nDF7YQ7RzR34lqf2tBIIRcWpwcpVlK05VZ5VhTFqZvAd/6vf1Pez3XMAPu92r\r\ngWNxEf0fQCU0EEDeacQ0enCGr2RsGFx3oa2vIMJnOJ+743oKOtByXRn5ZXv5\r\n7l/OcDjgvk+ENJRhG/CH7KZpDoWbX21e9hATiqB60tqRwu3jG8CvSC6SYg2k\r\n/HZe9XVI+s9JN1wFAXp10KrZ0YdVjJqQgCBgwYhQIIII8BKeYOPu3Kj9SZAF\r\n318Z7iQvE6CaoCScM6d4VqNDi7rUz2FLAwONQOUmGY39+lapQjOKwYMcCCWL\r\ncxzT3t4I2QB1/W1//fWL13CHhE8dYKvIWbQ=\r\n=lTO9\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221222105419-ac4edb9.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/5fe5281e0a3b3aef2b5306509900c9cd/graphql-hive-client-0.21.5-alpha-20221222105419-ac4edb9.tgz","_integrity":"sha512-hbIlfCuqwoN4t4na/CDcKhC2+7Zq7CBgaXgtFlMG5j1HcvTWG2arqFELecQwvLoxVPz8ceG87UDjtwcp8Q195A==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221222105419-ac4edb9_1671706494199_0.8406045853025133","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221222112452-bb0da5e":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221222112452-bb0da5e","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221222112452-bb0da5e","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"a5aec85ee2706a8d5ca048d0e84e8bb76b1a164d","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221222112452-bb0da5e.tgz","fileCount":60,"integrity":"sha512-b8n80huvgUvLoCu9+TGjFUF9k9MOgURhTUR9C9BrfRRZcMvYOMXocrFUtPLL6SLoAmt4KY9eVwBOxUeRqweVcw==","signatures":[{"sig":"MEQCIEyIWAANs9YBhFtDLJo3vvCUdW1p9aYA0WOPhPmIE/ENAiB/GRcjvxt4B+C3S9/06FsNAds6uHbboZ24R7DM/32Z1A==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjpD6oACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqGdA//d7Sx16AQJOl4ZtluU7DvRfwm8xLkhEux85isaPNoKiUB+CSY\r\n+xTMT25OIsk9r94knYOzUrwSDne5bbdaMCdfn3y3QmG3hRbwZvrkCcuYjTwi\r\nqUTaNN8RQxu/hAN44GMIB3eLTLZ38yWnowKG+8YBEqzw6IZMO+9nwYOnLO2D\r\nQcntKmMJ5IfKTpCwI0c/Zo+oanQwyhnhYtayjR82TzYRcY7sLG3I7t7MGqlv\r\nFXRH9inCLoiNTWVkTdZApvb81ANwvi1dAfPhiS5dkoragpSTgSoMTOfiUXuD\r\n8IE7o4cOFCtmeXC1Z0lVO6yqNl5t2lWm7zMm7L5K57Ehxu2pqvPVTqCpHcuu\r\nFIfN72W4tsrqK6S9oHF+Yy69Xa1+25TLC/qBdsAS4LW7C2kzB7+7OLD6YSqE\r\nU3jM6FLFsBbZHskfL6SdLLmhnsWNrk23v4Y1I7GlrgqhGQ3xZt4vvoQk15Xw\r\n2U2Gq++qm3lM2eZBi4wYO1+lwMGg4/bz5tsk8PvsmsFQd4Ec7N+i0rSHbjC0\r\n7l0T8/qqHrfScJ39GrpZzbUdE2nDRlxY59mxdKOpxeN1RbnjvI7FpV79nS7h\r\n/OoAIYbEFK0xdmT6kGly5C+5OSFE1IqtLtrBnhIPu3pbKA0WvpYQz5tCbL1x\r\nw2Uv3DK4NhpYNbVpd2PPzCCeS7sVC5BTt/o=\r\n=Y0bM\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221222112452-bb0da5e.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/c056d35c3550b703942e97f999327028/graphql-hive-client-0.22.0-alpha-20221222112452-bb0da5e.tgz","_integrity":"sha512-b8n80huvgUvLoCu9+TGjFUF9k9MOgURhTUR9C9BrfRRZcMvYOMXocrFUtPLL6SLoAmt4KY9eVwBOxUeRqweVcw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221222112452-bb0da5e_1671708328574_0.6009465825000169","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221222113039-67d8069":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221222113039-67d8069","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221222113039-67d8069","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"06a1ea697379d36140cfa97bdd033e818494868f","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221222113039-67d8069.tgz","fileCount":60,"integrity":"sha512-HaG4SoYxwaOiiB4sv+8diQe9u+AfetGqxYFr2NbPNLECL+PmR+m0V8srBQp9n9R5ExPUm6PLlLbF0nIpVEsgxg==","signatures":[{"sig":"MEQCICm+JSehrRsxeXQT2quZ26nYfw98C4Amp9mgC4y2qM//AiBdH+6cZ0GA+/Q5tr93HPtddmCTqJT+O7QeyfXWb63dCw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjpEASACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmprAg//To6KZumUo+rT/swmvaUtS7DD602RA2Q/j3XTYtQv6auUXlwZ\r\nJxb4wpD+F9dnSOG0bkRReSy+CosyLIJaWp9UFrIEPJvt4kDY5Jfmf+A43+I2\r\nfw7UwV/BPELiOvQFBssa3BH8svoh1MXi8Uo6bUH6njs7P1BUmqAiKAw1HmaC\r\nsrjMUwBPMp+1RsNM7O00dVW/Akwn6Y3k/eQC8SmkAZuSQ8ijzHfLXKI1mlXH\r\nhttqMG/GSWLOrQWyqdnd3oxj8aITYCNNmLlCyzcBVkE18Lygqy/f3Mxcm+Ls\r\nsyaLmaeBKlX4rho9/ImjMGUM7TGMe8Kos+oDcFFy3p/PxjCN+a5muodGsBY4\r\nLp5MX+FdspO7Nboo/88bXTlkkaQ10FFHRLp5D48eMUn5Wo/IlALYwEdAuXTm\r\nnuo4sR/+9B/FJqWJNiLxF9rGGry4DeJjO1PObl/IDf8WgXbJw9RLY2nFPSPm\r\n32Qtt/bM229dzLzdG3/l8zs2d/ashV52IdNNqEMcfVTPDTRBwXeqSPfOUK/6\r\nsdA6lUa5Puz7bQjaAFMdEFFUMA0s0na51l77SoKMxfSqRjdaX4hKPOuK+Zfk\r\n55BTo/IMHQevoxy2MU3lVW95YLz8khWBnMsBVGAaVxMKpu6mv8M+taDlMKRF\r\nrayDYJFpVhnPf10oXp5ZJBJ2ZzKwH/xoOqM=\r\n=/koh\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221222113039-67d8069.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/75769e460a60f0b36c96976f131f7f74/graphql-hive-client-0.22.0-alpha-20221222113039-67d8069.tgz","_integrity":"sha512-HaG4SoYxwaOiiB4sv+8diQe9u+AfetGqxYFr2NbPNLECL+PmR+m0V8srBQp9n9R5ExPUm6PLlLbF0nIpVEsgxg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221222113039-67d8069_1671708690123_0.1654158915960402","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221222113513-921dbff":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221222113513-921dbff","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221222113513-921dbff","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"a43ad65a6ce9c41aa01ed75b38dfdb24710500eb","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221222113513-921dbff.tgz","fileCount":60,"integrity":"sha512-D4bRJ8eq++VkdptlRBnzJgLyAusoGbuk3T1MX0I/yKYORPBch97dF63lmxfWPT/VSagq2z4Nw/5ekw7YXQSeFQ==","signatures":[{"sig":"MEQCIHVi2hPBxsAQjr/anMIVmPrwHjiXz5sPLIz6GSn+F5EEAiAPk41WmyeDdhNoMJOZ/wowmXQiOLSAknVGAZXQTSYEdg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjpEETACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpsjA//ebkqpPuZ0H7LFLrjD3iuyjfKI+fBaq/7jzXofPeAuYlvl2YD\r\nbFreBxERpIKxcs3POWhQFFsW4AT1URqgDr2OrBO934BAWnIpcHDOcwNyJPYK\r\n+UrngNanPgp12Ct1K42UFHUTDKcpv663pK+Uisci3Uwz5XWj9R3+WPeRJ6LY\r\n3ePk9Bv+c5dvd98IXp6RvL6y2n61KmNO2NgPz5VD4x20DBIn7GQpCdClpwrx\r\nWh2PzAsrxdt/3vG6jFK1HN4FGYWanUVDdSIGQZswyPMTLVgpiwzE3m0H9C8r\r\nagVJTNrc26wvB+pJQT/13O8c2WKx3kPGrf0A8soeJ+0G8nDHty9v2cseiaVz\r\ns/rnRKW4K2RKuvCTtlDMMC68aYnOo7ibj1mxUYK+dGIWq/pY/NUbfzey+LYs\r\nXtd0ukNfOFDtt+4/yJfOYZOft3BomxWRDMyjDWC7IGBnrdxEI+wsjauU3rbw\r\nzK5B3kDpcW6HkiTe/FY3tfOVSgx/NPaP0J2U6vz4YpUVWWyCzPPg5EmJi+uF\r\n1fvmrJ7s1Yz04LR2SOPtwHwuMEB4zCIdn/gBCJklc1z31W1NpQm4AuNPRj53\r\njd5a1nDnPDo1tSWab/qBOZWX6mdQ12KmJB4VCP/j/mWdm5624HLxIWDnI4B0\r\n/oyF6c1VlPhd7nqj/0gsGmox/cIEMK0Q+gI=\r\n=91Lb\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221222113513-921dbff.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/7200ce68ae03f25f5c68d1509597c412/graphql-hive-client-0.22.0-alpha-20221222113513-921dbff.tgz","_integrity":"sha512-D4bRJ8eq++VkdptlRBnzJgLyAusoGbuk3T1MX0I/yKYORPBch97dF63lmxfWPT/VSagq2z4Nw/5ekw7YXQSeFQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221222113513-921dbff_1671708947653_0.45670743658595625","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221222114530-160d0d8":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221222114530-160d0d8","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221222114530-160d0d8","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"1bba763ecca490b0f300bb36399005089e474737","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221222114530-160d0d8.tgz","fileCount":60,"integrity":"sha512-n9zi399h0MRcQpSIX0zsyjhf24VIw3AIJd4g9Y0Dxgaex2ZOsTdmcNDn9nVzX98sxbMXAHvxNijWZrv40mdp9w==","signatures":[{"sig":"MEQCIDMJyTDMK2lLmGNtI39GQtImOR7RE+56wTG1BlWBd9h3AiA5Fc7N1SvyNNGdBJdikUWo0yA0DUWe+O7HF4YX6G5DYg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjpEN9ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmpspw//Vf2Nr9IzsE8nTKjCwACpMrTK2AVS9A7KJb0BdZrFtllZcuX5\r\n50TW5mvMNAbjAHMfGfclTzX65vFTXmVf7ZM3BheDBz9SxpTatCFpyiCPQDAp\r\nQTsRSe/24ByY5gcLTISNf4H7zy6+BkHZmH6QnLYrLTAguGMQA/WBgth1+ZjQ\r\nYJtOkVJK9yIQ7Yla4+Knttg32sjZFYNTvRypX84QzNT4qS9b0eK2cLwR6NML\r\nIx+Q3+SwHn+PUmbhRqVmufJt4lzTrj6yo6GzfNVxFthgd14QmABfuKLl+M3C\r\noM6vUwfW3neqH+yRo1ibQkOWPR+qK4YxCB1iLqkMyqGPjhyYu7y+hu0PNHZT\r\n9E6JvcrczyfIgx5/hkDSz0cMSA+wktvzX2shTYqSBfOxIvfDdIGijEqd7sUP\r\ncdAbjQ2ixFqYkizS9+Wmk9jqxWySnqHqQH5CMUg+aJsZ8D6Y4ieCDIeS6DaJ\r\nRGr0GwqEtyvCjkbLN7wWTSEW0pKDH4GfTyca2H2b4cXc8Chjx2q1v2ywGXRP\r\noeA4w3+KKKEMd2ndYr5+JIhe/ricc842RNldO1J8zUsH8vDDKd+Pm84QfGQ6\r\nA/lZuY0DHpqb2jXYnAk2pH9IH5Z16iRAENtxWsOF4D2WqbGZ9VNQVR8oyQv6\r\n1CyurVL8OWVHk2MZ/SUUT3Mwy7melEXeFOQ=\r\n=zmR2\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221222114530-160d0d8.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/1febafeae070a05b68accd0da1102cff/graphql-hive-client-0.22.0-alpha-20221222114530-160d0d8.tgz","_integrity":"sha512-n9zi399h0MRcQpSIX0zsyjhf24VIw3AIJd4g9Y0Dxgaex2ZOsTdmcNDn9nVzX98sxbMXAHvxNijWZrv40mdp9w==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221222114530-160d0d8_1671709565596_0.4972438093204501","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221222115130-3a708d1":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221222115130-3a708d1","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221222115130-3a708d1","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"59a479342d63269bc3549c16904442ce98cd591b","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221222115130-3a708d1.tgz","fileCount":60,"integrity":"sha512-Mdb6S/caSU2eBysOP/tNDLnzHGE10W4rNLZ+Rc8o2y4quilAGtLJ/dDRevi7Esy2XftD+sRRbrygpmOWTbjoHQ==","signatures":[{"sig":"MEQCIAz+gXN5A1Grk9RVmupWUBCg2XFb6XkqlMI9njNl7wSnAiBhmpfnY/KPsWWQnN3qW0/bw1ug733fGXgSQaa5xxIt4w==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjpETyACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmqg3g/+JU7JJEE0iAMp2EPqKkbrWCGJuEEfSnhcb2/Pq3agEHwkFe2+\r\nZHO1EA8c7i5iXhJI8wmPzhGJLSGZ3MWx+Od1VAtstTfcIR+JdMTKnNEJ7jCr\r\n7o0tlmVMLe5ZdoPW1ODz3jvbmkWbZQSXZ86kYAwrUH1+t7EhyLAq1JpdOn1l\r\n07lrsY9oG1+ZQpEzQIAzExjv20V2JvVLTW7nx8zm5e1WGmWyCLDNitByVwpA\r\nBMCDPqjq/1mQIAU8G3MQRdiTAQOgdRiaAt+zTkxvj+4XQtBq8er21rlaIMP5\r\nSKsYPTZwLupVYKDurEVELgS+RhfK3b/wYHhtnKLdhszPNWOWWzNN8dQDsHNJ\r\n2z+SsDCdAUjlyoiXi018JKsYxAhLyYBc02sKFAbLtjNQasz2ww5/lJnpA3nY\r\noecuxphXuf52gVOQnt41erM5ta8BsTqObKslyz55Hekoqn8+0RbQmgpKWn6y\r\nuLV/mHnoA7fUGYjJfF0Rg4bFCefaLQ9sVupjFD65WlWt0NE5Ib2Sj4ytT0Nx\r\nWZUjsMKH7Rsrg7qudzzY8cXYzoGpi1YtJjwTEDIf7IePkxQA3d8BzCjkw7dW\r\nmdXR0Eb5S3ME0BG1SukfIdh4k9J8jbQUfqKlp/mS4ILBh3wigePRlZNg+VNX\r\nLnfYqb6RJLRH1ji7MNBYH+2tQu16h22k5sg=\r\n=NKU6\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221222115130-3a708d1.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/b049433a9db203fa2ed53b286fb89954/graphql-hive-client-0.22.0-alpha-20221222115130-3a708d1.tgz","_integrity":"sha512-Mdb6S/caSU2eBysOP/tNDLnzHGE10W4rNLZ+Rc8o2y4quilAGtLJ/dDRevi7Esy2XftD+sRRbrygpmOWTbjoHQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221222115130-3a708d1_1671709937933_0.007798505197800676","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221222115245-7b3e0d1":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221222115245-7b3e0d1","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221222115245-7b3e0d1","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"a8646fd15a8e73e9d2eb4dc26c0f563f9965b75b","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221222115245-7b3e0d1.tgz","fileCount":60,"integrity":"sha512-7VN+9+zZK2pG3eLT0ILerg+rVNf2mULIifPz7XhekpD10T4bR8U9qy1LaJJbLwmCmE0PkBmFTGjdP7OPlXEDqA==","signatures":[{"sig":"MEUCIDpsk/JdStahQyYjfeacAfZtI3KTTs3sv/bd4ae9JVd8AiEAg9//n6ZYPcDDMJ8uMOJ7TArbtEXXwkT97zXR+A06J4w=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjpEUxACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoiOA//Zr0U6CnjFSeNE/fomJ/1n+FC4ZPBEssdcEln+lDbTphv3NqH\r\n+3ZUPYzNXOaKXkjR+7xHM0OCfKiqm4QgSJI6N2TRTElxFPnVti3nZas0+ixs\r\nB3z1pwiqi8T507V6qyPYNrkwtq8ZzRCFCV1F/PxE/oHU6EuKQsqkFOeTjop9\r\n6wn3G9jqJSzykVKa0d7Ajhwa+RLM99hA4nMmJAcdb+zmgBgdoFjHdbN7OwAe\r\nVFzDPrR91Iam+P/xcQf0Ytrv9VCrVtBD4NBhAO3ySLeTX3RR+5CdOiqJ2S5I\r\nZgvs3Zdsr/00C3UoMZXg6J7WNv4rNjKAThOPr9IaCkOw0j/lGFvOQNu8hIA3\r\nUCv5m2Za4S4To13JmM1Gqcb+tcbJND9DRkpHoMx0IhULTBAMxXpe4pXnlr87\r\nPy9nyZdeW4VrsqNuXwxh8XT5fkgkvil+7HBZx8Kb4huxKkmSMH87GNXpqSiu\r\ndi26272vA/7q7hTXQDVEuLzdAEws6XUhChDhrKr/dHpaBVAJQdKBIV1KNs6H\r\nE1MVfLwMHi28a1FCsmTN1hvbhB6I/6f5NV3jGqYrzkyFrtwjU10JuzxIWq/l\r\nZnBbLlLVsD82xIGMcShyvA1ytJp4zLyDUznJy6uBrr09iJSLwzaGwcCDMmmD\r\njFICS549Mkm/1V9T1wKFtTWBABR/hMmpp6M=\r\n=3mzz\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221222115245-7b3e0d1.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/a4656928cef531b7f6f23a9c6e139d3a/graphql-hive-client-0.22.0-alpha-20221222115245-7b3e0d1.tgz","_integrity":"sha512-7VN+9+zZK2pG3eLT0ILerg+rVNf2mULIifPz7XhekpD10T4bR8U9qy1LaJJbLwmCmE0PkBmFTGjdP7OPlXEDqA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221222115245-7b3e0d1_1671710001408_0.8004071215396338","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221222121024-6b76508":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221222121024-6b76508","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221222121024-6b76508","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"d2ce1e80a7daba73a083b84af4b312c7ead8d0f6","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221222121024-6b76508.tgz","fileCount":60,"integrity":"sha512-V51hEiP19P1AJbSLIpCNjS4K2ynkg2CHrR60Z8HSc3DRZCpZeorWFCvclpl42vmArdIzsJIVIQFNQk3Oij2Y9A==","signatures":[{"sig":"MEYCIQCMZPRJ+IZ0Va0tl2R4cJLgxoFwEm2ohn3jZTj41zA+FQIhAPY8xD7lQ3X6o75u7DJ54QV5vFQ3qfaoMoUqWBPTxdov","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjpElTACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmq9Pg//bE/7H3p1yOmoHFjRNYtTLjmiWuieRv4aoDuACZ1H7JKJcrYi\r\nOGCsGn3EEuAj1+nOxygsfP6qs0tN/SIbjka7N7nZR3Loh+7xHXlBT0vFHgxs\r\nwQsUSzaeCL0QLhMeYxJ5hWCHmH9NGw++xbzIupsfaja3O1MPGFj3oIPX/hYv\r\n6iGtVYEtpAaLNuYen3uD4VW+ZDOfSRi3wRzzAqmVxcgcciztTyoglierna+j\r\n2yxvj2AH1xBmBWiw5qOyt90aQHuNd9zXWevN5IazmtGs2sAsC1sQ2+nwZC3Q\r\nA5SBJaOvUIJpciacaG1JTJThtgTq0XbgSVdYRqr4Pl/6fyiE2+u6BRjPuw7S\r\n/Bdx466q5ArOKl+XW7aTEzFxtzBmEcGWvbgK2giTCRPTLjpAGSNKeOT28cp7\r\nzELojI4nzLYwPVZj5pMIX4U12J2uUKFWwXrkwNaq+HyqfnwYQXGZ1W5qmRNa\r\nXtbTVab/or3E8IbV412wauBa6KoYlcWGe7XN34+vhW+7cehXaxO+utc6hokA\r\n3v+8e5h2lCA1UiCQfvspkU3cB5o4UeKvFRW+8U/7K6JJ5B0grtIP2IPbkY5o\r\n/+WJk+cuyfiyRAbe8oa52tgKpd+xZsVQ1oL8KrmiD5QeCsAh3KkbcfQ6IVt+\r\nqU11Fm9a58GGKwJY6gZHHOaXho9d3jyew74=\r\n=5eWS\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221222121024-6b76508.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/b5d0ccb62d4b98a53947b0a5b412887b/graphql-hive-client-0.22.0-alpha-20221222121024-6b76508.tgz","_integrity":"sha512-V51hEiP19P1AJbSLIpCNjS4K2ynkg2CHrR60Z8HSc3DRZCpZeorWFCvclpl42vmArdIzsJIVIQFNQk3Oij2Y9A==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221222121024-6b76508_1671711059609_0.17804905739322385","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221222121533-d57751e":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221222121533-d57751e","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221222121533-d57751e","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"a6a841e54af6ba76e6e7770961198fdbc445d899","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221222121533-d57751e.tgz","fileCount":60,"integrity":"sha512-ZUSJeHp0T5I1HPpCG1dRJoBbndMzjguMcIqGH+wqdFBfUcPhkM16/mUiRVdLVde+Aw1gUP6tqT9VVfYDG7K6vA==","signatures":[{"sig":"MEQCIFSWd68iMdXltY4vu9g0BdYWTlWjsZNx5+cCvrk5xSWhAiB27swS7528zXJpC/zzL0o3ANYNgj62ppHz1chVTCzHWw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjpEqIACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpYuBAAkxP4ZNCj2VAJKnVV90f8JU4ykAifVX/tzqLaayguJJYc9qTO\r\nWhg/5OE3sbjKJfQynEKVMDVpIzbIdyNJzn5c6hLojUlUTiuA/wunNouCWbSD\r\nLxyyH/CgcXWEp63aehd2ih3JrWS2QAzGgkRPCp/GP6UxvByd5LKrrNDEJqu4\r\nk7tkE7+fSBmiEKqx9CEFid90/+KUka1+Y5+1Q9pC4ew8ocEiw82y8Y5jD+J+\r\n03ozqRauMt6btfpo7EiK2T3tm5r4CJiFtqjsH+x/U2MwwZBL88nhjWi4KKKd\r\nM21TfsjBhsfBJGpBN3O9xieK98wcoU6ZCC8Z+zxqdcfq+uQ9zGti3aXz8OEf\r\n0GGN1hDKnmTGdOPcA5WFKZPGLVkCi626yxwCLQZghx8z1VXEIZPliTkuDPbg\r\nWAoHj5kf3uDCdsSO9ztAnypNGqozZaZJX/h/KhYERrquqEW3LExWDwjna5u4\r\nRvZsXeYgA5ubvcZePwyL6oNdbApWgzG5T4Bx3eoZJK3EPz9pV4KkeYRN4Xo8\r\niwg2fJO5SKjDk/dzUWwtVDt8gLqCkZBDDagetudTOJsPgPs9jsw2UkWgBeAy\r\nlJ/2G2cv4xiKyoArG5fhzxSygq9C3RI84pSMvpvLhswLVElAD+Bx5XbwFOfO\r\nCAd27xM+j/21LTd+GDF2a/jc2TwDV8T7HLw=\r\n=66O6\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221222121533-d57751e.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/b892b8a6346aadf092ca3d48cdca0062/graphql-hive-client-0.22.0-alpha-20221222121533-d57751e.tgz","_integrity":"sha512-ZUSJeHp0T5I1HPpCG1dRJoBbndMzjguMcIqGH+wqdFBfUcPhkM16/mUiRVdLVde+Aw1gUP6tqT9VVfYDG7K6vA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221222121533-d57751e_1671711368004_0.9540514028213791","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221222122052-6b4065e":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221222122052-6b4065e","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221222122052-6b4065e","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"9f14f6abadf156fc9c4cba7fd321a045239603ae","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221222122052-6b4065e.tgz","fileCount":60,"integrity":"sha512-D3EfK+9aD3LP4wRq8ndjsN+hlyp/6TtLka5oVp258ietmuPsAZfVc2zUUYw1PYRV1UC7OMasOQSQC5p5XNi1lA==","signatures":[{"sig":"MEUCIQDv9yCQDsrx2W7Gvd5vRKpdaB1A7giWxws4AqfMx1FXlQIgOMRzk2+EDXdeOG/e0puB1GQfTui7st22PpvtxhiqAa4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjpEvFACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo1lBAAjxG88I0/rha1Z/vKQRKnFlFf0f7guZ0VYnJ09mMx5cpvrmuG\r\n7MckuyPwGTWYck8/Ug6bsh9MNCwx71i9dfYwxNv+NLigZf4tzP8+mRXNPc0w\r\nsF8VLHNNCsx4m7sNlavrIZSFlX5TPAgu2rZw60X4ObW6MH7xDNXMTJJdBMEc\r\nCfuCRtpCSLaPP3zU9E1kxCyO1x2HJv2YP39Rni06eqzkck2eh6kimI5DtMYv\r\ngX2mHUrSSzIuLpA7WY5rUf3EF17c0P5hOyAWLBiie1TJm9g0zvaEsQ3Crkd6\r\nhZ/rS7xaGYh8DJZJghhVOFiwP87iqAV4tmwKFv1s8kGpqakSLAIw3yZq8X8m\r\nv4kLbrBOD8OH/G0QSSncBvLFfa5JIJicyIz5HdCodMpUCaxhkJR4wdkKtwG2\r\n68kv1RE6yv7Rxpb56tHMSzqtIgz5TOcEVg2wm9zEb7I7P55lH/4E5zDxuii7\r\nLtlH7bMUm01IIsQXJlim0JybAPz+mhOuY9ZrrNq1ecfzyB/1iI0xyOyUPxJB\r\nG15RQ6PVQrjSFlc0YP3gqak5fm0humQC6fWuAc3HenoHCzIomGg1jbhirjHx\r\nL01UQv4d8T8PmDTgM6EDcmyg6W/gd+vtWy5bfsT1+U6IRh6YhxLK1JiSBCZU\r\nsoRZydEp1WHu4fYWg+gqeCmEmWjW8CgBuWs=\r\n=BWpy\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221222122052-6b4065e.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/7458062438986671306f92ca26356552/graphql-hive-client-0.22.0-alpha-20221222122052-6b4065e.tgz","_integrity":"sha512-D3EfK+9aD3LP4wRq8ndjsN+hlyp/6TtLka5oVp258ietmuPsAZfVc2zUUYw1PYRV1UC7OMasOQSQC5p5XNi1lA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221222122052-6b4065e_1671711685525_0.7638283315716823","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221222123148-2ad655c":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221222123148-2ad655c","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221222123148-2ad655c","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"141746e0ae26c4763fa34bb9fb914ecdec8c66be","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221222123148-2ad655c.tgz","fileCount":60,"integrity":"sha512-YMYfNi9oCencDTEFRgRDAntMfsMX6TpkB0lTz6WioUiM5C9l7w7wmvBbh3c23N/42aBUiVO2Z+q90EXvDfxqtw==","signatures":[{"sig":"MEQCIB2jsbHK2DOsJzYncF70QAnItxrgK70JrlWBvZC5DUkYAiBq+EiREmyOVoxC7VBVQi9qMtT0uh/OrXwJvivPmXBKRw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjpE5WACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoDoA/9EIk6bzbb8ESlrmWydCEBSJMOvtkn75SATIX7gCQDEhSG/kHK\r\nGq+C9Vxv3XJ0yCV9eQhDSFrzoZIWqJgblaAjJJcoOlOqxYHV7SpMzt6C5Zde\r\np1xvqn+mXuctRXPitFzH94rXd5oTTbHsHfBQKRIBNaDZYxpc0yJRCxcAEJpS\r\nl9gGKSxYYTVzN2B8tZYsvUn4aw7OPaB0MJdjiUUTpp8gdGf9SocDYrHdhpN5\r\nPtiCvlsBFITg+rxWi49cVnFihQMAtjU5T8O9b9J/uwJbpUJS+GoNTPWIQx9d\r\nsLyZpLVbJ9H75P8qHaLNWLL/OjTwLYNJ49k63/REQ+H1YXlYn2Oyjzj+wkPO\r\nISx4bfWi/FKL6dZPHsRwinUDzeND+GP20L17aJMRUQpC3GmM13TNGYgv5W7C\r\n8rHefQrWilYf0bMoUv0va4dXxlgh0m3sajHr3hEMMYP37TcB/bY8vD7MO9rQ\r\nnchtOMAxUsRiqE7rHtj3oPEiXhgQBgp6rIlLX+HK4gyX02eZr4QhjHvZuUvp\r\nt1oHIFJuMf6w2dtE39WdxwpoxccN0doUfYgl8Gc84ieeDIyplFTwcsd9tJHe\r\nIcfJy8C4y8EmHxQk9chmxtc9MdCKBQX6FYuHClUKQgoTOTTIwTZhDT/uELLw\r\nRJ2G7/HMpbfW3UiFov+kWJ6xU8EYKe9vkyM=\r\n=efZM\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221222123148-2ad655c.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/4cbf390108f7b065a9c2bb8d94686f6c/graphql-hive-client-0.22.0-alpha-20221222123148-2ad655c.tgz","_integrity":"sha512-YMYfNi9oCencDTEFRgRDAntMfsMX6TpkB0lTz6WioUiM5C9l7w7wmvBbh3c23N/42aBUiVO2Z+q90EXvDfxqtw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221222123148-2ad655c_1671712342501_0.0540416364880123","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221222123652-da2110f":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221222123652-da2110f","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221222123652-da2110f","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"4b3b33bcd9faea9ecdbb4e4b056e8914b937b94b","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221222123652-da2110f.tgz","fileCount":60,"integrity":"sha512-FWXDEVaGMtiEYmrmsNh/zeMqC5neQgTIK7vxKiOoOOREG8zBEVda9UdhNcmwO8Maoc8mfuRSKy6HS2s3o80sjg==","signatures":[{"sig":"MEUCIQDUtS32nIxr89OorV1Lgqpr6FqzqqKbiDpKM9Fs1zenqgIgHZmQNHA5gdKo3V1rBr/E5NmdR9pUxRumC5l97xBttf8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjpE+HACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpRgQ//YR7dLYQTY5yHSaEBrh1Y+ry98DtM+BxQcAaNR5BXCY5Trb+n\r\n5qwpZML9vLhw04nWMje/GOOIgfS4w2dY3Oh6ni7rPdgSBTOE/GVVrgEkI7nP\r\n7dDkAPOScyfqyav+tD+33SN8bg0ONCzIWmTdT9fdPlXrmuAoB9YclGv+rCdt\r\nxlWsqDe8NViRhVAPUsTqGaRM/cnx7rZv4NUAoYQuTNGyyDbk7jcNGQVjVYR4\r\nA2IphFO2n5qU8G7o13KMZinLdQE7W3Fm7ZAjySHbGwqMZ7kd7NFtlBtDIMEf\r\nzGNLP5Lekd5OxrKxhBHSehimX7u/OikZnmzJV4ZTcJWO7Qd/pE3YgseoVw2M\r\n6reoBMKrKgz/QRl0mqm2VuwetLicdV5NXW+zFct7mNJhwdoUc8jqu1z+QviH\r\nB/TaMohB+sy6cPIkfn8UWOxrLLLmEFfQPRwK7cmzGOp6Zm1ENDgYGQRyKwcc\r\naZXZGZvGnmV1KCyAvwAEkXu3sUlQ+LywY7opB/4fAKEsfXw2rjquS6VqASmE\r\n9fNIeJKYxVa1cCT/mgHm3gFX5I46DuIDygZbej+eHQEPTEep9ZDU9zM9VG1f\r\nEFZeXPJgULlGXj2q0saFb5SSzhw8Hg+6usxz2Gci/SOLbQiU/d8srq46AjDH\r\n3MyuI2ao+8oNw+3yMwN7LBRxNpi570OHBqE=\r\n=2WPy\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221222123652-da2110f.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/f2a32549cbbf1b2260d3992779dade2d/graphql-hive-client-0.22.0-alpha-20221222123652-da2110f.tgz","_integrity":"sha512-FWXDEVaGMtiEYmrmsNh/zeMqC5neQgTIK7vxKiOoOOREG8zBEVda9UdhNcmwO8Maoc8mfuRSKy6HS2s3o80sjg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221222123652-da2110f_1671712647482_0.08992589966316467","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221222123906-ff709e7":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221222123906-ff709e7","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221222123906-ff709e7","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"33a78e1e005e89db27294ad2603551166c48de82","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221222123906-ff709e7.tgz","fileCount":60,"integrity":"sha512-JrkdrrhAmHDYEJEDW01hEzDwGtNyItEJzNMS4axlGpsHUQBplGsVx5+/wHEp4QM7oZAQHTRDzc0zkrTb3lKX0A==","signatures":[{"sig":"MEUCIE0uY6/U0T1h7PUijTyV1HZI+woRlEbVELmIjaDr82gmAiEAybOjKx6xG0Cdg0+iUSerOKvzp36AsJbvxtUlBkjkPN0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjpFAYACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqdAA//ZE3CaMg2PPrI1xuTGuxfhIgnIfUryd5xKDKNpjmwq9mIoJBx\r\n38x77XcDKRXPJ12JSuq2ptzayJ6b5xbHtewt0gDbvx6BJs0u4j1gTNMHzqJd\r\nWsumfl0XEXWoXiVoF6UcvtzUN0a9cD3LnO4xvZalBGMt9cdmlUnKM9wdmCcZ\r\nc/TZGMZAFPUPDxL2mAf+brNwvsPFNOwwQQAUOGUx8Lt8KlaI8/yCLCqUrA2n\r\npGhwDAaE8Rtokiceb+kFengxYAxJwi5aTl8fHTMxQQV4m7F2i69CTF7x+OWF\r\nsfIA9G/2Xf1aKWfnASaVlldaMhM0GVix2Rxj7p+ZHzDvFYEJxH2T4gWvOmsd\r\nL2XX1FwXqYa728CEYfDXn+0Kx4ob8+uU1OlsNuDkTeOvuHclcRil1NArJIuv\r\nwiPQF+D0wzqVbVruuLfDjyoMNZuFVrrls+S/5dDBZAOH5LP9+WTXG1B9M2jl\r\nMgdtpkgmmycf7o6XA0zGWaGczkmurLdG6S3TLVqjx2YGfheZEEhtJ+s6FU2w\r\nAAI7TEHSRgiTOmDTMRi1QSXCE+2Jwx849LUheLD8dO/bIazXNoLgW1dgwUzI\r\nMYFwcTRgWYu2QOgst1bd3Ixw4vk/dZmAnWguo+n3vvY+QQ1JX62ZR3VmRuTY\r\nDmpvUdsiKySYXGT+o+AChKXCwabC9U7x+Tk=\r\n=ydFz\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221222123906-ff709e7.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/779f535cce8ef64f6fb0abc641b4ca99/graphql-hive-client-0.22.0-alpha-20221222123906-ff709e7.tgz","_integrity":"sha512-JrkdrrhAmHDYEJEDW01hEzDwGtNyItEJzNMS4axlGpsHUQBplGsVx5+/wHEp4QM7oZAQHTRDzc0zkrTb3lKX0A==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221222123906-ff709e7_1671712792698_0.9265820918811438","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221222190957-8730c23":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221222190957-8730c23","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221222190957-8730c23","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"befeaf6b0d30cbb053e95cb94e2f58fc8424ab2c","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221222190957-8730c23.tgz","fileCount":60,"integrity":"sha512-4z1hptdJNucOs1HTqHVokAxRqdLMncASpVMiLzgLYzScIYqBKIedB4/PKmor8V7xnuorKOayJCWqFcOQ1/ZNLA==","signatures":[{"sig":"MEQCIEp4rDWS7gTaNuaAjz1Os5WJ0x36Ng5IZZ49VCzpEWhWAiBAz2Pmo0xpe5AvepTQKzeyDKULdRtERB0grYrLZiu6gQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166013,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjpKunACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmq5lg//eO6jOlmFc1Yq5JPYNA+eAezVJmakLpALZ1seOi0gGewrE9tR\r\n1xGtFwGeZFWdKFd2YRCel1KeBrhBQYsKxVOw0aJxRO9XW3BeufTMv1jYbEDF\r\nLvrAqeMS0L0JtJgVdsvq1E/0L1yXCGa6mFIcPrmEmTbU3OSe+jOKNGBishfw\r\n+1go6jNcnhevKOY1y6mtXYo1RLgOkCrjZvDu6ed3DvAkHKGe+IkXmTpawmpo\r\no50d1CgLt9LKtUy89H+E+03nazmH5M+Fu1xGgvNSXGmGA1rsTyCN3xNEE/Mo\r\nAmajtRqxMRYtbkoq3c0T4rIhEYvU+KNnAQBCwSznnh6RaD0w588PtDoX9u84\r\n8T8UtEvjYdlgq8dn/0K4E6m1ddDM7UgV0grt6E+QHg3NWrKwt1vnK2YAch2t\r\nHykt7pRK7KPF8AggJCUrOCfWwIHynMkhEvAQ4mYZUURC7Az5HOwBstwe8LJX\r\n5B2ijvc+rw99LcXWBiFEV0MXJOmYDkOcTSAmcl+clh3kCBjkFF9hY4GyLCcH\r\ntp4ecjjMxPkdxD8dSk640ZbvW5rwwxDv1u5zoAtR9cJJ3Dc2v65LjniITRsA\r\nZ2u+uKHnMjb0dg+om4KkP1xNUrAFfqNtKsbFWwIRuPAuB9jCOyVUHocihVNN\r\n6ANc7WF8vsa8OirpOYz4ITApOEXNj6PdcQ8=\r\n=pQ6a\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221222190957-8730c23.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/32c62629d00139d9839c0c85cf3935ef/graphql-hive-client-0.22.0-alpha-20221222190957-8730c23.tgz","_integrity":"sha512-4z1hptdJNucOs1HTqHVokAxRqdLMncASpVMiLzgLYzScIYqBKIedB4/PKmor8V7xnuorKOayJCWqFcOQ1/ZNLA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221222190957-8730c23_1671736230832_0.032436899277530795","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221222204442-96c67e9":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221222204442-96c67e9","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221222204442-96c67e9","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"bbaad3424c9b3c7c4052f23b605e787c52c06130","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221222204442-96c67e9.tgz","fileCount":60,"integrity":"sha512-RQmzT33OlTm40YBmeqK4nozr7BqniJRhh0BO3R4QGp1To4J0fjWJnu/83FvKrvr40Kr6POQUxaGPY/nmTQ+asw==","signatures":[{"sig":"MEYCIQD/GDeZeBhnBeOuW5c0tKMFO1ai7g8Pz5BCzDFjJ5SLYQIhANQWgxCzd66Lt15j467TbkjcqVOq/v1g6p9i7qLj6rP0","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjpMHeACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpN5g/8Dd1UpubFO3ByMGuoAsFbjJUe5wXXPfZQz/FsmAPhLoL2CLaj\r\n5VDBcG5QCdg/luNvnQow9Hy3EoJ89n8XlflC67/Wb6NxB46vSEn3dHpZ51MQ\r\nL6s9mwEVbhtJT7wNRq6ZNuz6jN0U9+FuLiqYlXQ1qzq5qYdsPSf9VNgWEEB6\r\nn0Aau5WgssB5aeiuWqLjG7YNcM/jVEXUZjtL9fPcYJY3r7ABhN3VRKKNbQVx\r\n9IB5K4otiQBF0nyEOoVEVWbx+PCFXmoxJ5L2QCNfIy7HoRY4b/D90sSXqmli\r\ncsyd5I7L9K25+jXqoySQxl/XUJZBrR0K1sOMU/eTFfqV1GdU0g+UdVMjA4n0\r\nz93ZrxYlfNAbjl5z5y8HcPo833PH5I7rCdb3NJrjzP2hWvWUPqhaDj/SsHjF\r\nt+woUBL1a7JpoIH4gRASIo279+cfe+OLfLqR9vy0ygBK8XdAgbnfEdZJS6vl\r\n0+QuteLIhlpn6TNbZprKK14cU9PQJzf+vdXkAerp6+KOaaj80X+uE12X6n6k\r\nwN/E1lhCaZn0d7JBjb3Z0LcEiv1Wvfgkk8u7suI/KGagUiam8WERgJ7+JAgd\r\nCb4XTFkKJC6Kd5x36z+gHS+dbB1FknnlaFQRw6qxr7K6x4OSAfxdaEWyk6Vw\r\nsBpzas5e28vbYJJerZLVjF5zCN4FwjiN4dI=\r\n=oYwK\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221222204442-96c67e9.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/cd45aea19a8505d8b3c3cef4faa9271b/graphql-hive-client-0.22.0-alpha-20221222204442-96c67e9.tgz","_integrity":"sha512-RQmzT33OlTm40YBmeqK4nozr7BqniJRhh0BO3R4QGp1To4J0fjWJnu/83FvKrvr40Kr6POQUxaGPY/nmTQ+asw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221222204442-96c67e9_1671741918413_0.21082720720994286","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221222204918-a19df1e":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221222204918-a19df1e","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221222204918-a19df1e","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"4293c263f2b919ea8ca8b0ccf58448851ca1583e","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221222204918-a19df1e.tgz","fileCount":60,"integrity":"sha512-4IUXbBukwgS8Po0l5QHLuJxb8kHeB5a8VuRD0GiYCdJgtjrNZWM5P/HEnz91xpfV1PCZN5pDl51LpDfNGF5HjA==","signatures":[{"sig":"MEYCIQCet0co1TgdV45WwJgGimQK4tv+x3jREQ0+NQblLlJ4hAIhAMcZkPZ0A9IHeBPSVLtxKx5lDYORGYTk27e7GYFmLbB6","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjpMLwACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqnMw/9E5utarVmTetqGVS2Rr7H4n1LdhuScMCWXUxSPyXKcYc06+RA\r\nxoS7W9EovL/kYAr09VFu6uuSJGmL15UKAFqvidmidRFNlBbdpDr9HkaoiZT+\r\nP98mk351CRh01isD0vIj+oHO7r81ZBykWaWkebH9QMzHZRhzDqV3q3t6m838\r\nVjdDdzFqTOW2f4347d5kul8i4p385kfV+r/ARjo20VPu23KnRptYCxadg8do\r\n11xzkrbEuQ16w/7q/iWRSURzjfeCFQH/we90mukuCfyVS8qjtbc/rEXx2+SQ\r\nuRXY/+wgbjRUHUimEOTqeoNs9xJSbms4BkWJfj/0NgbgGWpytsU4cM9zzkmN\r\npR5B66SWZJ0tRedEfWObnCfc6Xqgdz2W0cz3C99I7dr4nFOKOHRp4Ycx34Ox\r\n5CTFbNTr7SJ+7hYIawPwdIbymegObW0g/3nn+QNJk4oSkrr2T9o/p9ebrV1X\r\njDHQAm9kWi3bK2YLEuV1KF6v9OqV6bA213Uhv1oPi8TH8H1xqTRfIirziWq5\r\n3nYY1SzibAzEpaRYL2+lJT1u5iet/Ee0XXGOWF/DUwHYzSi2X+atCIy0diRJ\r\nlognQUv1OB6VDqogz1leaEGHVQbezEFfN/IR6gLrJIdP5sdnTJo9Mpp3mzB1\r\ntqJd/X24G54KgaaqiyewjHFfbkvmJ6yNhtg=\r\n=Jzw7\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221222204918-a19df1e.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/83d3790ab08ee88ae698784257e85c93/graphql-hive-client-0.22.0-alpha-20221222204918-a19df1e.tgz","_integrity":"sha512-4IUXbBukwgS8Po0l5QHLuJxb8kHeB5a8VuRD0GiYCdJgtjrNZWM5P/HEnz91xpfV1PCZN5pDl51LpDfNGF5HjA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221222204918-a19df1e_1671742192010_0.8808543504970245","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221223000602-6123054":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221223000602-6123054","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221223000602-6123054","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"053de9477efe778030252283bfe58f950cb68fd9","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221223000602-6123054.tgz","fileCount":60,"integrity":"sha512-FZF+4VYBugMGZwMMiaale7njvtMmi7eJq4n8L88x0/x5x5yMBhsQ+NQMHjUwhiSvjZaNl1k684zDbvcB5Wk15w==","signatures":[{"sig":"MEUCIFgnpn8xZagA/3yprXFN5x/P63C9mw7zPPuX8w8cjlkLAiEA+0n4AkR0bp86ox56t8EGIsVE9uZs61N4+D6ZVF19o14=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjpPEOACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmptKQ/8C0Wedb0Wg7cXMEmvhn0jM4dKGqt8jQ6wvOfyCSh9kQVsbkAh\r\njU5gdWBfoeLvQBjTnD/FfzFJryJgLPw8mC/R9AGB0bVg6P3a7l5ckF96Y1d4\r\nVUztKfRcWT8pPe85aZmIG5/ccxDrPoXrFmch/vn8Yspgw5yTmFfQ8lvIe3F8\r\ncHB5SUkAHi/dU+NLwiNPooTvMmhntHTSKZzac5F3QfCOVxmYt68A2W5iC4WI\r\nwM2dim5aN79A3wysqqK8lhe66Tc0ybY6go9n8AzqyBBq2qv5UxrUOZ1Qm77T\r\nk74unVIe/568NcVUTv6tGClic04VEDUcjo/dW7Bk2M6dd6zDeAujmxoOV54W\r\n31GOPY6I5nMlh26khnleQgnHj0FPKQWLhuTf9TzS2dd+ZnycVwhLDqhVK0z4\r\neQzErptWwDiuimh4xMGZybmJhkVjTPgXj2EtSE5ukZVu3DNV4As00/GXpOPY\r\n77XPaKOrlldsVstldPVxvI1mzIsTj0oaBQZqNXB1a9vvI7E1TLUXlHXNvv8R\r\nX0jhCtyHYEKwcSAS/+SAXJjorKLoAekihitiLyhu9tFySpPMhq1puBZSKfdT\r\nOR5Oh4Osdo28/o3g9ZiWim3DgN7fB0lFna5+PICk4Ri0DzWevHauvk03IgDD\r\nj0gWEGtDiaXxweR610tntZoOkAqqm7Wd5Ds=\r\n=Wy/0\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221223000602-6123054.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/98cb6d5de6b2e74970723512b25381d3/graphql-hive-client-0.22.0-alpha-20221223000602-6123054.tgz","_integrity":"sha512-FZF+4VYBugMGZwMMiaale7njvtMmi7eJq4n8L88x0/x5x5yMBhsQ+NQMHjUwhiSvjZaNl1k684zDbvcB5Wk15w==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221223000602-6123054_1671753997937_0.0046315378234857985","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221223001143-c470495":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221223001143-c470495","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221223001143-c470495","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"d8ddd16251204e72a63a39ea551d605b43ba919f","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221223001143-c470495.tgz","fileCount":60,"integrity":"sha512-Jk9pu1DPbnV9LXPjyfbggh7uGTJjGjUol4fOH6rAfDc4Iyqw19S0HOnp2xE5XpBFRi2+uWy57VcKzc5CmCx8tA==","signatures":[{"sig":"MEUCIDXv1rByLsCI97Rkhe8LrfXBRDmRf6LOnbCmmW/4MKhOAiEAtFZNyFsc4/HP5thdZoTuxRs0JGWW9Nk65ZVcF2hjKHw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjpPJgACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqQpA/+Io3vbK5A5Z02MgTtg2gftk3PXkSr9C1UsKzmbau/mXLktmtZ\r\nI+7ljpVqEvyEOHkPL6JWBahOArNA7C6HhUQ30KuYq3dNfc/3VugAp7gd5QiV\r\nYFOQavofZBcuBwNSGWbZRRy9WbkjrTrkaUaHBWJk1aahUCGWX6fJl8vJV5kJ\r\nqZrFbO1gONsItyHBmUqKzVy8RlFktoIytatf2r+AskSryr80CJ7gQkcd3L1R\r\nVn2Bwlzmul1X9wxrqZNkRZpjOSpVOAZRQOur4z227GzQHqjudrKvVeBkPl0I\r\nTHtC3EWdp3LgLqbymvsn/GW+KvDrFs/v4uEHtzTchlV/XxZBObxo5+QZksa4\r\n9BbGO+dJcuuUoEDwEzw4pKxBnaDeoWTBp1m2V38Wz2VyZh9pb0hPdrMuIxA6\r\nTTTo6YkmulflvC7QLmjbPPMHTnGgPAsoQ1B8Q2r5TwHu8gCFWp8xzuxhFPL5\r\n0X3KgHYsSnZXxKZSQIwUET02UnjvDzfjUD3QgiQPwU7U9lfnjUsRUOw4a7PF\r\nZJG4pMf8EqODykTyT74EePwrC1GTY5MwQzNBPPL80qd6ChGKUEqv1y5OCT16\r\nMV+/SNfe7eC7pTmrW547tYdPeiHQSEMYOQORSsCXH+MwNs/cKeXwMrok0sxT\r\nL9yLYRo/8EkygCn3Gft44kWJDeZEfpJ2N34=\r\n=PGZo\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221223001143-c470495.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/1207e7e35e151bc93c897cc685787c00/graphql-hive-client-0.22.0-alpha-20221223001143-c470495.tgz","_integrity":"sha512-Jk9pu1DPbnV9LXPjyfbggh7uGTJjGjUol4fOH6rAfDc4Iyqw19S0HOnp2xE5XpBFRi2+uWy57VcKzc5CmCx8tA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221223001143-c470495_1671754336124_0.9643398553680864","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221223025346-8197d0a":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221223025346-8197d0a","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221223025346-8197d0a","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"244f92799b95fe4ebb5b687427a346dc1c63fd7a","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221223025346-8197d0a.tgz","fileCount":60,"integrity":"sha512-6SHiN3m1rDdavwaxoAGaf/7oO9LRE/cYq3XREYrl5Glb0y6Q+sNXWkytlgzzT67n6TWW5XyujPtYAIaP/TVrVw==","signatures":[{"sig":"MEQCIA5hl2gTuNpVYOyvRfY3eUTgOs34S1xs+uEE9+rA4dQoAiBZV23Fc7Z+WgWbwPYhLl7naY17ao6Nv/cDvGaeI+FhuA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjpRhiACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmq3iA/9GEOzCHc02JJxLItPQNM2EnhfTXXh+nOmDc/fd9akkQFVUZNh\r\nAmURVmeUpnCj0VQdGvkwwzPyBxDyiuwW3Hs9s8MaS2EULddIvQIvzVQ+mfYf\r\nsaFEQA2iVaAz1H2chCHyyS6mDZnMJ2davbYYFwts1iny+YZiZktFeQ4WZQnm\r\naHzZqQ2Gwd8cNqoUH2ePELa71QfDgu3JDAHDouzH4U+50cqFaNv8OivLpn75\r\n0OxtYePSl9iBanx7vf38GIapPdNebNGBKf1Rsy10LdbWvcsIuRLaPC29laCK\r\nQkZiRXmPeGmQ9tjXqac3vbdtkgLVgQ4EvsV0KVULRNtiFA38fOGQdxkwdAML\r\nWQohanPXP6BnYEGZBMb2eIcvbHK8R0E0Gf2Di4yoOrDqnR7g2D+qrIQ4QHJv\r\ndv9Yne3cS+GPs2LLvxAJlpRtMNZgn9TlrtHfv2BfDM6q7oqqnEgkQWJxZLA0\r\nDRnFpyntJP7v2PpJmeLjyqOfNNeNFXQ1ssrhuqRgi7UCHIHBu2P8evt3tPla\r\nAwKpg3Q5nDRaq92NuPZS+mTovsTVhnHOiSUHDbztZgmHAS1kVzhwt7CtPIoN\r\n/ey4HKC2+UHO6m/BD7aainO2gZYoRnUsjMkPNpP8h8aMQc2gzuDNwQkYFVtA\r\nstUwxuCCLo6dqGEO2ouU5TdScD0+OCUv7Lw=\r\n=6bnH\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221223025346-8197d0a.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/ddbd42c856d283f58c0f9df353e6d4f2/graphql-hive-client-0.22.0-alpha-20221223025346-8197d0a.tgz","_integrity":"sha512-6SHiN3m1rDdavwaxoAGaf/7oO9LRE/cYq3XREYrl5Glb0y6Q+sNXWkytlgzzT67n6TWW5XyujPtYAIaP/TVrVw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221223025346-8197d0a_1671764065895_0.7366935978976665","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221223025521-bbb761d":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221223025521-bbb761d","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221223025521-bbb761d","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"63833bb4ef7c121805fb9d368df668f6d402b6cd","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221223025521-bbb761d.tgz","fileCount":60,"integrity":"sha512-mOb+tcBKXsqXz2mhO98ukfhYPrYpx9j4a5RFSjJil2ks/QoOZWLtUhEryVV5XuXxwvPGJ1RiiDp0EiwFz+S8rg==","signatures":[{"sig":"MEUCIQC8G//e+zS7fWh10GuO+Y9WVM9IbKs0npufQpFolNfF2gIgMmanVl4LN54puz3/ItXdVtxLAKfx3nprtKjGhxkX31w=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjpRi8ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmpa/A//caVPFE4VHTeUl0sSVb+kqYz32DxELDRIWCpyQdSvO701Awwh\r\nsUcg25ugomRfa+0DN4/yDyq4K8nfVnAAwBUW6kRRzYWmk8vyR+GMAwhoB7/e\r\nh/lD+b1dVqIBU1I5PuHAyAjb/4pWJd0X0ZoSnjUqOXu2pNacXk/uSRVJodJJ\r\nuKi09GB1en3gZnftZewh6yuZBpBqa0OMJ7rTwUfhmvkyiwPeNR7c5UnsqSSi\r\nzeGt1JDTzIV6yHavx+6UDBBd8W8zSMUtzBUXjxO0WBKYDw0t9dSy2wbQ8MCX\r\nEiuWFs4NQzAa2uQ0WlMkn4qdSoQO0X6OgHZdQkqmPhkr0PwAYJefNPorSatg\r\np7mDD0h83KdasUulwIoLvhPkG3DyPYySzWrkCKbjlZ14AONFz8Bd//tBNZ+g\r\n+yeg1Jj79U3N5T56ZXtu1Gp9qN1G9tVaKQlGjPki9WfiwHvALYdxgQBOyJFH\r\nBiAsxnsKmDuMz8LLShmCRPZa44KxVzq1CLJvyMf8L/czZAV9lnjNMifFKXEd\r\nZ4xf3NF1lVqCX7IRXbe7/z+8S49+MVMXPoEE2rPho7OuV56yb7z6E/f/OtN4\r\nnghjW7QM1ox8ITU+8SncYQ5MorwkGqqh5YCq66ext+5kgYbiCxQwG6cjCDHT\r\n03dbn5bnbKCXDKjN7ZUTECrIraYyc1fTCH8=\r\n=LV7m\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221223025521-bbb761d.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/2c000ba3e4ed410896b0283f3f69f852/graphql-hive-client-0.22.0-alpha-20221223025521-bbb761d.tgz","_integrity":"sha512-mOb+tcBKXsqXz2mhO98ukfhYPrYpx9j4a5RFSjJil2ks/QoOZWLtUhEryVV5XuXxwvPGJ1RiiDp0EiwFz+S8rg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221223025521-bbb761d_1671764156759_0.2177200364035934","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221223051244-9d09446":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221223051244-9d09446","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221223051244-9d09446","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"4979a5e5476e119f9c2731eb30fb78571a73eff3","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221223051244-9d09446.tgz","fileCount":60,"integrity":"sha512-zJ7cRqFH3aO6ajlbARqSePmB5AhEN+ccbY8yvfMNViiiRICYEtx1fi6u46KkCmcJHyZWQXJDjPZfiApoH1/eFQ==","signatures":[{"sig":"MEUCIB5VUbYfQEsob+M3w4/1+yqJ7CmBe/CDAREAzJm0Dw0sAiEAxiEbpzZJsDMZHFx1OSY9Su59O98BQloBS+F8sumjDS4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjpTjwACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoxMRAAiNYrjIbEMYEvrkDuzlz9ys4epoS9vrvLGsb5RChI17ratssM\r\nc1wGJKTExkPPkFWzsm3to0YCE1QKJysDIrSj4FHz0DKBBSkkofc0KdRB5Qr3\r\noA61wIfrm2t0Hax+FYmEyp0X2kY5ZUVdSr9c6NpzRgyV11bpMKRUxi+I48M7\r\nfVBt4hmJFT/N0lpO4ERoxwa8yLH1VWFwFlcD5rdpPf9WFkNSslJ7/N15b4xw\r\nkC+hSxPBZZmvq0Qt+a1EJkCjOHQVHkAaJD2Ysz7sLgx8JvCLvGwrYfa840ap\r\nepo2hgeRtEORTjhN2lhfJK9XakVnd+pCIX5L5WfPC7V+ug4obb7WuKpyqxeJ\r\nyD7AJYR8FrPpNPK9U7mD8uxnNWUtV4knrK5326okz8meMD4PpjfC0iMrd2qY\r\n5g5yeApPnriNsN8NESq3v0+psMHoOqGUP5snGQ2zGVFUag6G/I2ck2SVAG5B\r\nAoY9Xhm+iY4LYXTzEfhqILKtJzzmQrWHtpa1Utr/7W8HypwuO/QaKdWGW6wa\r\n633lPIU5ZNQLyeFj+2x4+k0LDq97XCJ/UTSI33mB1iwpxKuWt6Cy11HkUZr8\r\nLjgGZ2VN0Mt6t6A8PJnxr5Mdau7pPfULvihP1SPcMBMDuLpwxQTMRdt+aMBy\r\nVzvL99vIjrSYgWfw4qvgdFRI8p2CFMD8kCA=\r\n=lxkS\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221223051244-9d09446.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/1fd70297af42e9e4d884fe869cb06086/graphql-hive-client-0.22.0-alpha-20221223051244-9d09446.tgz","_integrity":"sha512-zJ7cRqFH3aO6ajlbARqSePmB5AhEN+ccbY8yvfMNViiiRICYEtx1fi6u46KkCmcJHyZWQXJDjPZfiApoH1/eFQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221223051244-9d09446_1671772400146_0.8613883637106718","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221223051806-64b0a26":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221223051806-64b0a26","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221223051806-64b0a26","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"0ac94a41036721438347fa81c949819718dd291d","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221223051806-64b0a26.tgz","fileCount":60,"integrity":"sha512-EjFlIYZxApXhx+nOEP4igtd+aj6dlPr1pYarLhEdQ3f7k2bVQB4al0wkKnw1y62Y9gGUpBEWTrZDTihXT+Rilw==","signatures":[{"sig":"MEUCIQDxFOTCtlZomkJy5SENduwUbNxU2KblLEcLGko1cp1/OQIgLmLoAfw4LHFqEcKDDwLa5HGJKmj8x1t3rqo0FbMs6Ig=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjpTo4ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqIvg//RtIEOoIjaE5NBMVDy3FV7ZxVpcd/jQq5s6mcq9EmiGb/b/q/\r\ngs75vdubi0Tv5FVDr77zEzfk++yoUruOmzGQQ/NmBFHQSd8MpLLYk9YaI4s3\r\n0YU2UWK6qh7UKPCYWPSO1PkNfolkXsAhVnRZR7yekqsJAbMHh4CTrCVOU6XZ\r\nc+YVLnFF74js0JE4CkjDxssMaiYwk5LMbpuZdGxiGa1QrgwWp+FQpb94TAmd\r\n6iuclxfoePqU4qPedQ1EIyHue0rSKcFMIZq1XseI+rm8a+7suv3sAWhQDAoG\r\nEibBD4jBA9kFD/MbKpyeSGb51E9m/cy8/bmrShBtHqWbK6Isn8c8ZNGRzBAz\r\nubO1HIBlLgPKlxViO5G6JXPI5NrUDVSzjDPQYtBRf+Tsy8ItRwUm/vGIKynp\r\n3EA5kfqwS+zK6VtEkunMsC/dgcyt13SFbQHJeWCA0R5sG0nvLSY8tC2u/+Em\r\n/HQ8Z78yTmW5M+J0lc1PAYeUf9zfCE8Yz/eRLKcB82nBGCDd2SV5Rt9TBb+b\r\nX1xUAxkXElt0w3qWJC8UH71uuV9l03MoWZjLXsuotJEMNTIbT4oSw62Uq1Jn\r\nOkRj1bLPlt/9aDO+0Hcv/OGzUL3z7rB0pW0tX6a9oqUfqVYSCqSANM6Hsju1\r\nlJR1nLxaHlJsf5EDx40mZ2/2EW+61DRf2mY=\r\n=Ggxn\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221223051806-64b0a26.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/3bcc7cf7a5f479c7407bb309dac74c38/graphql-hive-client-0.22.0-alpha-20221223051806-64b0a26.tgz","_integrity":"sha512-EjFlIYZxApXhx+nOEP4igtd+aj6dlPr1pYarLhEdQ3f7k2bVQB4al0wkKnw1y62Y9gGUpBEWTrZDTihXT+Rilw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221223051806-64b0a26_1671772728027_0.12493884191473148","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221223113035-eb1d3f5":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221223113035-eb1d3f5","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221223113035-eb1d3f5","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"d12ec536e3d6f9aab7b421a3f8d64d9299feabb4","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221223113035-eb1d3f5.tgz","fileCount":60,"integrity":"sha512-yNmG9zzRiVwLKuzPQiPfKToVXdxY+kiPqSv6xCb9dWRIFYD6lJGrxkUWbqmiKCmhUfCslNVPaGoEgoyFULGang==","signatures":[{"sig":"MEUCIFDIoE9tnovOni0BBoXzukP2z8/+UT5IwwPesaozLS8NAiEAiY9BcAMcr5Ld1CPCsbf907gdwwGseykYsCuHFPZ3EX0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjpZF9ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmonDg/+NoJiCysqOnuIVeUvEESKZR4vVMh3EKdT68rqQhgr2c2ruBwf\r\nyLvLZsBohzdfcG4bnX41Q4QKSRSRdZncnPxJDuWPUMzBZaqT3R34LLlryGW4\r\n1UN5OFdKug1UzSeaFoBg8k6DgyPyKfyN46Kjt1VNzkuQCSvhhFN8tFJTcJSO\r\nFvqKtD4aY79J/GAxxwkCEmDpb/Jd1v0K1xKgsJ32mov25S7C0k8z7Q79/iqj\r\nykvG1ecwv3ACL5xlHmsBgaHcizV+W9UP0k8tBO/QhBDsEQh23TjUzebHdq2Q\r\nlPjnQSE2JCFMeSA7VJMHgNbEl6/SC6Ixz5eYgdTQxKG6z9da49cAWXU51C8T\r\nivzN1KPLKiKRHftjCtfhwm3TQu4qcjGKPlxFK28/9muvcdl6IDDLldBrbOM9\r\nDdsEyFcMDrxUzJt8RzAbi34COuaEkQTqOgB3rPVmcXXq5DrN2FuDa7IaZY8i\r\ntA4JdMzS4u4u+NhzjymzarbDtCvhpgKfVjZKf4y2dI0g0wafvuBMOUzjVN+W\r\nfTkA1ATlg0gusKIztd6iXv7B5omc78/2wUbaVQ3aNNm6Em6OOFgpQLMVTHvo\r\nzL72SRWxRuq8bnTy8Nu/xUcIc4m4cbPtYBB3TIe9K9LNs4COkm4cp15zq4cw\r\nW/R0Tybh01Rp88KeKQMQMySoGqZNrDzKZXk=\r\n=H7iy\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221223113035-eb1d3f5.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/dd344037e3969d9a8864d9c18991f225/graphql-hive-client-0.22.0-alpha-20221223113035-eb1d3f5.tgz","_integrity":"sha512-yNmG9zzRiVwLKuzPQiPfKToVXdxY+kiPqSv6xCb9dWRIFYD6lJGrxkUWbqmiKCmhUfCslNVPaGoEgoyFULGang==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221223113035-eb1d3f5_1671795068847_0.4938495904952729","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221223113408-f7d2abf":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221223113408-f7d2abf","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221223113408-f7d2abf","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"000d6a59424abc9e0cfbb9f64baacbadf66a2743","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221223113408-f7d2abf.tgz","fileCount":60,"integrity":"sha512-GMWzr1zN4Pd25P6K7LG2gPeoHdqV3jk4BnHtBslTudGmdecO9ErYlegJJTfCnoMUZdBmkD1DFmX63rSWdR2X8A==","signatures":[{"sig":"MEQCIGAJwUJgdWM284n7iQH0A+7BH61oyw7rdZ06kHvX/wkHAiADvcvFpbOUI2BDJa5wJVGYRyJbGbIyn8H1fxhst++phg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjpZJXACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqLOQ//TWWdl/A5Ft7GTL9WdWoYmWU+Tdf/MHUDQkYhoTEP8USZprs7\r\n/iV2qp+878tQ1ed7xPVr3ZSMhjFC50RXfdoGvJEKORz9UiuSagI+a02ACu4n\r\nhkk5ywy0pTLv1hFwG92FdFY2ZTf2VSyPcLYLZSWzB81A5Q6nZBTmojW70VWq\r\nmdRfU1nr4k9GylxQIq3qDA5LrIve9F6/B3UMpQ4oZDbV67r3p9bNFuLcMmvj\r\nitAUcl/2BVyoVXYnRVJIKompOE2CcpUH+8qvGj/ZCKwnt7ZSVlnzz4LMvEAk\r\n2n4QXtkvxsmSR7RC7nE09FpsQfV3htOTFTx1UW1VD3JFMlUnydevAGP6P2aG\r\n2MDX2oB74+JfvpsfonOnFtvxARk+rihBNCfDqFFQxx+0yYVEfyD4lGP//ub3\r\nLDv29zCJsBvVGv3mtNeZz/yZlJ3aYH8plaQpCZmzmKG/PGA/+HGz+YPZqIgO\r\nCJ/HBYIksywpRkoFesgwY5GyVnUnKOT8Djv3nbbrbaPTt9l3sMl70+HGDtqD\r\nu5BNbx2YxFo99PMwH56GgQ0XkwDkcJKvfVIhcfAXlboPLl6WfBxyqhCrP7ot\r\nkhTbGMYliGTwhOaa6fTQe3fX9J/NgGqUDgAH4Ef5lBMg9oTpJkVII2YTwdFG\r\ngATNouFuKTvDCB+8I9R+qlUOU22Ib8LS+Z4=\r\n=aJVe\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221223113408-f7d2abf.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/d0c9aecb9cd5df9cb0d0cf1fbec838cd/graphql-hive-client-0.22.0-alpha-20221223113408-f7d2abf.tgz","_integrity":"sha512-GMWzr1zN4Pd25P6K7LG2gPeoHdqV3jk4BnHtBslTudGmdecO9ErYlegJJTfCnoMUZdBmkD1DFmX63rSWdR2X8A==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221223113408-f7d2abf_1671795287283_0.27966986543448336","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221223113429-d1c379e":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221223113429-d1c379e","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221223113429-d1c379e","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"6f6467ff2a702ab74c6a5ddac70c6299655757e0","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221223113429-d1c379e.tgz","fileCount":60,"integrity":"sha512-rIx6kkummrmVjfiFcPB1md9B/zQdFScfQlTENbqmLuSKJvh2W00A7x1dVTTk0ovrYPTW8D4HYm7kPtSqZ6/zbw==","signatures":[{"sig":"MEUCIQDGoxKkwydZu7FIWQhunPdWbKS2uTRx8ef+9YdUqQELAQIgEG6dCsRwwlk+2LG1X6US1401DDLWdMQKu3E6upDrIyc=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjpZJxACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmq/IA/7BqXxiSA0DvdVy8RBMVP7QoB3d4UUT4TcSfnUMCwezF5uvW3Y\r\nGOkxemsU8w4iJTNNt7ktUBButKwecrP9aT8NC3UDpThx5tairmq+tyxJlrQ5\r\nWz2Nj4sbJ8f1AXgq0BNAp2KaUraCp7SoAW/apEUh+bg5DBicxNWuuFHrZpLg\r\nXt21a6E1DUtJrMU4pMbZ65/xcPHr99oYp1+I8t8YlWKmkxMJ7UcnUQNtyuHz\r\n+qfZY+PlKln+Cg3oxLT5CJjc6D3SWf7IqkiGEyOw9TBlf46MJPC8C+vfxUvL\r\nr/VI0VzmYPVKtSrEaSb9fpAPq0//rBibWNOuWRXTE1aYdpzb4UDzJBL3AGXC\r\n5zAOC6qAJNWzOzbEMSDViyCL1+IJH6Nuh5fV8FYv/LI+uKIpY9+Ng6Ti2SCH\r\n251YIrSI9UmTjoz+EpWHpr7INh2LbN0QVcFfEnGviJeD34qkIcxKy56sqwHN\r\nQmN8wN2UcDCAHGCpm9n9fUgBarxnGpatQyLzrTZ5c9BgV4zbHGq0OmClYmQA\r\nQuuRfjDtqyX94ZOiLdNJtwoWv0Qp9T48DN4W2Cb4grGeU1OdYL1QLosyiRZK\r\nQlQ6ZwhyqSK+9hQz0fMDGm6LJcp3hkxn8RoYDjemjkbDXzp6PIE5roRIozAb\r\ngqATUr3W/XBaD18o9VZa5vF735pqrOhYNcw=\r\n=iZYu\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221223113429-d1c379e.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/e4e438737156346859253b6abb038b76/graphql-hive-client-0.22.0-alpha-20221223113429-d1c379e.tgz","_integrity":"sha512-rIx6kkummrmVjfiFcPB1md9B/zQdFScfQlTENbqmLuSKJvh2W00A7x1dVTTk0ovrYPTW8D4HYm7kPtSqZ6/zbw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221223113429-d1c379e_1671795313303_0.7995940369082706","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221223135238-a108575":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221223135238-a108575","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221223135238-a108575","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"a4cf36a55a704f0e79a69e994f549e10c8642dce","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221223135238-a108575.tgz","fileCount":60,"integrity":"sha512-NW/KtfIZdWTpD106JE9liEKPHpQtCZvLTfHyhI7HfeTyw3dXvCMETkBPT0/PZUObvxmJAH44uvM71AAR+Q/PdQ==","signatures":[{"sig":"MEYCIQDKG6bUO/uvZL/luq2sfNbuIov8QSFYjZkgYXGcjsysRgIhAOl1l+hiXVMs/zFrxKXBrgw7NEq3fE5/ORUmv96vJkU+","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjpbLJACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrEixAAmI2d32UuU5Vx6ABlTFMioyG+CiSSlbIfu5ohwos1o11fOzB9\r\nC7f2OJtlUYR5Mtgdv+Td5EVYqBWn0uRnLT4TgWHtJSDuqA1SJbxa5br7ZxVU\r\nZSrVyCivpyBVfeRn4vimP6oR3chFINBMEu591SPyMUgmFzK1doM3jz1emhXG\r\nIC2Ib42ZlDtzTjVmeqgBXq7+sgtJumIBlUfTB0tuwM2zCRAeWykDy47YT0o/\r\nTzjH2CEeLWL5Fzf+HDOYWNFM+c46CfYLgmxmmvSpx36SJmC0R6lRChaE68SK\r\nhRwgJoPpXbqSFx5ebA9otVgDSIboE13sKW1wXmROIDyCfel+Kmyp1UIiW5ax\r\n9gHUQoiiZWuRPtE3Vxn+M3J6Qo09wE4UMoHi8EDkf3sd4BGQJqneKbZiFhai\r\nLJbkF88sOtNlDi5jwftGjng/EatsyPxE7mlCnpC0t2oS9B7wfobIcWe1xUfb\r\nP1vCNPwASZitTWwdn4FiEHPpyzEWMMol5rKFCeiflHlIhTE2CELT/Y3/feTM\r\nCdcTRoy6+qUXA8bCKgRawGq39jr9mZ21HpLxy4m6q2R8+SkEdUFQlPBA1tKm\r\ny3/HTE/b/D2z7Qini0tSgXvf+3gIR8uhzn3mi12nfiroXTK1zywSrU9ys4s6\r\noNQRSOfcE8uMnwPqKRpyRGE0yFdPw2yuwVI=\r\n=6egc\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221223135238-a108575.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/2f6ffa5ac19db830f8ab202b1f558afa/graphql-hive-client-0.22.0-alpha-20221223135238-a108575.tgz","_integrity":"sha512-NW/KtfIZdWTpD106JE9liEKPHpQtCZvLTfHyhI7HfeTyw3dXvCMETkBPT0/PZUObvxmJAH44uvM71AAR+Q/PdQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221223135238-a108575_1671803593366_0.4404714274095449","host":"s3://npm-registry-packages"}},"0.21.5-alpha-20221223140651-74d150f":{"name":"@graphql-hive/client","version":"0.21.5-alpha-20221223140651-74d150f","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.21.5-alpha-20221223140651-74d150f","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"444b2ece0d234e80c652920a27d58d468b589ab2","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.21.5-alpha-20221223140651-74d150f.tgz","fileCount":60,"integrity":"sha512-daaSoHkogK+cwNgG5fHxYHX/3lnOFBDB0ZQthxEOhG9jl0hagHnw6c/CqLfI3YsZ3Kj9R7cl5WkwWVAEpQBtjA==","signatures":[{"sig":"MEQCIDFb48IgN/NFcBJL9hDYC/gIAg8TRJdZ84H8ga02iapSAiB7UN/LThUoDj9xgIMQ5IEfBiD4JXrl55kvtOvy9uC4Cg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjpbYdACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrW9A/+Izj1RhEczkVdhcH/V9aBoLXdrXw/2eaSfXB7GGyrnZxaA3Ee\r\nNrf2G7NHIkIHPbYOIvrUUOGtHMIO/PVbrKSYv0YbADILWtnoYeskWNfERfBv\r\nMoxHoxSTaj3CsBCFY9ytvsu0yac7WMOmvnIWtQ0ipEct5j5QuBK9QO93Uose\r\nDl4yOAMMcHR3CiIf93cL/EkX0swFadXjvQEpG8yRMnEgrbYEhIxKsWLtMEhI\r\nDjBeoHjFfUbA+hdW6yD+3KokeP8gNg2+0v3GfPbbuPGmcWfun4vNVFjqefbc\r\nhU4/hvAKcmuy5W6UDpU/q5dMLM8FBXlnoqsXAFMwrZyUkXlDslbEBMguo6EF\r\nbNRkGAsVt7tTilG9nH8VVa5VgVAYymebVzHuzvtjvKYjYjUo7Z2KI61yx8md\r\n872NIrYZ/Z5BCtqGcwhhxVOP5G4wEi0wmDGII+RLKAp5gMq+JdBlmtZyJcVp\r\njMpIPPkJa8k1iPPDfSlE9QzoKPD9oM9PP/gR7o9iyiYyO8U/+Xm4V9ABbhQ1\r\n3K8PBiFrxpQjmOAYbXOj9B7LlJ+QECE8BcVIqWTF641klPlreWeftcpdTLAl\r\nLY3AomqD9Jj/Wl3TsXexeGEgblpfdcFsANBtztkmSxu256KF/g2FuRFhKPSw\r\n4KCraEaVvM9u8DgRUC5E2lU2xoQjxrhj5bU=\r\n=ZqEe\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.21.5-alpha-20221223140651-74d150f.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/cb50985ebe85617598f0c59917b01425/graphql-hive-client-0.21.5-alpha-20221223140651-74d150f.tgz","_integrity":"sha512-daaSoHkogK+cwNgG5fHxYHX/3lnOFBDB0ZQthxEOhG9jl0hagHnw6c/CqLfI3YsZ3Kj9R7cl5WkwWVAEpQBtjA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.21.5-alpha-20221223140651-74d150f_1671804445751_0.1125237126266494","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221223195553-6aaaa44":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221223195553-6aaaa44","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221223195553-6aaaa44","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"ad59e9deb8792e84c3ad79a8061b4c8e52f45fd6","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221223195553-6aaaa44.tgz","fileCount":60,"integrity":"sha512-C5EXRUTuZTh5HXyDiufRUhGqtTGJxiKRnjR20BwkRQALqbxMvxe7n4LF313GOLIu7zHS3aEyqFw7NssOee4N1w==","signatures":[{"sig":"MEUCIGlUUJsXZhHpBofK4TZghKqtNIZhhMaoZKvioWQCg3XHAiEAgLJx9p5R1FDLRT4mnFceBTIcTDOk9HqRU/mOkrjvjV0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjpgf8ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr7qQ/+P3CJeRr8L+EOJPwBtti0w8LijumRE00iO+vn1NpSnGRNViWv\r\nbT3ggItprJWGfKFQI3CnwRAU6H5bj99ShHa+VsxlAWcWOwt5HuIwFMs5Oou+\r\nWjAIL+VMJRBakPxvbPfjIJvSfE6ht/oJrKKIzd2cTNP8n3speFQ/mr3acV0J\r\naa5NTSTE6p1dbhe9mn3DN99b6zUtflPurfKvP1OXwRIocMsL42qVDH3PkUnD\r\nLv1malDZ7yqKCn1XSRcneWqjoGEem8OO0ifX3t5Q5ZOXpanTqMQTz0t7XiiS\r\n9uxxB8dwa8/KGXw5kACUwX5xQhHmyE4R4IOin2j4RifzHm4Uhr1rCNkvIaRz\r\nAt/rQttAsxhD5Bp77QHJSuTDXvsOWfIRSaj1CAEPQHUQgWoOAjHBRG/oi+Mv\r\nmXs+5mcGiLm9ahx9s1G98vBRTtgwJB66YRdv8cmO6d0lEnYq0A7fXtgtfUeh\r\nevMtNdvwUu8BJB5zv2BXMhQrCp++2b7KJQv5OJQNEmIhulYWo83m9BHk49i/\r\nQlkSK1RDw575f+cSQEG1HSK1Nuqh5CNP2wSs/JstkfNd2wEyl29SM5ZAzunw\r\nacm2LJxXa+aFiQU/Uqc69bTAGQkaZQc+fFxshyFa42OVGDWN7wtuKmlQ+fZP\r\n4Mq69sd4Q79BLNak1NuMd9SsVGPbfsOTzY4=\r\n=8v3/\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221223195553-6aaaa44.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/de7a199da841a4da794cb278bb845dd4/graphql-hive-client-0.22.0-alpha-20221223195553-6aaaa44.tgz","_integrity":"sha512-C5EXRUTuZTh5HXyDiufRUhGqtTGJxiKRnjR20BwkRQALqbxMvxe7n4LF313GOLIu7zHS3aEyqFw7NssOee4N1w==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221223195553-6aaaa44_1671825404620_0.5402489304345661","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221223200052-7754d6f":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221223200052-7754d6f","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221223200052-7754d6f","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"b73d049ef0bd2d2f6ccb0d5193644587753b942e","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221223200052-7754d6f.tgz","fileCount":60,"integrity":"sha512-tik5j7RgtUuIM9dbDYHnJB8Yx+j+lAwjtYECyWEjCFYgUbAZXcXRoosjwfSlERpCDKM7vM41Y2Uh5cZxtWu3AA==","signatures":[{"sig":"MEUCIB60cbzw9G2SBx1eqX3WAZXeJPvWWNVVabqFr74gJvCvAiEA0brdcj4s+YeM4N2NXaXCZUfMjNdpm5xOgFHqiWl1Ej4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjpgkhACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqTthAAm3J098UTSjHtwBt8U65C3mNjGdUc+YJBB7rnH0cRht809dEo\r\nWU8/1On2vQsSi7vq0I6P0OnaZvw23aQ9fR/WZcjskIRQaGjLwC3ttDhTVEw7\r\nm+fpc1EvgG6X601ZatL3raq4zCgetVT8UqJfnHn/IVxK3DZOZ41AJyQxTCcs\r\nE4Knk3wInl+Z2ANH6UXwwS152WcYWgSBhCj12flNNjimukNW95YAA4cCnktN\r\nHN/w9Br4s+olxkIYtDIe4hR0WIpUPT4m7stMsYQQs2BAa6Y/5EGgn9Pmsk0Y\r\nFVZmgkuvuSbfELo32H2hq3KPmYYBONcHSS5a+9u/jRbASnVGcvWMlfBHjA8L\r\nrba+6wJqOU7HVW2Os8U+fSJtzEbN9SqPoABB4sxTIRZItwpfqgDlTgk6DRN+\r\nRx8UX0UPIM+77FtW9APFHqE7eUI7zB34s+BTcQW9aOak94zdxY6RNjdH9/jI\r\n1TJwYRcZK3Sm/PeLUH38tIln32lQ+ldoxr5kPmW5+YEFw/dLtiRLdm2ZcdvU\r\nbcQRuWbXxZR/Tc+vpa93Vzi9rMxYo0znHCbskbMuc8/mTXswstWmvPw6hJak\r\n/Dja+A8V6HGYeS8Uw5Ar2lMP6lRwo63ma5fJZoIy+LK+cFXURH2hzfZTtwC0\r\npL1K6Q1n5RU9sVkP8RZECNbm0HOWG3qTT8w=\r\n=YBvU\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221223200052-7754d6f.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/2edf6d5b468787e574763871a3dda4be/graphql-hive-client-0.22.0-alpha-20221223200052-7754d6f.tgz","_integrity":"sha512-tik5j7RgtUuIM9dbDYHnJB8Yx+j+lAwjtYECyWEjCFYgUbAZXcXRoosjwfSlERpCDKM7vM41Y2Uh5cZxtWu3AA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221223200052-7754d6f_1671825697061_0.19958075257543095","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221223225128-99dd99e":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221223225128-99dd99e","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221223225128-99dd99e","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"25cdbf6e2aef799a22a7477c826842db41f08453","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221223225128-99dd99e.tgz","fileCount":60,"integrity":"sha512-QbKUxBiaemfYX1ZlrV7/+MsCuRuyJA2U+KR75/OswzrmGfmNTDn+csa/+DGGmD2LWN4rAobdVszQ+l6zkdPGDA==","signatures":[{"sig":"MEUCIQCZM5gTElqX/9D6n+FcDLr6m31CCHBiGEHQkWLc749jPQIgSvfEQXiMUzXKDwaNtLhEXTyKx3lGxc/0seWNbThQ5QM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjpjETACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpTYg//bKzwhMMYJZuBaWWwNONqJjtSsk82z03YZIpA0ZHybhPlPFZ7\r\nIpCLqtCZM74pAKKxoO5IRwaTxd9ojkxIS5xHxRJEgA1IBkt+0FglQKwL3wUw\r\nSJxtZ8v2eSg/S/eOu9tKeWhp3/t27xDtkPdKAhRnCNAdxdnRWH5hOsmRIJTd\r\nndrJvwo5H8o1s1uX9+djGegOC+C3qqr3ZIs1psl8yNJgOeRfvih1lZhVslXo\r\nWAka8bEjs0DKywY3LxrUBFQBomDb8nzuIGDQTp+eCtDGJ9msR2KjyiUK+mhO\r\nMVQSfLqK62fgLiDMtlkkpcnmRi4YS8/oPiqoU1BGQGLwYi6W5qprRjwkRMnX\r\noMGAAhJwaIJ74wCTXClCRIhjQc5kPMxK6bOk2e9DgHx89b3J3fiYOmWYlCqG\r\nU1j23pFlQf45XLeOkrs+iXu2WnhArDyU0BcNIXuh+SHLmb8CZ+aDs+McVPae\r\nliLmAjkec99fNHEcsMdkVQNnXuDm0I0O6oUJEAW4c/4Llh2NiiHh5m9CxdRO\r\n6+EWXGR29cBccm7sOqHRZm3L47Xj9lx95jFFnlK0a5BqW/dMApdZLGsdBhsW\r\nO83jfm2oDBV8jrd1J3OhbuLznu9E6vJ1ragQJMSMdfpdcqugPO2TDFElzFVI\r\nA4rxu2okCJqkEKbHa4QItj2gVFees/prqwo=\r\n=/mym\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221223225128-99dd99e.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/307406f1ccc2642d04c83aeee2b17a42/graphql-hive-client-0.22.0-alpha-20221223225128-99dd99e.tgz","_integrity":"sha512-QbKUxBiaemfYX1ZlrV7/+MsCuRuyJA2U+KR75/OswzrmGfmNTDn+csa/+DGGmD2LWN4rAobdVszQ+l6zkdPGDA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221223225128-99dd99e_1671835923220_0.3678915507831553","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221224015458-2e377cd":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221224015458-2e377cd","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221224015458-2e377cd","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"3c0f57a1bb9856e61adf01300d7c2613e507b738","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221224015458-2e377cd.tgz","fileCount":60,"integrity":"sha512-E7XIMhY+uenAn4BRA0ked7LVbi+LnMO3LTiXsQ0S9cPFSPf05a1+HPefKtPAcAlLhDL27P+Nc5g9acxyYygmoA==","signatures":[{"sig":"MEYCIQCbksIvAJtlke1paSI1hzDQFDXWfmtiTplfsJf7cHsDcAIhAK8h3zdJhlWOiRiR5wDiJaGXtWkGU4t9CRQppefWvLJf","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjplwVACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqYQg//R5tTbX/r1tt9xfWSppC5/Anumsh4wCVqt1PGo0rcSgjX4tAg\r\nL66/MLuM0vU+q80IPSHBaajqPdjwjqh5JGqJo3QCN72m6DCAlRn0M6q74kfD\r\n+jma4o7LjcFyr4fof7fzZapafaA5IaMnvrOOdvit7qrwmAM+txjM8e7USB9o\r\n1rdjZs695OoaZ9RJVPNsqpa493UZwR6KEiVPhe2R/Oq5UROFc/c+F7BqT9hb\r\n/tf7i9dn7eeTtHtuY3hLv95Kj71VUTV7zqhxmk33dUFd6qZEejVz+WBRArTH\r\nn7SAAuk8a5t+UlaFqdpeQFvd4n3uVGx/V6YeJU33/aGrUPpVDPLbaqCyG73b\r\nOSR+JVhYo9xYAdtVu3luIwvtksKKReE791b8NUh6Ti0CsBXZ4+kIjXL+5pTX\r\nBaKD3fvsG2jGYNZBrfznK0CJLYYPYmTEph+FbzD/JgcG/7lh2K1tBoIc2Uu2\r\nk8m81TyD+Z6aPp7d6t/zy6WU9RKt/88UESJBpi8+g0j4oePrAD95MZ/iT3lF\r\nq5WALKLTgP4VAqKC1Age4Q814FPRY9eBIkWrk95SMj2k96WjnfFy46yweCGF\r\nPBxVQ0mQChQqqb91A29HSDl5ZQQKferP4eR23l9K7bdS9RLuVAwZHb3XA8nB\r\nrVdl0P2OnMwiXPGjfaPFR8DX9ga9fLuhYyg=\r\n=cNbW\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221224015458-2e377cd.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/e9865e7caae859253cf364ade0e56b40/graphql-hive-client-0.22.0-alpha-20221224015458-2e377cd.tgz","_integrity":"sha512-E7XIMhY+uenAn4BRA0ked7LVbi+LnMO3LTiXsQ0S9cPFSPf05a1+HPefKtPAcAlLhDL27P+Nc5g9acxyYygmoA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221224015458-2e377cd_1671846933226_0.6134519559191567","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221224072654-6af7369":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221224072654-6af7369","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221224072654-6af7369","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"a36151233757ce69220b2763e2b7b0249479bc45","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221224072654-6af7369.tgz","fileCount":60,"integrity":"sha512-hxkvwxFZd7VSDE82a/eAdRtcVPQ4Iv+1+WIdNt61asR7v3cgg5vrwNWfcfalP5fBA3c+KT4UjwLYCfpSCs/QGA==","signatures":[{"sig":"MEUCIQC6DWj2RtIGCuKoCWiUaVuCU5cYmD6G0udcJvLvTlsH5QIgRGuHECx/KfKhp/6UmzHjlg0Hgn/dwDH4UYqYYNdc4ew=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjpqnmACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrFqg//ct0pziQ501WsPB+W+CwWyYFCm/5N8XuqM4uXX1r9WhMQi1gh\r\ngYAMsTOi/f98dr+v69rig52ViXP4iJJ7AcUdpfk3YmjgMc/I7drSHaRimJGC\r\nlE4TsOB2YKAgWV1R03ksNXr6XjDiBKEMu7Rb2kr7ohoRrx95KqbcUZOR4/Ku\r\nPysitF57kzmV+SmIFHk8T66U/RG1za4iVOTl1z2PQBV2S5ga0zGA03R1lw0h\r\nPDRG0H/6bEWQ6/zS9IVo2F7RULqhhlS1X8DLye0VwR7eTiFocnLxZX6N3F3P\r\nLi/SzprgBpFSftR7gr3WHUh+yBl7VsPUbvYqZQO3IxG8vU98m3ZCORANU5sk\r\nDIGAvhZOClibCYfHif7D3v3QXfU7+E8QHm2dUI0ekZWM910UbCJlGw2sw5z8\r\ns74Wy+0a5RVPyKwjCyFit//02c/KxiWVwcV5GaIClxSJLEG9cjlmm74UqC0U\r\nIVd7jKyN0Zz0VKxL/Vvgulbb6f/9pWLdFCwKzVtGZMq6+mo9DyUpk2iaD+mP\r\nDLT0z0l79/eTFALQ34uxVdN6xSH3Q9RPofj6HPrgX8IptMVpqceU1+iM/LHd\r\nvy4iMoM9ME6yqjRUFJhCNwTqXvFajNK8PptaXN+eDwdMY4gERlHTiDmpX4N+\r\nnWS5aISIWBH6xKZ1r7MsH7EfunNk9y6ac4A=\r\n=BAEg\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221224072654-6af7369.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/76344270ec68615c121705b3e4965217/graphql-hive-client-0.22.0-alpha-20221224072654-6af7369.tgz","_integrity":"sha512-hxkvwxFZd7VSDE82a/eAdRtcVPQ4Iv+1+WIdNt61asR7v3cgg5vrwNWfcfalP5fBA3c+KT4UjwLYCfpSCs/QGA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221224072654-6af7369_1671866854605_0.8367364495260559","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221224073100-f11eb97":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221224073100-f11eb97","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221224073100-f11eb97","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"aaa4be3f8671c4e86945c87130fcf737d75b51e1","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221224073100-f11eb97.tgz","fileCount":60,"integrity":"sha512-CbvnPjT4kvCnG/8dkMc3bhJENLXs8K90LRi88Hv7POKIZFhf7dT2MVB7l3Zpy0/Iofzw/RQnWV1ZE8O0PsKw2A==","signatures":[{"sig":"MEUCIQDJl1oGVYm4s1EHNM2Y3xl2HR0T+Up+T44clqNkn3xdhQIge9+HUqTcc6Z4NlD+nEd4NYiomeDjRU43Kfft//hhSHc=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjpqrXACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpwvA//Re5S0TtR4u50Pv+Zo2k6HhVffNpKiI1dJMvYfUDYtTpOKoaV\r\nbc4wEFROEgD5ZOHAr09DxggHogksyudq5+hUA7RvY5V3iIHQ37kn+zhg7N3M\r\nx9ZTXx6bgKRZENmxrd7At1BVZIeNNedMWqkhMdrbx2KPecV2011fXFMh7ISM\r\nZ46N1OX+VSIlb4TXbCXIe4ATvHYkCslRRiPEGXWGLqKROLFQiEtPVnPwHQDL\r\nefz8Qq2wpDHTI/9rtYB0imWwpw+QtrJowV8au1q5NNqMeeyntuKyMBzKSXPe\r\n0JlKQMNTlwvybcE/R2x2Cn6nZE9CTdQpZul1vRDc8/hQJEeWJUXELr0aulWI\r\nDOqngVuLPrCvBkWrcQZBu2mCzdrjnQcaE+x6s5DrpkTg0RcpEX3/NFP8+ycJ\r\nj4m003nPrGnIeHdarFu25bX259MDeNXwkczg+3UDB/mkq9S/rF8Eo4R7ktyc\r\nr29kJ8CWVzt14MmIJppJ2YoS1bOhiExrCxhsc0jgTy7t8V/nW6BaqWrICnG+\r\nhUp3ncG6GWXSmc9MGIyqiy6kuVGdlO/l8ztrO71RPhadxTXAXA4lYmIYb4VB\r\nbOuJ4aONlvn/aQ56rUEhDmUYvyLMFqLdOkVp4XiEYkWvx4LSXmhIY6R1FA3k\r\nN4NZ1ZjFVlJMszoJujEitEdPFo0/e4PClzM=\r\n=NDi8\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221224073100-f11eb97.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/2d5a7bd173b8ec5b31654a5cacf7d4c6/graphql-hive-client-0.22.0-alpha-20221224073100-f11eb97.tgz","_integrity":"sha512-CbvnPjT4kvCnG/8dkMc3bhJENLXs8K90LRi88Hv7POKIZFhf7dT2MVB7l3Zpy0/Iofzw/RQnWV1ZE8O0PsKw2A==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221224073100-f11eb97_1671867095342_0.7758955483303949","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221224073632-ce6e275":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221224073632-ce6e275","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221224073632-ce6e275","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"77e3e081c813c49fbd1b6dc5f0dca0093410acb3","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221224073632-ce6e275.tgz","fileCount":60,"integrity":"sha512-bVHaaCaX+/QZBjMLzmOa+UwCGWri9i6JOCfDC6jHgzRfJismc0bb90YkSfUoYZjn2zaOqcYIATU0rgVWXQkGwA==","signatures":[{"sig":"MEUCIQC7pil7GCbBdSWxJxfPuYY8IYG3c9uJfbeTEvhZeJCvxgIgSWAHzqfsCm5vlb7J9QS2+Xa9+QziIR9i9gDDrjMlWKc=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjpqwiACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrTfA/+OV+5OWehBwC+3ib5J1IdRd+Cg8PomTKzuP1zT+Zn4M/fJfZ2\r\n33hwL3WWoS2DwU44SCWYFSFwtoaLo/m5XkmTh/wIaCH/rm1YCS4QgGBsDBQZ\r\nQOAOV+HDv/SpVqT84erEoeRg8QOO7MkZNb+htD46Sbe4W3xz02jJDwoRs2Me\r\ntkpWPdZjOulxsdtxDn9J5lJDWb69v+rIv+8qiMrz8EJKtTRdXI/fLFzM2S2C\r\n9XIOke2zXvTn2nvcJ2X5VyYmtUwjgayJzBwBYasaj9H1czkHLeVOy0Tk3YkD\r\nJ9ZtERG9EVTieMISRNLs2EhA3xOFVT1qFvg6JiG1wi8M4PWJ/0UXwMr/XmmB\r\nOWxMxpnAL/YZ6eC13CRRcPX8FT8jcPzSzmIOJAb4HkBfq5bfLimBhhXTTOB/\r\n8cR1niiUtGPAzPljl/5lN6bMzRX+nbZqCsvrhx7YvVHhELq5qMu7w6L6rA20\r\nv+cSy38zKcYewuKIEr0N5Pv/EE3fuZJXCerR/xsns63z2e+ZerTtZXWK1V9M\r\nPHndOQfeu1BZUPeloNJV+9jWPVKppP0KYKv2JuoMA1c3eASE7zjBXSV32ajE\r\nVEPETzR0OKpT327CgA8BDuFp+I65E8omythVgTg0wQ4uq1p65T8tkl5mAe1+\r\nkzEEvqFTW0/VIMYZqsmE6dgRKQvpLSqZXQ0=\r\n=+vcc\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221224073632-ce6e275.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/06f1ddecdb82e733b313e25b75229d59/graphql-hive-client-0.22.0-alpha-20221224073632-ce6e275.tgz","_integrity":"sha512-bVHaaCaX+/QZBjMLzmOa+UwCGWri9i6JOCfDC6jHgzRfJismc0bb90YkSfUoYZjn2zaOqcYIATU0rgVWXQkGwA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221224073632-ce6e275_1671867426064_0.6035316459838496","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221224074727-31c5463":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221224074727-31c5463","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221224074727-31c5463","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"5dee9ea398c3941e6abe515245513b625a64f0e1","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221224074727-31c5463.tgz","fileCount":60,"integrity":"sha512-x+cWfFQPpFKZmRyc7pU4TNhEEqwlyQQIV4pg/pGbrIhjjrKZIJ/QK895S9jMB7H970wF7QwAcXkHIykZ+a6y+A==","signatures":[{"sig":"MEUCIQDgXj5WEHYxkAOEwX5p3V5CR/jAWn4jMAjKiAhxCe+sfgIgJOC3zqXm4R4Yu5JgGJsoEKmaP6WffQIfB3Gn8hp90Ig=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjpq6xACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmolRhAAmeLAFFF4A6D7/VvRTpCKlR+zgcnvztv8Vubs66mSUyvBCrhe\r\ncjZC0GRHZVG2z/KlfEb38e7A7ALA5kk+zYyjxi1wWhWRUsu2upet5qxpIyjc\r\nZ0KCZv0miquG/DisRLwqIu6QUJLAyPov/FXYUdhISxL2CSHYRxVRq4DmkKU9\r\n0kL9ZK07XtyC4pKqxwev55trDhAuXpdTtz5bKrtXsD6E5XSt4IQ5iUXPtR4R\r\nBcSCCBiUREJPqKDrMRXu07uEh/CJBPv96O2n/z1fFgPUy+jA9b7Z/auSAffr\r\nT4UoqYrHyvmoPretXtDfj+kzGfQl2sfy4L7GE68cZImaGfuF20apmHHOyxfi\r\n9H2BpLRrBTT6klepRYrx6BKXkFMe9lH+OGl6AspkAN3f8J2F59FTjCYqyyWA\r\n52Da4MDUDj8p6jGEBfSR9iF10dIaw4xsmjU/LifnpQDEdmzJPgMRendzE52D\r\n8ps4eGKux0nR38VKXgCFokC6lOPHYRvHdTPf1H9mUakUeZEWS9nXSUFUFnZw\r\n6X5EZr9mK4HARI7dIsGsnWcb/ydTX4cOXEkliEBms6CTzQtn0vfK/QBWTC9o\r\nvIkgdT9VD5krFCKhqWrPUhQG6dK4InPDBsIl8Jm287pt5qDyBWqw45VFWCqN\r\nW8lnL8w5aT2uFXmJVUgekY8IFzazu0XaBXo=\r\n=Ru6o\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221224074727-31c5463.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/333227fe73d88fd2b18e11dbd6321a13/graphql-hive-client-0.22.0-alpha-20221224074727-31c5463.tgz","_integrity":"sha512-x+cWfFQPpFKZmRyc7pU4TNhEEqwlyQQIV4pg/pGbrIhjjrKZIJ/QK895S9jMB7H970wF7QwAcXkHIykZ+a6y+A==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221224074727-31c5463_1671868081663_0.16686256875592975","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221224075338-6fa66c5":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221224075338-6fa66c5","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221224075338-6fa66c5","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"7902a5e70c6b3bf906b33f00435b3e498e08113b","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221224075338-6fa66c5.tgz","fileCount":60,"integrity":"sha512-V41Jg3QMntHycCVAVeu2js1ep5t2q6lgBcqPnAgZqDYOPoCOhWTWYgpkvwOyy+3dY3+EtSxavibbqg+wQGrs5g==","signatures":[{"sig":"MEUCIAlitObBQR1JVTk+SY39uhEbyQr+ypxB9l9avKxWSlxoAiEAyL02tbM2D7Qnn4WdXDNTO5Es3kOJ3M3usiTvXdON6UE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjprAkACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoXuhAApSH3AUkWBytQn8cehOWEJph+3sqTEg30gmQoWAaDyMP9pXWI\r\naXeYj/y7nnWsGndWmAcFmZEQkSHZwTfvKDCYPEemoWt10hK929r4zJE+SQwc\r\nwTnbGUYrB2qzuG2NZdeYj8Zn3ogyho7cyxNja1WiNncejPYD7xvd97sOEz3O\r\nQhZorNRFnEQUHKoVIceJK+38xvG4DFsYp8ZnZ+GsKUb+HZyGpz2aL2EFw9ZJ\r\n1KA7KBZbSGl4YnDe485xTtQ5ePs46gJ6QMFpoyByQkiO6/Utlq900O8ZjlrM\r\nuJmQiQw5BYDbpcyNePzsAq9XBAsyB5kog4pivEsPXzUqVSNqkAFBh9Jft5ZP\r\nzqqFr0LXK4/9lPdJUvU1+7qcDvrXoq93OqiuZMx5cReIe4UMMyfoHZEiWDZ9\r\nsTRtpILZB64GSwfW/HDJYfhryhnHf8Mla9oAiOQVXjFUWrTyDzrwkZkpJE/p\r\nTGetYVA64fkQ+RjzKQwI/EuLiaGyPbafryB8Wvn/EL1IAevM7M8ZhfFWrIBl\r\nnvS12Zcx4IR1rV34Mm3NUGpJ1bkfSBXwLyxkMC8mg1zOZ4dfqn3kjUlzHdPD\r\n9DaGCafI9X5W2X01d1QYu0qlFbUJa+q/jq7FoY1UdiMCVyn9tNulblVFrl4V\r\nz62A8AfP+rUfCr35e1pxDl10aCLDzF2MOjk=\r\n=wv+L\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221224075338-6fa66c5.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/f041a9e853749f7349384afb36d1af13/graphql-hive-client-0.22.0-alpha-20221224075338-6fa66c5.tgz","_integrity":"sha512-V41Jg3QMntHycCVAVeu2js1ep5t2q6lgBcqPnAgZqDYOPoCOhWTWYgpkvwOyy+3dY3+EtSxavibbqg+wQGrs5g==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221224075338-6fa66c5_1671868452227_0.4481865527743123","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221224083017-247273d":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221224083017-247273d","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221224083017-247273d","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"cbe2170b393c87b3038716dcf9da8cdb264a4602","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221224083017-247273d.tgz","fileCount":60,"integrity":"sha512-QA9cQosDoYIMQAivTJLMIAvmXL3YQ2zKt1Sk/uSkhaMlab9t7u5m2BX+t345a/F/4CqpwcqLGvFFApHW4Tdhnw==","signatures":[{"sig":"MEUCIB3Hl9iU18l+5zvbPWAp0KoO7HTnigyBfJqCNwg3UNQwAiEA1nfcpVUuJ3uTKrRd7PzjEPLvqatUd2cQZj8O5E4pzx0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjpri7ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmrpqw//bHkSOV8pSSfcZRXsFIJa3FEhsRCaiGDn9c62qas2RIzNGLdI\r\nnnC/qSPfM/8zN//AHfoIa6eYTqw5l1rxrUJtbZwBPrY6MW+PqSA6JGcAk+JI\r\npSawoHc5lmUrgrGk4LMWLUrh3A7svhkV4U1rUkhZ8sl1TbSbSfqBej9NPzg4\r\nfGxk6yb/b4rYqsXpMxKtUhx/ArO+McWzdBj3Tml4c4xMZ5nvFQ8OG3tDUU6Q\r\n2Bca5rwdVlewclo2JYxAOfKvzxAReuw3zpz3I39Wcfh66euMQ4XzobElr9lc\r\nKbH94/f+FGD3+Rd7c3uUhwuT4A5kRtMDJjOp2KGrUvuwqgMARDWokQOH+QZL\r\n9p2hAFS2p7ewwBkCXKG+x120gsIPEAh9fmjeniJHScHMTQufUkfB+zGV7TnQ\r\noazSgZ48yw7zCX9jZu0b7YsMhGCzTR6uMhHolP2Q329OAEaZVHWbFKslq7Dp\r\nwMZ335suQTq0uKUVIbLYseQbG7rro/KfUkmWhTVydBPD2QaSNi151IyWgaR0\r\n7CQ+F/C5IjgPCrPAEypBRGg3MYR7MduKciGj4TWnGNzELDCP1UwbAZiEyLZ1\r\noV1mnNvUJTh2irIPy1NWM8ahz2WpMipBLGv1cj13K7LGJZ33GYSM2djab5I5\r\nTpXnLqwabEeqpAj1pHJAcg6myB/mOB/hlYU=\r\n=LaCO\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221224083017-247273d.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/338478ab0495cde480c7e57dea6b7e5b/graphql-hive-client-0.22.0-alpha-20221224083017-247273d.tgz","_integrity":"sha512-QA9cQosDoYIMQAivTJLMIAvmXL3YQ2zKt1Sk/uSkhaMlab9t7u5m2BX+t345a/F/4CqpwcqLGvFFApHW4Tdhnw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221224083017-247273d_1671870650990_0.3047925425059326","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221224083542-526379f":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221224083542-526379f","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221224083542-526379f","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"85daed2d86e4b9dd6f44cc6f09bc657db47f889b","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221224083542-526379f.tgz","fileCount":60,"integrity":"sha512-pQ3m3q6zCkkkvjZJwsEb3hG/mzLIRbYa2+uYcg5sTgil1H1ZY1Ak1XheGkGbxX5FURFHzEzqFrSa17+RI2V+9Q==","signatures":[{"sig":"MEUCIQDtwd9G8lmF4fyHANFpJGgVu21VA0UX9n+DgiQLCBM3AwIgcmdhSaQx4yjHe8GkDFJxZoB2sMsrV93Mxkj5rIk1Pww=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjproAACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoFsA//XckPhjpe0xbTX+GwrfNVYVTtD2eHfE5DKeCJh5TcQ0ySqsrp\r\no489cuPy+bgMxhUqx/YNKkQD8hdXZWKQKCB1SZi8VpiNe28ogd+gfpK6U9/z\r\nCAM4dHO1av+jYkcBmDqebzGuV6On9aGclgabTTh00D7Yq528EJl1kamP3POV\r\nf1unnWrKJIrdHMX6rhmj27lxqVPm71am1PyUkHKPBGQ4EqFSZmsqucigwSHQ\r\ndd1igWAB8FGvJJ/OogTAobAaBYO2Yj3VPkWdSsVqWyor23poowmlLrmnQMVv\r\n3Dkvpck8oMa5DXVy3VS7qZbk0xqHRxxkK2mir3Yy+StX061NOJaDGi4i1GNu\r\nYXXbGoNyUR5JE8ofcd+/EE3UiMMPQcRClmGFjthRI0Tet0iHkPv9glEyxUsa\r\nwJQn5G8QG4t5j7fqf87/cEFYaOzGJAHgbt0WJe/ZSFEZpE1gpRQNSBoKVoBL\r\nikfMEB7CQZNDG/sCfLWrYmPLMAHg0uJUxd1zxG9NYPzkFCOJ6qEg2bVmWSCe\r\nyXCaS6xjcF6mCcarhqbmk4asRt+5sEv7taxTgPoFHJbyHZmrv6UB0KeKdYEB\r\nKz/mWL/lOC6GAKyqD+Jof4latw2DcqOesow/Sh/75gu3F9CGQiNn/oxkZWCI\r\nZVGYVHigVRXgHrVov9A8erCCdPaCqkSpwfY=\r\n=A/ng\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221224083542-526379f.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/20eb39cabf58de717ec7985bcfcaaa20/graphql-hive-client-0.22.0-alpha-20221224083542-526379f.tgz","_integrity":"sha512-pQ3m3q6zCkkkvjZJwsEb3hG/mzLIRbYa2+uYcg5sTgil1H1ZY1Ak1XheGkGbxX5FURFHzEzqFrSa17+RI2V+9Q==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221224083542-526379f_1671870976758_0.7943374038656068","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221224084054-1738bcc":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221224084054-1738bcc","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221224084054-1738bcc","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"d7e25c42c7c5e61f4232b854b371b7e4ad1fbd7d","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221224084054-1738bcc.tgz","fileCount":60,"integrity":"sha512-7m1mwsQGktnGjM0d0fGcZN8ohDuMC+KKSTH1CSJC36BBTUnUGEy/tYZFHuFXUQ+7eiiy4NhqQcY/yDnwHkF5Kg==","signatures":[{"sig":"MEYCIQC7+p4Daea+APR5YPNbzpOPSyhCRdVXFQe0hlkM3V6kdwIhAJVu7oVD8i7ZjCxyK02OfEtgtaigM28BujwqTg8y/FQX","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjprs4ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr1EA//Tu1V4ca3uvUiKu1BxX9UorgnKsEM6AQr2t94LNZsmw8+SonZ\r\nzA8F/e7DBCcSs4cxJ+ydBcdkHJYUQzeijcUlUK9D9C70zuKxpV/RHdKTiN4u\r\ndxFVgdXUjnOeYZQQDww1slzdFJdDja2GdmuEwME4qV5McjFNdXMA2Ncf4a+c\r\nrgi0WYyYPxzwzKLsHa/PCFgIO2MsHHuOkZojHcT6TU6fHwvN+kmnsvnMBRUd\r\n/MQJnis/tzadYQ+BAmqCMGCKwTFHtKFlInoGs/oRt/gVdQzQB7jGcWwO60Et\r\nqWx3p+bp0cbvypzbwIMtkX5W/YBU1qTeWr7UvQDya2Gme0Nu7ulRm+nFUQrS\r\nJMXDWtH3mR6jzgNWrQtyTRj5FLSglWMYuWkNXKQUJKKCuB9KXeptPy4u7t/J\r\nCK0Znn+mt1OcowXJFd5LQwq5HsEb4ucefsLYaIXLOdNS+0lETYVBOQwOEyQd\r\ny8o0+7284Vv9dR3JCVyanddVVRDe+6VptvzGwL6uDMx5gqiwcJVx2V6E734f\r\nKA396Q1MYHIpGGXG2rHb499Mmx/wRwqGZsmk/jrLngrfJllyN8lY8CEomgtA\r\nVC6jQM+PBuLBwCrkTDD5hg3/ls5CxAKDlei1W+lUuWihtpn9FJ/C0up2xJUa\r\n8TeiWxJ9uZv465DlF4hKYz4G2qQIK6sbcZk=\r\n=uKHj\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221224084054-1738bcc.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/a00be15d84d3fa40d0ff671ef5677c8d/graphql-hive-client-0.22.0-alpha-20221224084054-1738bcc.tgz","_integrity":"sha512-7m1mwsQGktnGjM0d0fGcZN8ohDuMC+KKSTH1CSJC36BBTUnUGEy/tYZFHuFXUQ+7eiiy4NhqQcY/yDnwHkF5Kg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221224084054-1738bcc_1671871288354_0.2728524594091468","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221224084549-91cd0b8":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221224084549-91cd0b8","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221224084549-91cd0b8","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"a71f315290983a2ff883e0a73781b90fc3f685aa","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221224084549-91cd0b8.tgz","fileCount":60,"integrity":"sha512-/7hvhXGCq4XIQxkmPL9ndXFdf3fZ02OjD93la+hRN+wW0QjSGcvyG9Ef0kJwZLUU7YjswjRXaAU1xMH0jpEXyQ==","signatures":[{"sig":"MEYCIQDg9QAqX3k0MrsEOhFQ4xfCafGUlduU2o6ahYeqP4BTfAIhAP2n6O6A47a4wsDou9nZgXCgH1KbAM3xZ15ruFwXvqpJ","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjprxgACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqH8w//bzDJEqJ5MGlsnOFDbjmqO64PthDyEMMO9Y5iVFzBtwKpCCvt\r\nmdLwDsZzqerRUGhiZl8hFA6SkW4wPYo33xMjjQ3yYP9V7QNbHeKYqxWLC3Pz\r\nIeX4hS5JzNV9BBmTbJXcN2J6HtljTMClnv9EV7E0mAybTIi/snsIqWXBBfdi\r\nXq0is9htmn7L9lBErHz4UJqnJ4KVXzUK2E6DiYMZVIOMUyWh0UqtizQNIiNX\r\nRQFE4Ja4pY9E341oexse/bYD+PYSU2yj+DeN1xtmNpNzgYHmtTyXdC0P5r0N\r\nSsgvOgbrt6xp+i4FZtR5c8xxYGcbMSqbLWL38xtyK+xYhp7sxLeFrgkiK4J3\r\nbsAYE1kOYgSHmwvWLw8Y8cccMiUW0vopI667hWlt3QJA79SkZo00fvyHLgpS\r\nUareQmW4rk++MGPSXv3o0R5XA2vbw+qqbx9zHUtaesJ7WQZx1EUctWyZ4ixb\r\njwBrkERJkUzbiL1wyuDqyTh1nQ1/HfZNCz2JPpwvMqifRVPcXIwnwyS80zAq\r\n5cBJhzl5nnceQMTO61BXATmQztwua908w/A3BFVjatqn/7oxKMF00TJWeAHW\r\nHrQGkY9lhLyjA6AUe6q6GWOHXkOsPYEv25Z7dDDRJ7hqSHJzvPxBRHxadYXt\r\n3IO6RbdYCYG5/t4eauMMT2kEdf/ZQgi8urI=\r\n=fjeh\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221224084549-91cd0b8.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/c41a026821679e31c48703c37589341f/graphql-hive-client-0.22.0-alpha-20221224084549-91cd0b8.tgz","_integrity":"sha512-/7hvhXGCq4XIQxkmPL9ndXFdf3fZ02OjD93la+hRN+wW0QjSGcvyG9Ef0kJwZLUU7YjswjRXaAU1xMH0jpEXyQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221224084549-91cd0b8_1671871584676_0.5164477834133443","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221224085132-5ed12d7":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221224085132-5ed12d7","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221224085132-5ed12d7","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"bab64694770f6821b7c7bcbe00060dbe997dd3b0","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221224085132-5ed12d7.tgz","fileCount":60,"integrity":"sha512-zWJJ00Wq0JgHd0hXAJ7i4t7GRu1z3uK0mvFp+M97lw/2+iX1vPFCAvp/LkW7v5ndmCKwpPuBbq3OVW0izOqw6w==","signatures":[{"sig":"MEYCIQCPqgROz2QihvfhWv4+dVJIVKA8u1K5QTLxAZdclSzLuQIhAPBS1ZlWON3AaQ1BRPh+N89g5eZ5SQKLaZCw0eGnQipb","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjpr21ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp9aA//RFcuEcieiwQvW1xtSWOBTZw248rif/nQZ4QCJXQyEVD6Xqhc\r\n1+5tWBCeYyrnGNyBBVWhJj1BinW5xUVf3ODPNYuBS91VEwAcBGXcisbH+nOM\r\nzy+akr15U/Gy7TQJgNNKN22MAlpw0XkmRMQxuiIMn9NaP4Jdebnh5f41y/QY\r\ncH/xdlJVqQfbxC/9AzBAln23kxtLTB00dippwB8l2CPLKa//5s+elG9XWMQV\r\nUuNS8ArPzM0lDthVh+z9Bt+NDtOS1IbGBYxg3Vw8Q/euN9koQ+f2v5cPKOOZ\r\n695Hf1ar5QA3/iAfuunrMTBtdH1mHllrpe8BvNEuqiCpicLHaFj8GgC1pr+V\r\nAbjaQTUzX6Es64aU/ce3Yak7wvu5Vd8U7JgWnVEZfjC7DmfJFqqCSUDxE7Lr\r\nmHgr6QMGsBYHvSRTZD92NqttZefGPex8TSVUkZ6zflwjEnnc6rBJBEjI4u63\r\nyLta/pZKiUPOqbpTWD29/LGiczfGF/v3F6TjQIdm1brco92GvRokR7BAut92\r\necwihbg1eBjVKwdBKgaY27Hf3mZ+A3oT08TF+CpQHEEQp31oaOYjvKuWgpDN\r\naXG+7JitQkQwmv7jb8vO2HAZUk/g3dW5pnzP8x4ZILevk1ijj5jdUf4DXZaH\r\ncvpKPjD6HgZfqTQAnFUQZq8HLaz787hNpV8=\r\n=hKBn\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221224085132-5ed12d7.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/2b308b0d592bc864894811b170fe2af2/graphql-hive-client-0.22.0-alpha-20221224085132-5ed12d7.tgz","_integrity":"sha512-zWJJ00Wq0JgHd0hXAJ7i4t7GRu1z3uK0mvFp+M97lw/2+iX1vPFCAvp/LkW7v5ndmCKwpPuBbq3OVW0izOqw6w==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221224085132-5ed12d7_1671871925763_0.7050014324719309","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221224090122-67fe9b2":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221224090122-67fe9b2","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221224090122-67fe9b2","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"519595071f7d5ec41f67917995c9de7dcaf95ba5","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221224090122-67fe9b2.tgz","fileCount":60,"integrity":"sha512-ITHkzzKWXRFmppd4BSnZb/qsV6hXinvjpO0vMombLjgWVKn+PsG25dRm86Ab0O8wu1at3QbsAxEIu4sgknxlSw==","signatures":[{"sig":"MEUCIBBIpgARWwVmrB1W4ufWd1swIaiPTf14mNr3T9KR0OFJAiEAkVN9aAE7x9eX144JbUiAywBivAK3/ogaM89oUnzypaI=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjpsADACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrpHxAAgUSnQvKBbCXY/mhXdixPw91qdyCFCeYZ0ZSqvD9RPITkzG32\r\nYWBJeJrlKNjSZ5WWJMAnjN7flPzXuhLgnzfD3/OocHt25mlpNAYb9zXxFRlm\r\niC2qntDazUHzVw0BMUU6oMCXvZdXOODxSMj1EWQJhxrOH2WtP69Yc++2lW3B\r\nN/2G7AGlDmxaY8Z37vnvmNNIkgQWa3XLZcHtLxFxDin5OvjZTk94mVcATpSG\r\ndfB/KfAAw49w1/HhMpTzTx8q2Sgd/EZ0z2fJ1E/bTfaKS6Yj47+qwSvdoA0q\r\nPiwI9dylPH+v7zcinsd7vYroLfcJNWXx5HqIEoSJu94FGy5TTM3tGtITRVhX\r\niK9ZMTwkCLTMsNS0T9N8qJ2MyYBj7N2rhv+R4xOSjVCbP1BmnbZMpPr+ySgz\r\ndmR9cLBRaayWDpK7XxWHrSyQ16mOOS+QHLScE6Mff+Cwr6dfoMohn7EfBCea\r\nbOB4PeO74iWp86lqFerXkV33+sGZfeu/TlcvaUQjZUgPYq7D7OkMvBaMMwM3\r\nQM4u6SdZSgRpfiF5sYynwGSqTOodHzNLSL7wswrOmp710QwmDStxeCvlb2VM\r\ny6q4dGr7fmY2pvStGMMo3mGCUsa7i1kCgzoloU5/Q1Wxmt3gNWTAxNmxbUII\r\nL9C9iuJWw0E/xrHLCCQLKIejDPe0218cHbc=\r\n=Go65\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221224090122-67fe9b2.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/62b63b49dd100dd7596b29a518709f6f/graphql-hive-client-0.22.0-alpha-20221224090122-67fe9b2.tgz","_integrity":"sha512-ITHkzzKWXRFmppd4BSnZb/qsV6hXinvjpO0vMombLjgWVKn+PsG25dRm86Ab0O8wu1at3QbsAxEIu4sgknxlSw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221224090122-67fe9b2_1671872515659_0.9611123177542835","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221224090632-e8877dc":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221224090632-e8877dc","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221224090632-e8877dc","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"8b7e3911070a53d2e23150f8d117f8af52b1469d","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221224090632-e8877dc.tgz","fileCount":60,"integrity":"sha512-iTc6cjwpUG6ZiIq9aBm2iJa1UwpEkOLaWl9pc+smB9n7s7LwXE1jBjBqXXNp6Bj2y2yf6GNxgWyzRAxYacWLHg==","signatures":[{"sig":"MEYCIQDjBx5ygosvZCvAW49p59tAy94vrOjM6g3pYkcgFg5eXQIhAOlJR3qaLEWjBdjMEDnczu36EFJShOlglVXn4PROogNQ","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjpsE4ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqKTRAAjqWXYKqNQBPlbVLMB0U/O4HD5wtwoPpD/pVx4JrK12FUoI27\r\nTdnPOXk5IJ9bcd65Exib91WJE/1oexZvxq18EKR9pnf1TIn/T71C1EEcijSH\r\nTrd+OVqLyknjYMsadkzqBB37tHEGJF5QdnX7RJVZruPkIr20YeLXLIm9vwu9\r\nD471HEbAuJQms8EG0bnseAlJtcVewMKRc8fvcalnt2aNnY5/1uLMmF6HPJkS\r\nTn0SH+lg8Q1rATEMbES9vbC6PQcAni8ec6EnpfzQPrCDY1K13p7lETYenBG4\r\ndCpPaFXVCy4PiqQBnq6iJq8JXdpKtM7sWPi1l7fxTkcGXbJWpSn/DYWQ0Mjk\r\nWUKnkrnVjtmTS8TI9lKVWFKARzZWIzm2uNZXdqhSInIRz+KtAmFUJI/y1Q+L\r\nN5m9vTCnUbvdRqEYT6FX80P88XUthpWzN8xM2Wjsr9mFpYc//R2v5XU49MGN\r\ncIu7bZnIgOb7cdOjJui1kqbSUQpq53pPmACWsVvdlFVUPfxrZtaoxpqym4W5\r\nyVqliDYQJtGdHD77gFJRqQLLTM+SXnWKP+j89sKdI1FyyvO8GzjrXLbjmVuN\r\nqzG8ZcO3fbIdmVruh+HzeiyEwHrx3Snx1APjibEITcEk+XFlysSNhtohy2zr\r\nFMimjyujtH2UBHO6Sgrx7FnyjNPSa4jALdg=\r\n=7fJI\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221224090632-e8877dc.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/c084a6c75c6fbbebac835accffbc61fa/graphql-hive-client-0.22.0-alpha-20221224090632-e8877dc.tgz","_integrity":"sha512-iTc6cjwpUG6ZiIq9aBm2iJa1UwpEkOLaWl9pc+smB9n7s7LwXE1jBjBqXXNp6Bj2y2yf6GNxgWyzRAxYacWLHg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221224090632-e8877dc_1671872824622_0.7109961155397204","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221224091135-fcd5566":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221224091135-fcd5566","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221224091135-fcd5566","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"afb6b1701c56b25eb3459fde4687bae26a0f4d75","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221224091135-fcd5566.tgz","fileCount":60,"integrity":"sha512-znWLOe1Q4fevrQGdiG+QiKlYAhCm8AZOUwpU0EiY/1LQeB4LV/hC9cxb1kzVTKPQwhQqvOzSluZd/k06aVrVNg==","signatures":[{"sig":"MEUCIQCFBCEouEn2QDNlQxMqGgT5wYWovkUeOP1dH0mRBvm0lgIgLs4plIrN1aHlhwzS6hEMJ3jf0IoBWF7TqoHKP9Ltmqg=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjpsJoACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrhAxAAmOGaHbsyecLcnuK5j3Tium3YGx76E8t9Bf3JZbbkJonFVCM+\r\nqyLYtoL1KXJUFj7oW8v2vpuDVDzvhFFtE+LmeIYcbgQkqLMhc9NGhJId5lbT\r\nClHN6WPZZeqsamsvFfshmcXblWAOLs6GYYLy/trVfSIneaMp7Ta4rt5v8WyR\r\nIQaWedS/9HU+VjUu3eSPUySdHnUIxZYCFZ9DiTc0gD/oisXqeDcHcyScCpEP\r\nlOaKrTeCw0SeHkkFvM9nS2oTdkFzhV30AcuRzJ3y30raU85hzcKXnQCysayy\r\nsS5+fIAlkq82CpAkhyiGW4VFoNfd4u0W8vyAK226NkBuao7qNZMAFa7SxVK5\r\nGIg07Zg2vWGw6xnSnmouGnI9KdQ9TcAhp4gjMCMXto+kM7xejd5i9F+UEK8G\r\nSMZ9r8E/kepaMraBN1zCp3evWaAU5pKgkpWcIVdFsTFDOnRjscQHe2ruJVwh\r\nJ+0qFkpI+ExbpLT0e4RCtLRKMYvzSPhTMYMmtywwFdbE051/3IGKQMskYi6c\r\nHaXVZcpnV0yNa5QrX6sa3iSKz591UjoXrkuURmIStSS1wpGJezYtW1n/e5My\r\nK57GL61SzIEdO8VndfDWFDYaSN4oDbDi4SHMmVar37ZPOYpyrDcBd/xeuHbK\r\nr0x12tKA7GDCpc4PHbYI7GmS7+3biSb9ACQ=\r\n=zH4f\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221224091135-fcd5566.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/04167b91906e58096a2a68c8ff54c5a4/graphql-hive-client-0.22.0-alpha-20221224091135-fcd5566.tgz","_integrity":"sha512-znWLOe1Q4fevrQGdiG+QiKlYAhCm8AZOUwpU0EiY/1LQeB4LV/hC9cxb1kzVTKPQwhQqvOzSluZd/k06aVrVNg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221224091135-fcd5566_1671873128332_0.31438078572460104","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221224093914-37c3844":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221224093914-37c3844","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221224093914-37c3844","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"a2873e3f743dd0fb8f3493b01de69735bb9255aa","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221224093914-37c3844.tgz","fileCount":60,"integrity":"sha512-2y4fk6S86v2a+8T8ereb5OaADjAl0afDsVPY3+y0/lJFTK1hhDOYVqJdpRwO4ZZYKrAEITkcih3WvOK6hdmOEg==","signatures":[{"sig":"MEUCIQDuCb+wqxol1gPykHFNdNSfzhhr9nEXWlhPsAiumsuxqwIgVUZt+lLnbe0jA9JgywqBbDi75gJJQOmnKIYoUSgi7k4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjpsjkACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrRwBAAlKbmHk6GI46azeoNIuRlCpzjpGu5y7XNVbYfbGwcK4w/nFac\r\nfX8M4fg2uvMerZ1QIgldeTeMTpuOKD9Oz9EUQfGBCUhLxuQTCNzTIIPVuzhq\r\nkqiTjFNrbQ4v4u2fJpSfL0cFXEY8MO4Qncfp6VqPPeLTv8HPseI7nONqiV45\r\ncQ+qWYABN3MT4iG+NS6/36pnUXFEIjBK3YLZACsisSoGP2LZnlciQO1NJ0dH\r\nFbGIIWrlorPKHch+0OmKqJkJcy2DFjMYzeCqdrI9lMxX+4N5nNNPtoJWvFgu\r\nZr5dThM61Myoe4RN0bbasFjFhEC8T4jZ96NUW7G/1MQTib6ZXhiS+SSXApT8\r\nIcZQaKmv0kPThMPWyPly5c0a+MAUcaYYqTsgHCF0RoMFl8001X7515Hmaaf7\r\nv+FrrBg36DkE1ZBeeremHm8bI0SZM8KFfF4ultEgdFLQaHFb3n7gDvvjbcA1\r\nfn37SY9m2lp4iDBRIaivK9jcAN4b9Rx82rL59mlzrDCxb57a11IlYNu1/gRJ\r\nmo288GwvL4cq3CHnxliKq24CNHzCXzjLKpuGcUSs4STi3FsoE7qODEeO/WO3\r\nKrXVr7tYvaZUQy4+YOVjUiNMma2R7FpxWimNKxrr+T0+w/+jc0NGD85Qf1Bx\r\nCbPSv1fhrlSOnD3rc8tUM4WxICZRd1+UTLw=\r\n=HcNQ\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221224093914-37c3844.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/81634492a996866ed5d23d493baa67b8/graphql-hive-client-0.22.0-alpha-20221224093914-37c3844.tgz","_integrity":"sha512-2y4fk6S86v2a+8T8ereb5OaADjAl0afDsVPY3+y0/lJFTK1hhDOYVqJdpRwO4ZZYKrAEITkcih3WvOK6hdmOEg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221224093914-37c3844_1671874788013_0.45158457428561727","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221224094321-554f47d":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221224094321-554f47d","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221224094321-554f47d","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"5647c05a2d2b63533615fa0098dcd4358c188b00","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221224094321-554f47d.tgz","fileCount":60,"integrity":"sha512-Gea8vQL21+YHrgc5uElBO7DLzrxSsJm+8vvGF0A47Nbwk4gGUYaVPkbx3JRO88xr1bYJifj05tbqKzXruzL2ng==","signatures":[{"sig":"MEUCIQCmjcikTdykh9yykEF0CKMdXexg2cfZiT2dIj+wqKx7LAIgCURSCWbKL5hSr+7EaBJ/nAjpDUPUoxRTsG+vGwlWY/0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjpsnbACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrwOw/7BJZ0UZa3t/Omz9MqA+CfJMpvCeltPPZS5eWj3t8AiPpdpGiU\r\n7FX0yQ3mB1O7zcne//WcBlBpuhi4DTD5B2XR4zkWaoLjSPEUNwdPKtmEvMYs\r\nJjeaEeYJ4RIpeE6LXrndt+BZccGyAg+CvdIgdKCBNEeOupaiPemaFYuXWdlo\r\nhhPR43s//3aADO+sIJWBFpn+QAmZaO9XDHQ/XhXvz4opWvpsAwRxu7T8skvS\r\nvBqJhhp5HtRwr67kY0YRLQXWOihaOiDDZGyEyQXVOwKq+o5n0Q7WkIEpmKDT\r\nwbNSbNRzgxBdsbC5GY/amJdbTM7wi5BrH/bh9HCWoi5M5QFq0/LVIla38k4V\r\nsE3KxJ/C9sClOJM1zIyBEFysoLQeWBTKsM5wB6J1f/aI3k1ztARg7D4DRaw8\r\nYOkFLPGnV7Ah2CosfSbWn6ohJfynZ3kdjBmQnj065cYH+9okqnypi+YeE9pa\r\nfAlVpNjS2pDFezjI3w6JBgYxt3ixiXZv+7Hw/dNcGFxYcDaJueleMqvidAHq\r\n5JhfNYYGK+1EMXWHW7rFUk+4rKprUxfAeBRkWvcfCZrBKvq089vCoivbGtc3\r\n01CuIkTcsdwvrLwnjODjEZiCJc1RkTc8Am0LACvkgsr/9a0nKe8waekhusdJ\r\n6nnjVIqxTVcWqSrUkYQz3YFckJU9szWlKMg=\r\n=4bdu\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221224094321-554f47d.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/02cbce87ab2cacb3efc53e27a83d4069/graphql-hive-client-0.22.0-alpha-20221224094321-554f47d.tgz","_integrity":"sha512-Gea8vQL21+YHrgc5uElBO7DLzrxSsJm+8vvGF0A47Nbwk4gGUYaVPkbx3JRO88xr1bYJifj05tbqKzXruzL2ng==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221224094321-554f47d_1671875035414_0.5379253671681739","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221224095141-c2546b2":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221224095141-c2546b2","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221224095141-c2546b2","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"64bdd832cb535be327d11d9db60b3e25d7daf750","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221224095141-c2546b2.tgz","fileCount":60,"integrity":"sha512-syBAtcbvhJX8H49MU3kdWls3FhmRfMPbbCinYBuLyvd13/wINl9VWa9i7tXyciA2CaYdFIyheFJn1UX+wruJxw==","signatures":[{"sig":"MEUCIQCySqgjaUb01unaXims0JLb1CXvuaAJwALq3APwKeJiHgIgGsONApiPMEs62+Fi9ZgA20/0KKNeqXwKAucQi/U6EVs=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjpsvcACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo9OA//UgC0ppnLJqAfslUOCIGiv4nRYHNS5/I8861rdS2oT+5aGO+K\r\n5AXguHBug+a+hxzKhEE5bsitcVQRnP+sG1oXrwBHEaQC/hWSPp+BpBK1WBIs\r\nFCLCFnPcxKNFZaMX/+vSEhjwjF8MsssoTlAK+8HfHBbR8NgxzT5cdy2hSkI5\r\nVaams81TMZithFRJ1n8FOyOaXdwtlNDpHGslItub5V3OsCVuYRnONwDzl+3G\r\n9xYYXv27uPnIGJ0nhNb32Pe0UasmQMGWoQZfKOktZtylGIQz4yECKYpJL0zy\r\nn+F332KOm4vAhv7b8UB9Obv4Dv/qnVIOCoUK2Zw83c7mZNRHz0mSmdIrNy0B\r\n4Rf2ESDusFMmDdsBBl6OOEfAkN47mr+w2qPk+eN+jJVhdEPjEn6+G2E5nuYk\r\nQGYRt4oa/j9zmkMGQz+iWS8ZwunZH9WItKXjhWbwYy5xYB/DqBhpv6Tc1q/M\r\nHQUJTTwNyj0I3zf3K7/Oao/mD4SLSlfoq2IX0FdG79o4HJUZdpN6R3JTrYvR\r\n/DNHZEQkFAX0yTbzUoomFq6E1q1TIeWlhLTDWmR58yJOEbu1fRJA8LElFaoO\r\n0qXLGBujygsNiM1pSFcAx0iu5zmHlQCAjjfaGqT4fWPFu74EQL9yibUNXAMQ\r\nWNFkgGWCRNgWItAH2TXnF/vuQK0ZvEOz2w0=\r\n=ApMz\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221224095141-c2546b2.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/8c16c6caac6c1da3ed1cc93c25749e10/graphql-hive-client-0.22.0-alpha-20221224095141-c2546b2.tgz","_integrity":"sha512-syBAtcbvhJX8H49MU3kdWls3FhmRfMPbbCinYBuLyvd13/wINl9VWa9i7tXyciA2CaYdFIyheFJn1UX+wruJxw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221224095141-c2546b2_1671875547832_0.8239049318450768","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221224095643-6e25aca":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221224095643-6e25aca","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221224095643-6e25aca","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"f415c67a0ede2096318dce9373d75c4f4f7a4649","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221224095643-6e25aca.tgz","fileCount":60,"integrity":"sha512-J090a4aJ7rFS+fyBVKem/ycubjuqwxE9mQdTQsfRD2meWO2LVeeqgGqZiZxxyBsQ2rUC8h7C/QPDJF63RY3mqg==","signatures":[{"sig":"MEQCIFufos0rmurEZfMMZvQ1bmefWEm3mq5x5D+lFf0IY3+GAiAzJO2SPwN2VEKAchEDcANM+2iUWtf710sTZTh7Bnnxiw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjps0GACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmppjw//Wm6K3DLLIM9+NbWabMFkgzwHt9G2AFiH37DrLvYOeHiXJ85B\r\nYaZNoXOuX6BfIC+zM49mHbwN3NKLuIl5oFOlbJodiSXWSE3nsqqI2Q3H2ppO\r\n5CaN3FyEHjkYItj10xK2NlcKuRl8oAMiOTLU31XY4U7LEk5UZU6AIiEELIyq\r\njmocXkuvstndeGFO1ea+HawSQ8rxrWd4DqqS2LiL3lNSvrwQO3SRcWWaJ2X6\r\nd1pk0HjD2SV0gENSyU4a/mdY/dhZIjPwGa8seVD77WuGTBPQHsF3Bv+luUTw\r\n1UXZRzGiFx2JbYnlzceZPkn5xy88csZtmVKrUnf33SADCr4lfu1hjKKApOld\r\nuO5FbIL9CZcpCSHV055RTEW/+pdmQAiB1gw2QHvByLleH84JuhbQcJga6/rF\r\n95wy4gUY5xT2CBbIceTpErqDJ6Td1elBqZS6gXkgxcPu5KtTK+Y2lZI+3gOE\r\nE6ffIDTsI+T/KcT74EJGlHyz2DSZNRrtLyiCtC18LfSCDy9KPuaZBuj692Mq\r\nWO5eECF9umW3AJfnbimULi3Hg/acgPsoaHmoHlpUnO0anV5cwXi//fEJZmMT\r\nAMfYQ57JYjcmPjxL1a47qQeYbWTOQS4yWyB46YM81CLtGZ6Xm9RawiRHtdco\r\naENYA4XBfahZly7rNEmJSOdRT8PD6Di4vLI=\r\n=LCTP\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221224095643-6e25aca.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/c100a3ea231b27d555bf34325f6122cd/graphql-hive-client-0.22.0-alpha-20221224095643-6e25aca.tgz","_integrity":"sha512-J090a4aJ7rFS+fyBVKem/ycubjuqwxE9mQdTQsfRD2meWO2LVeeqgGqZiZxxyBsQ2rUC8h7C/QPDJF63RY3mqg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221224095643-6e25aca_1671875845926_0.3494136380929673","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221224095737-fa07669":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221224095737-fa07669","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221224095737-fa07669","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"6fb7bb06f110196d894911c10d7c2f432ba7e1ba","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221224095737-fa07669.tgz","fileCount":60,"integrity":"sha512-rc0tpPmAWYdiA80HHeDote+4I29eHta0iT/2UxCigqc1nhiAuGMMeuKDYKtWyNhV2GCG5feEA2RC1Gt/SvXKYA==","signatures":[{"sig":"MEYCIQCq2rfTlrIg5oHTkl/cgaNgH13F7CMQ/mZkXMLxmB9ylAIhALWwGNEn5vk1JTlocYF89bI+q9KMdZudiaaHc6eXPeqC","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjps03ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmq7GQ/6A8cIe9y5+zVmU0FUQ+pEuJcpR6mD/pgfjV6navRmtvtCrksO\r\nnEC2FaDJJ3sqbS41/0NE13RLiByLDGfqMIGakeZ4R46Afkl2FPmuIFRXT/4y\r\nHG6uMCHybiJD2IZkY9J3/KSgo3yfsS1oTkKhyYq6FX2gbkXTUqT9EmyhF3l+\r\n7iiD84ZM9oX9lfIfOx3BbARHHfVqbWsinaquUrSMIUQWS84R+sTexQWiM5Jv\r\nDWmjPzJcoz183q4+PN7Ja2N70IldVD5yPUdYp9wc+Ns7qyVch802mdBYBTPQ\r\nd0BI8G7wYD3DoYeolBstuB1X7jMUm0VMH6I6rhDEPyEWa/tlxL7ZtrtBFlU2\r\nndrv9EhCFm3T8xTrLw4N+AWcOdbWqCMDZWFC6LJ6nCMniRC+e8tcFf0oCzts\r\niy3u39HDnfSsAXFERteEQR4GnkpukMnTaiARhoMQ7A71CP/A9WNWme6gS61q\r\nGr2wCxGHA+4dw8iGuHpGVJzbkmntb8TdcSCHpv3cf8WzHjHwNL230mG0ui6w\r\npXLUEhW9roTUOSpv5bsHn35uHQpAU9nsafO5bRCfmOyeAEqk7EUbFCOS55UD\r\nOs9pD3VM5uibCRU97yu5TklNbQAXkOAzHRoIGR0jya3q4cmu+A6ymiML4gNs\r\no+ZwGb5emWmWnhECNyM3IpIfbiUTt3TuVgQ=\r\n=pC5B\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221224095737-fa07669.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/76b0951cb9aa3e3863273a0e334ba564/graphql-hive-client-0.22.0-alpha-20221224095737-fa07669.tgz","_integrity":"sha512-rc0tpPmAWYdiA80HHeDote+4I29eHta0iT/2UxCigqc1nhiAuGMMeuKDYKtWyNhV2GCG5feEA2RC1Gt/SvXKYA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221224095737-fa07669_1671875895208_0.4795004066263766","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221224095830-004d32f":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221224095830-004d32f","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221224095830-004d32f","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"440f87aff12fb99459ff764dd2e598ddc9722659","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221224095830-004d32f.tgz","fileCount":60,"integrity":"sha512-RCXXJE8UBV+xrZ7FuicVzj0jBDCq2VRBUgZjpD1uAAS/VGb0tXJ9o+2FnmflpotzoMfDyFvKZEwj3QJbhg6Caw==","signatures":[{"sig":"MEQCIALtAC22hUYir7aSIfdM9Bs6+tNiq+4IvY4rSOUZEVMbAiB+f4X7/yMJkfQ2/8xYVfNZgCOuUn4YJJegUlpGMHjE4A==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjps1tACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqlxhAAos9o40Z/NCCpYbQSp4/ALFDyrvKCcampwuwdCvq6RZ4cFn+K\r\nT4svRfk82sHPwvTgEBzrl6vTrogH/q52aS4FA2Vg6nhOZmgGq9DXn8aaAuBx\r\nhaHuRcsHsCIALiFOwGzSzy4X1+CzY4y15LzVPpJhHnkNtQfioENqvHSmeirm\r\nIe1dNOmAhHbWG7DgrTzStiNCQ+MPk1kyKSorrS1mrvjod3v+GQzh1ScEEQbi\r\n39bwYLfMxpchbQUY4dfsaSaws90iVnxjy6WM3kXvmi5fbkQxhJUM/4LRtPLw\r\nrDtmfIXwI9tYzwmhicRYuGkLsgVyblDXFbUiIqR0c1GGwV337hvzeipXJpTt\r\nYAPnr6DszDZU7hzXsDdS+kzE5dNl7CVU4H1+xkJT2h6pTxt1ZGNgn6ONkZTB\r\nhDzeC5jAA5nYo08wlUdMvdIBjA17pqeugrTsa20BhAgygJucWPKMrFRHelGI\r\nh+TZPZIJDQbqfvK0s3ZMru1zRc6hqYc9LZJ1CNA0ufNVquZ3n9gz3Y+mkeAn\r\nn0nr2SLc65Jm8ntNqIawwxVApGsgoruClw0p7ZvqDJk6YMNF9JtxUma6Bvmj\r\nTrAw0cPnMkI8emNV2I9UbLg/5wGYMqzKz96kewPRV9u3+LmBu1KpgkpqEn8q\r\nbGIVl2fbjeHpr9tSquFv9nI7088vhoR9I1g=\r\n=sK6Q\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221224095830-004d32f.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/79283e1b5553bed07303833ad4e4ae24/graphql-hive-client-0.22.0-alpha-20221224095830-004d32f.tgz","_integrity":"sha512-RCXXJE8UBV+xrZ7FuicVzj0jBDCq2VRBUgZjpD1uAAS/VGb0tXJ9o+2FnmflpotzoMfDyFvKZEwj3QJbhg6Caw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221224095830-004d32f_1671875949394_0.12439380434083303","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221224100139-45b5063":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221224100139-45b5063","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221224100139-45b5063","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"cf9fed204483c5e571f207f9afd3d74c439935d3","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221224100139-45b5063.tgz","fileCount":60,"integrity":"sha512-uVrZ0itKMjivTXRsiVefgyurzUTf5gYIH7CsqaEvYcWTJDV9maGB3mZ9hND7YfpqC4bZ5ux3FjyDJX8ylT2NYg==","signatures":[{"sig":"MEQCIE99/DN65ZYz6ONxwzkK47Z3k/0QYUl4nZ8HxF7G7SIQAiB729EB4Ea30inDmD2KJp9LnGlB9z3LyigAx+GVSI8Zwg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjps4oACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr/WA/8D+ymlVEubGHLnQP08eubuQIPKWfJeRT3nAdYj9dTR0dIybVV\r\n+tZ8ePZh6gSUSXQsOuJ6ilpWeA3KS28yyk9S/ufqd4lwbqn97LY9OR+kSMOm\r\nXeMP9d10TyBrKeaLmLdpLW1joViqUy8IYIsqeZr/KCztsNO1BfyC8oCRHtRj\r\nVzid0sT5D/nJwe1uDWW5961HfMKV5+KwHhwUJu5B02UDg1t8PX3BDesTaVmH\r\nPFcHZetRej5nrVVTObROAYkdeRh64RdGKJpR7nd/arz3gEfAdOfbvWflh7tU\r\nUdIjDXcUxyhHRKcWp4eK8vuwthfeJDgYEY5PblAmmkBq3Wv6zLTjx7OUKiBQ\r\n1ulg0bXtWb80uct7tgHlHum9XcP8BHfRJVIusVfxzCbboR0W1P00v3C4VQUf\r\nyoPpBS6kEjxq8fHilGOuG9DCNwCnLFYYVChYMwhS7JbdAJLTdq2QHT65vFem\r\nPyrCPwMZzu7ohnSM4rHwD+e8hqXBUaNM0VemZEcT4aCG0vtmiEzcIOMVDDM1\r\naBZ+bW3AfuDBAfLpPFI3LvaO5SmJIl3ClrO1z+g/lRuRC6w8Jrs4G7Jyujjr\r\nEflBuEB4IrLu7yGech/PKTqYOfeblOCEoDzmr5xMEKkxGgRQl0eIUtHrsq+1\r\nbFgwmwdyUBq1Ut6sbaiTAGkuv+ZiiA1EZWo=\r\n=T5cQ\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221224100139-45b5063.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/d27944a92acd3e75560ac85f01f2f3fc/graphql-hive-client-0.22.0-alpha-20221224100139-45b5063.tgz","_integrity":"sha512-uVrZ0itKMjivTXRsiVefgyurzUTf5gYIH7CsqaEvYcWTJDV9maGB3mZ9hND7YfpqC4bZ5ux3FjyDJX8ylT2NYg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221224100139-45b5063_1671876135903_0.7077899531570258","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221224100729-24961fa":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221224100729-24961fa","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221224100729-24961fa","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"c6498201123ec215580b1104d2af93b8c50e70c3","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221224100729-24961fa.tgz","fileCount":60,"integrity":"sha512-iBnkYcjfvUuQ4Fu3oDkJ0j6q92ATY7OwemnYEcPGPAQ7U7m5ldy67NZyUPWcHB3GP+gXo60ZljP/4jxE70Q5TA==","signatures":[{"sig":"MEUCIQCtt976IZlDDLxKPlu659Qmxi5CLu5zVjm7kUX92B6r0gIgV3XeQZkAXHuN22KgJe4BmnH4nM8/2K8C+tJHRNAbdns=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjps+DACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoyjBAAk3qoOG98UDeGG2mGDDkCxz9le++tS2sepG90SU3CS3VsKawH\r\nzB+PZe2vcI4dWdNeNpA18LGpDgThiLCjt5wGcTIgFchSoiIKYvd5YBZy4+ij\r\n41Kyqk69WA3VwTxCiIXWeliI3TFK4ak7oqIl1h7tiKP2qqDLFOYL9YnDLL6e\r\ndUt3wWhEUF+9Y2NOiNrbKjF4yLVPz1+chJ4n7qIVTKy/hWYLV21c2qF8EnMt\r\nL6RxKI4wL+DCWRLmmtn2HewcNh5lUjiZj0AgRLSAXv3tsMh60pmip6LN0NpL\r\n1U99pu9MY3jVeKXm0i8KPd6EIhAac+RWzOJ2LlPpYT6iG9pbJjPeLiNdP4MD\r\ngDxtC4gJh+rThfOHr5gX7OaUZIguXsoLw8x+e2JC6ESK9jdqB9vPfrUWEvL0\r\niMuIa6xFJOSsrD2oDO1qEckYV8e3qa0C1n+BvuoVg2xepd8bn5rnFQCpWy+n\r\ne7bwr28xz3rnsg9l8JH/olM2JaQNQ2tJOwEBpGnk5M0+XxxtAIyoQwzXFL11\r\nX6f8mdh/WE4ZoFxRIez1aW4xRJWCDX3CQJTnjhkDd1zWz8ANbul/z0vYMJmx\r\n+8fvI2iecvEUpu8FuAtmcc1ZmtzBS7V7jzGud3BMmQY3rgKXzgna1sgXQqKZ\r\ntPu60Tzu+MJ8joCmgxe3iTqfubpJAq80ibA=\r\n=+z68\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221224100729-24961fa.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/bf4ca9a2bc0c2c733d3c540b901f7c1b/graphql-hive-client-0.22.0-alpha-20221224100729-24961fa.tgz","_integrity":"sha512-iBnkYcjfvUuQ4Fu3oDkJ0j6q92ATY7OwemnYEcPGPAQ7U7m5ldy67NZyUPWcHB3GP+gXo60ZljP/4jxE70Q5TA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221224100729-24961fa_1671876482993_0.450563082886384","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221224101706-3df6e93":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221224101706-3df6e93","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221224101706-3df6e93","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"0447ff45a72edd86920c6b97b6ec778647410661","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221224101706-3df6e93.tgz","fileCount":60,"integrity":"sha512-6haUC1f/f0/N7PxiEWN6MVTnKDmIhD2G4YsqmiQwK/3dNf8ru5cF2h2NE8TqXNu3jg0aj8Fv/bEieHVIQI0eLg==","signatures":[{"sig":"MEYCIQDdVZjgFRfRnlewgwZPyYCenN24peMqIaOKeTh5nOBOzAIhAI0O88MBhlVMBEdNUFo5KXeCmn/0E/lXonZGvS7SDgN5","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjptHDACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrfchAAifP1sZIlTDaZU87T20tmUpAwBh5qBk3/E1NKMOzxuYGVEgwP\r\nEYWm7bY1Nq/c8mWTsNF9wOGxbUwqahgmHXRp4bFbo8pqJZFuGH60QTEEZtUo\r\n+CFNSODtiolPqhdLIFeN2LMhYFDmJoCHgOERWBPuC2zNgxOr+OOcua8b/pZq\r\nnGZtnWqFjnpSLgSq22wOwfX10Ba0SNIbv/G6YC3GtnqlDR2CASHmTP7DPLCb\r\nlAilS5z8GuKBz+nlusHAgMnyX8MKT904IjvDRAjTg+QWJ4eNuEzstVhb/vNR\r\ne+MbU3Xoxv4ZNDHjyYHcKrgo6XsiVSWWfgpcq4hA7na82C1FZJZr+rGMNOL8\r\nBeHNW8pYx6fUHGVDPrqAAOHOeyIEp26vuKEWBLBlp26Nd623fVloCQucIYFa\r\nXSCkPLD5fVfXXHIXRmLH5Ann/opNja9iFGcGZxk++H9g8GHdcg/hD6BFf58h\r\nQ7SVRyk2wYRs01Aohdq56pMapR3YP79PL/RZoocFgvifOF/6E8o3TvJwQXFZ\r\nFd7sbsnbNDKSbU1dlDZIiMyfeIX/94eVOTz1QjJhmyjHnxs/Cy8Nu4f+y6pu\r\n9SlsyGcYfVZYlCMcnIkljsGFfvfpnrv2nDlBShS13rZ3un6+l+J3IeJJGvHk\r\nS06kv3BUoQGw07Cxj3zfBxRcv/4rra0akiY=\r\n=DpAi\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221224101706-3df6e93.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/caf42bd66daf5adb3618471715f681d5/graphql-hive-client-0.22.0-alpha-20221224101706-3df6e93.tgz","_integrity":"sha512-6haUC1f/f0/N7PxiEWN6MVTnKDmIhD2G4YsqmiQwK/3dNf8ru5cF2h2NE8TqXNu3jg0aj8Fv/bEieHVIQI0eLg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221224101706-3df6e93_1671877059683_0.21168161871040003","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221224102258-66a3e29":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221224102258-66a3e29","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221224102258-66a3e29","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"77b97eea11c59bf48feefb2e2c465267f27ad13f","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221224102258-66a3e29.tgz","fileCount":60,"integrity":"sha512-zBMbtRBbaxvxL34KMJ1xA+hjMDnvP82fkBNlLi6f8r6Lot1E8Z6WgrhMyeJkRa27xodYzgNFmr3dmPzMeHi4tg==","signatures":[{"sig":"MEMCIF3wMm0QsKW+o7Yp605ScySbdVkoYWb6ns2jqQ0fdxEsAh81f/Bh9/L9ZjAlnfbJFD4N3qy3mVneDVlHLhE4FRVp","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjptMsACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmocag/5AcelqbUJwNsGzoSXYMSiJ2ntxncKAxDA4YITPXHwLpPpvyBs\r\nLcukSlieAGrPPcJ8/9CkXuMayLhMNwvkWHb2GpNtqKV7t2kzuUFJh6LY3x3Q\r\njlHmIx/1m56ka3xY8HaoSaga+zQNlUBx6+7EtQZ+zmt0ebYlRUsIin9s3zlh\r\nMYJYJeqgzTLgORDU42PfpxPccMURHML9ObZhc8/ZzICX9qloyT4dHVJZj0P8\r\n6TVhzMXIasBUKWQLcFUe86/73lVUmwvt2kkbMogcqZlZVgK/mWbGlN9lJa+O\r\nStrjL9SoSpk9FEidQZChk5XVdwEIX72VQdXPSvg7Wwk43vPpcd25nuE1RrWd\r\nsLkuLN4v/mZnHL+BsJ0kHGzO/4oNQaU2YfmXRUQW3972msZq3WaZLkI1BvGU\r\nVE+CT4kD/f/2GHz83LPUzj0lgSzPq8yjTMpMeLfW+XwPFhM1d8EIddzHeoQr\r\njO0xI+ztYAac32lu9Pl+qNDsblA2GP680vLKYwW3uPzs4x3A3vOSDJqnSsE2\r\nyC0BZU6LqqSGtzgW36lhuO6wjT9CiS+4Ez+pzhv/YbWEM/JJfzXBy1H8oCrU\r\ndBNY++myGw4iBfQZ99M+jKo16vg11GEfmveIivGHOSzXar75CIfbSNpL2aT6\r\newCx8d+d713dRrHcDaVkU9BH0Bfy/fBQmRw=\r\n=ZUEJ\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221224102258-66a3e29.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/caa03d944f7325bd91dc6851c77c5887/graphql-hive-client-0.22.0-alpha-20221224102258-66a3e29.tgz","_integrity":"sha512-zBMbtRBbaxvxL34KMJ1xA+hjMDnvP82fkBNlLi6f8r6Lot1E8Z6WgrhMyeJkRa27xodYzgNFmr3dmPzMeHi4tg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221224102258-66a3e29_1671877420543_0.3408809640101653","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221224102734-498ad4e":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221224102734-498ad4e","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221224102734-498ad4e","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"af2accb6af5642429dfe2934ffd5817eeb35f901","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221224102734-498ad4e.tgz","fileCount":60,"integrity":"sha512-kQRBMj8Fyr3/eIvChxhFh1FAmWElVDK79qzf9AZpIPR9v7dMvpp7gp5NlEvPjcrOS8WrxsbARB3/EHB8MlrjEA==","signatures":[{"sig":"MEUCIQCriW8fHNaVxP2gjf62CrivfhcA/WHHtkzdqS/DWsqrWgIgEoRk2hmZEG9C9TiKvr/a2FhwqZS44NOhTCYe3vqNl7k=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjptQ4ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoxqQ/8DAh3LRSL106qAB01aKNwkIvrWvDG588os3RQ57tYSA6vdYXq\r\nuGGsnPGDQca6hGfdHhAG5Ah2fguK1bUeVnc/TCsFhyhq3px/U6h0Bdq7WV+g\r\nELo9QNS4+i5mU/1nV9NNChowmiS7Jl3arwOC5movkfOjGVlqQzhyS5GDNbZb\r\nhXdN3hfrbxoGC3zqboMJR3rfA9P1kWUQFy03oi/H7St7MVouYZAiQ+9QS0RW\r\ng7MN/IwHZHDvzeWvt6OGFzR/oZJ/xQYKd4sAB57YEtN7WH0c6t5l9MCH3FHO\r\npXOaWOxa/9NfH4wpBkrRFq9PgQOTx1NOk9nJ3c/pC2i60kW/doA7pWDVyRQ2\r\n9a5h3Jof9hsD/s19BTg9OBUe8G6GQEFbFKckLyVM0AZDQab1E0sji+uckeBx\r\nXEsxMQDM0veB4qhI3lm/mDsjMnYC1W3pzXHyTrv7vHIpo//rIJpo3UQW3aUC\r\nUIL8Q4St1aXvYs5SseZyaIn/NSnV+ZKOaxo7XY4CSdkKPEvx7EqAkKyULqvC\r\nXFqi7OaGcY3TysHwHiM4dQxYTykoEFwxB7e/BpfzitwLpC8+5cZM9xoqoJ6j\r\nM0Ad0mg9itcy+i60YPk4EVpx096oTBiNFiVkzUH8+sRwnnPTSrcJC5tS/WdD\r\nuZmlwhtyF0WZiNaEROBkf7c7Rme4N0kQBEA=\r\n=4PUU\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221224102734-498ad4e.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/2a592307ca675cbf70e0c2620bc8af7e/graphql-hive-client-0.22.0-alpha-20221224102734-498ad4e.tgz","_integrity":"sha512-kQRBMj8Fyr3/eIvChxhFh1FAmWElVDK79qzf9AZpIPR9v7dMvpp7gp5NlEvPjcrOS8WrxsbARB3/EHB8MlrjEA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221224102734-498ad4e_1671877688677_0.3798581450031282","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221224104416-dfe8cd2":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221224104416-dfe8cd2","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221224104416-dfe8cd2","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"61f2b86e7a3ae95f1a534871b6ca4c7f6647ed26","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221224104416-dfe8cd2.tgz","fileCount":60,"integrity":"sha512-8S9yXXS47rJIb9kq2vvjoPHef1YheTP/m9ZpRmo47NkIEak6UB/+CIiHSFxe1IrXv4C9H+OVZabMWDHg/+NnWg==","signatures":[{"sig":"MEUCICkhctptltIwfdU8GZFGpPwsbxnoPjAYKtQO2UnRJjVrAiEAplZELBudqAagnlgRCXRjNJcuan5V41+onEL5OLb39c8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjptgpACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo5fw/+JMxSS7iT4pBvJhhz/mC0sTh9bqx7sK0bsmndBWrAlcJ99xES\r\nbqub3Z9G0VZfBDrre1C0uddQ5vscXZAbgcb4agoqEdUkya7miK78HNM9F1/9\r\nuOso+zL7BUZ1e+GQJMG8PTN0zjIU1uiLWt6XOin+1JsmmQ/Q4Ftg2VTAQ9PB\r\n00qlwCBP+6M1CRoSulUvXy9nOiXwMIXy0dcHqDH9sQ+Yn0eMSChyp+oRXU7V\r\nXnizaua8pUZO4gWMHsXhBDBRgqHKJu3pS5Gmd2ZZb87Cw28xCwFqt/iuDR/q\r\nDlzrrm4pHol/bS/e3sTD1shmsVXSKY8mgx1OVA/h1fOHu+kDoSf8/e4Kj9t4\r\nlevJ6UHyGLewM/ztdiTAomR8QssBXEsgaK4iVejYAEkWEkrhcphImXBIL1FP\r\nYI09JvApCdA95yw3ZCjRFLl33MyiQCt4S/Uy+yGSY+yxVAgmW7HtuAaBJl4S\r\nnK46Jy8Fj7kDHG4TX/Nvhhqd89Ow6zW6DA6MF3PxwfRpTjhfxqjgCWUAbObU\r\n33uEjTUaPjM98B3Nv8Bg5ANY4Qw2RDSAYWad4NKBJcsXcwvzy/r2s+4wTPz5\r\n/42oZ0VZghEVuApo5n+RRRy/Hsx8/DckRPqjA/XmIMwBN+YuIU8ahBOotDtd\r\n5edG3nxfTPNN1z5IWsaBRkS57/bDzxcRVOQ=\r\n=Ph4w\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221224104416-dfe8cd2.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/ce94eb659989320f34ad98e9a8c80aea/graphql-hive-client-0.22.0-alpha-20221224104416-dfe8cd2.tgz","_integrity":"sha512-8S9yXXS47rJIb9kq2vvjoPHef1YheTP/m9ZpRmo47NkIEak6UB/+CIiHSFxe1IrXv4C9H+OVZabMWDHg/+NnWg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221224104416-dfe8cd2_1671878696855_0.6239296534103937","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221224104538-817139f":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221224104538-817139f","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221224104538-817139f","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"e9d9986e86748276053e06a295dd7f4cb491e84b","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221224104538-817139f.tgz","fileCount":60,"integrity":"sha512-x9EilRsa8TivjIKLeQ8iniB8zVEYi7zyS7jmZ5CL4EbRBK0znLfKYGMI9FpLfuFKaPFhqcnbBfAxfAFCY9+AnQ==","signatures":[{"sig":"MEQCIA9tWPaxRMZnfZvCHjdNPau+q5+TKoVjaEs3vh4sANbMAiAfiyUJ66+3G8RwK0dnz04uRoMjgdcse3p7pNV6ueMSvg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjpthzACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmrp8g/7BsrJuNQAIermXXUzkuRn7Dw+Nn/9xPbLP2zQfnPyRSe/voa8\r\ngigkzsDloLHS8UIeIqFwd2UKtXgeymsGppsaB1uk9Gi2yiqeKyofvVPUb0ft\r\nS4V7XmDaooUiUQkDZOBY7cr9rcIlMT1g0X0IAnpYTQjRyZ66XkD8wOvaURSr\r\n7rdiIJNo1Qmv0C99Y0TgejDCTYMAhCw2PIO6qCAi+bFcHJinTQHsEeQxslPY\r\nTJt5qnLyxgXqnry7yp1f3ZaYBzxHjC+rgj1GCHgOgY4N3O9Lny0XXebJqLg6\r\nq1FYIQriH+FhfVrGterhcUNIi3FH7Y3WW+Rq8lz1NvVBe4+nJvp9hjT8B9m/\r\nny8ga3wyE7Gp2w0AvtzgO8RIcc1BHVxoMbJAwxcRoWqqLb55wLC6/c/FNsee\r\nnJndxc6KBAf10LI2Pl9iGtnqCzDd4Ll+VKUZOYG4Anu7nMoMmDf0TpAjhlP7\r\n52z5pAqmFO3x8umB+J+06GwISE0EpuyKmx2BL+ktS82P8MO5wsBZCX4LGQsz\r\naeosse+YmN/Ae+9K2O8or1hNhw/MoMB2vNV6Pk7BYX8y3ZbPU8u1iYGHP0GQ\r\nUZWoa3y48SqX2VCUSTOiEAvh5mZermTX6GEM0TJ4eCjYPm/QIWm4RVsEwioM\r\nkzrYlbOpC9TJuhhPk2cpsquxVSjiuj9Kflo=\r\n=Gs2d\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221224104538-817139f.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/ae870d4812f805404e6a7bc765c50a8e/graphql-hive-client-0.22.0-alpha-20221224104538-817139f.tgz","_integrity":"sha512-x9EilRsa8TivjIKLeQ8iniB8zVEYi7zyS7jmZ5CL4EbRBK0znLfKYGMI9FpLfuFKaPFhqcnbBfAxfAFCY9+AnQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221224104538-817139f_1671878771189_0.6108855015105081","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221224191343-c07c6f7":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221224191343-c07c6f7","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221224191343-c07c6f7","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"96c7287411749eef73f39e1da8279c060364e01c","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221224191343-c07c6f7.tgz","fileCount":60,"integrity":"sha512-lbwqRLySTaDpNusZ74wXjv06B+E44D1aKYOSI7a4w/qZIw/rSav/2r+p6v+Lqi0SDbz1jHaJSm2amdL7d/OWTQ==","signatures":[{"sig":"MEUCIQD7H2wYO+KpjbQcBGDiZM/p0rwAoDCpZMyw9uLdQLjxyQIgaFJMJ2gmtHLrS6XOPOOkPZViUeiEH6xv1KoNCOumgRM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjp0+UACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpedA/8DNezRPfbdHMeLMQM6ZoLqAqKqEOlq1CV1sYXHYD8k85Eg9Dv\r\npiIyAkhTcQtX5Q2HhixP0DL9kQ/RSWBZlGSW4I3JNwNllGn5GL5G7PF4cigx\r\n23iUiU3HStlCqzaBrQE4xeCukowS/NaacIRw6LSrn0d6JgtHQbuceesN/PJk\r\n2O5f2275LE/lyi+/LbbPFrOPAsMY9XsdEcNviArHLiZ48lk6aUFvS58+VgaZ\r\nZy8bH7UKn2KFhUr7/ZWqu/MxAdcFC+lmC8NxDGsvbJisAa2vdssdVgg6B9P9\r\nkGTG65wLd68bLpUdm2aQSSC13IRUZSZL7Fpv4c+ZuA+TxCdB0bT+wjnXklIW\r\nJBeltdCSA8YYOfNsurP3y9jUCJ0wIDVpKTKYwryXV9bVaCutKvdrA+51aBVb\r\nklI7eAF0DHXk+qJpligyvoE2PwpXDyzMnMHYbEJTm+WrTnH20iPFHRi6UVY3\r\nnBrNjKsKWpETU7ckvWKvJ/Ha3VdTX6nxYQIGx85ZM/EIkuX7o9knHieLIfLq\r\nUzE2ZNAWAQPMoSwO3T9G65qHPHIl1PzxlEppCZbIGlKCbmUE7JkrnIzxXBqx\r\nxcqFC2REGJk/qetjYuftqr6ACEaqJfDZS9GAGYfhKMe+TZheE7yB17AAoNy/\r\nF2Gop2pbij5Lrdw0hIuCy6k7zgjpiE9qhTw=\r\n=H1xU\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221224191343-c07c6f7.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/223ab8a86e302bff015edac9ba4c168a/graphql-hive-client-0.22.0-alpha-20221224191343-c07c6f7.tgz","_integrity":"sha512-lbwqRLySTaDpNusZ74wXjv06B+E44D1aKYOSI7a4w/qZIw/rSav/2r+p6v+Lqi0SDbz1jHaJSm2amdL7d/OWTQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221224191343-c07c6f7_1671909267955_0.3889572428420198","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221224191759-37b08aa":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221224191759-37b08aa","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221224191759-37b08aa","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"dd410ca94031d71dd67edd215c16fdba0d0d3fc0","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221224191759-37b08aa.tgz","fileCount":60,"integrity":"sha512-tDn9l0HW4o9tv0bk7JKpwbqIRHQKtxro2UgZleEZM1YRpbeobi3x+tbUMbTVAyeEPLfUW0d5dCtghjT+jRKIsQ==","signatures":[{"sig":"MEUCIE7rGsfyfTF8iA5UKgZ2QzOAjXPPfpvM0s2NBQFtcLpwAiEA8jV9BPODy+EQIeYU5jltbORu4dZVt9/WgDybplTBhuw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjp1CKACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoUww//eQbjDQy33ZFB6p8VRrOUsc1jJkDKrJm7tCH0vcADUjvpA7nO\r\nwe1XNJjSuS+JGAUMOXqEH63JCkRKocwd/xsvEM/36xpZ1nl5PoZpM/3vMQtS\r\nPz2035DKjb4VuHo52SFMHbsaibS3YeGfsuOm4oBVCjQZpzysMSnAThfrGreq\r\nYqUL3Szh4Et8M6KvnAiIDnE7sDe3B9/3DtScCLWmXc54ZuBYSbHzATwo+6Vy\r\nklB+vYeeeIi9tFzC8VXh2+NnDanOPDMaUlkgG6PjD6RZ7yhqQo+GzSHRVEGd\r\nJ+1ui7aN0fkrGtxSNYcE8HRLc8AgVfGAPEdp9q5C58n+ckQY77YGAigPaWhK\r\n5bhm5r4BbBKp773jOAEP/rGP4LnNK0WpqecmHe/213qcUn9rF97lqF+Kdrfa\r\nNjN6B+w7e/NqFXH8rkFeCN0YlEKcTQ7MeCANvMAYXK1p3VaXvRSIHXVfIWof\r\nZhU+X+mOajdTQ55yaV4qQ7EFjR9tZfkWeNv6MejAuMfWTNf6iLK5sFFUr/9U\r\nPiv+Exrm+qvn83KFg8Dm1fX0M5WZ4YVm2/CoAMjAle/ZzFj/23mTaHrIwKC9\r\npbnCFeSCCU8HITNY4PdlD74pRfOcYMeqeIDv+26c01JzHN4CusTpfe/SFrw3\r\nx63e99CCtVed7U0TmPEay1t/GXXkDdIqawE=\r\n=bhCI\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221224191759-37b08aa.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/aa37d6bca4a3da56cf5750efc6c3e459/graphql-hive-client-0.22.0-alpha-20221224191759-37b08aa.tgz","_integrity":"sha512-tDn9l0HW4o9tv0bk7JKpwbqIRHQKtxro2UgZleEZM1YRpbeobi3x+tbUMbTVAyeEPLfUW0d5dCtghjT+jRKIsQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221224191759-37b08aa_1671909513863_0.3311028724215701","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221224212711-ea01326":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221224212711-ea01326","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221224212711-ea01326","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"e50a7e199251ef62d777fb2446d8ad988bb42042","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221224212711-ea01326.tgz","fileCount":60,"integrity":"sha512-s1NeUa8Ci4q7+0DrhwTxHUtPmwgPRptjk79/8vZzpZ6GXdrckQFENWI7YJRQ+9ey5ye8RxtYF5bWBR+O9GOogw==","signatures":[{"sig":"MEUCIEys83HtFUtMHcXoCSz7psg+Kgnln5X9P5rrZJZHDG1vAiEAyHlY8+gE4ydIuxtDwz1AzqM6B9K2OcZcR8gbO/Hxf1M=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjp27dACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqO8Q//UGcWZrVebplx2yuImJ6OrLVVZQNE8QV6PQZlZge8osikB3dQ\r\n55/lso4uIrlI9r01Vi7IuaorGHk2PiS+axTQC9lu3qlvQy7tj54j57EN8w3M\r\nnvAhYO8vjmY+e6Ov5QgqY+Honz+LG51N2n/rf3VmBb40ImA9TH8RiIX5WOVU\r\nAaywLG/5EyU+b6gMozdsHPQD/y1yrweQC+KCXgf02nEnhv9kYxkmH84D5PmA\r\nVOjBYql2QtVJRyIoAsZGJbrslmcDwNLfrcu7jhg4Suwh5AM02P+PmAF2KcME\r\n4NphSieeCjJXpK9R6jgBjbCd7jy0lOMap/B6t0CsLC3DsmZRxSFpl25Q9cOf\r\nBLagib98jjFidLMziVyEMPN65vMXfGE6juJQE9NItY/3D6cXYhzdc2wK5aNM\r\npTkZ0WCvv1Qydwhqf+d4xiMsPanerEceupQeM+cpjCqxdaB4s00ox2G2CDBT\r\np7A0VHFxoVBAKWb8PgSkcuJzXCdGjalAxaDhmN2oiW0I2U42POVgwZpikTfM\r\nPaIA22CmBP0+skjLSFP2xhLoxCatUWsl5jE9LaKzyLYCruakffoGQe+v83kp\r\nYVw1kAe6Yi+jviJ4FnXnpR/OSNxGl6zTJuC5K3d9GfiNVswg9m8D4afQjXga\r\nZjnmAvkHI/kOTv6rapHS6vqzxjr2yzXNZrw=\r\n=/oyi\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221224212711-ea01326.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/a6f17bedd6a3324bfde504e86fa2c8bd/graphql-hive-client-0.22.0-alpha-20221224212711-ea01326.tgz","_integrity":"sha512-s1NeUa8Ci4q7+0DrhwTxHUtPmwgPRptjk79/8vZzpZ6GXdrckQFENWI7YJRQ+9ey5ye8RxtYF5bWBR+O9GOogw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221224212711-ea01326_1671917277347_0.06238763901344724","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221224213140-5eb8dd5":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221224213140-5eb8dd5","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221224213140-5eb8dd5","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"4b88bd6e9359ea6e9277100e1a3ac5f14f66806f","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221224213140-5eb8dd5.tgz","fileCount":60,"integrity":"sha512-qBbfsaSvoazkpeCNIz8lYhfeGWx/blDvfYVFKm58ExSlZSOuk8RXNscsvVVjaA25oZYMuKYO7GvVg/+FkmUgpg==","signatures":[{"sig":"MEUCIElA1YGfXZNKeRN5a8o2aIYKmwUyYXwPoZxQnhcHW+WXAiEApPx1bRSZNdgV6KFRAqi8/tEnwO4+fGD7MbkaSwVmq+0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjp2/oACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmoxqg/9EKRwGjvMgOP1JyFRBmqqblZPCaGtJjux8UtJWiIADCYQpj2F\r\ngt76gzGfi1bLA/hiJnt/9Maa3DP0Tw9Jg/Pt6a/te8ia9Vqqn7fe3Gma+dmW\r\nv5MqqFdMTSyZx3J+oaWlDjj9f+LiHtPkufvTd1Mw/+Hij2ev1JcGcAWBzMsK\r\n75xKgVLwnIJKsk7ptqBlw4LjCt5GwX6mZtFHU08QcAox24bwAxE84Wsbluzx\r\ndXIGBgI5lEZmu3L7NjTDiL35SYQuVg6sD0lz+U+iQA2hS3slNs5ko7dSwfA6\r\nmFCCQGUtAfFKNJ/kne7///CHqCOQbLaEiFn35dXOI73jDQ4psrUjSjRe1Hto\r\nj5rb0xYMSKWFqA3hqQJAxsZfUdMWCOLXKITDX/8tSieVJgHyn2KJ3/XLlGh4\r\nP14PvchnqPgHzzxWXMnfWQ8NKsz26TPzYYlG8GjWrp7ISePOVjfrq4q2RSkV\r\nejoYanzqNAjc6LNE4Tgm/hD471s2mIxeM8ZvQ0NTdvrcBZDZa4BftfnO4jw5\r\nqkvRG/oJjRSJvUv3dsUUJkc3zj/PVlCe7/E+es9XLX/CJpm0THrfKtxxGm7Z\r\nhBXT/daQdai/yANZBjYk15pQs4Ol/W3cdiVGQ6NysXWR22POZHv8nMbzuES3\r\nJSkrKVY/6s1z1HE/NJ0j3YVuCm4nqLWR5JI=\r\n=L/OR\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221224213140-5eb8dd5.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/7efc0af819269c291a1d39e1d9073a93/graphql-hive-client-0.22.0-alpha-20221224213140-5eb8dd5.tgz","_integrity":"sha512-qBbfsaSvoazkpeCNIz8lYhfeGWx/blDvfYVFKm58ExSlZSOuk8RXNscsvVVjaA25oZYMuKYO7GvVg/+FkmUgpg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221224213140-5eb8dd5_1671917544715_0.43638294743905415","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221225001851-dc493cb":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221225001851-dc493cb","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221225001851-dc493cb","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"09b6e704d8dfc398e796648f12c079d367853dc1","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221225001851-dc493cb.tgz","fileCount":60,"integrity":"sha512-E3S+Y5zmpCnxgqqueZFJlCNaMAQnjfcAIQn19MPMV6v1lg5nFjgQqi2zNS3RBIEqMACcN6nU97/z8wlCBqQOng==","signatures":[{"sig":"MEUCIQDwnw7l7mH92P5znF4xKnetdI9sgCllJzZEIQ0Asda/lgIgMoC6wFKcF35yREOLmpcZ6H1RgBLC8YgdnTLQLDnksHg=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjp5cNACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp6mA//Zxn84kzDRRr7TWVnXGRvyeZbvQ+elhJdVAgfVflYqzkvIbLf\r\nuHPdkaJQTloueC6Zrqq/WvRMF7wsUOi1PlyZ9d6oYzJd8F5pl1hOsZKryWd8\r\n5SpBoFtcvrhmbJ2qkEQFON370yD/rpZCyJFOv7sLxk7UtmJIZquklPhpm37R\r\nX/k1wysc4oSLgPcBWoZCQEy69HpetbwLpgQeR80VOV0gZ0CPc4qzXtxglyZM\r\n512LCYfyjnwxTCLbhNorPc5ZflD4P9ZM9wf/lr+ouNcD9NXPgI9JAqZgfDGU\r\nQtCuVQvuFnVzQXueiLip14U1Oev54CYbZcJaPtGzWsCGmasGh5YPiwczhUcc\r\nZ4C46pjUX0RK1SD4sRie+Sf9y/Gb+kYivqM0HHgGUJfO/vpy/0mXjTjA6gwx\r\n7JcuyjFW9QjqDuAiSvgyCihHP8VAsRQsrqBe3ayRFo3kCH2UMNhx1KW0OKjB\r\nqmvpq1WXpOU1XyBgQGluYmMnSjv5UjVVIUnmgXrxiwQ46a7IqyhpQJkxgRSS\r\nilp660/eDmx9nnjreA4pbOd+pVoKCMQyLGhmkIfSNsOeT8vJ3NzFCwm7Ds+l\r\njt5ZqD40qWUZq+jjpNpZ5fN5gWj5UeFCw6pTMx9wVW5rDgCVoI6AlsdpMUpw\r\nJQzDryfKTYAL4OIJhqSrWp5Vxvivs7ScTv4=\r\n=t5kq\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221225001851-dc493cb.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/200bd9bf74e56c69ecbf78fdf86dcab7/graphql-hive-client-0.22.0-alpha-20221225001851-dc493cb.tgz","_integrity":"sha512-E3S+Y5zmpCnxgqqueZFJlCNaMAQnjfcAIQn19MPMV6v1lg5nFjgQqi2zNS3RBIEqMACcN6nU97/z8wlCBqQOng==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221225001851-dc493cb_1671927564861_0.8970476757258883","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221225002404-27cf158":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221225002404-27cf158","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221225002404-27cf158","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"5625f98d7e0ea0f866550e77f3ff9ae2f5ff931b","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221225002404-27cf158.tgz","fileCount":60,"integrity":"sha512-BVKaXTz1lfbNSoG07Rq/vzZQo3A52kdOZlb13Ll6X7qwF6xXjZpCelPLn/ysSpGeX0JzUYgzbOtepglUsBQEpg==","signatures":[{"sig":"MEUCIQDnj1eFtJLNH+mIjmXK9P3PRoR+m0kndnMwmAfWeJDbNQIgByyR8W4Vg3yxBwX49u4UuErFPphkUQIfVj1AjoMrZlA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjp5hFACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqY7BAAnufreJUqbLgkNbNK+qnZXfUX8ZlHLUPO4NqKWfQqZh9glmOk\r\nQ8wmwLzNCzMmE8y2zqJPQXOjHp9wCR5+eU8PCS2k7gbTMPkB7oWz4ZSCODZd\r\nXq3JTCGvdyBeJY5zOougaYCCKipEt8cJMqXYX+cpGFUbuHtpZp+6ogSG1Jo9\r\ntdQ+2ndA5Oh9rNHTRllYbnA4rtErwbXYL09sGoYgZqwwM99BGomULgQxYIJt\r\nZLwtOfTFGiROi25ZHflZzxDxxaoy4Ow3MiUHQHh+maH/7phU4vs8PdkxXOXh\r\nRbxshfefUMC4X4OA5yPcI8ZvLayk4a+0tsg14LVZbVHOx1amymTM/FzgE+h6\r\n7302rtyp4cibB/8vmdvwC4D9Vz0T36GOBky22cUxenRYNRrsrbCpfx4zaWuK\r\n4R1ePJ2Q8W/4FRcs8LBARRa3wS4WwA4EYQdwCg3UlljLPAPezwSBixoSicU7\r\ntNSsuviDU++TUlwISbmjOyOiI5TmDI4eG5W9i4BFTOP19wtZVfJgCxcmxPA1\r\nLj/ukZd3jUiwqCQhe5Da/iBmCpBwCJOA+k0SEe6OVqFIwdmLT0gKXeZSPLvC\r\nigWtSMRS9Ye7JwFp3THKtAwEpM3+1NxQul3rM/9fmfjlPE8YgcPL6hTsvzls\r\nUfQC+MQ6ZI0ma6R06NnjBsoGVq1WDFfJhSg=\r\n=+3v+\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221225002404-27cf158.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/3e931871d51532027889b31b431117cd/graphql-hive-client-0.22.0-alpha-20221225002404-27cf158.tgz","_integrity":"sha512-BVKaXTz1lfbNSoG07Rq/vzZQo3A52kdOZlb13Ll6X7qwF6xXjZpCelPLn/ysSpGeX0JzUYgzbOtepglUsBQEpg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221225002404-27cf158_1671927877520_0.6864291869645682","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221225022527-3392026":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221225022527-3392026","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221225022527-3392026","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"5a19b6b9778990769e6fa7d5ad2e244f336077f9","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221225022527-3392026.tgz","fileCount":60,"integrity":"sha512-WwLCIRqmxHWzHO25XeXkT/UOUt1lTOEsetwY5mvSY21/a2c5/QoT3o8ynBgCEZ4NsX3tAASFDkme6PAvg1xljQ==","signatures":[{"sig":"MEUCIGZJc+0vw52GFPTvffKanha4hi38858C0eUych3gdLMlAiEAq256iLooKdDqz6E+fsCe84vEP62kjSFKFCUEoLbABi4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjp7S5ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoxvQ//SUWUVt+kD6/kWqWKN5Nu4vw6nE5DUh/SCBM90K55wHuPMEIn\r\nZu4dz+H8KfiTHTl8+T96qKU4uRTrqGMKfZ59I2kTQfpecznPGKTLglLDAS/6\r\n3GteJ31IyzHfbFNzEraW6ucy30plgB7t7o8bec766rfURm9ZKx5xyVCSGYee\r\nsWu8WALFXA+87Qk+mbh0gvns6nGTdztGT9IHJTSCK7Ntg//TXlF9CnUtKu2A\r\nlRRWZvs1Zvmojx+b/WJPdQkEYYs2ONlvVbiGEdMLkgoe6Xt3I/YbE0SPA4K9\r\nycVN/pvZCjxRNe92Z7POvgyYJcQ5aeVKOHv3t1ovhdAtI4ifP1BiUnRsTMop\r\nKqdgsGCzbGWwNC16pFBdaLiHX1x52iv2UknBbKI+GJY/+MbAn1f7hvEUOaz8\r\nbguBSPzVlDIuaOtXbS5ynZ7RFJW7B0AsQyoMFnkGNOo9Pgne9P6ogdDIJPeT\r\nxJ0PS6n9/RimfIsBfXJCc92hJIaedPC/PdvdFrsuAaXC59ZfoSHqhSNzhuaL\r\n5H6fOh51FgmWg2KQSoAdzYFnLJ9jT5QI86RJ+ebgiGsdR4upoBLraFg6gg4k\r\nfJ9zLPvxdAShSV5KgwwqPcsYO+z8GjEMmXYuINiFmnTQu/JImr7w9x5KIkkP\r\nO5RB9j4UG3mPGPL+GahP8ZnFBXmbTUfdxxk=\r\n=ZHD1\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221225022527-3392026.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/495b9f3e69bc19d076e59c614678fdb2/graphql-hive-client-0.22.0-alpha-20221225022527-3392026.tgz","_integrity":"sha512-WwLCIRqmxHWzHO25XeXkT/UOUt1lTOEsetwY5mvSY21/a2c5/QoT3o8ynBgCEZ4NsX3tAASFDkme6PAvg1xljQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221225022527-3392026_1671935161274_0.8969621492927617","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221225022541-9007a18":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221225022541-9007a18","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221225022541-9007a18","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"3d38e934e05cc9aabe5b43e5e67060cacf50ed6c","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221225022541-9007a18.tgz","fileCount":60,"integrity":"sha512-oXOuBO1nE0NqbzONKXeSXEU6npOnofE/NNlR1GNHQn48IOygDSeJxuH2WbGWVmSIYjpTwxcwp173VUooUQcXGw==","signatures":[{"sig":"MEUCIQCjve+ObF+FnW2d8z0T4kK/pmQM26Tere9s++BA4A/HbQIgWLiXgB5NsAUOHFHQjVdPjvf3SDNKDRb/osh4w03G9HI=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjp7TNACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmopaRAAmosc0g5j0EgIv6RwMP0ZlihV2pKhr+r4doN6PJnL8KnCYPfi\r\n7isI/J5B+ty9rlXWeX6Pr1EDu8s/T79/wVy5VzD/JM5Bt0TgiHejxRagpDI8\r\nTsnVsSXd1YvWb1zgVwrTA7HaR4Lbf0kMUInhKgGYoLfIYt7WU6zyHOAyy58g\r\n0FNw5d/4phVlJo+z/KW7KaOpIs9JN9ixH5buhPlBT9+VmGWS+bRP5yM/Oz7f\r\nzi9nYUZ0PQjhQfNZAdOtoAOhD5rhiL+oKVVPEjUmeeRs/mnKoTNIqfUwDMO+\r\n7tTLJc2C0Fyhfz7gR3+pp5ssIZmvOvdP3RSuwBMNLvHJcyiZQGWFj2NOMfkj\r\nwVCo5yyIk4OZ1DE5/2Tzxd2Krp5GfBFKxakxnGLExqXHpXq8Qsbu3OlZrU6/\r\n51pR/+jnBa19RpK0HnkCtA6YvPoZi6e6MYQ5W/ufkwiku/PtgrRNORwbx/BZ\r\nBI3Xt0UOCrjx+dzggNolAkV3CaBfewsmdqOiZv8eAo67I2fXAnSJpBIcFesS\r\nb/n11VSlUannba2V310OM+lEgCENcZQWwg5Gfbo8wrP7lLQ6/0E2rNNK4zJO\r\n026JJ+AZZeIwsnfX7QqfBjwYddVZFFKPdlWQB8zA606P6Fa4bOPO3A5ykJwY\r\nmH+JW8/0JAGxGEOqcL/kBpeTuRTpm9S3vmo=\r\n=U7mB\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221225022541-9007a18.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/3fce92f329f4f3cbe4182db17b002afa/graphql-hive-client-0.22.0-alpha-20221225022541-9007a18.tgz","_integrity":"sha512-oXOuBO1nE0NqbzONKXeSXEU6npOnofE/NNlR1GNHQn48IOygDSeJxuH2WbGWVmSIYjpTwxcwp173VUooUQcXGw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221225022541-9007a18_1671935181341_0.34482367353491483","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221225044810-14b9453":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221225044810-14b9453","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221225044810-14b9453","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"f18212bc0cd7bf4f7da9755315cd6dfd13c58fbf","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221225044810-14b9453.tgz","fileCount":60,"integrity":"sha512-Xk2FmCIjcs/tpZh+IKR8Po/0GvVMyLnT4yy7jFjkZdTWtyF0Dx11K7p39Y9yl0E7RxiqcKyzAIQNYMUtr99OwQ==","signatures":[{"sig":"MEYCIQC7+ybIDhYRTwQzXT256W/J02IE/ijboZbZwSxCCnPONwIhAISW2AmiLLiVkV2YAdfQFoRItnMZXZ1oCgadEkrJofNt","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjp9YtACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr/6w//eaXFaDMNQowzu1FG1/riUpTB8nJA9vpX6sJXDfUjoYSerLGf\r\nHetpFW4w/t0dV//X/rS0VB+EJlnxuBQhwY9esGODD5KC5H6oKbsqt0jAoTJJ\r\n/TrE4YKpe9qIlbUkLmD1dANxwZPLep0TKOrDrAVTKGRYtPUFS0/ZeDas/RUC\r\nfjmYuUdk6YiCSA48XnrktupVuFu2h/dfX3l4BbP8A446PydXusgKul/hvfJP\r\n0PvqFwYHhFO4pcYO4IKYb0G6xhUMNXrAEEQ1IZ3k+kuIlQ0oUT9CTMMwWxI8\r\nGNXCepywCrPYylSxAN2XjMWJPuwntAudkuhQ1ZSTXYRdS0H1kazvV9QZH3B7\r\nHyweIdbfaZchgijZMj3FItaYAkr2MlUzXZxBuhPbA2o7goScYypeCd6Ci65H\r\n22AWv+/bkoFAxe6B3WGnP+r7/2nxEoRTvUWNhcrBrRsN5nmjrnFtw/mIX4SV\r\nEY8WxnerkMk0o6d6k53/rL4D3S840o3B4sz2DAP1FWMDY+2qXkJXH8G3w1Qw\r\nZMx0j/95xS52BVPtkDj48rbTKFBSTQZw4CJJJAWoSkF7VWme2lXO03+oTxWl\r\n5gFRn9/2ZZwGo+lPnslmeTmpCEfHQLjaFKNTUHgrUBLJcQAYoshmpxeBE/Vf\r\nS9ZLS8wDcaOfp0YLca0MTAjFTujXfwk3e6E=\r\n=Snva\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221225044810-14b9453.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/669dae208c8ea0ffe31622eb63be3387/graphql-hive-client-0.22.0-alpha-20221225044810-14b9453.tgz","_integrity":"sha512-Xk2FmCIjcs/tpZh+IKR8Po/0GvVMyLnT4yy7jFjkZdTWtyF0Dx11K7p39Y9yl0E7RxiqcKyzAIQNYMUtr99OwQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221225044810-14b9453_1671943725296_0.4412750164093491","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221226091057-cfe7532":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221226091057-cfe7532","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221226091057-cfe7532","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"ae2659d863130e822239f593b99a356f134b0f46","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221226091057-cfe7532.tgz","fileCount":60,"integrity":"sha512-LcEz9mkIHhRaUef9x6STkZxKPHaDABbnFB6tzKakhDc3cAAj/DQppbJyqCMLfP4OfwClEOps2SkMQU5/Y3HXVQ==","signatures":[{"sig":"MEUCIHumcqEZoyQfH6wimSVCVgFn568Ea5CyMSjs2dCTVs6qAiEA+S1ApxlB5sOlUBgg+KZcg2jfZ+HLxNAkxkWL/Rg7iHU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqWVEACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpG2Q/+Pd3aR837lAVM6ZXAhNDQcaWWL99lJd+3bTmHXQgmbU7XmEeE\r\nve48L6CtnVswGx60P1WAO/LmHsovjLFR1m1c+37HSBizS+DwtVMEZR6i89Qd\r\nmGjio0B4ZXiz98zLHkhW1VcdJEbpsFShWduztOq3UehaepWKAGCVsWcKDbKE\r\nlk6orqoVdBIU0IPslMqaprYUWAnffTjFCBon5RitKOwjnrzAzaA7v1GiqWXR\r\nmHrqEzQBWPsfEtC5v+CMhTJJeMiEEUX/JcXnaWgFPnyfa96+rJSsP9IyvXV6\r\nZ15z3hmH5pY3prAmKeZb4VvTnwOW4051N7//wetCE/0sBB80h0J2EqZx9yEn\r\neTYHlg20hNRKYZFXRBHzr4TPSZzE2TmdcE/U+96LHTuNrxx/Y/RqnyQ12n38\r\nP/uK61dHN1CGHj65H78jAU9k9tAeHGkQOQCgOMnZCp08umP+UTai4UnmBuCo\r\n/YlxRJCSzGK0MOYYU6LghwigHa4RjiTO+DrvS8Zs6wapelTabZSqrIBWFb2j\r\n4XP0nsW7M0F757BaWMPJkhuWEj4PVTU2+K8FreJIResEOl4cZpwVBslgvfWD\r\n7nAwFwj6pdB2sUIZg6K6VxfM7Ue9pjbHqSiv/fIfoCtmRPRDizCmBq4gAfoa\r\nDT9zw4zuf9YbeNlt3H9n2B0QHDqrUQukokA=\r\n=jSwO\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221226091057-cfe7532.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/7077238c6a2cefd660b1918bca5f71aa/graphql-hive-client-0.22.0-alpha-20221226091057-cfe7532.tgz","_integrity":"sha512-LcEz9mkIHhRaUef9x6STkZxKPHaDABbnFB6tzKakhDc3cAAj/DQppbJyqCMLfP4OfwClEOps2SkMQU5/Y3HXVQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221226091057-cfe7532_1672045891820_0.9648455525779245","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221226093454-b0cecb2":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221226093454-b0cecb2","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221226093454-b0cecb2","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"90a1696a969a5e21f5be422934372c63879b4828","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221226093454-b0cecb2.tgz","fileCount":60,"integrity":"sha512-rsXjrn6+FWlGGt0Cls9heRRAKnLoPzfZfR5d/yyU0TJkgirSXitGclBSsft2f5NMBtBRgF2d3OUv8qqiG6/qeg==","signatures":[{"sig":"MEYCIQDMdArL8qcP3UWPZ+7P78qOsggd/v5VHmCEdSxfou94VgIhAJSroILc+qxlFkzlekIq2Utml6jyMD3cNKtbBt3oxCeb","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqWrrACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp4Qw//UxQf+dNHADghSu8VFNcemVfJ5rovbQAsuUxDj2uUCjlvBSki\r\n+5GuTlYRm42RpuGwDrB1Ddf3nd+WQszjuNX4VvWgHpew+SIWNLP4sdIjsNAE\r\nfWrSVie8yu4La7K4K/1PI5T6t9S6KwrpWrkX0BSlK5cFxsfNTjQW6Ln7+Ptc\r\nbmxmHwcBkNkbfPkHRMIp0Z8RuiZMBL4J1aLDxVEdMJ9x/nykH/6acpoDQ1Eg\r\nI8JyferRVSAwZ43J+xjm5F368Tnz8s9fOFmiX26XFXcNTtUx46StZf6tHoWU\r\nHk1Y4ODgcIRigQdbd+SQDhUZxu1MnpMf4CqJ/KaPuic9h16wUmxIjHVOs7Vl\r\nCtMb+ZywI1k9t3TeHBKzpyg3csApxlXbRH3Rv9UxwwqnqR6ARqUgC+GsnRLT\r\naR/WCHMmOKHjaTHjPQbA+geb37J1fC3wWV3vPgRHnke7SnRY50bvf0CAJI6W\r\naVidNP+nt1aLMnp7tI+2/IPp3ypPVAVbPaYr0kHLQw8LfLHCF+vzKZhRBm/7\r\nc1dJdmZ1mvzmxZ69dVvgMTVLS7o+05DIpnYXmpJkLbevfte5Jua9IGpCWfEn\r\nJuM5jhNrN3GiqtxLyThgyM6Rs9wFfHjIFNMXyWz7VLO9iav2EJU2EzY+03Fe\r\nhDlOsLTqny7Ran95pMaJjWaZI8717fzDsaE=\r\n=t7yp\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221226093454-b0cecb2.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/97258a6ef61a087fd01bfa7156a5a29d/graphql-hive-client-0.22.0-alpha-20221226093454-b0cecb2.tgz","_integrity":"sha512-rsXjrn6+FWlGGt0Cls9heRRAKnLoPzfZfR5d/yyU0TJkgirSXitGclBSsft2f5NMBtBRgF2d3OUv8qqiG6/qeg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221226093454-b0cecb2_1672047339286_0.9850573606807456","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221226093643-911681e":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221226093643-911681e","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221226093643-911681e","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"e4dac3c22b4fe2527da2e579390004d04c75ef4b","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221226093643-911681e.tgz","fileCount":60,"integrity":"sha512-+Zzhob1MbpEV0M67UemJB9mmAgISyeEoCNwMlhNWK1wm+e0FFPt7ke/ZPLcvtBWyODld/TGVJOTb7S3Lep8Zfw==","signatures":[{"sig":"MEUCIQC43R3JchygN+o1ePfXQjeRdDLkfIGHCGC+vS14puE2RAIgCFqytUSieurmInEE6DzIJoftIgUAnrP9HEc1gjEQTAE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqWtOACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpXiQ/9HaWrdWszgTqmtp75DnoRCYOilPDFjWxPBUUISMnLvDT0lr42\r\nndrbfRecqwERdqEb1hQKZR3FHx+Xj+cwHJ2c6YWIVR35XRDBe9FUOCN6Z6uz\r\n/vm1VyDW7MQda29adp/Z2jUZ7KhkraL+6CnjzBhyfqSFnkRKbqV2o4J5p8j6\r\nL0DH2IfVA6x7uqbvw6DJFc83MwhX/eRASTjK3iL64JJlUlHnjggnvdAlK5d+\r\ne7R9qLxv3XxCMOSsGfGsFkbncCQlG3dCFA4FW5qKAR2KgkHlzZchZn7xCkCS\r\nDvhsDUOloinO06b24eC2SLj1US3zhxYBlKkvdDhJfBV0fkEVgBPWjpzv0RBF\r\n/rpIAUkKwYaTyeT5GNnqK9k8lU+tiLmd8pv4nfEAhlFn2lReHLZ8USKe+NNA\r\n20lEiq1U0Kq28JBI7rxDuCzJGhZCdsBxMBZ8zAJnmYMRm+zUgHiOsxyNePzL\r\nU4i0a2wEeKjaFH5Mwd6eEA6EVmrR7xHWbac2jig5gEJ1rbtP2Fmq7zc8WYMY\r\nG0InqfSMNdRC6IRjmWVkdb2RI0rg07y5qp5ZLlsg5GJKd/5BQyP+JcxFn4ac\r\nHg5tiqK9/6eSx/OW12pfzeMLFKnsvJ5lwvsftuxlosLzeE+DYVC4xfZhHnJy\r\nol8dBldU6CekPo7CX/8nPL7msXXNEzrPfRQ=\r\n=atAZ\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221226093643-911681e.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/d26b557ffbdeb879277262bb534a5e49/graphql-hive-client-0.22.0-alpha-20221226093643-911681e.tgz","_integrity":"sha512-+Zzhob1MbpEV0M67UemJB9mmAgISyeEoCNwMlhNWK1wm+e0FFPt7ke/ZPLcvtBWyODld/TGVJOTb7S3Lep8Zfw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221226093643-911681e_1672047438261_0.6029501304380553","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221226094030-d36c47a":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221226094030-d36c47a","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221226094030-d36c47a","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"2d83e66765f5b9e8b653d4dbea5e3541480d9982","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221226094030-d36c47a.tgz","fileCount":60,"integrity":"sha512-E4vAHmF1LcBPpJ3fKdKE3RFdR8y5G0nHQADmmS1iIAtUirYxIIO7fQNVDAG2pNDjeSUji/4Bk1ZBBkfbo96Spg==","signatures":[{"sig":"MEQCIAWqyxr1iCtDN7GxhaTAD84R3hdmppFEfyYMbPekGBBxAiBOWEN4JyBddeoDMq7UD6y1fbtbDJCPzEW7/1oS2Md9RA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqWwwACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmqjaw/8CVIeg9GKoP/nTW6T4Zih5TdGOM0s9Y75k69g44vdtcjwoUeg\r\nat8wMYpK6GMgkNyu3qpDdmGa6qxuyvI80mb1LyHYE+8SkZlvL7qzsTeJwaaN\r\n8fuPfB1su3BM3vp5vE2gZs50U/YPyK8ZdIHvYKRVPu63chrIU/yVvUVwxFEG\r\n1t5QKctFwZAkLVdGx2BKMqe1r4WqPBBhdX1fQR6Qd0USqeLSo9kf/vJRPrS6\r\naWVsm2NAscCi7phzf/TwaSDUZ2vD2fu6me3iEwCOeGnsQCFuQOql585xUbtg\r\nxVLVDC0a/G42m0ClLkTM8O0RSQh/Nxig3iWCqYGSOnrMeH6H8bUHwHOH+E2D\r\nEUyCXWf4iIUBntb17BSTeMfDrcEi48ZQNjYnDhj6hP9wWnO5pA03Vpqx4gac\r\nYcMf3SqgbMhm4tPgNy/5W3mW9nU2LVhY/ylItTqNfENTUhsMrpA1AMaDw0Ve\r\narxrYZmenQ9SAGuUWtHGgVdtXLy1dliz3cKGmxSE0DKFhaL7vlsZqkGpMvbg\r\nbXar3pTy6VtnN+SgBP8VkCgOmPcKW8sxQf0B3SnW43JDUHy4GadC/V3P/G6f\r\nDceY05R3c5ej0vSJCeb0zly4WUHOm4cH/pQuclYCV1DUTd4CoJZ8B5hI9Asr\r\nbpWaiZVpV3gKJVrZSBH1Upu2AgO3W7JUOG0=\r\n=6Att\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221226094030-d36c47a.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/30747a11355d016bbe091d632a7c9a49/graphql-hive-client-0.22.0-alpha-20221226094030-d36c47a.tgz","_integrity":"sha512-E4vAHmF1LcBPpJ3fKdKE3RFdR8y5G0nHQADmmS1iIAtUirYxIIO7fQNVDAG2pNDjeSUji/4Bk1ZBBkfbo96Spg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221226094030-d36c47a_1672047664757_0.7292888289883344","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221226094539-5767c34":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221226094539-5767c34","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221226094539-5767c34","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"17833a2506db898736566ed058b57821810f730b","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221226094539-5767c34.tgz","fileCount":60,"integrity":"sha512-UFJJzQtNvkFVJW0+v0zCOs0WT4H+GQb8guPFg/y8+0u8N9nSCckASIA4VTkR3Flfkk58TOrI6+9gHjQvNKfWdA==","signatures":[{"sig":"MEUCIDDOyCsyp67ksqowAz3KTd36wneh/UcZh3TdxkSVUCEsAiEA1Uw565KMpXRkK+YpzN4htRCXKSK0OKQ4H9s8rTNXi/k=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqW1lACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrI2A/8C9DQabv8mvzXheABoH5cvsgYcV8fd0729qUrid05VaMK8OXi\r\nNDxbLo15Ya9u3ISbPj+vNEGffj4He29wxtSU8TNMyTlpZ0Ar9cikx/b8siP2\r\nGdK6wnL+lZkCbCpeRNIU7GpyIo7F21m1EA8UWBp90KjcYX/kns4xfK8sAgda\r\nUl5GtX8ufcqOrCMfMIyJEVLo+93tzAKsKsSmRon5LWJcpaZANqCJBiAmWirr\r\nk2/KLaPOATbN5XgO17h9luJKx2NMsqkCGw0GcqUi99RnreDS1l+1x2qFJaRI\r\nme6A0VxM/Fk7XtkzmoobSVSEj0i5p6s5mR+BL1+Uza+HeCsxE+NjyPJVZq1y\r\n5cadbnasJ3pwqVwAF6dQzkKWl7Jjg11NR30uYPKBtOM6VnSY8Bu9QGlRB66H\r\nmieg5i38J9TVuwvYZQZVUM6gzHVrZcwsu7k8Pf0Z/Q+zaln4DqhJTJbUW9fY\r\npKQ9ZCz3s3HcCx6FC70JX8SZksey16+NiiIa9uKGaqQJFgA9qSePmmY4TOL0\r\nEjionh0lohicmANDnASlxmOxvWxrPqOabqVNxu0Zl/K/cxe5Fp80YdsH6sm+\r\n6cqoWuYtwxl8qy9NxC2JBJiKwTW/NP+1/p6rXP6oN783xyhPumB8bEtgKhsM\r\nlYldl2yNDmp44ZmlTrOGXX3OZ7FGHoPvGv0=\r\n=r2/8\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221226094539-5767c34.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/2805b4b821ed7828b4f9608725244ccb/graphql-hive-client-0.22.0-alpha-20221226094539-5767c34.tgz","_integrity":"sha512-UFJJzQtNvkFVJW0+v0zCOs0WT4H+GQb8guPFg/y8+0u8N9nSCckASIA4VTkR3Flfkk58TOrI6+9gHjQvNKfWdA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221226094539-5767c34_1672047973414_0.4976624231456179","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221226094740-4bcc469":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221226094740-4bcc469","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221226094740-4bcc469","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"17a533ba49244467d253d7bfaf613c9677bef336","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221226094740-4bcc469.tgz","fileCount":60,"integrity":"sha512-WVeTVWx/KtgqVBYUkGOP/qcmONRPHO0aDwhCQdOGqhq8IlQ44g7xexMqcXL+e/3P+EM5RReHMAhv+GsIyTcNVg==","signatures":[{"sig":"MEUCICJOdgbrICyyd81ObjheaVnUWLdumtsS6K0rdwRsRIG4AiEA0XoKROl2CQ/CxirR9+mIFbAJIKfTg3Y2lEJX32rkGD4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqW3dACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoC+xAAhotCt2TTpRXPxs5vgNgtD71dqf/sjBy3Oko0YK9IG7qKgycC\r\n9sRqXai+fFJXnltMZvsor3dpirexChIKlnIQ6/u1Clot6v3HkgDJuRYNVye/\r\n7/wuVEqaIJ60ULCNB3x9/llpqqxbgbq+k0locv/VaNxyy0D2x7zNAHRHpnU+\r\nhqskYx7bepK+vjPodvKqQ1q2LXsQDwa1Rf1CecStDD+VPxmZ1YK0WOqsbMWc\r\ninfrklSjuxt60fP2ebHyzIgefcNg6zeNkKQVX8wk9+tu/YYe7/2CKxZNsS08\r\nwKJAmi3RqjqC7BdeB2+mHz53nbtchUatg0GC7nK3j9P16yQ5i+u0Z9ZOqxT+\r\nJ+mCHzyXbzStVTvfLQYemy8X/4mm8yi7IKDY2B+c0JDB3owrGiBCwER2PcVo\r\nxU65ricgkuNh/XTHcG/bocuwSPa82i8RHV70whtshy6RGExgUO8yG9TMJwYp\r\nnGDF0OZ5Fhe0l9RswvzBqGdmOTueqB4ZQx2q3BJ8cJ8ileOliEV8WL//sHv/\r\nO9QlvqNHstBs9JsVZvhTApDErPqwspktG/vysRwnORjlc+vySiU1T+YZQBc0\r\nA6b+rUMy2FEw13yFH3vNZtiq6/T8+X1fH2MHpGVTbJkyadKcUdSm1AbpXVKr\r\nyQYWWohe8RWrFQfgWa6LkJ9YoY2kCDmy2/o=\r\n=IaEA\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221226094740-4bcc469.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/d7740ba7d58c9e93fb877f9b56019b12/graphql-hive-client-0.22.0-alpha-20221226094740-4bcc469.tgz","_integrity":"sha512-WVeTVWx/KtgqVBYUkGOP/qcmONRPHO0aDwhCQdOGqhq8IlQ44g7xexMqcXL+e/3P+EM5RReHMAhv+GsIyTcNVg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221226094740-4bcc469_1672048093729_0.915210792985087","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221226095053-25a8b54":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221226095053-25a8b54","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221226095053-25a8b54","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"e3413a3a7737af11f76a1355f4476f3bd2c4632f","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221226095053-25a8b54.tgz","fileCount":60,"integrity":"sha512-LfcrskxoY8CVLPEoU02BYHQuDRh+HTl13MF0iMUUZhQEf+zgyoPkDTeiSbuQM5aBM1f+OrwbwQnp72fqWnrOnw==","signatures":[{"sig":"MEYCIQCi8rXfXpGUGt9yIfIz8QCBKZEP0qU1JtxXWmaMxEwtjQIhAO2i6MRhlcn4e8Trar8j5d/DIxo8Yr1vzv2YZxqvL7eb","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqW6eACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrHmA/+N3DVMly8XqWItmLh7R9yzu5AgY/38JS7DAnzcZBUunD0GkVI\r\nYuzzDE+71Jmuq0bBvtzzx7gwPO5Ek64oVYXQwvz+Yyc0sIKbPFOEi2YH0jKV\r\nvWEuPmuujJ0zGL6FLd6Dqna5f6eHGipGPvEVAo+j5Eib9wfL1mh0HUNiCQWv\r\nkgEIEeXw/ZVucxHAOla3dxftnEUm7uYxLlyhRu+P57kiOfv/0M+VgKFlSsQu\r\nMCrSixH3BHKzDYP1qOhVIlWSyAaEAkPeFiQ2+VEnhcVWRo1s7Rj7g9VRX+sz\r\nfGPSvPY6LWPEdxSmtGfhkKuxZVuyizYpibRQi9yHssU89nksDghQQSWrpir+\r\nnwL6/EpZwgjayD+QZtUXrntMpIA5SQ3wFkmLjS8owWHDo4ghH21a+5Scffd/\r\nqYdEOmCTJZS9kcVEVtU9/zgszI1EdtjJX0kCQ4CShSJA0vXRhEb04R9uqxYh\r\nA6BMEuctXaZUtrq2gDBugAombg/+RtfqE40cBe9uCay3BUJbZ+nSNlGbmDWI\r\nMoOj8mATGqVCO9hvcdsf5vMhD2VeNzJFMVh0Gi9lk6J9Gd1Zymt55TRKt9IG\r\nPdZ3ETAmQgY8Rw4DEwDbPJlMMTMvVZkuj3BRegV+cTC7H1Ydkk262Udo0wk4\r\n+Q1nuXAOjYfJJahwkpgB2NFAXmg1RJaL7rM=\r\n=qaz3\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221226095053-25a8b54.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/a2fa441da8307f7396db13f9c923fe26/graphql-hive-client-0.22.0-alpha-20221226095053-25a8b54.tgz","_integrity":"sha512-LfcrskxoY8CVLPEoU02BYHQuDRh+HTl13MF0iMUUZhQEf+zgyoPkDTeiSbuQM5aBM1f+OrwbwQnp72fqWnrOnw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221226095053-25a8b54_1672048286755_0.37979761914837584","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221226095550-e3fc3ab":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221226095550-e3fc3ab","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221226095550-e3fc3ab","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"e098ae72c4188534db3f037237e5aca8d21e52f8","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221226095550-e3fc3ab.tgz","fileCount":60,"integrity":"sha512-LNZTJ16GVt1tY639fcz5viy6cPd1Ed52daKZ+LKMWuvrGBtk4OHKHTfUiusxH8I8UQQPTL6e9M06asxb8/4JVQ==","signatures":[{"sig":"MEQCIHcok+DXFiu/4cl9+2osqWmtjy+WbLugmm2vJIDvMySyAiBUFa9b0f1Tk/84AKTjaWQEWp/IqPw/SBT4suzRpxxSHA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqW/IACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpQYg/9FLCyCHIry6FSej+8ffeT5oq3pAuctChOzDkk5pVIwWPAqhux\r\nZLvhbQjVH0aWWIiXwR/RcdwgVAqyI9iMp8RjgZIbl+F8vlyjmWf9Fkq887Mx\r\nOTmkT+TFitX/vlm1/uM4/kG4bgKKlZ1ExsUU42y4U3y4/VLIvDfWkeV/vc+n\r\nVHhyabRbFrQl+fuNPqhpuEi6iAoraq9CrdXAuKHVmHdmxn/gbNn7M7rFTBWj\r\nJ3WdOmKjVgCpABB2qw38tv9XyNvp8lej4EJcbhO41HW9xR/eMa5psF6CR977\r\ncohpDBvEqJX/amvf0xmr4j0thA+wLuNCkYYv07vduydMXCS8ds9RjG/LKeT1\r\nDGhxQkY+m7p8jP6DHqSOe47iKB9akH5XfksorDm+2K6sGdK/IHPAhIWB06K9\r\n5eUYQCnnjrzVYHHBdHkbF49t7LGCLLLAsQqMUQmuyfGJiTbqxgj8fYafBROG\r\nZGNcadwwzvANSsoov1w4F4/UFiiq7SJQUtW7qC302JY0w8O9wMg/CZvkaOWl\r\nQSOXL5669x6YfjOxUhzye7LSiEJHAZRkREsKt5c0yfC65RCaQ1D5T1TsKmOI\r\nQze2MxyusTKxN8BkL5lOMvtUSC+LyAjjxoUZiYUtrhyQuV1XvvFvOpE4gDhH\r\nPuwsHxWestBj+Yfc9qv8YldXYghqcj/nxyo=\r\n=s8XZ\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221226095550-e3fc3ab.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/e6d39f6961d8c564f8968120a8dfa44a/graphql-hive-client-0.22.0-alpha-20221226095550-e3fc3ab.tgz","_integrity":"sha512-LNZTJ16GVt1tY639fcz5viy6cPd1Ed52daKZ+LKMWuvrGBtk4OHKHTfUiusxH8I8UQQPTL6e9M06asxb8/4JVQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221226095550-e3fc3ab_1672048584487_0.3977805205416476","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221226100538-59af8aa":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221226100538-59af8aa","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221226100538-59af8aa","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"6ce2d26d83b9b25480066747cddc3c435433bf06","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221226100538-59af8aa.tgz","fileCount":60,"integrity":"sha512-1XjcgrSPufXm50jf6Doudp6DigdDNeaJo2esEljXazXWOBrAMMR6696u48LVVRM52dhhjK7a4OGIjwewjNZ1fQ==","signatures":[{"sig":"MEUCIQCOweRybngpu4a78GpydJ/1SC1iQ3mltgbi+4Iortr+JQIgQg3YKmy3h3jgaEVYa1+AS3E+VeBCwXZGOWMsR2MHsFc=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqXITACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmotGQ/9GAyoraTUS8ysqpt82SkJhOwCCgnwuqv4Z94b9jzVmyxWp0KX\r\nKOrmOTq4uOK5MPgp2QH24ciDtvyxIYaGl+mms8hW0Hv2HmnQbWH53u9p9yv7\r\nAd9v4b/20DeuNLxY0r1IAP7+G0saZo/qxAUbQuTTdWJSQDUgi8sNsckT2tzk\r\nYRATQSz5yGlFlxFwIZ94dRrQ0VfyeYE6IL3r7uSv2S2WURYTDxjdb1/7YvHh\r\nhseq/uruDqSw+L05N0xk0LCmrZ6xiwFLZoy479SktFYWYMFHVN3G4qgmB/Nw\r\nEPePozpRCp/CFl+jRONvqlWaNlJk6n8RvIrk4tSYz1XTLMXPHemP3iqCiZqT\r\nmbz/Nuhv8ro2ztcVwKJz1KZdfJoHd1PlWMfkyPRthu/CjZS/W4VaslFH1O9v\r\nduaa8Ad1HESckE2turNxVb7ziXbI3hhfkz4xXF2qMiNkN1eur7PJCLv4P/78\r\nwUT2X9kTJiDkKcVT8Ab5W92nPraAziS/N8DHBT++RB4XY17qwU7XbBmJ2HnE\r\nDbBWin5auo7bXdMr2IlXIyzKhfrsjB0NVbDG8JweJ7Nr4Dr+6KBlCdRUNy+Z\r\nLeJBilVu4H4/v/xFicsCT1sVQladZiv9jI9jwtaeRIs+2W/O/nP2H0xK300i\r\nn56TyfCExCq7kpVwreez3UOq3ZpXaiGvyRg=\r\n=no9f\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221226100538-59af8aa.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/90eec4c7eadad6470bf3f18ee8d64193/graphql-hive-client-0.22.0-alpha-20221226100538-59af8aa.tgz","_integrity":"sha512-1XjcgrSPufXm50jf6Doudp6DigdDNeaJo2esEljXazXWOBrAMMR6696u48LVVRM52dhhjK7a4OGIjwewjNZ1fQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221226100538-59af8aa_1672049170828_0.6582845143893605","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221226101050-1e660bd":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221226101050-1e660bd","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221226101050-1e660bd","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"7ad1d9c3cfa7420983a1c91d3bfd45f498c1dba9","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221226101050-1e660bd.tgz","fileCount":60,"integrity":"sha512-8NVVN5LcEPB8u6pfaVnaZkQMXbcULV1QN+4CB+7hiWOix2tVOfa9UQ6LHM2j2dQIUyvy4bc7LxO5vqByouEuhQ==","signatures":[{"sig":"MEQCIA+nq9cbufkg4I3iO1v4rytHM3DyLR2wbctLMGAp7sOIAiAE7qqe2EVF13E2iZJWsSu1gFd2PwtE8i9SmK4G8bhuhQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqXNLACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrkGQ//XWD3YAoZyCUYZqQW0MRNxqa4tZVP+kwJ5DPXR0sk37mZKGdg\r\nj6fWNze+GLM0VYfYw8MuwH539a/VQFZSK4M+6JiOnJJIPMADI4Ok4J1BLG59\r\n24dFryXXnkqPaHYPKHNNRm1lOSB8+JsczKPvEAvzZIoOr9xe5RFGwM2lwwrm\r\ngoM4+F5A6UPyx81AuGI8w4y61KmGaI1W4lia3U4RYCPT4s9UY4AVKlpfKdhT\r\nZeIPfNICEa5NKZlycgfEMQ8obX950dUZ01S6iBqS97RT//XOFREYNpSfRd7R\r\nA1WNw5nrsu0141hC8TobXZ9IA+lli+lCso2OO9XHz0UMMP9rdC+9ATV6GSRA\r\nGm62OIGxrpnw+vYhKWgW6oBQCADxkafk1lVIA6BwEg+5Jzofps7MgiSfBZdy\r\nzG0Y5o0+jWSeNclfaqpZoPQc7IQ+U/8G3Pd1QMsQtkqpGPSn5tqZ9iigtZKn\r\nqmGzZww27Ls/tzg0cWc/tmwEAetqEnWY2T4Tij8T16IP5Qyo9b3wjUPthiqh\r\naGai5EOYJILwfrOscpT8V/tfZEgQj+MwlLMLMaSMxVEbUBBudw7ykOwAcNiH\r\nFeJ6/8YihwPYAXNzw6SXNpafm9f3MG0dkJAarq9C6MRVy9jsNAMVZ9WUxFZa\r\n5tmbfk5fc+DSWagKTQvakbvlf3Wdo3rPOpw=\r\n=ttun\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221226101050-1e660bd.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/717b18fdee03dabf99161a7f4cff3b03/graphql-hive-client-0.22.0-alpha-20221226101050-1e660bd.tgz","_integrity":"sha512-8NVVN5LcEPB8u6pfaVnaZkQMXbcULV1QN+4CB+7hiWOix2tVOfa9UQ6LHM2j2dQIUyvy4bc7LxO5vqByouEuhQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221226101050-1e660bd_1672049483292_0.4016836950365301","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221226101616-6b0d7b6":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221226101616-6b0d7b6","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221226101616-6b0d7b6","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"de794d9a8846bc3fc02d3212a9d4f30cf362934f","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221226101616-6b0d7b6.tgz","fileCount":60,"integrity":"sha512-IZcBS96xoJlnzq/0hIZb70dKyjugTcwh3SlMJhLYR5ea8RvA+q2j1R1Jdrl0mZaU4iyJijyTXFhpaVvy134lmw==","signatures":[{"sig":"MEQCIAerh67HtoMunLEPsH/xfID16g+BoSxtUISYnU6BwOXSAiAwNBbKA0gajypLo4VLwW3DINrvDHYe4+7Du3cJ78vr8g==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqXSXACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoIPBAAl/PPHSU3DfCzT3ts7Id4DAScQ4ysOItPQixUDm+AgSe39m8K\r\n3p+7XMpPhbiZhDtlgpxIFQKt6SyJudHczDOIS2TMFFcn3tmzEpvDp3c0QK6/\r\nHQOL2qVOnlvfA13h3aHl5XaeBlyzalrjCiWpR1Nbn0kBvOt8q0RwHfRnei67\r\nXNPVkvgc9GJIg4BKFRQIxGKpcvCVjxJBIPRMgGjT+Whxk5cjxh7r+PPUYYFg\r\nUtubBjWnTw24u9dJ10c3RWIoaNC9dBPeGIgzK8Yn90BrwOWkBOBKSmMl8a1L\r\nqZNs2YQmLqoBF9gYJR/7LT03LzCcFSVp9r/ENjSaZ16BS+QBwNdd7JIZob5T\r\ndLFTNBDgcf7mP7zAikTi/gsj7o8MyVJ6xip3AhUyP+1DBHG/ReDm2X7V8vir\r\ntxEVacpic6cHyu+Gdj24aUE5aotBO535XeIwsLmNHjFtq8oCc4wnVYWD/WLI\r\nnYNGDOXfrj/bEpNLTu2k2dIjR82VTefPaen/dqZUiSZYZxn8MwIZM6wEh9FN\r\nf7h66RI6k24nEVu9gGXKrWeSf+mLMhhTVr7lFfUpQic1zLUFe/6l8/Tb7iVc\r\naiFfinEu8lp2j7ZCTWvwGVNHKk/Oqe5dPbVVkc7JN1u3BW2io/BMR9SAuCFo\r\nRhn4K4jthPdkfc94WFVa67u8Rqxo6ney6aE=\r\n=M88j\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221226101616-6b0d7b6.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/a416113e9c82a448a1ed7475b1750b7a/graphql-hive-client-0.22.0-alpha-20221226101616-6b0d7b6.tgz","_integrity":"sha512-IZcBS96xoJlnzq/0hIZb70dKyjugTcwh3SlMJhLYR5ea8RvA+q2j1R1Jdrl0mZaU4iyJijyTXFhpaVvy134lmw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221226101616-6b0d7b6_1672049815479_0.12552049948080568","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221226102644-f5a3839":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221226102644-f5a3839","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221226102644-f5a3839","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"4bf2e9219ce7383714b02fb412f83facfb01b9e2","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221226102644-f5a3839.tgz","fileCount":60,"integrity":"sha512-ZTp6qql7Q+a2+KthaNNu11/hfwSjdRGOJUhG4X1XTcaCAfscjLXLRJugWAsBcWY6cD6vZPkYwOGTtb7xnh0Yjw==","signatures":[{"sig":"MEUCIC6iZPS12rvGrobmqIug5ZtMzZZKpoBO0mICyxXiJi8XAiEAhUmdFqbO94qOSOOtujT8aA7j+IRqxpTSEl2UJwkh4Ok=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqXcPACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqhAQ/+Kl/8TE9U6K+Jg8DtHkjlkzZwHxKs4srcfITr+lToQA3LJCQ6\r\n8W6ckX6LNPFXDLdrqLL+ahnVNieS8h7HHj1TVbS8+E14moeyalMH50jResaa\r\n2T3uW48zCrrPyQj6YwfZfLDKDKxKCfpOvrPzrnriQwZlh1BrONOdMZrpTq36\r\nZK0KZzbBd75TUSL65aFmLnL752+ywGZlakwYNwAGwDykAJO49Iv6V66+Q558\r\nNIT+LsjeMz1HPP4fvFZcyFo2dT4itrtMqw+MO8HNJNEUl4igpRuWE5jchipN\r\nMiE6NuMObEgQvg4UmWuyMA6HDcJDXVaLIJnacW0Jgf7mOYuEETxYToVIpBC9\r\nkYD4MHaJ6Camauh4jN4jzp7MykO8I3ahLubyHM2HtqLnyOLu5DCgWK+PKj70\r\nOFmHlpEFNYp0oojfPBt02xyCmm1EGWbGrQhG2fGW3+o+yyRsDkX/gVhWyulT\r\nLGy2fv4PP2Eb3ogNurfBqrV18flHzWszDqYsVk+Eb6mUJYvjwQdgvncVx5d8\r\n9KqA/ntaA3h64w048JQnAk7tuB9NXk/tm4pqPVMDlneYiskA1+/A2ZZacOmt\r\n5Sj7ACaAWAVsYCeX40U73HWIEGhzvXNNGC8K/08KT/VMcFkZ/MQeMmfq794Y\r\neecMJGvfXN7Fs0C/iJcAvD7NpAMtcOemFE4=\r\n=aZkU\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221226102644-f5a3839.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/230e1e19faad078128bf744e3853018c/graphql-hive-client-0.22.0-alpha-20221226102644-f5a3839.tgz","_integrity":"sha512-ZTp6qql7Q+a2+KthaNNu11/hfwSjdRGOJUhG4X1XTcaCAfscjLXLRJugWAsBcWY6cD6vZPkYwOGTtb7xnh0Yjw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221226102644-f5a3839_1672050447531_0.20909883366909932","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221226102727-29e713e":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221226102727-29e713e","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221226102727-29e713e","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"87056c94ca6947e9d36afc1bddc4cb5509cf486a","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221226102727-29e713e.tgz","fileCount":60,"integrity":"sha512-UP0CaH3/0Ce4RCs4+UpO9SMu3tQhuKLdjpMelonnvzPykgODj1aUkPPPiq+8C81JWBDiPjq9GTUUsnUT5t3Xug==","signatures":[{"sig":"MEUCIEcj3TrWr+yUXjAYdCrIuc3D14P3R+KfGvsFTWIxwcFEAiEA53dfy1kPId3EI9oVhhP7TpR3P/aKmFRlgn/usjcF0AE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqXcxACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpG/BAAh1QXx4r8Aeep+CtFMfyP8ZXaarMC9P6E63SQ15QMDPDjaHRX\r\n6WfzPRzAKZw3OOCtXKDtdp1FzDlkuIaX4+v36mBYu0FTJNg4beZRPZ4pst+D\r\nt9K12aNz+QweG9X7Ax1try2jr1qnGS+WeH4ZRDpgDnANW///p1rXpM8hmZXA\r\nLCEg4T7HwVCL8C0Z3IxnRr/33o8TnY44H3Yk1yT7jCsuM4aGVDnRmZ8QBjj8\r\nbpri/FNBxgRaGfiYkFl4twZwcp9LRmw9wyZ6TozLp1l32BcpLoIpDetteQsJ\r\nYw6TILOD9Vr9DENOBWS9mfNhNzrJA7Br/xpkSgOPXcv2pqNSVjiYqKqoteRQ\r\nP9HhvoJ3wwKwDTLjzXnJELWN7QHv0CNRrmIHeJVL1UbCcXRuPN/kCWW3I8HU\r\neg8dMrXAypOjnq0ephPXvv25fZfOf5G8ifVpwsv/tAGmKLO0dqF4+nyy8VWY\r\nq1UP3qesVY/y4uXqhq35AoZGwoJpUEqKvJvU0i19jYeNeeSV4Psm792SWLy7\r\nTBZIJNrtj9o6TL9H0TTFcrg1NMTq8YAqKq2jx5/DZFGccEfcJrBw6vQN7WbH\r\nLBaDs+lY96yQzDIKUP2dg7Q1Rs0zmUusLtYBp1+Kr4z7iQmtjpURC/lPNva1\r\nrjMtfPGQ3R8XCfDa8oEG97jFHaFesGqGMh8=\r\n=RgIQ\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221226102727-29e713e.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/c7445cc09ba377741618bf9e398cdc74/graphql-hive-client-0.22.0-alpha-20221226102727-29e713e.tgz","_integrity":"sha512-UP0CaH3/0Ce4RCs4+UpO9SMu3tQhuKLdjpMelonnvzPykgODj1aUkPPPiq+8C81JWBDiPjq9GTUUsnUT5t3Xug==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221226102727-29e713e_1672050481452_0.8252236118663441","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221226102922-093a204":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221226102922-093a204","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221226102922-093a204","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"aab4d65b8fb7123d906b628014da1f835e603ccd","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221226102922-093a204.tgz","fileCount":60,"integrity":"sha512-EyVG2P9Y8gd7z9M2P+isd72OMgxHKvFjMABgovbPIkId5rcvngY6A41maikp03dkkz4INlhbdpuilUAKgkxi1Q==","signatures":[{"sig":"MEUCIQCMrxVmFvZ91EYdbtc/MnvQEWuvxtw1rYmqDAFjEdrLegIgV7YJ44JXbv5XkUsxFNZvK6QcOpqyiX05Y4e27zJL7v0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqXelACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpTjw//WSAde8Cs5YT6uaZDnNoZr1n34O7fhRmssjZ00YkyY9vEP1tQ\r\nKuSXMkdNOAfAUarqatRXnMqMVPAWOBtExpMLFxglRfjmqdVwGQo4d8NPQTwK\r\nsfkxEUuQVoA7M5m/A2qIYWstvzF0K+Lg1HHh/FerYD9bHjGItH8srxfyIXqf\r\nvyb6ZtvXCtBvlvOpwUlVGVISC5LDFA5kakkebvzj/arjZVTRqnCbAEFZxv+k\r\nct/op2sg0VBlmmYHvqknkuNbCo/nH+zIbhBhpKzmitAbjNz5PQckB6fEI3Hy\r\n7o/1Pqc69AV5amc2cWGvDUD+ZZLfl6OsL18T/8p0DYgnNPlTyWGP6mk2UMj2\r\npThJMXauYpclMz9AvxBxSagADq2bogPcl4tVjZdZFWtULfKMcSMER3McmNX/\r\njjZhhtaNfzN9gSO+PdpLcKsNkSYGWD+ekgztlqVzOR83eiB/U9HtIwDFbifk\r\nmZPdDBjxGFapswSlwDZQ9y02KocvTvzuUkAJ8IRNr9EYNlTAg6WXtWSBMwMY\r\nD04u20Df666pCKMvJPXsn8GzOCjUIOZmOC3h9sEnUNkgJOhJd0K0tHGH19Wy\r\nGmIprz5X98DGL+LUJxhCwyrqU/6ypCFaG2RchIO2ixU1yNMp2B+/SojCOgIB\r\n+POsGMTnsCKlE/qR9g0nTXLkRgp7DiNsN4s=\r\n=pDIH\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221226102922-093a204.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/9de2565cf3d08fc8885994ed1e8c9d1c/graphql-hive-client-0.22.0-alpha-20221226102922-093a204.tgz","_integrity":"sha512-EyVG2P9Y8gd7z9M2P+isd72OMgxHKvFjMABgovbPIkId5rcvngY6A41maikp03dkkz4INlhbdpuilUAKgkxi1Q==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221226102922-093a204_1672050597755_0.9011649412947531","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221226103405-e7fbd5c":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221226103405-e7fbd5c","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221226103405-e7fbd5c","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"69b444bb1f0f7a7c80ee1a75e8909aa3723be285","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221226103405-e7fbd5c.tgz","fileCount":60,"integrity":"sha512-qxnEML9cBamw+AwRILUX6J29Sx6rMMLCxDoSAycs6sQgFQ+nvroGJ5n5BK61Fn5sHV0RP+6Nyrpsm+7AzDCzpA==","signatures":[{"sig":"MEQCIFuqk7z6t72s6gsH47lmQuy+x6rGvESFCPq7wL/2VsuSAiAznK8SsSDk91R/2Gl+Zza1WUYL0jCMB6keJOt3oPRg2g==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqXjAACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrgNA/9HRB1F2YmtE/+DnHRcxV65MNvtrjv6jdAMkLRE6sWKv1VEaGU\r\nDcl90r1A0exQCrgRZPX5u4LNvkyLr6x45MmTi+AJRiwgUO9YunKYt0Z7mNx7\r\n0Ai39NjBV/TKUdwKUvwzYAuBUncFmOb0uESHv8YBrdfhMsYXNEFjFgowe65s\r\n/KSWKN2krgutszEz8KssniV4A2uVrP0E8QvKONAUihdFDdr5vxSRB0z4ddF3\r\nWU1sPhut+RSwQBT08+cDa3nqdtdohFbpAB01R7H89mp8ymsTHAuBXkULojeL\r\nIoGeJpOYynzXhO8V9LY9KEw8h+kbVIL5Be1tFOOx6sUpjb/RAm0mSONW/QHW\r\n1BARtbbCAM3Du8T8sqXKpLLbJyqZzghq3u8hqPu9OXyDND1kog9HsyWoiwKY\r\nI077RZr21dXd01+SH0fpnBVvHNEkfwOHkXmcD2p8O3yeIVMCzdTzBbiD1aG4\r\nwJxNiIBJoEGDqCWSkoTQsuog/MMRyeBC01fSLumI6/m8aKPo9LpWSH8gyvgD\r\nWMqvx+ZMmk2Ji+eXev2oPJ0nwPX2I71lNOz0TwjuRaj1ONFbnkeW0kgvXpFi\r\n2R5lqClES5eDjnBHeTbh1mIV8+n2+DYP0FsEqG7EiGkLD+VPidY0X0WNRYeo\r\nVSVTqXc4YBeCiGfrWQiQP4WY5NdkPXwuoPQ=\r\n=F80/\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221226103405-e7fbd5c.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/2e894ea2784722066463f8cca708b8e5/graphql-hive-client-0.22.0-alpha-20221226103405-e7fbd5c.tgz","_integrity":"sha512-qxnEML9cBamw+AwRILUX6J29Sx6rMMLCxDoSAycs6sQgFQ+nvroGJ5n5BK61Fn5sHV0RP+6Nyrpsm+7AzDCzpA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221226103405-e7fbd5c_1672050879997_0.741101477206825","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221226104350-2632eb0":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221226104350-2632eb0","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221226104350-2632eb0","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"17ff53bbc43a23bf5e635775fb571b1ba46bcb61","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221226104350-2632eb0.tgz","fileCount":60,"integrity":"sha512-+rr8GDAiUivIU1pKDSLEwAD30qFYMcLnlCQyn4VK5BJ08zpxCjFSn+A0aBcERmfI4dgu0YD6bdRzCo69hvTEKw==","signatures":[{"sig":"MEUCIFoN314pdAMxzxOtUCnA3x5PAs0ITpj0xPxlH7UqthT1AiEA1MyPuCKL2ERpArgN3+H5igboxVa1bmBwa0T8DALhf9s=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqXsLACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqSuw/7Bgc3vkFiXMvfE6noJd43Z2aFFhvFKjfvhKsvo77t09+ukPs8\r\ndQJgWAI7rWra+Qd8H1BH9wFh6EvGVEsoXEwvLnbJOr40YAu70hGiBrieSJrc\r\nDz/5RKItjUybSef1+JQJDWp7LiBrOvVpx0jgcEmMufYbPjwJwwHB+3TXIbU1\r\nfH+Dn9VjewyISneWquCpZ++L4MYx1cUas1n8OUXdbqGKkct/ZNlQIcmlICMh\r\nGl2byYp77z8X6iAoRBJ/eWPqqK1E19e/R4hOD66QMdWGKTfbZs1fMr4FSJtH\r\nF2v9kP2ZsA6pBFAtfthVk7uf0Em/yqft/ROFTlkLvKP56Hzkr8UX+P9z5d63\r\niw3DdidNZTmg0uB268KGWvgAS5pYsDQfcR+1Rt5g5+u2ZlnQK+pdUQzxeOKr\r\nsL0kUlZVVRt8Q/J5pNKHzi5+5XR73zPQAnmZh58mHOu4wPW3Asn8ueUYiAbv\r\njtbKg2yOMkZvs4y4HQOt8Pmuqk4RvsGhNoQEfrIVWIL6crg4ntuzX4VA6bru\r\n3JboQX2VqrUauRztqoAZ7gGoNZn6Lks2E/TSM0O9iyGfqC6jbkW12Rgomsrf\r\noG/OHyDaezECMOvDAuqXlKkZokmdIuxI8AYQIWHo0AQgKyIZFrjlsC/TijLq\r\naPO5OZkWvRH60tldNbtLp5yPCR3Evxyu1hU=\r\n=2rtv\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221226104350-2632eb0.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/e4f80e24e67def1f3b46701da33d3e81/graphql-hive-client-0.22.0-alpha-20221226104350-2632eb0.tgz","_integrity":"sha512-+rr8GDAiUivIU1pKDSLEwAD30qFYMcLnlCQyn4VK5BJ08zpxCjFSn+A0aBcERmfI4dgu0YD6bdRzCo69hvTEKw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221226104350-2632eb0_1672051466975_0.36203128406796603","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221226104828-4eec29b":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221226104828-4eec29b","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221226104828-4eec29b","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"08d78445fe240fdb5b19326770d2d209938c217f","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221226104828-4eec29b.tgz","fileCount":60,"integrity":"sha512-9tIz0iIqNd7VrvjSCYLNZ1H8gBOA7M6yoRmxCd9pn3ibjZe3raFxhz0+V3N9CuvaWLrBW14saXaTPZy5gBG8bw==","signatures":[{"sig":"MEQCICKqYOAE43o8hsMF2riJuKlqKOhvj175bi3wDahFuX8GAiAJvZu2/oRkYDJVCI8Rr1jFb8JDcEu/HnnBVp5kh10WhQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqXweACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp4zw//V59Cs5/Oj2v0OPzfufS4OQdbius6ul2KkO/rRnprJd7nYSuf\r\nNZfJ+i5AsiHAt2/0d5XPyhahK+L7rSnmIJwUMpUFQiAVHjhenhCRbNfleWlt\r\nVDw2sXW7Nhjx14ZuVe+ycPfR9cesB9N0Mcqugv89JEEiaF2uN7O0fMnTdRx/\r\nEcjDmcqj/N9G2AEh7LSBZ3U15Wpd4JxQKC62Tu1WDcb4gHYGzLgCYmGMb0mJ\r\nz6K/9DVqA15TkIBLGUh8C42EtGxkYTOuG7Mj8I1vKBRAP+8uq+S2349RIjmh\r\nQhjBNixkOcperfXHOsyjRzZCGttKmTST/L0c17Y/yP7llO1uqkNEnvJVycbz\r\nuCbhewu0E7EC+OLpGEJGmsduc+JQOH6sPj07F1O3V/SoMqnIiNSL4pzJ+3P5\r\nsNakUpcEMihMQ5rw8LJAdTV1M5J0/8pEQN0CsX2XnoWn0bnTU7ZoK9qvqnEs\r\nXabgLCBLs3a2vglCQtHFPcOW9UN7EfA3mMh/GaO9gi08Bfwx4/ecQhUwJNzh\r\n5RHjN5Fmu10QSCfiDJGpR+qtQnenQrunUJ3JusDcYylPA1XboMeVh90FNJAc\r\nWsEeRNMeNXDBYVU5N1TiOQyNXWERFssrsUOvERn8+pLs8seSahvmfE+GdGHu\r\nIQleTTmSNU0j+mmfHDHaYgTnbLkr6+se8oU=\r\n=V7mI\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221226104828-4eec29b.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/98273e239f4906b188a9b4d5d9b72184/graphql-hive-client-0.22.0-alpha-20221226104828-4eec29b.tgz","_integrity":"sha512-9tIz0iIqNd7VrvjSCYLNZ1H8gBOA7M6yoRmxCd9pn3ibjZe3raFxhz0+V3N9CuvaWLrBW14saXaTPZy5gBG8bw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221226104828-4eec29b_1672051742757_0.942161922836094","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221226105325-3425215":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221226105325-3425215","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221226105325-3425215","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"3b3847d6c9f895b33a99354552d97314315f4f9a","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221226105325-3425215.tgz","fileCount":60,"integrity":"sha512-xmpuRdpPUnQL2MEMumHtxf4E/21MqFX90qNMr+D9CXGNaVVAJEi43pODA/eizlW2LMUb4DQRSmCKoEsC98Aeow==","signatures":[{"sig":"MEUCIAokReVSHQ3969img7qu3S4bo622W0jZ1yMC1bWSEkqJAiEAon2zjhbFzoTZyt7usft3eM2EgQJ3lTuJyrHBSGbEyls=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqX1GACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoJ6Q//Yy1bZr9cYW0bQuBp+jENW/l8SluYdgorgzj/CZl8PqzIJ7va\r\nXDXhlFKjcsOk+onYifkBIV6XOBN4xM6Fdl3UWLcXvaWnnj5S9pDuSJRGAGbx\r\nscHld1UU7IJztElrLj4UKXs6S8W0D3/vXX4g1NT9EfGc9TqTcc1PLBjHWUkb\r\ntfOiEn0em782WIG0pxxTSReHs5STG/Aw+pmkrFERI6c827bp3pZtXrisSAIQ\r\njBCuUuyCJwQLlFAWeaVHqBnYI7L/fXzp4R0MB/5K1KlOGWRpd6ep6ziTJRyF\r\nQC6d51CO4a+GDwY/a+zJZnbtih7tJxVPhaMFdcu7ecH7oNmggBmjpE3UC+Uc\r\nQGi+gwZKneAsl2yDus28BBTl/nypiXCbiUgKQD7dwwGC8Npk82ytYAFIuhU/\r\nmQqe2kZPJiS5P9VGnrGZO/1qX1AmLGHoR7IfCT3qTR429wgYR6A8M4GERe7b\r\nxmb5w8AopyTxFdwTI2M6wPkCDnERwZKzzg7rLfTGmn1VKEtPGwsse3EWSyas\r\nGnndApKqvdJJAflYADYT0qRzmfd6o2KrF6R+JPF+57GUj2ZTezsxP1bbcDvi\r\nyIWzI+65H+raK6QS/0RwtmZYcNC4EQPgv+cGfC72BvQcx8pdiuWD8o45Sh0u\r\nnBfxRo/bAHLql+a2PnquMFIOBqQINwU2Zp0=\r\n=z8sA\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221226105325-3425215.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/484eb0aee9cc53ba8331fc0c8f7460c5/graphql-hive-client-0.22.0-alpha-20221226105325-3425215.tgz","_integrity":"sha512-xmpuRdpPUnQL2MEMumHtxf4E/21MqFX90qNMr+D9CXGNaVVAJEi43pODA/eizlW2LMUb4DQRSmCKoEsC98Aeow==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221226105325-3425215_1672052038585_0.3431228803225801","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221226105855-6f55006":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221226105855-6f55006","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221226105855-6f55006","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"14b9295415427e50026898bc307eb6abae03198f","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221226105855-6f55006.tgz","fileCount":60,"integrity":"sha512-/FFM/SrvEOdisu6fEC7L12rGdMmqqMs53iAXO6XOQ6Db577PmI1ZKR4XRXHbymI1TAlEdYVu/8tXh46l+2uL2Q==","signatures":[{"sig":"MEQCIEd7zJ/0Cr3g/cXp5Hw7A8OhPV9ffDt7MEbGhYN+2Ef5AiA2nZUF7jyaXYbYNGa8hdqzrKMgiIRb8jaXu35MEBGNqA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqX6XACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoqfA/+IN18xXSRDJP7KRQ2HOVgVa6BKJI4PEOijRZuahRdZ0qbT3g5\r\npGQMJUyaUNtTSPTZ+0DNVFE4ufzWaE7G37YhtWrRQ+ennGpuLAzUOrC5CPLK\r\nyXK/DD+exE/GXmYLIbyeO3piwLxGv7TA2R9xXngFXSLgeBD1bLhgiXQhJlOQ\r\ncVPWnBj/Be+fa7GD51vJLhH9ek85juHiunsyj9hh4Tg3PjrCsBho8opDiC2+\r\nMco858RrUALKHawSIf+h1I4prlEUM7Qy6uGonJI39m+P1kqadGqhlWFJYDMc\r\nUukJb01ZlQQYocwFr/i9hy+Q7l4tb9bWDxrdNvHojYU+lp+pirjSi5ZHGw3c\r\nrgjnicEB25cE1kCw+bJT2vP1tfmeKcc44gBs7utX7JnQJmpxbLDO3eXr009Q\r\nuVMUryb2p+QRo78FcSUrnyIKP0Va9RqhOmbT0+3lMC0Lk2d8jVgPcyjq6HVc\r\nqiEiabFy9feFKMh/Ue02B8tqZ7g0V1j9GVWVU4OHMsUZ+kBvJSpGtd8bSTf7\r\n+mZJ5urA3YSuzGTl8MMApVkz2LLSWnV2L2264p5N6jw8bD4u4xrHw7a1n0s4\r\nDgbQKZ3L0yxG/NUhrq89bJxB9dd/nazbn79y7sSrJiWMiGR1NNaCxTL4aDQQ\r\nbZ2oJLptz2kHbw2L5rnLA3xhlqgva7SzG/A=\r\n=1k1H\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221226105855-6f55006.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/1e9d933fa3d91650c58ca4d1d6e64b21/graphql-hive-client-0.22.0-alpha-20221226105855-6f55006.tgz","_integrity":"sha512-/FFM/SrvEOdisu6fEC7L12rGdMmqqMs53iAXO6XOQ6Db577PmI1ZKR4XRXHbymI1TAlEdYVu/8tXh46l+2uL2Q==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221226105855-6f55006_1672052375232_0.8164272803148542","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221226110333-81a7553":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221226110333-81a7553","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221226110333-81a7553","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"1754ddacf9fa76524ceb992f84b0b4003949bd73","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221226110333-81a7553.tgz","fileCount":60,"integrity":"sha512-rP0NAhIb4bBn1Z3Vcho5qG4fDVMZyF8aU/FRWMVqYOjFQbWG02Bkx6+CO7zqtQGJ19j4K1ntXpFTmnFAYwJfSA==","signatures":[{"sig":"MEUCIQDlIVfSM54Y7YFn4cn+48nQFseMzc+JXfs6CfsI+M3I5wIgbCkgbKoBHSG+wgM135vT4XZXEfezbDGC2qdcZQe1oM0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqX+mACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmrf7hAAn6TuWVwJsEGiD8H0OAPbfbmp4NHlV4GMpuRBtf1wXtoFXJYA\r\nv8DNfAvONAMZpGxT4dMsuOyYKpHziKVMRCVm10CEILkD7Gr4jorEuM9GiAs3\r\nWShZSNizWDfEJ//+BucEanYzyTDwUg/IPud34Flb+OGNSG8kgYsgZx/rDc2l\r\nxMgjlKG2/RUak5gVPM4rJZ1m+k7aC+FtAOjxTGLvLGb67TzYjyyeY0EKnm4C\r\nMJWr63CZk4nJuH7SUEqKbD66diKxBFS2rMxSsN2IFDbWl0uZwMvSYo0ZZt2Z\r\nEPrhR17nMDPhI5NbIEqvQiwjYvyWYukeg1dre+0bU3V6DirQiAY3AiPfAxoA\r\nfT8IItTepKXtga7TclFrv/Rci13FarDy+NTP16NlGtMsqsJQz96nS65Fkxe5\r\npfl//klH+aCmsOLhL9JYkS8nlA2TVO9F+L4nXjH6y6fGKNSLPE7pBKSDbGoQ\r\nMg16fHrOlBwxtgC2Dt4I3So9YKNngEVZr1N8L91SHN5EqwUkHX+Bx2nR9MNr\r\n/D2FE/aZ8Xs4nfbl+HaTmWFtvxrZ3ShYqx5iZf8AGHmc63RiXRI8X9SiDs12\r\nd8b99O2kQDiqtY8NoE+/KXjaZBpeSTdKoVPwnelVohTbZ9BhZY9llljzRuNL\r\n/8mjNIK0pFg0sUDRERdxbQvunvKvlCddYqU=\r\n=jKC0\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221226110333-81a7553.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/98d790d608826498a1141a46d12b76d6/graphql-hive-client-0.22.0-alpha-20221226110333-81a7553.tgz","_integrity":"sha512-rP0NAhIb4bBn1Z3Vcho5qG4fDVMZyF8aU/FRWMVqYOjFQbWG02Bkx6+CO7zqtQGJ19j4K1ntXpFTmnFAYwJfSA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221226110333-81a7553_1672052646714_0.08181175522454343","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221226110532-93a3507":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221226110532-93a3507","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221226110532-93a3507","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"d27375563236eea4bafe3e957d85ac28468afe09","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221226110532-93a3507.tgz","fileCount":60,"integrity":"sha512-Rp4gxMEazKiSaBCuvSU+/Qk2o5r9euoFx9xNLunua24bUXdKKp6pirU+dAAVoJ5NEf7G5LcqIK0cU9Lih14yIw==","signatures":[{"sig":"MEYCIQDSM04g32m54b/8DTwjFMPI4kdXFca45WlDv2IfPBigfgIhAMXb7r4pxu953e7vSheazsTvQ892FEGgyInP8mK25vcq","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqYAdACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrDmg//YFesDal+A5IlqX0JanNfBYgIyjRQoy4fiKvMUCf9g4qlFJD2\r\nEHU6br1quUw0mOljGjaJxDKA2eIJPo5OWE5uDHFHDiJyIGs8hxFBAjLSrh+L\r\naDw+nzU2WME7xN+YztZQuuNOhMMssxbA8vyeA0Yj4Z3qGJxelUfmTYfsnC9K\r\n1fq5nLqHUMJCIle6pLkOpnemvNs8Tph+1XvMUhoMPUy/JKOv8mq4vBWKXVwY\r\nFl8CgdlKgAqqwOAQHQfL1FesFwh7c2wlNGZzCuNDzmAR3MKi2uOceLu3woGl\r\n/eBSqUe7JmMRTk+07ztRY8tRJIjsw19ga0ZZgzoLaikAy0brzWZbmn/BcuIO\r\nkPDrBHNItdQ6gI7hknoKqNqP0JyzFYDvNhrahiit6+89xypVPClWfkdgpxER\r\n8w8aUTxvPvu28qTZZKZTtoSOsvscCS2MtApRd2R/5kfvP/Wnrsk6xWPUhFtc\r\noHjoWxhqlCb8Ef0nM3ivCbRjA+H3wCRUyDIQ3PWA6Y6BtU5J88z3YmBXHWpk\r\n20LFRT30rf+5YYgY9KqzlLu9c4cmFMF5Au30/8hv956oQ4mAsWAzLfaAGPIp\r\nqCi/h6RYBBy69DyBhzh+WIAw2PSWs4Q5xQGSZ3HR51RXbx4uxqaFSiZh+Kpa\r\nbhgqMun/Aah7OvrJV/LVHHRPZxRaCVlBvtk=\r\n=QAgs\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221226110532-93a3507.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/5ac406a6a592b44e1d895931b7ce075f/graphql-hive-client-0.22.0-alpha-20221226110532-93a3507.tgz","_integrity":"sha512-Rp4gxMEazKiSaBCuvSU+/Qk2o5r9euoFx9xNLunua24bUXdKKp6pirU+dAAVoJ5NEf7G5LcqIK0cU9Lih14yIw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221226110532-93a3507_1672052765330_0.37700156340727586","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221226111450-b37d03f":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221226111450-b37d03f","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221226111450-b37d03f","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"304c80049ff32fada315aaf3786319e89ca2031f","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221226111450-b37d03f.tgz","fileCount":60,"integrity":"sha512-eSaV75oPBZieu6O/ZZ41euK4wbWI6CrBNXCb8tP6M5uqCJEYRUjTY7XSllW+kdBII0eM4ScunKycpsniE6pWGw==","signatures":[{"sig":"MEUCIAUh12PkOaZfIwPm6qm/3I7zpt+JgorDUYkTLkr9hgs6AiEAwrL/BWjs3Zt1/hjpoh0zqHBaO+NKnR2CQMEywOqEOaQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqYJMACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo0uBAAmvht9k6ZFHrCgRiEmRoS5vMlQCQtn1jhBgas39zSRF2dr+SG\r\no2hLgCyrpf8ef49EYOkw6FLTcnItp5ac0ysch2nmNQ5ym5s/M4yu3Kdp2/CL\r\n730AsfXnnHtzYUEY7b2KvJTZf++6M9UnI5Z/i54dBwDvf1BTd8/waeIJYiNO\r\nw00dSsm+4+oxaGFsx6aIuZCZlvRpENKeozLF7pXwHJfVI2zPMlGRIy3mIKKD\r\npOyoHgxTewb9VrCNGMjc9GWN91prisNYvEHaxVhT99CEOBWmz7T5wvUs4ite\r\nUFkooEWpuzZgyBFnXHVng1icVpQpwKmdbRS/mX7hvPmQjISmWO6b/Mosnsbr\r\n20LPI1br/yA7nq4JXhbhsDOfGDwmbwHhRQ9bthgsRFvSeGOtN9CzIe7fNml4\r\nQl3W8+uLkibuM7sB7wsMyQZ6yrjOq7EmHpfOd1k3xQlZwHufnJB2kE1/FBJ0\r\nKnfnb8LbeRmXkDoLUyZokIiVIiITABmzD+9HA3KhqLZ0iWKmpMqQTAJ1lcJU\r\nrau9KCPnGE4Zj0cAg4Sjn1LSyCVs33Whbxlp1p9usN484DaUcUoRi9aQdNem\r\neSznGDkIiz2bCn5wtytcIUaCr3JBrUGeTjH7awAdPTopuER31gGDCPUE3dCG\r\nhLtWkkQywhq30Gt6b3nohUKjACA/lfHq/TU=\r\n=AAvv\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221226111450-b37d03f.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/338e6e0531faf85eecc728cfcbfec570/graphql-hive-client-0.22.0-alpha-20221226111450-b37d03f.tgz","_integrity":"sha512-eSaV75oPBZieu6O/ZZ41euK4wbWI6CrBNXCb8tP6M5uqCJEYRUjTY7XSllW+kdBII0eM4ScunKycpsniE6pWGw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221226111450-b37d03f_1672053324503_0.16908137786073252","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221226111507-d23a9f9":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221226111507-d23a9f9","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221226111507-d23a9f9","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"98afaf9a88b5c5ab698a9d5d758146649bbed3d1","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221226111507-d23a9f9.tgz","fileCount":60,"integrity":"sha512-2RyWTKWNMSe4KmMiDAExwhLOiFtiSqqubJtcntZarlYG4aOhIOw5WBHcFFkWylNDMlXUbRni6oGI4GIjOlpFjw==","signatures":[{"sig":"MEUCIQD+t9WTuX52f2h2QCNITAX3PiYoxwvi3NJSPnDAWAxrUAIgZPmVpXd9uSAnHkj6I63cXUexTWJnBdcvPhbMNFIxC+s=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqYJcACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpEAhAAn6g9q7wWdl7+VCAFIFe2PycO9edNCJP6JFVw/vANaAeKeizS\r\na5hCUkfI7lUyU0c6RrFSC/DGzN1X+Fu2Don/SZvy3Whipaq1iIIrTSx6S9MC\r\nJWbEBB7fcRmnSev3QQr4cjXM5I0JL/TQwwMSddMHk3+1JXZkBZ3yzEJLmewM\r\nkJnFuSq8VW2cAgiLhAt+JbX32WT6d3G31x/7t/zVg52RG7mouvuLxr1vsex5\r\n7C8p16fKA2peNjz1lLrf06SdD6LKElA2R72T/kDYl+cOnwryOPXKuonlptkO\r\nV1FUvbp8Y/tAFpf5nVeEQueaSIWQNL517lG9ezueyN1yWfQX1TxkyoZPc2+f\r\nR1kOuqwRIq5Nt9JTg8gR1zoJ6o2dJX9sCzE9PUtATFG5h914a8gcvieN2OAI\r\ngddIQ0MszTaeUGVhNYt8aAOM68AgyZGZnfsElHUvhhTstI/iiDHHbAlk6S6B\r\nE/iMRb5fqO7Otf5xIz/o7stJTK0VlGJkTBcxkX2HlKnMRdqzu63f/ocpszcE\r\ngJKHFTcGkdekWqXp0kyTSCtSW/Rcdu9a0sNWFBa+13ZZFdwJwUiLFV1dUiPy\r\n5LB80WEvuQIRm4ZCOiwtgAgnJUv2QBIMvlKMqoucFb+YkKmSSRJ2FD7ZWtvd\r\nAfTUEJ4Ai27uFzcoJtNymKT6rbrDWnsFEOs=\r\n=NkUY\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221226111507-d23a9f9.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/1c63f56fe3b5c11c70baa8d5edb3cdd8/graphql-hive-client-0.22.0-alpha-20221226111507-d23a9f9.tgz","_integrity":"sha512-2RyWTKWNMSe4KmMiDAExwhLOiFtiSqqubJtcntZarlYG4aOhIOw5WBHcFFkWylNDMlXUbRni6oGI4GIjOlpFjw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221226111507-d23a9f9_1672053340741_0.16729748466799066","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221226111701-4cf3edc":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221226111701-4cf3edc","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221226111701-4cf3edc","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"c136714f1647f5122d4e9868577a717748f89790","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221226111701-4cf3edc.tgz","fileCount":60,"integrity":"sha512-lhBUBlMPx2cmqQenAz2oKQdqbNObwu6erVABba1GU5BTrfHDmQ2J3jtxwTo+89VF7OfrRB3yS+gDxq7694q+wg==","signatures":[{"sig":"MEQCIDALAuuvYht7x87/GmzwOIHRPXPrYlHpX/x4xPJF3FdrAiAk1a+CWEHTwsssCNacdZoHKVst9WBEVb9Jt3bc7iME6A==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqYLQACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp45BAAkAodafiQ25ww66d+5qXM1gT3S2ocR3T8vNC3eF8qRDXVYKim\r\nmPiPY3l1EMYjsslKuhoiSgGd9LtiHnrF3SEkOMUfdXaesgDlDKhxj0NShBT/\r\nwVwJ8MOeWdC8yMAOS/bIny6tkFMPj50mhmbx6PmOjrV5s3AFZOGuTqEr/CRn\r\nsxA29NhDl2Uh1ebtbmswx6dhxwHC5MPYgoDhys3sNFRokVn2VvMMUBL9aMrz\r\n/5PncRrPL8EnyvC3XIQvAtoDfZXXLTycV2nEUBYee3SkHvALt5O/Y0gHPGDT\r\nso0HjiLGpgJas7Mnx/mRzBJeFOHGOJAoOZNxl6Bx5NWjTm2pXSyec5oWYu0P\r\nTZyOOjHysm/pWhJPv8uAJEeHnIaSd3TPPfGpGK6HibwPXdnlgu0rl6MY5muu\r\nruZK4HudsGk2Z0YwZcH+nYXUYhkPBa+pIWTK+mwtQWYfeFnuzhVVcEDUqcC5\r\nmKHYiMJFRb0sPfZ+8j2EKW3q1ow7jh10bZJ115UQq3pCmYED6qUM6BK9vVNX\r\nVDPwiK0HxIPcQT/9e4BrZfAVUi/LLBVN+pT+ig4T0hfzm31qQa/QFrhy+Epu\r\noalXAS285sn8kFgy+Id8JhWg4Qo16pqv7WDOx+4qo/+Cmw9Iyw62JPCxymvK\r\nMJLgVwPe0FwncdRuGi/LJYG8CiweaHxq+kg=\r\n=ZlJl\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221226111701-4cf3edc.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/75336679bdc0eca71bf380056472ba7b/graphql-hive-client-0.22.0-alpha-20221226111701-4cf3edc.tgz","_integrity":"sha512-lhBUBlMPx2cmqQenAz2oKQdqbNObwu6erVABba1GU5BTrfHDmQ2J3jtxwTo+89VF7OfrRB3yS+gDxq7694q+wg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221226111701-4cf3edc_1672053456609_0.06476600819251832","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221226184345-1c23a46":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221226184345-1c23a46","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221226184345-1c23a46","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"ad02912f8f3a43c46fc190468e44fdd25f7fdd70","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221226184345-1c23a46.tgz","fileCount":60,"integrity":"sha512-sD7QbwcEFEW+kbuIHnMY6yM5zMnmB7bGBmtpSPVM24vHPANQHPeeKsFqscGBTCFBStCNHi0XQJ8QyD92Eqa90g==","signatures":[{"sig":"MEYCIQDuSoPT96hCm23SyAgbsc/eJhJUCIreAsHXk9mknjbDhAIhAPxJS/kzUPPFGtHQcsghW47YmX/52gmXsM6+pP1pUFsJ","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqeuDACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr/eg//TkCeiqbD/j1lJzqBpnWu3pT91ZAul4cm/toi9EO/+FDgcbot\r\nfHxafQ9nflERJdl8vQfEfi4zldvMVU4AGvG7x4+O8FGpj7hbi6u27DWWThbA\r\ncOTy5zVZQzMQyegaeauoFLcU/zpwXberCCJPB4a1NxNkvYMNcT7mSLHIatSz\r\nd/nwEBs1kOmiuSa8az/x9lr3b0dAyxJVgvapUY2MrHjKvhY4KCQlHgu4Ur1J\r\n9+8AhrJNHINfqEqMpOi4Yj8WS5gvAp7BNq+KMXcedo0OkOq9UkloXwcBxW/0\r\nFpuBDI+wJ9Z/SEm50IoE6Yb011IWQ+r9qg1JDTsDOstEWihyyi+qiVY7oXG2\r\nol5vSok7K6He5ps77Cv71Bbq1rwUuyPqkpCAWj//eF2QJCFnulreIq5UATUo\r\nd/vRpTi9lCRaVbHFh9xc60BTt/NT3vmY49P7WahcEd1KPqj3Rm7arTYzHOX6\r\nDB048DdDOp/oQe/8Sf5fZHEZWSOrlTPPNpAlwOcDXTUsVxU4zARhdfT/m82k\r\njjNhHmBpTIiaSuHJcJzWEyBr6u6PdcFR/VNczu6T7FHl2R9VCTEXmg7k37uE\r\nPc1toNCXJqlFEtULucj9cynXFPkGaRvu9GYTwuGcgarLavwnltPfOkNR0g7J\r\n7n7ibXJ+UK06RBxO7OPuCqumEqIKiqVtBJ8=\r\n=9IZ1\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221226184345-1c23a46.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/882f8fdb80cbd8dff51207dffde965e2/graphql-hive-client-0.22.0-alpha-20221226184345-1c23a46.tgz","_integrity":"sha512-sD7QbwcEFEW+kbuIHnMY6yM5zMnmB7bGBmtpSPVM24vHPANQHPeeKsFqscGBTCFBStCNHi0XQJ8QyD92Eqa90g==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221226184345-1c23a46_1672080259336_0.7009345709713157","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221226192211-2cc226a":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221226192211-2cc226a","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221226192211-2cc226a","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"79eca4c3373eba08fa87c3e0a180c0626fc6c584","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221226192211-2cc226a.tgz","fileCount":60,"integrity":"sha512-rhp6JOJylm2WUGjinyUqPmgjbXE/lV/XNbIK974VxTTlWxdAzGIoWp/iNepafXW9Ix2n0FNPBtUafuT+6AHBJg==","signatures":[{"sig":"MEUCIFXbYSVLlUSZ5iE7ppKQdiWcH9AQXi+Gmr2ZESxuj2JbAiEA6oDOcQuOwbZ/lPdYW9O3hKeM+T816ea0UA6kgOPHYWE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqfSTACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpyFw//aP+/EaHlltlaGyhQ/YXtqfCAVoawV3tx4W1/td8lCxKVLfO3\r\ng+Xp+yb3yyFZFR7VGm5RAgBHLd3y/toNTlDLAscoVHaIpP/AmvTz22PkV0eU\r\nVwJZv+5EgeyCBd/d4xM0jIUuIe8UCU9nJzcfW6y1758cpCLm+1PKh8O0TngK\r\nqqh9HqeynI+B3/z5N5yFSFQRSxw1kn6+EvJpgoa3lMtHn47ROEV3F39RoBK0\r\nK2hE5oQ8cQZoBfeqd/JMVdYxLvX9+SIBMn2IrtqGgJDob6b+5DFjMzl7YOIZ\r\nUPwL5fEDkz5ZHPYgRNECTPFvkvIeYq5i50llwdFT03tTXp7MzVsomeK8BYXU\r\nZ00zJ8H9GVd3m6kC/ZTZBGCehdv/RATylZpj4A9N+LzBb0SPuRqU+P/cpsFP\r\nEVCNGQWdyxT5e+awTvQXEVZbGr8fUSjOjRl76lXjeByrPFYXICzrKna1evUG\r\nlpMIpInr9ZGzKXOw4STHAhbVjpwAB80S/SckLnbhYB15QxKIp3Hmb+IUMaNr\r\np4EXrBJ0xu/tjXrARmcB48Lr+Wal2Bt4QZTxnpRnbVH92v9jX6bE2ZRcdIf7\r\nhFIrsvM5IERTqN0jlN8HJV46/zgT14cg9jcSwb+kprVIRSoetPSz6AtIhPQ5\r\nAnsKoEXwOWpAd76Ox5eggWH39dnZEilAgu8=\r\n=CBWe\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221226192211-2cc226a.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/cd78cbc344610d09998cad805f5a99fa/graphql-hive-client-0.22.0-alpha-20221226192211-2cc226a.tgz","_integrity":"sha512-rhp6JOJylm2WUGjinyUqPmgjbXE/lV/XNbIK974VxTTlWxdAzGIoWp/iNepafXW9Ix2n0FNPBtUafuT+6AHBJg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221226192211-2cc226a_1672082578982_0.920837430113886","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221226192236-7885cc8":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221226192236-7885cc8","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221226192236-7885cc8","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"19b34e20fc2f62a0955c0e3a2aff575a3ef82b77","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221226192236-7885cc8.tgz","fileCount":60,"integrity":"sha512-8mu36lcqFtLvi+kDn/HtwbORUNu0PSrXRM5YxoT+ILPvV6FGSpiVxlPxzxF4MgpPfUYkbMfYS+GoyDF5mSlvHg==","signatures":[{"sig":"MEUCIQCxfEOxqchvEaTN1G7AY342jwr4h61Io1qaHDsJCSMJ+AIgfxFLyV9G13zE0rh8tjoe2BfoDuqmNj2Qlb0NfWcIZqo=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqfSqACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpynA/8Cb9TIkGtiVpZfQ+RFl53U/y9SvUPcPB6YY5V7nPg4jKquC1f\r\ne9ZWDHa3CymM6nzo1J33L6EKw/W+GfrkVVTEXmXlgtqapghTScsqj/798Nej\r\nHHNy00r7V5Htfbbimt22PdCgcvLoi4hFYPPB7o/Eu1nwOBOzlWJqX67KDaaR\r\n2lD2Bpg/C1mv2xaooCsZDgZDolAA1zmKmo+o8Q0P9LbutIgn+iHS8LjsVLTo\r\ngZZBWDis3iEVBcOQPGWpYNR6JBax7UVfaY0WuMbjXoVO5Uu0+Wn5pxf54Z58\r\nD9bkARhdLZOXONsO+N3CQT7CZJtG5re065IPn912VmM2YLexGgmBiF+7XowD\r\n6vAC3mamqjCP4UwLiJ/riv5CcrBVjpxtVc/5TkvmqYT8I4uY9J7wW5LyTq8D\r\ncEsXsqUFd/qLSuwnKcyzKzd54e3rsAkhN9hERGtSKAg9ZlRacwEBNp4ZhFB0\r\nMPQVEBWWD8Bk9/zUQ+ocO6oq08eAjYGgusVRuNjcieU+yYiPIC7j12EqivtA\r\nTZn1lRlLWARHA4PIE7Eli2doZwEUstL2WSFDit19XolZxPKdds3Adl0Nvekp\r\n4GYH9fcShksq5jnuU/y7qKSGNbON8BMvGqyALj3slvxOGcJHT8Mt6wf73LvJ\r\nMrl5Cg8Ew5EogvZMlsVgL3whc19N42AMKKo=\r\n=u6+j\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221226192236-7885cc8.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/c45d3ed348d0ef351de18d48d6c2f341/graphql-hive-client-0.22.0-alpha-20221226192236-7885cc8.tgz","_integrity":"sha512-8mu36lcqFtLvi+kDn/HtwbORUNu0PSrXRM5YxoT+ILPvV6FGSpiVxlPxzxF4MgpPfUYkbMfYS+GoyDF5mSlvHg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221226192236-7885cc8_1672082602709_0.37892940008193166","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221226193320-90347c3":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221226193320-90347c3","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221226193320-90347c3","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"b0eaf0686d9e0804b4a1512a759ba7062dddbc36","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221226193320-90347c3.tgz","fileCount":60,"integrity":"sha512-DmjtAsZVtrcHeGu3hxHdIbuBwsVPatmt9xfxKa9J3KyR/IuYORY6EAssNUhQOT701XATn5+3ZRZY+1j2kmb8HA==","signatures":[{"sig":"MEUCIQDvV4pdeUn/KAUcXYGQMISD4CPA9RWUgs3fvNGUKIbsuQIgWt1tGxVafLCt417eQuUI+W7E0wh378CAHXtFNUZ7w+w=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqfcjACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoZ7Q//TCJ2l0lgf0+KrJ+qROs8Upe04bkvPelWjYsfSg4yYCvxTh8O\r\nMIzzaQ2mEy8OccocIamVTw8t9jrJ42ujKbUjWSKDjuaQirADzl80FG44y0/x\r\n4j6M4z7CMRSSdrpFK3vb7YQsRfz7tS9iAvQM67Vpp6Ed8+cO9WL1rgmLsFsg\r\nCqXQsQGLg0mN8vnRmavRKGLEkFB6ySUhhRhgAje1Y23Jvu5dw2tLELiyvLCY\r\nHuNWVDxr+PFB2a81F4mUOVIxGvZM+ae2r2yF/VmWVRBawJZhZZuASKeBiBj+\r\nMMLw8+85td1GdgejaD2c7lEyr9HQ/8/FPUmNoGEaf+DJY/35DXK3bqDRmJac\r\nCogntJ2RPS9RxRrV9mRl5TUkwRWRC4ljddiCBvUmGEkqjcJbs/gvq6MdEBo4\r\nbzMgPS6xVM+WFC49T47zAw8K/5eG9ELMnpIXwRKLVwR0mqloAbou+1OZcIvl\r\nTIjVUJ6Y23JwPIrl5N3BD0mHlBBg8yMMo7ujKaN/wTQj1SGiI1WSQYGhQlpI\r\n5WTEC1xSp83OLPGz01E0AmEo+gVAa1/bB/e2isog7nit0gfBNbnvVCqHpdMV\r\nQJ0rd0WxmUwErdVh9xRyuoIE3ZY32nNzx1l1JHn5Mw/6BIKIpHPmIw8C+FOn\r\n01x3LbYsIqZVRFFNbzUaQcit6tL/tiL//0k=\r\n=F6Fr\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221226193320-90347c3.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/0157d076eba69d3c20921a3cb7c69e51/graphql-hive-client-0.22.0-alpha-20221226193320-90347c3.tgz","_integrity":"sha512-DmjtAsZVtrcHeGu3hxHdIbuBwsVPatmt9xfxKa9J3KyR/IuYORY6EAssNUhQOT701XATn5+3ZRZY+1j2kmb8HA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221226193320-90347c3_1672083235747_0.8202138034678796","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221226195549-353a36d":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221226195549-353a36d","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221226195549-353a36d","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"37138d6641da35e0061a6048cb0b4b86ccd6487c","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221226195549-353a36d.tgz","fileCount":60,"integrity":"sha512-6O48k9kKjO5v0tSIFzfk6xhbJB66njvut5ACcEKyGXr7QMeJRuV8mBxk1ZtVFEMaRHhdRDMgVdB4l5BqLaDhzQ==","signatures":[{"sig":"MEUCIQC3MY+N5CghdvZuwul5Z/0XdCzbibvnZqfN+2buJR6G8gIgJwEV2+i9M6WvlHGupNwwkVkQj6qTgl/TUvYvVkii7kM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqfxsACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqMxRAAgKmaO0yeVtklIzXg+atfcpuyBPoESlbKD/mw0oEK878JGvI4\r\nfqZqyxK/b8NGCp0ZMhdd2ibjEDXp5++eBRe1cVpP1m7oSGXWcWVJs6ZbcAIY\r\nuBIVGycsTuNG0IMEFDsNfSX2CAMhcyYbXZdUFJS+aKnhbPUw/aCb90raExKu\r\nKpot65W9GAe9Wf+SVlVf2xTxXdyP1KZ7OsM3ifqRTFM0uDVGBmGM0+xWZtoc\r\n1+AK7ZE1tFAms2uA9XFXqiVf2zh0NPudn6lI3WlsGtpQoFGVqSAL9O4onSRP\r\n+ww+6EAB1jZ+imVVUmIJ87MH/txc1zZflubDKcN0AE8MugsesC1k1jcsxcla\r\n4+O8eOkBDugW+Gnp07M3t0xM0nJPnEG3tp11VtSMxFPJBoG0wGm3nxIFMfX0\r\nu/9QZTs7IxQUs+mmhn9a0Dh4IU37VcT39UZgO5s7ZI3+E0Ewh6gdn/s8IBpf\r\nrNjTQjREzcTRBwk/ZrPJKR4Bnx+WnVY5rCPiOi/GVGauFhms6n3dIA1guZVN\r\nLWCAYDku7lMRQl3rBG02U4xcFBa4mI3TR9nqIT65rIvjteo/0lnkDi/ciQkz\r\nftOzC1kugp6QHXD003w/c1NEpk+skBmGAWmkyfY3yL8nu9CqA2+5RSIHBD52\r\nnOlb5l3Bxg8itl42BQzCmVLXKTopZaP0Ylk=\r\n=FGQg\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221226195549-353a36d.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/417f66c289001db4962dc41045039f96/graphql-hive-client-0.22.0-alpha-20221226195549-353a36d.tgz","_integrity":"sha512-6O48k9kKjO5v0tSIFzfk6xhbJB66njvut5ACcEKyGXr7QMeJRuV8mBxk1ZtVFEMaRHhdRDMgVdB4l5BqLaDhzQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221226195549-353a36d_1672084588517_0.13860270712390954","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221226200019-3636477":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221226200019-3636477","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221226200019-3636477","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"0516949e13e76da0afaa5a1f9f7fef3ae4028c76","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221226200019-3636477.tgz","fileCount":60,"integrity":"sha512-xF2/e6b2JcnUq6+Wbxv5TL+Vxie0TpadVA5uTDZD8iamuP2A/bgf+qMD/i8R+4/t9DJmvG7W6BG5ydYDCU9LgA==","signatures":[{"sig":"MEQCIAMeAmvdncaEP6qtwONG8qTp7S+S1bXSxjlg1Webc1jZAiB1Fe2VLOKGV5bEU9KWpknkYHFICTlFqjWpezP696jQqg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqf12ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpnBA/+Pz1te4qxajM/kQUY0HvI/FTjpJywiAGEZ0Mh97dtN052Q5kB\r\n7gnsABa2CQZDqdaK7ShB9LyOk4qt+AsgJguj/m6q8DxBjCCd2EI3C1qvfvCO\r\nqE5z3Iy/k0m6hJGfJknfm/nkJZIeBo4hFvPKDXbbrNCZv7hYZ8rvc6HTHxF5\r\nT5C2RugJjjFpIY+cdhl8kqHqi2808oFFne3Riam08y2cSozP/ZLWKZR0NArW\r\nP9I4MV87OgtvKbAx3+kqen3F3Ch1/1NKgYYfSJJnETFdF4TxUKff43+9cF1K\r\nLd0OSXMWwJ1NYQIa/bytAeG5sVK1n4KkRtrCNWLVsRSf0UBtUaBXx0018Qn6\r\nj/LTyB/1EuKaE7d63ncWlN1edM1Vry2zrizavJFNfPpcYV0PeURpABUwKUdw\r\nvhxRS+JSEgDkZgHXqj0RZxYdx29zIWp/fkL28j/5KFvh5TQHwLr6HoJUc33S\r\nh0zHzle+9dOWm8NFC6m0fvCIRjCN9vgjjm0VmVljJlfCHkzYJssWUJcVrTZI\r\n+ZLVPqJ16c9i8y3s74YSpldNgEJbgcuAvoUDnrdSPxP7nwblBz9EG+KRSksr\r\nw6iNR8knB98gLLV4895QEJpPrF/Uox1Z9OdGqVNwvx3a41KY+W7aJ4dqH9sp\r\nErpmS6pdeK+IcFQoJcQxxM5MNA50GYqr9SY=\r\n=xjFy\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221226200019-3636477.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/39ea9d96bed32a65ade6af28b74d0125/graphql-hive-client-0.22.0-alpha-20221226200019-3636477.tgz","_integrity":"sha512-xF2/e6b2JcnUq6+Wbxv5TL+Vxie0TpadVA5uTDZD8iamuP2A/bgf+qMD/i8R+4/t9DJmvG7W6BG5ydYDCU9LgA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221226200019-3636477_1672084854498_0.3860698844013899","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221226200030-91fcedb":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221226200030-91fcedb","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221226200030-91fcedb","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"be27c9ff6dbb035ab69e2e66dc4662f2b0167127","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221226200030-91fcedb.tgz","fileCount":60,"integrity":"sha512-76+1AbBe7G4B5lz2EVVIhSufQ9G0XXmAVbW4zONfE8TwDPs8TQt6aNcxqSIKNpp9ju6d6r/3J8Gw1HVN2UuhKA==","signatures":[{"sig":"MEYCIQDGsdYpLv/i6LZduixgq2KxiLjYUToKK/5ylhMRhJOoCwIhAK3joqMUkkvVF7w7ZdKTXIfip4Fvc8Bz9G8EN/VE0p+k","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqf2AACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqDOA/6A5vFoMkaO4gMN5/w+nbvr2aC0C1WOEODmHqZGnHaS0Wdg0p7\r\nOi3z9TNxWCRDjRapG0scJJHKx9KlWk3chtpOu99oQVs5qWAMI02zN28dqNLp\r\nEMUh1vfTaHMR3VCvTTJqKKem8Btb0J/bKzCLwhQUICUHYUAvPMP6tfUZpDw2\r\nEiCVIs/qhx9hyuGIlBcwpXJTvm8m29lCsgg5ke/O+8r5K83gISX0RlLR+q6T\r\nWUQVW9RonqHy1MK+EUcUhkP4wGslY30hdExghU3jx1puMrKk6fw4KbeRHGYx\r\nihmhTmE+ZVAT3DI5qcRicX5Dg6Ol2V/6mJ8jD0vBFV2HNm5d8oBTZvUujZAI\r\ndxXwPfBwS3CaXs8esy3R8YFy0OZQXbaWJUmv0xFPQiCC+dL8P+WB8iJlTb2H\r\n5HXwTPnvbPtMvCiqUTgXGSQAoiT5lMCvgEspxpYpdajMBnj2AwYcqWs+kn31\r\nSo/EzgwggCqcM+olJzw/BZkE3ZcpTiWs5HivWxdpm3DzobDF5fUnzZxn5pof\r\nxP19XwO7IZUdixmFN10hBRyoMpB+S8y8ENVRGLBTG13Uujrn3MKOjA60Tfo7\r\nTpFb9fx1iTQx6ezH4o3c/fwLgQBe6bi89KEEjaqZDpFDGdPR+ZJdbBh33+wv\r\nsXv7ZC5LoGdUOIlob70xab9mTihwOkl3oLM=\r\n=yVai\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221226200030-91fcedb.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/cc77f145d0a209ed1bb5158f646c86a0/graphql-hive-client-0.22.0-alpha-20221226200030-91fcedb.tgz","_integrity":"sha512-76+1AbBe7G4B5lz2EVVIhSufQ9G0XXmAVbW4zONfE8TwDPs8TQt6aNcxqSIKNpp9ju6d6r/3J8Gw1HVN2UuhKA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221226200030-91fcedb_1672084863846_0.8126654730729752","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221226231011-b6c5e5b":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221226231011-b6c5e5b","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221226231011-b6c5e5b","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"c7e6a0afd00cdb1f1e454432f134123e2c3ccf83","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221226231011-b6c5e5b.tgz","fileCount":60,"integrity":"sha512-xJvWk882JZBi8HYbTumoBtk2s4uvmeU0t7aWV7y0MDCfNs0trvJ1C5TYiilUojmVYbGIZiWmdRK0O1jj6j69Gw==","signatures":[{"sig":"MEQCIE/uXFmH7GKsTRLw/KG4T7ZocifejF4LTqVIjJWfrHWEAiBiYBR0sk7y9sLHOKoxNeG+4wU7wc19BNevxMR7U/g+qw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqin3ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoUmQ//bc45D8bAfv0MUFdbOenfWyqCO9+rlw99b3Zg+JndLdCIA29m\r\n+AGg54mHMQcz4fLStnR/3pEJS1Imkndt2ZEJ6U23wl0hh+Hr3gWCHVt9V0iS\r\nsmh4S66c12sU6sccJHMODhKvLOfUUmhLcAZK22JxGeKPQl66ZKKh+2hBX0/L\r\nxpbEy08Mj8xnbH1w7r+e28LkRcxtC3kXyUeF+uB8Dj4s9D61UYlGnglad3g4\r\n3zkS3bzFC7r+dNZVRJ1oj6fLQpENaDH3Lg4DEooB5ZoNf57Z6esW8e0+2Ww/\r\nlEnTzjiUs0S6OwFVmsPTygRk9a8hoZJaxuaQ6iJ+sxJ73IKkuqFLZ1wGFcGz\r\n2/ziNH44Izo+Mrc9WZqMQlJaSoQYcAv5C8xb4DpFySVTT5k/kdAkLqUIcPSb\r\nmhGU427jIGgSa50bGNd78yRf9NovtKizyUvMZqxDuw7pXfSG77IEBcTR1Zub\r\n3x2klC71SMIoZTZeV2MA9b4Ltun+lBOwoQZW2umbegqa2TonbCYTfWrJAozW\r\nySumxo3ZH1HfdfWToH4jt2PcDsQY0SzKfcgFjgxyo6AynSojEInRQphJSeoM\r\n9VmQNCdVo9gqcLlQ4PR+TDfnmmcvOEFODG4vqiNE7bxew7wkHUjHbl2rAjQ6\r\nhkKiGbZkFtYarLNr/yGam/XB7O47hsf9tfA=\r\n=5G2r\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221226231011-b6c5e5b.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/b554b0d6a1f1ec5bf9865a5c00b8c51b/graphql-hive-client-0.22.0-alpha-20221226231011-b6c5e5b.tgz","_integrity":"sha512-xJvWk882JZBi8HYbTumoBtk2s4uvmeU0t7aWV7y0MDCfNs0trvJ1C5TYiilUojmVYbGIZiWmdRK0O1jj6j69Gw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221226231011-b6c5e5b_1672096247175_0.45059644765680784","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221226231113-bac3f3a":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221226231113-bac3f3a","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221226231113-bac3f3a","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"b285a996d3e74ff981dc1a72adda05f4b13dab19","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221226231113-bac3f3a.tgz","fileCount":60,"integrity":"sha512-MUVXtS9iXgvfU1NNmVU8jtOEBvikt0CTQpxzsagKPXNRlKxeYri6TZEOX/kwGrO7QAj47cyfI3BdQnG3UpCcvA==","signatures":[{"sig":"MEQCIEAls9ats7B3EM0rKrOpgCK2kbTfE2pAUQN/YG+Qe2yQAiA51ZY8pC2Qp6VHm1C3s+OaTkAiNpu+dpkYR7kCbF/aCg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqio0ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmohLA/+JUb2oOlHhuO/TNzc+6ida64AKEHQKa9qBEswEvCkYc3Tc60X\r\nGQeIOaZV5bEwFBO/ULzgFPsyaTww+NlF84FZfGTcihXdZnuO3ZN2Lyn/lyrp\r\ntMcqm8ZCiFvoAA6tPpWccT1eMu2YV54IGqXKmZjbHV+sSAylIbA93XzrX43+\r\nVAEwhnyGSxZZxb/PeF2Uewf3yKiH/fvmLjgezisvhBkzETN72gCsh9r17xKH\r\nrHEBXYUJ4qDc+UUHS6exWP/afAHj+gF5lS1wSTPOLx4m/jRJtKmL/rvV+TkC\r\nRU5S2ujIgsy/I347PnxO+YYlnH+9tHInSEkPWxxuYgYtczetQh5s84TcSjiV\r\n2xYmpfOYlmM0audWiQ/Mf2PsRQGpj9HGNu4UYovsn0ARvrGdmROIRVX+WkZc\r\nGFOM6zAYyW4Tc0+dAkzBN1ukRnYa5m9f9kg0RfDYsPr5cVS28pqCWXGSev2/\r\nIOCW+3V3mj2Qfn/BkaGCRQxh0TCCpsbqX1aRwSIlUcRqCcj6ReY2i6ZQd1Js\r\nFU36lEAW22kcZO4WzlNg7GxahqtWG2j6LZfQRJ64enHtXGftzetq6S9A0K8v\r\n2qV9V+wwi8PV3gL3StUktGBFo7iHmttDYeriZ2guXy7xdyIDBvml8H3zwooJ\r\nAXxp9grsYz+jtTdwHC2M16WkzMfbmO+5+YY=\r\n=RE+N\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221226231113-bac3f3a.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/50ec5ca12548fa0b0b878a5eb58c8d99/graphql-hive-client-0.22.0-alpha-20221226231113-bac3f3a.tgz","_integrity":"sha512-MUVXtS9iXgvfU1NNmVU8jtOEBvikt0CTQpxzsagKPXNRlKxeYri6TZEOX/kwGrO7QAj47cyfI3BdQnG3UpCcvA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221226231113-bac3f3a_1672096308457_0.3091263918829099","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227012702-fb2c9f3":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227012702-fb2c9f3","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227012702-fb2c9f3","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"245bc0db1ad11ed8f6d56e6e6e21102dd99b0d7b","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227012702-fb2c9f3.tgz","fileCount":60,"integrity":"sha512-blSwP8ta8cJ40WnMbFD1lMIK0ahmjYM9X8HJ6HsLCpYl/6eE9GB4zzSO57ycrFPTwj8X96Z74z9e7vZSp7xSHg==","signatures":[{"sig":"MEYCIQDXbiRtJgLbOyyuHfds8+gu5sAql5BcAc6d0MXhHGHxEgIhAKdYGpS/YNTeHuMXfX63JrC+Oqz/gpGgv89otKeE3MNo","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqkoIACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmrn7xAAhY08Obn+g7R63T1MOitbCasHYgAPbQpOGR2F7t1ofNeDThQc\r\nV8FLHEBWVCY5nVRsjPByYggzWlR0BKTM9QVf328nxUYmk96Yc1VxZtZRY1n8\r\n/acaWxLn7QUH7DxzULcr3gbD98L78sK01KQ4YFRF2VRJhHA9oL9zIuP1GZsn\r\npJOiDxJAVc+QIgLCok6BbjuhTCKLBk6YbnGZjQgArLi7U13eNbpy6aUoA8GU\r\nb+DxCcUk5sUKjqV/rbnq5Li65BvlIwaZCA91IhufIDUe2GerrQAIUvECrXMe\r\nGdX2p7/Vlr1uEWqXmjF2c436aFkIuUVDCpmhwJR0HUemnep59I/zvcZ3iA47\r\n2u9/4zHqHwV6S4UdsRmWjZSxGmP5WNhZF/zvCEOcdN2kfs62qr1cdmu3AhtX\r\nK/tNhPXYdZIluc/RbH5PTP7UtCb6Ots0AEh+ftvlqeebe2b+wn/M9aAIqscM\r\n3WjSWDzZhJsqU4YvCS2FCU0IHVtvO7YbmmtSprTPtBazAxItZfI89NxMmpop\r\nSu7LsiNaowdt2Ty8pJQ4tt57Gh17Q9LoWQuEu3E11mZPammbHOyYPly9G9ah\r\n5SRbfhPP7NbjXlTqaaDaihqhWDVQSt6ObXWeCHWxUZAkx4kLS1z6iDHuceG/\r\n5iPOcQiNdLo9769HvMFnoj9aTqNiaYQKAGE=\r\n=01Z7\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227012702-fb2c9f3.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/0fe21888e36761a71fdd9955b2d38727/graphql-hive-client-0.22.0-alpha-20221227012702-fb2c9f3.tgz","_integrity":"sha512-blSwP8ta8cJ40WnMbFD1lMIK0ahmjYM9X8HJ6HsLCpYl/6eE9GB4zzSO57ycrFPTwj8X96Z74z9e7vZSp7xSHg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227012702-fb2c9f3_1672104455850_0.8093242799575835","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227013237-8542b84":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227013237-8542b84","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227013237-8542b84","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"7a00c0ffedb84a2c6db63c3609dbbe0a545c380a","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227013237-8542b84.tgz","fileCount":60,"integrity":"sha512-ihNDtfCFUbCbvLvYD2S0Al8424f63ccL/5hI7VKMw3jqLUEJaVuLEOUQ6RFvBibALq4+WXnLgNv7/At47+DQ3Q==","signatures":[{"sig":"MEUCID/KzRT36JuQMwmOkniaXhiNTWw8k2Z1/jDozvl9cS//AiEAo023YPT8W1sSzJYzTKvGPrSBurcfWLV4uUb/QWQ1Xrk=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqktXACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp7iw/9Fz1z8Kkx5qRd8niiJIgouL5pRjGQq/Nz8aYyLjlCGwk1e23G\r\nUDaLS/dV4s8eoUOvgwiHeel12pucZ1V1IuZAMOxB75Np1xEKD26eqJJyan2o\r\n5Gl8n6Z2HKkWTTZ3yBrmNYAroQX0X7o3FhE54lfKoy5UnA5s+8hhBOcCEdTp\r\nADHp49Dbi/jPOIOpvUBnr0gvV9uipfIyeBP65xzsIG/PwGm5sQuiTzZzy7U3\r\n4/DG8nOfy+2NuQjtA6xoP1skSF4JSf25XnqT/FvwBSDgbY6Q28SNFGsZMQqs\r\n1CaftB5lzd8Y0BqC1iE4pcBfWVtxvB8A41vrPC6/OmrlVR37GlBq0E0JYP0n\r\nYdvtlQu0kceb3aRKbAY4Qz791AtVYK1J8nAYnDST4YhIwIPxoIutf57VnQp/\r\nS/maU1GZWtxFNwkWSwWTn2++p0NaxzxovaNYcgis42yPrciM2HlUSFA19+I2\r\nGWpEU1pmpLSkB9lmg6U0QDmxQiZ3wZa9Kj0XHVw30xGvNYOlhvDvX37ZMQ6L\r\nvujY1bOEsPlWb6hQ5Dg0DPJxMyJSiC8JQWreUVZXktDJuT2i0GaVvNgErnjC\r\n5+hVAiQhE2mZ4UMgZAkbLX+ajd8uHnfMmHrO7qE7ohUbDEe2I0AGBPtiZe/4\r\niJ404j//795FL01J2HUqGtCqRVJHLwj04EA=\r\n=t57/\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227013237-8542b84.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/849de10ea9522f31afecfac833704239/graphql-hive-client-0.22.0-alpha-20221227013237-8542b84.tgz","_integrity":"sha512-ihNDtfCFUbCbvLvYD2S0Al8424f63ccL/5hI7VKMw3jqLUEJaVuLEOUQ6RFvBibALq4+WXnLgNv7/At47+DQ3Q==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227013237-8542b84_1672104790858_0.04570505855543017","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227093106-77d6194":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227093106-77d6194","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227093106-77d6194","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"fb9e1cd62dfae18e0ef3c1ed20b9066937a8f7eb","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227093106-77d6194.tgz","fileCount":60,"integrity":"sha512-z3nx1kldPq0vEr0bLC2YjmuYOia5K7fe+5Ie22T/qsUpHgNWagsr3gCUaytTxNi62bYwrYzstdF45O6NBtvAWA==","signatures":[{"sig":"MEUCIAyKU7qW7GOyX7QoMBSgBUOGyn4n8oRLfSH6hb79bphwAiEA2VSo3dDp+NchJhtQNIboCytqeMxapepRXOrsBH8jhBA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqrt+ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqQwQ//VHSoclPdxzZ7+Dcl3sB+A99arBKpEjRSeyPe8/0lPz/T93dh\r\nwS9Z+idnCrgDMlnKWqn2oreAhPXzMu5asRuUJn+fPYkHKRZomQqWaJxhHZ4N\r\n10Ge58Y2DjcspW40fcUqwiFwvfcmrv5jVsGDaeResqvJNtUv0owlpLyroikV\r\nmK/dNX8b1Yq1iVuseNCEbi2Ld4grEYaf3yclYyiGjQR9jE1NMP5cCtjFWWdR\r\nm8DZNpl43AT//LD5NG7wBg1p6M39NcmhVI1TC/0mv4L+7qkQ9NjGKQo6Ac29\r\ndtsk3tG+JEF7q2GbKrroBCdM77L0gpW1bwYFfeMHrEbzA1I8gmszXPSU5/Dt\r\nHwH0C8d37/qUV26L37uZ7/8Km6EHqVPzWRVMNlxxayRRsSorqBJfKG6Qqm2/\r\n/StwwU//dOkJYdoBC99QSpSaj5Wy6Zs2cvENNwB+g6cN9+dgddM2oibv60Oj\r\nZHRIiU2/2guHvwDXnajWmMyDQeWILsuxSoIX9xIZWQkKZfPq4svkz9L9fKkC\r\nI1iOc+1Kd1ycJ5e4Z050NbiwM/kKBNz/HuVP0uWqX7Ze9Yw7E8Lb/5Ef9m74\r\n/ctMqWJgo1+mBeMsmbNRKGt/SV3wORgR26KmOLCRXl6W2QBc8A2krVlFRJOR\r\nH6YhEnxe/u+epeDGQtymkLl2nvAQDToGAhc=\r\n=Hc+j\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227093106-77d6194.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/a58504b2471d01f3145c8adfa0314277/graphql-hive-client-0.22.0-alpha-20221227093106-77d6194.tgz","_integrity":"sha512-z3nx1kldPq0vEr0bLC2YjmuYOia5K7fe+5Ie22T/qsUpHgNWagsr3gCUaytTxNi62bYwrYzstdF45O6NBtvAWA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227093106-77d6194_1672133502106_0.8538964852520483","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227095131-6b1e926":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227095131-6b1e926","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227095131-6b1e926","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"bfe65329fc70fe6e54ef21cc1cd72221039aee30","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227095131-6b1e926.tgz","fileCount":60,"integrity":"sha512-8zQKqcvSsMDH4ZwkFD479bqndG8gqkd+7LQkOQx21WlQZZZiTUXSonREEKa15QZk2oCUy70LpvxT9qjehdU+8Q==","signatures":[{"sig":"MEYCIQDQZyUtUq/GUtz6dOuOVacKQUGLS+dhyfpHQvR93tw6+AIhAOy1eWd+2mZMHzosqKtFT7ygdQOOXh+Sl/QexTFp+z1z","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqsBMACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoYgg/9EyepP1VdYQbxEDPOfc4ff6oHFk58R3MwEdkUbc4/G3oK5cHp\r\n+jyFnK1zP0aKedSsB/pYwDVkiBUZ4owplJWMsaLnovye0wFe/tbtJ+B8yoaq\r\nAKvg5uJ6sI8TgCNqr/BuEpAYGuuD/RheOjxcVCXP34XWJi0KDgIAUkdavFw/\r\n8VH0kWSKH4SrPArJUy7tytrvA59nxzB/YuE07HSYq6MrYtL69OWkz4YkNAyl\r\nCDdsmhb36qXPGnUAKboi/RiYAkNvMPAmKP6v5+4C3YGtdesF/eRg/2uqveAE\r\n9kz/rKVBI4/AD+jIUU68hI0COsXeQ+qDnugPBjR5b4MpEuwCPblJgu3LtQyq\r\n2CkUAnBJRbdj6E1KiQa50yloEUc4cdaiC87eHxbjJPN0iFRVlx74PeiYGU+2\r\ncIU3zOi4MXL2/ESNB6UIv2bQJaEHNpbC09pwzeIHMeNtKn0+BNo3BLRkgXD+\r\nriUkbvE85B1r71v1w0SNnpK2tI+GijZHPAQ+bzFXercrV3uCV1qAu6H0USQI\r\nCWivfucIwlPyw1xxNqOEoor0r4Am9R5fnba8dZrU15qCbSRaWFEiUWbcVR+R\r\nEbvBjV9F3zzmm9TAlxH8hVVLHmHAanQBcbCGzT4OOMwZDGQyxab5A9eJG5WU\r\nSkL6LhzUBvltDzWAARPLh2f1/qUKHW0zws4=\r\n=Tdtp\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227095131-6b1e926.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/ce51257495b05effd38a0697d899827f/graphql-hive-client-0.22.0-alpha-20221227095131-6b1e926.tgz","_integrity":"sha512-8zQKqcvSsMDH4ZwkFD479bqndG8gqkd+7LQkOQx21WlQZZZiTUXSonREEKa15QZk2oCUy70LpvxT9qjehdU+8Q==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227095131-6b1e926_1672134732124_0.6159268319706095","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227104036-6324ed8":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227104036-6324ed8","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227104036-6324ed8","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"e72444238c4d25ab6ee1c2aeaf49d2b790c7961a","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227104036-6324ed8.tgz","fileCount":60,"integrity":"sha512-0OFhZjmADrQxpUudNoFbmsu7WXsIVfQPtLqMjVeb8zyklRiax0sV5pY9/GGEyPG6YYI/vS5/d5Dwft06GTNk8A==","signatures":[{"sig":"MEYCIQDE887+0tHcrqqyb88/UKpAgB2M2gsYABKu/pwUvpxRIwIhAPGkRuZT4NAQUngmT+vTrFJiBH9NPPpsRAx/z5ykL5+j","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqsvHACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqmrA//REd3xYYgj8/MIahCAjAjao6cfy2HumjtRP1wcot71rYmQKgK\r\nwpMbCnSq8vGmK9m4nlTmGaakrY9tMnT/EIfQSjZR2Kp/YuMNnnrDdXkwVmAU\r\nE1vyMiRnVURZQ7naH6NcyW9OV+s7LoybgMKTQ5hKiizaiXvuEAW1UFGWdikA\r\nWGtQNzHTgPwDgG3pox6gUpi1RJnpT0QoBxdoiuBEDoNBbi5HSQkUKPIMW/+4\r\nKTmlYIAyMdYqLPCHRNS8S3Q4ipMln9ve/UJlis+zSmV9Ce03fusyMCCfEcAj\r\nR/tvGHCfNSiKfILEPim1X9SBsdQg6nipBVAPFajRB6fca3oVee4sqf6+OJQo\r\nrPZrg9qYe/qSwsWgVC44m6dE5gRq2BB5aGG+qOqYOYApt0Gd6ooInAyjVUIP\r\n0O6CpRByiLCKEzt9Eo2UYnM081xTlSiZ8WKRU7qeyMb5ZEqC1fFUN6b3/o6L\r\nRjBqrYZNsws3MpKpzCjgN1CzoumPsda9uWDK634uxK/p6qb7xy+NapNfh+Ff\r\nsz76slqNVmtS5nMpOtvvsoDsSH4UdrKwvVHR8ynI99pJpaHdExNvpa+fTTv+\r\noOJHrKdGVnzz6rYRSiDcFXe9w0Gh2WDJn1o8h1GKcnfkXgqEQg52snVT8cVO\r\nhCVwnJTk5eRzfRawu8feCA6nArfoegU8dEM=\r\n=RbXy\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227104036-6324ed8.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/126b61f88bf802bc371839c991211edb/graphql-hive-client-0.22.0-alpha-20221227104036-6324ed8.tgz","_integrity":"sha512-0OFhZjmADrQxpUudNoFbmsu7WXsIVfQPtLqMjVeb8zyklRiax0sV5pY9/GGEyPG6YYI/vS5/d5Dwft06GTNk8A==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227104036-6324ed8_1672137671247_0.2083290906754227","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227104519-afc93a7":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227104519-afc93a7","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227104519-afc93a7","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"2e4428321552ca9c592d6061eec36cb919a3fae9","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227104519-afc93a7.tgz","fileCount":60,"integrity":"sha512-bhGHhByKnfRMbhAE7dlbOKiRTNqobOgTE818JB6dzmJ7HecY6pM3GbgLfEVf56vnQy+hRQ5i58UOofjiErQBIw==","signatures":[{"sig":"MEQCIBln0OM+d1BlXMAoHE/iuNmWY5/e/ANhUT9Dg4bzMhERAiBNlscBekMmEOYJ3UI3LFMEN617r+O0yvomhmPcESCh4A==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqszhACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpwuRAAjZooqAl9jH5H1RiTg6eQFKvQqOmO2Jh5KdIunpmsGU0vejlv\r\nw30sVUQ8oEvGl3WJbqfJHS5CftTVGZR2oMu15rltJvL8yw+Wuzaty43YV1Ib\r\nHo1dRdkCL3linXFVSu3j5ADrcUzfDV4g/48omTqvk8niG4wcH3pJavHNgWGY\r\nw3S2m5m7UHwYwqxggquVQAoxdJgSOkS9Gu36jMLIYvTkEFaoCBBwchY3UqDg\r\n0YnkVnW1GmMCF6b1IRE51I1lyiyKzLgyBWasJuq3DXgIm/Oeq3PBNfbz4kV9\r\nDQg6vsyaBWqevGl71rovWKMfnXKNI8zNCnOvBXjUYN3yv2WZ0xvCmKWQ717N\r\nId2DyjOtWaFLIfeVyTGuhuNMxNeZMCjZuW9szkyqUWZcHTtlzMPWU26MxU0n\r\nR3qQ8wxC2rT8GmNJOGgGEjNuy/JTsK8+WD1THTnz8NCyryaMC/JFjW0YIiJ4\r\nKBMT8WAT9gj+4Kp5i/u6zQDWcesu3WHzPlDq3CzPhFu9n+rrL6SNmsuoWGkD\r\naRHJUBGxaWMJp8Wlkf8jy0pmnKNl9aCXJt/YgfKRGZ+/Q31poXapavW4Kg6o\r\n6EglKIQ8a0aBcDZ0ZScvjimDIEZbglFqdGpslD/p79w9vOMDx+y64tkYk3e1\r\nnoTn+tBBMNcDW/nuX+wLyjXzohYgVZDjbnE=\r\n=+gl2\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227104519-afc93a7.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/5cb18873ff72b473620cb34c757688fa/graphql-hive-client-0.22.0-alpha-20221227104519-afc93a7.tgz","_integrity":"sha512-bhGHhByKnfRMbhAE7dlbOKiRTNqobOgTE818JB6dzmJ7HecY6pM3GbgLfEVf56vnQy+hRQ5i58UOofjiErQBIw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227104519-afc93a7_1672137953089_0.19746554737802513","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227111150-5c36c3c":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227111150-5c36c3c","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227111150-5c36c3c","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"f07db4cde2817ba4a119bc9f2122c5db3f3da6f8","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227111150-5c36c3c.tgz","fileCount":60,"integrity":"sha512-3LXYs8ZbUiUgPf0CxxgU9oftZ5C8xAgnUrwoTUySRczE88dL7huzcS28hRA570CR+Jx5OwZ0+UNKKphqfL1qfQ==","signatures":[{"sig":"MEUCIQDUFjOoVb5CT/Y/pMa+4e3F3HxXFD1b7UyF/HE4LWs7ygIgRvNPgXQIdmfZwD6zP+XNnZWhZR95oMIUySIFDhVs9KU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqtMZACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmqbjw//S70Z2J1xAzFgCFfKVjL0dwiXK+/xsmvv99U3R0ESFkhTAFnC\r\nWim8kkFH2E17RN7MNrBVIi4BIZsXYLUoiHsB3JIEqJttm8KVjwANGz1EBEy2\r\nHWXZpZZFpyHtrIElQMhHPmfM4lsn+OfKeFRTUWTNaMRZvQ+xKmNnCLLaIBE/\r\nyAjq3BvLtsFG8qwsmv5zQziOjoFR+l67LG558afBd8vkcjYgXrfOaT3ZJVtp\r\n1ev3ojPiFdIzoORrTFRgv/Fso84KoRcCBmlPoUAK9yJDaIa3wa9skYOyxgtJ\r\nyQPAVV9gp8PQR5nrK0WorH4ChWrhB8BfY3fYrwFC7DXLsMb121hahoZEE4C8\r\nn7hOxboT9nWS7v29hvtADNS/sVAWdSEYnSZt0icDzIbtL0PN1OJQPb1rBfSJ\r\nOVXnnivm0n+eXg5euC8O5g90mkomxH79r0/c5SkCw9+ZhlYc1IMbVdL18QOi\r\nEL9U2kPNWnkAF0ljZYWzr32pDQLLSgInLrX0tZ9Xqd+pkzTkWXQA+L778m1K\r\n83FL0ZWfB0j+GcjytWm2VmpTPY9zh9IZ9FVQ6QuI77wwq8eUEsQQWrwCfN5g\r\nR4IWoO4xXIsFn51Of+DhybCaY5/rAJm2d0CWHkUgJbaOIRtq1sr3kGIDnd89\r\nCE8v1NfIi8ltPFolmOcyFnDFHoqCBIgVNeQ=\r\n=EzUb\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227111150-5c36c3c.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/913751e29127daf95cf6789ed5948904/graphql-hive-client-0.22.0-alpha-20221227111150-5c36c3c.tgz","_integrity":"sha512-3LXYs8ZbUiUgPf0CxxgU9oftZ5C8xAgnUrwoTUySRczE88dL7huzcS28hRA570CR+Jx5OwZ0+UNKKphqfL1qfQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227111150-5c36c3c_1672139545313_0.9109861843831646","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227111253-5d51c2d":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227111253-5d51c2d","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227111253-5d51c2d","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"5840acc4735d4a973a8490774dc94409c2733468","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227111253-5d51c2d.tgz","fileCount":60,"integrity":"sha512-QLbF8IcjoKMZYVqViyF1bkZJNPUkVWrqSf5W95kr14he6P2JaR9NIQvwHBrmwmjsMZlh2KsmGx+7A6kJfyJkUA==","signatures":[{"sig":"MEUCIFwnuHPvZwCc8RaKSSe1xlTQk1Jbmg/bcJEBqzAmzyn7AiEAu5xxwxq9BK9AQqDlCdfEpdoHZVvnYN4OvQ5ohVj9ZSM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqtNWACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpnhBAAk40ujxlHB+vYKF8em3PC4K7qD+P5FxYO0u9NYJKyjUModfrc\r\ncaeFtXz1G8zp4zSBoA0lPewd3OMox2aI1Rmo0Sv8CTv9fm+gGgfQXNfgxRKU\r\nRpwJdRFEvQ4JPAOB0JQbPfwP/ONVX4fftKq36KSJcCezy4nmu5APSXqhtvF6\r\nl8ps+lDS86WjJj07VMIUsfC5wAWEoCXw5qgkB5RJmTSXjAtXEijfi0iZUWC6\r\n2mBAUubsOa1eBH+3J6A2clfksH1EzvF3mmSR16g8kiv4NW3GoPk4e1oqBCh8\r\nz+Zp7DAe1WIPbbmtK43z6e2IBYO6w/RuwUHKio5KRAP3/KyoHaerfvRE0Nmn\r\nH7Pdiv3Etc3hBVMsEtRNDiCcHkdDgdrWRreEtpx46pfpbX8Xf7mwNP0tnGGf\r\nIYngeF6O5xSwVuiwqHSZE7QPPpvP1iVCuVXhdEuO/mQAP4qRZaso61JchI2i\r\n9SQQlV6YG4yx6k49YhB511XyrRbwkLOeiUjN7ioBdqSfw6jlk3kBvkq1sbBT\r\nY/gDvkNfICjrCRed8Xk2u4DkYkXPZ7d2Z+p5YP/+swepWUFp1u9kEKiJc60K\r\nq+/ZYRfjcH52EyZPtzJ6Y96AyugOei+Qm1dtPrFDAlvVAU6Q6cnHyOLNG3Yf\r\nEURpB3MkLEXZqnd+e7KKVUIAtJZ+zTzUWuo=\r\n=2YU3\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227111253-5d51c2d.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/99464a9c25258c82e47b4f83518d3356/graphql-hive-client-0.22.0-alpha-20221227111253-5d51c2d.tgz","_integrity":"sha512-QLbF8IcjoKMZYVqViyF1bkZJNPUkVWrqSf5W95kr14he6P2JaR9NIQvwHBrmwmjsMZlh2KsmGx+7A6kJfyJkUA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227111253-5d51c2d_1672139606538_0.4515158596963649","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227111702-f5d10fa":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227111702-f5d10fa","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227111702-f5d10fa","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"158f62e4b952ec08303fd06091b665a2776acd84","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227111702-f5d10fa.tgz","fileCount":60,"integrity":"sha512-zktoq/1QMtibDErF0lkpZNaKD/FlBvzKQgAauyCCG/nQI6Q5vtVwKuBA0WRFG6X7nvK30B9C8pRA6yJdD/e9yg==","signatures":[{"sig":"MEUCIFuLaHxf0cbzEN5zEiGGmbpnwNTVtkml7ic7ZyW/zkqeAiEA/qQrPgO0lFFv3TqUrLMUKTsN5AZrXl1wfaIZnWf88Nk=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqtRPACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr5ABAAkcJvq7Ag0dv7A03dJKTxldT+4deza8W9/+G8eGQM0JDXhMRA\r\nOdulGYb8gWDCPJSSC8iTe9C6GtmBwPNutS0JH4g5XfRC84jbtRvd1LWskgrL\r\n9fNoNBE1yjky1qx8YiNK3DHqRhNOg3N1pTDdE7fBc3kqYYvQEaAXsEbxMExq\r\n+THTCBWV2N+OaDLzjnemcCrscHLVqXHglo2AufvsEAEBapvYoGK1ZB4lcD1n\r\nLung46+wrrPfqDcTFqvv7bU6GCU0I3Xhtu2VFpbKFtrcbAIbK1TZCi9UA92b\r\nrnBC7SgJDjKj+NtrOmMr3bSUPTvU1xxgrJML+Ll+XzKR1KNJDjBOhvCwMpZw\r\nee4fXT/LXhVvA0zmhqn+GOXRnkNxI6uQyuk5EJsP6Y/jvSaL90lwTidr+RYS\r\nFXAxysMSWYXYHSFDUuVwTKsO3ePw80sJzMYKindiSjMUjX8UFvwTIEEbmh/g\r\nTaziV39qUf9QoHI7Dqwd6EwdwwAGP4ZZzm73Wyt61z3RuXtPvTHdAK0Vw8gs\r\nuD+XvmOQAcE24emuRQdUsh1ZBoUMgRO3SvOBxTc7lYgsAZKGAReYF3gbhP4q\r\n7KjD7fj+IXabk/zKfHw1162RQlG8VJ/GXAMKR3VbcHng89okG7nzNcebcpCK\r\nyAXZQcpP3Aaweyyf6/pHHroyBBUNLy0uIgk=\r\n=fm+s\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227111702-f5d10fa.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/bac620b31726b318b4656285aad19460/graphql-hive-client-0.22.0-alpha-20221227111702-f5d10fa.tgz","_integrity":"sha512-zktoq/1QMtibDErF0lkpZNaKD/FlBvzKQgAauyCCG/nQI6Q5vtVwKuBA0WRFG6X7nvK30B9C8pRA6yJdD/e9yg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227111702-f5d10fa_1672139855528_0.581175504257468","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227112240-bbb112b":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227112240-bbb112b","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227112240-bbb112b","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"166a9909807ab3063904f18c6ca56005fef334e3","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227112240-bbb112b.tgz","fileCount":60,"integrity":"sha512-GcAFQplozBnEF+ix8e7LbkGa+xkxPaDoK0NS+Wvhce32p7reKaSXhSE0NxyKBuFJiCgpV2CfD7hZsUF99gjuxA==","signatures":[{"sig":"MEUCIFnOOlMJBcw3tL3kiEyU42YDLXxPDHG01Qza9JsRsM+NAiEAnl21/HXIRB7vKsmszzQ6PbN9c0C4/z+TZiNjSgz7d54=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqtWjACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrgMRAAg2pNyOg8VY9jXzkFpQic8J2ivlns8iNvYCsUFbkRfP+nm006\r\nzgMIQymEixt8RaYD89a5tv+Ct3X8sBjJOBSo7igB0/cWqaqXl5MCFjQOyZzg\r\nSRdq89vQjXC0sbM8rMtbCUUB95MIWSJKXVG/jycWJdM6mjWp3mPsaLtjAlfD\r\n+lLrq4+4CTUJBpXjBfklpMn/qKCKu5e9iNv18iBc6sJUswaEiEy09x4jDiPy\r\nBzhGTNKZjAgAZDzdtib6jIWIac1wor+pa2mnQ/HBQqc2FIOICUKQxpGVtOqa\r\nyUyvBD1nffo3dibNs+ITQ/YJdLhl8gRNo3+dM1TK10Q+hkuOIhZcCugcRLW+\r\nFormSucq9Xwuc988ecATV1WpOxzFvJBmCNeFRfi8QfD1ivczEvGhfKFrm/Vy\r\ngZsfcMoHg7VVJeRGBf2RUNN7eXNeKRP1FSQ7wC49jwj6sybMGUWY8V3r1LBl\r\nZvyh4/UngMAErUjzAtJ6XSzYj8Iz/MGYDwVPgem0I3MmF4QyylQH1XWwmqFT\r\ncj7EBVj1NKYHoc5+k0k64adP5k9x0FAZOLotfQMhYX/3M670b/zzcDqYB5i9\r\neoGriKK9mHckynXahd73OuSEBkvpKXrxtM2urlzftbfxSGoFa9i/MKvlJzEU\r\nkA/DLa+Trm8P+PnuvjTPmnX0O5RctEh58qw=\r\n=fcjt\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227112240-bbb112b.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/e25183bcfd03f6a77e50bc8f654550be/graphql-hive-client-0.22.0-alpha-20221227112240-bbb112b.tgz","_integrity":"sha512-GcAFQplozBnEF+ix8e7LbkGa+xkxPaDoK0NS+Wvhce32p7reKaSXhSE0NxyKBuFJiCgpV2CfD7hZsUF99gjuxA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227112240-bbb112b_1672140194856_0.07341805757243658","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227112708-e35897a":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227112708-e35897a","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227112708-e35897a","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"caa8fd2f951fd0e18f2006a10da376bbdd30088b","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227112708-e35897a.tgz","fileCount":60,"integrity":"sha512-m3W/fe9syAoEXc5G+p9sS8GefoxyOorPLAdsH9272/ScD2pksrOH6VFoAkSNWj4Hsr3iDf4DjvC2GHQbd8A6qg==","signatures":[{"sig":"MEQCIF4N2pK84kVLIGwzYbYLMNnCZbp5rWE1Y6SqxlVD4S8GAiBijBiIWzaDgYRzPalEseP874N9ExfUkECCtSmF/HT63Q==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqtauACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmpfnw//SixJCC6cWuYBnV84RJbAuf1pytBuwpBvGaiPTNOHw4P4yrqz\r\n/OOXKBwzyR/FoZMpYhtNv7FtkiLXUrozBdWiDYfVtjG2xcY8OkqKDdyzrp1v\r\nWDPNgZPaEB9hd6Ig/Z1vPsy/Odf9yKhrdRDa7KbX0VIpMLApgDF7cQRxJXkm\r\nBEDEzcYLHfQ0A5rUrhjWM2WPmii+AwyPQVA4H69wkO55YkVeZT9oUz8rEA6U\r\nv0FZ8W2I0HBI5IRIp5tvSfsD3I0zLgvbMFyp/M5w+rnpV+MQnuooxNeNXLBZ\r\n3yK3+GKsrb2ntz33ZLckvVJcKgTjhj+SMe+6pZWkhVR+cFd2C29GUjXPUhAJ\r\no13r9ErwtxMP8WqqFqjwq3N14NKSNsqu0MYmz1tDw9FjFuT/aBM61v+zdhne\r\noQsznXL5JHlGQBSmTr4rpGMjMx8GFQln64ADuwiQ/d/tWTjRjyz9iK0CTKjo\r\ne/CsG2BZycFMG/BW12SidIAT58DSTwKK0OHkNiyVK5Nz6wDelEv94qLUsnab\r\n4X0y+np0W9nwhwcK0TPSoQ78OvYLXmVybWM29Kb+JeSPkiiy9q5KKX/sx26f\r\np3pe0Qda3oaAckPUVw7R+4TnUim0DOniGKbsCBounUtmjzQVuRSjoNWpapYW\r\nb9gydrHMfnsDRPmRh0RsLqg1BDByWwf1NCk=\r\n=NAzA\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227112708-e35897a.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/0e63d56c0b378d848481ed485d3582a9/graphql-hive-client-0.22.0-alpha-20221227112708-e35897a.tgz","_integrity":"sha512-m3W/fe9syAoEXc5G+p9sS8GefoxyOorPLAdsH9272/ScD2pksrOH6VFoAkSNWj4Hsr3iDf4DjvC2GHQbd8A6qg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227112708-e35897a_1672140462770_0.8483910771234935","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227113723-1fcbbee":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227113723-1fcbbee","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227113723-1fcbbee","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"b559bb27823ea1b8db593ca6649b41580eccdff1","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227113723-1fcbbee.tgz","fileCount":60,"integrity":"sha512-TmGrezurbKqOK6Iyw+P6fJyAeGUen/7viXjOy1npNZbr0kTcLsAnZ/zhAysBbmd/Ni7434vFeAWU2+XfcKXhNg==","signatures":[{"sig":"MEUCIQDLckuLfNFYOE0zdxYViut9wzVe8SeNlK6fova6oFKJuAIgP8Imz2okyKn0CJe5BibZJs8e56HxnUbyuOUMOdvyyCI=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqtkWACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqsSw/+KV3XWAxk//CUEkB4cBbW/cyurJf3wLCHKfAMmzwsVPcE+9+P\r\nxI7P4B0ZNsoJwhZlMoFYRz2EuSNyisVNnuA/+Dxgb3dOk5yKzwUg8PsOofZx\r\nMjEiKz5CTAQWLkTt7vj05pj54ofwHK6yEuBQDWY1SDSCAfQU2kAzA3T7Zr47\r\nwoHXxHtbd0q2+6Xwx383Ky6Y1ahJrwr8f5h/bbXfQlJQAvkcdaGVQZcOnhot\r\nkN0ftIY6m2ATGlyWfzmPgSXFQu/TIMamZjDPjUY8SfQBOeDH69FgO2I+bwVm\r\nwyNyN8JavMIHPiE/p7fyx4OTbctgzJbmoWMPe0UoqjuKnFvvj23gvR8EKDUW\r\ndzd7aQbETblLElciR5NZtAU/LQPU0wfxU5zc6oDkZRiLuSQw546qLWlXA4MU\r\n3W5hPJVHo16OL9vFkfy3PGaITVt/7xR2SG4leJnvOAruMWPfSSRrHcqtYwyp\r\nvpnC9Y9PBs9PLlb8W+spGRd/BL583QRWKRl69I5tNtqpCrNSplSCRdxihteD\r\nAaF9yY4AyPio/XybFnPFbzIGXibiqmxLdM9TP0UzHBUasIfG2ZsEpmF8Y4QT\r\n8dHAJ7CVhurIR1I5MbRw1DjgFxbZedLeSioXhLtMah8oLOvj663qXvWyoNBJ\r\njw94rkGDmCho1UVRLdQ6XY6RRuIza8/R6L4=\r\n=98RG\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227113723-1fcbbee.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/f3fe6848ba3123ba7cd5fcdfd31a23d1/graphql-hive-client-0.22.0-alpha-20221227113723-1fcbbee.tgz","_integrity":"sha512-TmGrezurbKqOK6Iyw+P6fJyAeGUen/7viXjOy1npNZbr0kTcLsAnZ/zhAysBbmd/Ni7434vFeAWU2+XfcKXhNg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227113723-1fcbbee_1672141078502_0.16930770214739166","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227114242-f3e5320":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227114242-f3e5320","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227114242-f3e5320","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"eb27ba894c8f07522b742ec1c061cc990152c4f6","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227114242-f3e5320.tgz","fileCount":60,"integrity":"sha512-PyGOEV2TkARdbstEFLEb3lV7nV8rGg3DkQtnhdPVNpW3YQ0045gtHTTzihI86HBEr0/yjIEK3+XYIEhskSBHTg==","signatures":[{"sig":"MEYCIQCbho4oPY71eVTGIeAB7OhozDIvzvBqtySCCXUo/MiTEgIhAKAtDQNYJIJKPA7rjimRwF5QMwB/O83ijCMJTv6nSpBC","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqtpZACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqJAQ/+Kjy9rQvDD7EVj9ZltI3m0i2zcFSK0/bxIZbsnfJJ4c4Fb4/X\r\nSeMlepmdAOvm2XWSZSYmH8FphoWNjHDlW3hi9WmlcXCWd5nzrxktOpOMbAHs\r\nA1daxXAOWv5TXAX4NiAA+CEISoCEXcIcl+bfUuCF+w1FMHFws48HeKSU71On\r\n7faXo2nKnXf2m4L3jcynpyWXpYryhhWP/+7QSC0+4OqXEfGB/TYiKyZ5Q5Vl\r\n6nubpwjSR81pFzeKZJ7U0WOkPzmmYOrn2QOTGvkw4+icLztgfsVgoXSmjvkT\r\n3S7J3et3Mr0SwHYbKNT4fjd5GPCgAqaCnghOXCrGYSccVixvZ50N7mxQ60P9\r\nJdtJlSxoUbUfFj+f4PuzKosGvclMfpRhugsJQZ4zXQ96mH/YdxaGML+AVIvN\r\n+zT2vRQZISwx2y8xRalFpMVZA8H3sXzU1ohUVzH/QTz8h+e7eqzgTfy96Ao+\r\n/artS09H6mu1gG/+DGU4ZemBHA6FwRhkV+KPkjgAekKKW/EJC0GnC3XekLZV\r\nsEXvX0iDNqbRHsABpyAcN2rsVsbfQOy/U3pON61dLcA2g1/vrPvuMqgHhgOI\r\nKFEIHr2V06hGSYaixqOMUgaBE08XllQ3QauO8eSlKQw8NSK23ANvr2fv6zbS\r\ncN8HU9r06/nwo4dra11I1K2/i7xgCMAdd10=\r\n=DM4k\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227114242-f3e5320.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/604aafd286a533d12c46dc16c189b766/graphql-hive-client-0.22.0-alpha-20221227114242-f3e5320.tgz","_integrity":"sha512-PyGOEV2TkARdbstEFLEb3lV7nV8rGg3DkQtnhdPVNpW3YQ0045gtHTTzihI86HBEr0/yjIEK3+XYIEhskSBHTg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227114242-f3e5320_1672141401498_0.5541313117096494","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227114747-0fd3343":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227114747-0fd3343","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227114747-0fd3343","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"48571f0f918e4726a1e99bf0c19997b2b4cd5f51","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227114747-0fd3343.tgz","fileCount":60,"integrity":"sha512-BLRqu8tBj34QZXQwAdFFy3teplY+tq11kJmnZMLfWsne/xFXtpUM+lWcr68RIDl1uE4omY80D8AKGxKEqYURwA==","signatures":[{"sig":"MEUCIQDD5MyjKdSKGKyp5+8o3Zg5V8NLcDY5M304VmpXX/t+QgIgZVMOascr+D2e6Q2UTxIDOP1OoromGDebo2ZupVVDnFo=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqtuRACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo7XA//fgPMCUed71GJOnp8lERvzHYwbtDZXakDxTmAmw/xhWva1IA8\r\nOfoCRWa5iw7CAoH2pgIqg2Oq8nPYJ9AsigxleJ+MC9Xix5m/SL3N5+u50y8b\r\nC7fnuRoz/L2JbBgm6AxsdljKHK8r+Mo0gEoitLzCzUGqiQEVvPgBIYY2vlVT\r\npmO3CXVUAdR82vWplCbSaauYb32H1+KFcVoU+SjSvzlL34zVMe61unMGfadj\r\njkEXrScc7JYE/k2xO4GPkHxwRdygDAPcpIFx9wdC98e2TnVMlZGdZpBvK/RP\r\nLy+pVfO/O9JAsxsDTlt4R+/pN3YPz2hroc/otWWJveEQgS/LYa5AWef+h7Al\r\nRJQ5p6HdLDq8UYMonMTfGUEhTPQvG+bqFHyfGvPk4VeqEZhIL3eV+9HRIO6O\r\nnZEHvIdvMaxr26m/F+bUJaZzF2X/K5MiCrA3fV4H2i7RHkJ8otz3nizv7cqC\r\nFTi9O4b8Je04Qt5UeLnB1jG8zWO6HOLLP/ux0+hR1/wH4uJ6tALyG03140an\r\nzE23Atjr2w7bDc56wojlpjOimmF6wGv6zhf9hg3AXGJckDCyqHIDQsOfqcMU\r\nsexUAeXjeE6V0OO+gKQHSSS0jHPimoeR2aAeiw2GP7x/B7mjFir5UtQBLRke\r\n2oyzjE2Ji9aeV7nWA13AMlsCOf8IfDYaQKM=\r\n=hscP\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227114747-0fd3343.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/249752d1e5273d817966a02917217e31/graphql-hive-client-0.22.0-alpha-20221227114747-0fd3343.tgz","_integrity":"sha512-BLRqu8tBj34QZXQwAdFFy3teplY+tq11kJmnZMLfWsne/xFXtpUM+lWcr68RIDl1uE4omY80D8AKGxKEqYURwA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227114747-0fd3343_1672141713040_0.9321740192127967","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227115238-0e14429":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227115238-0e14429","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227115238-0e14429","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"33bea90b47ec01b5c68840e9eafbed162bdcc383","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227115238-0e14429.tgz","fileCount":60,"integrity":"sha512-8ooL3fMcyMIUcL863cJcWjeONR3utQowdBvuVY2oTsyel59fez/bTmSeX5hjNS7pl46N6jG9PcLDjwknZcZ9ow==","signatures":[{"sig":"MEQCIHUyaz86nkhwsMek8+bemx+jBQhuCCVHrZmOHALkh3XcAiBuElLnlZdZMHxPgMpuo92muohdwemw6Tfq0al2wcBEbA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqtyxACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoS9A//cZfCZWgr1Uv4t1sRaOJWDWifeiI2FOL9W8Z6XzO2G2o/cUlp\r\nr+h329Ejn6DHEx8QpzYZ9c7Iu+Ak7mL/vfHgfNCDr9nDOMWX6C/zAkHCqOkh\r\ns2raJ39BdgPQN2X6r8lLN54BG257dd+QjusWNRWgMFd/e14ZPiAu/gHXIyVu\r\nAe910HJtViyeG9FpD24mYZkyZIpLxDwVdY8j5NUpMd7ar510OzcFZ4PGuY/E\r\nZ4vNkWru+I6Jv4G3Re79Yx9dqs7MhDlomIXDXEjUCbkZKZBZlDdbGHZIUAWC\r\nPxmsOGN5kh8b13Uo1COnU/oRoh4aOucQpcrLUZB7KVKpniN7URJ2Xn6fchKs\r\nWD0b4jNEn9tRg1qK+2ONIjDXdtaz/4U1QDXWPBrGLbvlBFonTncgjt/Ueeb4\r\nXgNQM0SDyIsKHjWwCLVSmDC8Q4tFS2Xn1dvZ0BT85MOf1GnOn/SdR/sjCrqn\r\nv1dqLH6r1HiCWcW268v9TOH1Lhke9T4kwi0KC/svxUe788H6UomL+wwYIOtR\r\n3KXopvayMQmpmZW3D2IAcHgV2O8UQLilKyvaGSF+di3z5utCOkP+Ay55ndoz\r\nW4fZaOWpaG8VKDUtNgmYKSfgN1TsdULuVw6+onB+OwNUtF38rr9sSFP6YxfF\r\nGvQw5+8ioAZ32oJbubs2A+sGramoUfKbPCU=\r\n=3KDr\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227115238-0e14429.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/1a37da99b05c0b34d79723342db2b2c9/graphql-hive-client-0.22.0-alpha-20221227115238-0e14429.tgz","_integrity":"sha512-8ooL3fMcyMIUcL863cJcWjeONR3utQowdBvuVY2oTsyel59fez/bTmSeX5hjNS7pl46N6jG9PcLDjwknZcZ9ow==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227115238-0e14429_1672142001736_0.43420458386824623","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227115655-ed85ba6":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227115655-ed85ba6","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227115655-ed85ba6","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"2fcd2415fce89c14428527a7803e342bd6753a13","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227115655-ed85ba6.tgz","fileCount":60,"integrity":"sha512-VwOeQfyUo7netpBbEmbCa+Muezu2UjYYZsWMVgRVXQOhwc+/rJQHeo2/nAHgcFjnleTQau8+hWIv0s51QJzLDg==","signatures":[{"sig":"MEUCIQC6ls4ynC+yVrxkVg0//nwG4V3m4AZKilTCzS3tSQV3VQIgdbrHLLIZKZqlgp+axcPWemnXm3F5p0i8I/J58bwceyk=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqt2pACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoZVhAAjqeeH+8nlhrorekpdSgyyP3FZDChidK4NcPUIHrfN4zY/jyv\r\nbAxUQ/kJQgob1oobD8bjDVSuEH4k4v0S/DIXzxvyenKrNfAbdvhNW6mH4s75\r\nc9XJZa/O3OpTaNLkZ/IxvvtNzOjFFqCcm2NLyxv+2VhTEcX2XF3KT7Slb+/O\r\nrKF7z8aPOoudzA19rdGJNqiu52av2Jqt/BL2Ls7GOq08iq1B6qaLT7t3N3L5\r\nJOZPL3gRM6k4Af0cqRiwbJUpaW9/VwJqAnmevXsfLiF0golbKKxy3uH8mZaz\r\nQngTTkBRiZ2Nv+CN8qSVXQm7PICy6Uq7ZqJJLB6vWbU1H+DKDa92AwqRcDHJ\r\nNMSbADae9qiNRglC7TWX8JMtkJxHphgILFmFSjQvB+N5kzxJ4aLynQWj2lRZ\r\nLcl73h87ZJzY8vGBhI3atrsXwW4A7nqS8U416wFNkGo6IEd/hrBPxsf5Mdpo\r\nfqyhcuoL5FeWbjKxezEyT72qi7D92YHxk3tUGudX8scWu97x/ScxbvKD/rD6\r\n09x8u5TyCf2t4SGc14PU/d9nr3LJWB7mnbYYoHiea/IkoTjtyhpA3mF2lYX8\r\nOXnphBb/F37AiKohEV/I721jiK9rrLVesrCLZSbFAw9tOkBjwRG8PAodBfwq\r\na+wE0lkhZeFy3O8vlbJgy0sgGMTrO9exSss=\r\n=G9Ts\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227115655-ed85ba6.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/ab59f2d387938e97f5a11fe6a2e6b776/graphql-hive-client-0.22.0-alpha-20221227115655-ed85ba6.tgz","_integrity":"sha512-VwOeQfyUo7netpBbEmbCa+Muezu2UjYYZsWMVgRVXQOhwc+/rJQHeo2/nAHgcFjnleTQau8+hWIv0s51QJzLDg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227115655-ed85ba6_1672142248859_0.532845689425719","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227115843-78d996c":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227115843-78d996c","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227115843-78d996c","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"12dd5e584de5a046617e164ac15f4930bc8477a6","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227115843-78d996c.tgz","fileCount":60,"integrity":"sha512-3jlBJv5dU05mSTszaDioeF/9M0N6xPwu/EsA+uDD4m5PmbbFInCmTorsrL0qfmALfUUI3PDZmQyxtP/EdoyFUg==","signatures":[{"sig":"MEUCIByZ1pRLuztJ2E5idiusy+zZih3YM85cfRRDYldeMI1hAiEA6ipxNqcDbfU40NlADBFqUVWfXgfZcQRuC4df/dU9SPc=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqt4XACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmozyQ/9HwY1bitM2PPC3JlwyPHzTBzaMCs5c1LJnTiSOKmsHJoq7T4f\r\nh73WIaJeHG41KjDfNLak+b/004p1/wGInQQTSO/mZ5MLW2VLIxPgn8ubs6/P\r\nwf3eQzpU1EQIaMTsz2YDxdywIgA9lzZZdjrYe6g7hh0iADQ3H1ptzY6TN6/E\r\n0EbaM8I8nMrMINkCt7+AAAwfHsNSrB1VH6Jw2KMkCPVgDhLGkfrZ3zlTRLwD\r\nSkyKKml5hoxbRIM4ArkgOQqPR/cUYrzigCOXt5QBIyO+5W8ldFdnJaohs6PP\r\nIy6Yb4m+Kj6q02Gjmgxo0G4eo5nt0CwqZgaQMsUKloPQS4MlHsImsop0QBid\r\nazuN0HK/3nF0S7PXCgV5BO9+SJVIlSQcmdmeq2Nse5/UrKuToE+rmkdL5D4R\r\nZe0TNKoz/fnhE7yEUID3YDFDbGWBck283U45Vl8I5ytnLDyVtYzKkDUSIJA8\r\nKO0P3+GBd0aQDjxT/adfwJoqlmaXWNBWUOMrUcZ22YrIiafbED4anTPa0isO\r\nb4ThDBnTaDMFyfmHlMBvHIuyALRlv4ICUM9tum4REZGD4tw4tVP0DTrwKiwS\r\nJbi6E0kziZIwlVFHM+XWTPO5uRmGm5mFERjwSZwVLXP9NIgFcSJ2WEvYbDGp\r\nwnYlSxmtXQLtGy1l9t/34nUkNRldND1tzH4=\r\n=moIi\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227115843-78d996c.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/36440611e9f861c4f49ff70485989e4d/graphql-hive-client-0.22.0-alpha-20221227115843-78d996c.tgz","_integrity":"sha512-3jlBJv5dU05mSTszaDioeF/9M0N6xPwu/EsA+uDD4m5PmbbFInCmTorsrL0qfmALfUUI3PDZmQyxtP/EdoyFUg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227115843-78d996c_1672142359494_0.050282738721165954","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227115924-31d1864":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227115924-31d1864","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227115924-31d1864","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"fd156a1527e20e4d5083ad9a04ca5479677f9791","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227115924-31d1864.tgz","fileCount":60,"integrity":"sha512-ng+pjEOq8sSw8qGc4VfTP/5aeiTVO9wo28GAIIlWkzsiG8J7RYRGyanF0dWUBtMUZCGFQTo5MIoNbyA/ahqitw==","signatures":[{"sig":"MEYCIQCfxb2de3e0g+opeqTh1wHLit8H6mtKu0lwkesoIeouwwIhAJOqg6bFypuAhRZG0lqdFqvJEboVmylMKgyklkj1GY5l","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqt5PACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpL3hAAjV2mxHd5jQ2Y6dU1Ncy6oDxATuctpoSUyRedbeySNn+KCRsY\r\ngxpC7rlZWxwyH/NKrS3JJGlSbd57yKkwKFzJzpnDrDNpXAOQJnj05EhWeZKc\r\nY2MSWXm95HC36T/DD3xKKpdHds1jGq0tpwbvlnJYiKgEjMo2qeDrRg5MsXFG\r\nk4X5xV9shNN9kCOSeYi4nRreKJ/TDHzU8Uy+mjcXXF6RicWj8ShMoZ2gqPfy\r\nYQ7Bca1hFEYeTxksdyJd1Ql7kUD649ChO44QNfKRE4NtptfiK3nmujyDZKBn\r\n/zwilbfJkbQ9vdqOZIzj4Ni5MT5YYM23kNymCj7urmxC9cFuHB06r7VoCPyy\r\nvPf51/XxzXVZHh3PiMXCUFnfolAC4+hD4n49wg/0Wr0lsi8CvwG8rzQxF/Mc\r\n7UDnhIpHFdYlFNr8ghnpNtZaePlpbozqDQ6uUvwfCJTOE/lqmMvGfgvwLBhh\r\n5SgXfh0t+XLi9xJkDQ3K144HBcU/zV9cmnnt4a9vLFE2rGMdjKq5zUnTvcg6\r\ngFkFWIa91ETs7uQNKPvSxDJuRosI1qPvEcSUYsghpCuXj0N4jXdoINBRtoi2\r\nZGGIPeHvS3ilpsYLrB5BuYkciMW0sAN2etfJFWyPv+e/Z/Ogim/LeVudhtmz\r\nDR4dPPVXyTIQMftJGj7E5ZK+RhYRVHbwlYg=\r\n=4XKf\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227115924-31d1864.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/b68f4567e0a4a3b9d6e4da64018a1bd7/graphql-hive-client-0.22.0-alpha-20221227115924-31d1864.tgz","_integrity":"sha512-ng+pjEOq8sSw8qGc4VfTP/5aeiTVO9wo28GAIIlWkzsiG8J7RYRGyanF0dWUBtMUZCGFQTo5MIoNbyA/ahqitw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227115924-31d1864_1672142414923_0.03819423921892562","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227123655-f69511c":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227123655-f69511c","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227123655-f69511c","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"ae7ab80d887d88b782b50e7990b5920d59fdcf8f","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227123655-f69511c.tgz","fileCount":60,"integrity":"sha512-jd85ScfFTWFVdGrY4YNJsuSBR87ShuvbRl0+63I3i5xYEPV2CHpsLcq9lu0+4qk/SnzhtshLyWqI4XcEFMJH3A==","signatures":[{"sig":"MEQCIA3aKQtAaahzy5LKBszLlq+NNRRJZ4fqYvoON8AqiHy6AiA664i24s4A7LwSp9P20XZAIl2ByUhTC+HrRXmgxBiw4A==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqucJACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmolIw//cEZZ4fO8ukJaj25Rn6sLH75Iy9qC02Dwp/P6KuLPfjVKZXjM\r\nRkBrRLdMF0UsprMQsbQKa0pEFhiWKnFcD7I0LxdH9kHV32yxVWHEHIxleo9K\r\n486LFQcxsl1hIvqwHGS1qjWNDD3r0s1Mvrb0pCAw1H/TyJRm5FdMYkEjLZCh\r\nHHRT5hlmvl/YIJMChpreAze8UgwLVBnyVdMIG6HsgqH5esYRTlh57E58PlXf\r\nSdK4vygllWTIRXzm8IhHoMhwpNk1U1R+VcYOPxrRB1emF6GS0UuamN84QFRF\r\ndUpCrM/Ok3UFCXCdGdwVOK/PRt/XpiCDa8GjtLEsekMwh8/3viqD+xm5bhc8\r\nRWw+V4N49d/46GaxXE/YB5SKmHE9KTfPnIFVWUlAJjypqyc/pOa38NRJgD/M\r\nXyi63X/GRpl7/5VJzOMdVqz78kcNaDnbpdHGsGWmzVRs5xm6SzYZErhPl27S\r\ng+3NVxeBpQYm7V+2TEnjIBxSetN/ti7X8837/tc71dSMr6X6Yms60b54nx1e\r\nB0WLNRf6rtFmS6KaBeVM5Xvyy8KGmJG5Nn+s6eH91XP0PyIUGA+Sh95HIaYR\r\nhx8XKetCG/+k15uU3q0vTzW6hZmRkJbAW5Pb/NWpaIZ7nemaj7SDxKkFIktl\r\nCqvv3r7TnO48IBgayZef9Kntzmyrmd20nNY=\r\n=NtFW\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227123655-f69511c.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/247e5aeb57114cdc35625e82d6fdb7f5/graphql-hive-client-0.22.0-alpha-20221227123655-f69511c.tgz","_integrity":"sha512-jd85ScfFTWFVdGrY4YNJsuSBR87ShuvbRl0+63I3i5xYEPV2CHpsLcq9lu0+4qk/SnzhtshLyWqI4XcEFMJH3A==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227123655-f69511c_1672144649371_0.4179017368172875","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227123915-0be20b0":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227123915-0be20b0","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227123915-0be20b0","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"fc1328459b79e1296d69f32d14db9cddd43de2f7","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227123915-0be20b0.tgz","fileCount":60,"integrity":"sha512-hk/Gxv8ZAE9a6LvLRHQXs9cP/FTp9Qd/2mNH94eZuRdRNxunRiqB6AVqUVYaAXUI9fCTcC2JetPUu8iRmeK4pw==","signatures":[{"sig":"MEUCIQDQS0oEWOzrOhGoUWE+IjhtNuPBcL9z+BGpRpARiUGvowIgDKG3OLpciNR5/HYMkqd+UnFXbsc58cZHz0pfu/EgqY4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqueVACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmpi+w//dqI2Ex34bpTfhwcegY9sj6/qsG0E/iY9b1366Kscu6YS8aFZ\r\nKwPA57eGZLcU4BZDAqUnNVuenKUz8qSrpykQe4eSiOSLd2rZ7bUfo/TMjWYt\r\nKC3YLiVDKeQ70jvL/91FWQ7rTHVS6AqiHmU9jU4wD7+//GDC/q7wO1YHDkZ1\r\ny3oNoqQTXI53KRRHpR1QrWt5bkDEku8p8+ClbykSFbjDtrVgHnid0xg6zlpn\r\nwkSXCb9BmYhQ9EcgqZgQGM9buS8N5tXUdb7kup6+WIrzkty2v9TtEhWcFxwV\r\nlya5gsDpoqSBMwFcpx9a5BykRisbfVOtbXD46gtZtTIZoPRG6bnUbIey/QYy\r\nJCWqDMPuVFexf3gHFp8otbSpxzzFC+pYBrmE21JnJzuUbrBhPQhaE4Bjme5G\r\nVGkus0ngIPGC8K9VuN+wWJOuAQpthoQI/aP+o3eE0q3x5HE9JssenQ8J8Mwu\r\nWWYr3pXPb7F8qsxrk0NkyA1Qj05gQyhGEPGzPAE1nEOnMOChYEey4xpX43Bh\r\nKh39T07P69hEmMmZMVTv4+oUELw8N1hzX1Gn6h1MDHN37qxnG4y83tBLgO2n\r\nBa1gXmsYDrTBEQQOcQDJJLvMcpJpcGiE0GaotqWbNrkKx30/tGhOo5xh8Lcx\r\nmu4Sadgrmkj9x/aWsuwfkZjQK8hLFjLltl0=\r\n=rXOf\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227123915-0be20b0.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/71f48fcbe4272118ab3835d660aecc0c/graphql-hive-client-0.22.0-alpha-20221227123915-0be20b0.tgz","_integrity":"sha512-hk/Gxv8ZAE9a6LvLRHQXs9cP/FTp9Qd/2mNH94eZuRdRNxunRiqB6AVqUVYaAXUI9fCTcC2JetPUu8iRmeK4pw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227123915-0be20b0_1672144789079_0.27277355479491217","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227124233-3cf0677":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227124233-3cf0677","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227124233-3cf0677","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"8c7c63512dcc946174608d7a05569a0c8a4c3245","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227124233-3cf0677.tgz","fileCount":60,"integrity":"sha512-ni0jULpX9knRCmnmt38B+bVNI9WUC4HqdmyXmKtirseHhyF2GwL7Is+mhXxI9HCNoSyI1cITlnniMXBjbZ3Ynw==","signatures":[{"sig":"MEUCIQDVuMdDNjJTpcpUAikflojVPMt9+tsVJ4nOSTLf/0icCQIgMVanyB80PJUK9dDGMxq88TqZVBADRH98oxRSDlyEtZA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjquhlACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoWhRAAjcIBVEOOoZfjPklW5Yc8K1vv70CizvpZtwwEYCrosTnuEbNw\r\n5hc+3vO5Vpdv+3F0rpPQ9NLNN0r2xj3zlZ2qOVjYXVKZxGqWQmGV44P4JmIN\r\nZOzWlCLALSsy6KtC9SMoRuSwCY8i2HHIIaIJdrb7fCUX0BqWRyk4X4pX3OGX\r\nZmtoD+Q2P2LNpuAB8LxD6Co8sstar1Wy18k5trmqCoM3FM1WxzkkXVic2CN5\r\naN0ptXl3HBQGdERfDAz+arLkU2r9NfFfOeSX0MZhbKDSrv9R2RcReByEKgQL\r\nurpsig2GqP91ynk3TJbEX4WHY77Cns9rceBGO21wMqFhiYohDgdU0eHecDDE\r\nAomi2UFMa0bh0R+Y7K5lgejWAWHt51S+XR1e1s8Tvvi10i9U9HoUpKpTJJYU\r\nvedr3iqR0AHht7duvHYuyWHkLindpp/k8ODhWSDEUysoMRQqR4xHY9ArH8/y\r\nWiGtmVmezsElU/LUjYmn4+t+3PHQ2zoL8RZE921BTmn9nZBsDXB8ASfUrtKg\r\ndKCHkICSJrfJegWWkw3S5s5cDRJmgtPk/NwVd6ujl4YUUnEybhJTYqf35/tA\r\nXdkRdoHhwqLEFVGVahIzEQD9vRhDqEERSy7ODJGY6EfcF96npgN1pmyBYgh+\r\nec2kyEeqPA8wauYXWbjHhbKyG7TpaTgf3y0=\r\n=RRCm\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227124233-3cf0677.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/0e77f70a071a3fcbfb7b069d089b36d5/graphql-hive-client-0.22.0-alpha-20221227124233-3cf0677.tgz","_integrity":"sha512-ni0jULpX9knRCmnmt38B+bVNI9WUC4HqdmyXmKtirseHhyF2GwL7Is+mhXxI9HCNoSyI1cITlnniMXBjbZ3Ynw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227124233-3cf0677_1672144997460_0.2987907633448741","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227125156-b066f1b":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227125156-b066f1b","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227125156-b066f1b","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"6fe9968165f13b42a680108b3a4771f7031c9974","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227125156-b066f1b.tgz","fileCount":60,"integrity":"sha512-oAwBGRt/YO+Unow56+m0odjJ6z6/BwHYKEH7rzANJvxeT9ZZdLirx2O0O5lNxpq3nuyl9eVKnmWEJ+UYgBg2iA==","signatures":[{"sig":"MEUCIC5u0pvSpuqhMoD/wBIedUCDpfi4iVYnVnqZT7hJ7AeuAiEAzreOvWOtFMlPhAzee7kAGylJ0Hu+POl5K0Okgsg/p3k=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjquqRACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqbGA//RyaE7fOynFwWgMYVpxS/Ay0vFC6rB+6lnZxlageIyMN/dzA/\r\n5JRh4/Jdpsh3yXv/3zigXWZW5hNYbzKj1wkdzorjzdECjK78+XNUkHJR5NtM\r\nlYzHROn77wpAfGuLY7OdQSavmUZnfj5PTQif1OINAS15T8NkpBZOYqUuj0UZ\r\nWHoDxy0a4ONzbeZ1AY+ASHPAvd3KRLPDhzBIL8BJbQPlZG1sE/47hBhMJ/nx\r\nJ9cx65zWlUhqnhJbZ9AkftKKUTx16lTb7PMI9vhfXOo8nRW4mDDla5vgwZ2j\r\nsst8CwERqw6Y61j7k4ibt0YAZozFQRWxVW2FCp7GJm11n/ce1i8id0kHDFwe\r\nMbou8dvduABGRmKxY1N06Ztfh0Y3SxL7os8oZNg1GudSGeIRdR4I5zdtYF+6\r\n7zgB56mIeP5UJ2NZSgfaUDslGEkzFViSzqsZMCRpLnZH5xmCgx4lptIlqQ5b\r\nMMCxFrHDifUWMjWWI/FwO8hbmD8YkBmuPtXHPF2cKrAf+pipnF3cSbtwc07w\r\nLZW3LvO9Anvw7z895tDgnJ656e0V8vT2pQF5rkDe3K+cVjWncUCjIsaxCxoe\r\nR43vafNsf1LfaNNkSuqStJnc6PGY1kJhezjVyqjLjpiuirbNqIlNuQuD2YXs\r\nttPSeXJtZ8CcSWQt+qQClCv9emiYx2ng8m8=\r\n=j7Ed\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227125156-b066f1b.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/d8f0441cfa8427ff8e6dfb4fb70710e3/graphql-hive-client-0.22.0-alpha-20221227125156-b066f1b.tgz","_integrity":"sha512-oAwBGRt/YO+Unow56+m0odjJ6z6/BwHYKEH7rzANJvxeT9ZZdLirx2O0O5lNxpq3nuyl9eVKnmWEJ+UYgBg2iA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227125156-b066f1b_1672145552831_0.9947009525922292","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227125217-57c5cb9":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227125217-57c5cb9","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227125217-57c5cb9","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"57055b320c2dd4d92fb2b03c423d1038dbc7a38b","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227125217-57c5cb9.tgz","fileCount":60,"integrity":"sha512-uUrvbQR0TO1dYMh71Grqb05VZP4U85sx1DEF0/2ylB78UuVJy9hmbKexv9Uh0nifI17MM61otOQ/f3NMS5rL1A==","signatures":[{"sig":"MEUCIQDdgQwWH+7eWLjBjg3WsqLMmkODXHKy5+tiTBx/vxxF5wIgBCuYJs/xpNuGOjVcnKhKyY8i+eEn8/O2CsoGPrOZseQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjquqiACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpAwg//ZpVyk95qN47w5zFCoMTg9M/dGVoGyUEPLguqdkCBRXtOaZ+m\r\nQgXAxzjVv/0ZyFJAuKdfrg2NJSsH8dctFAyFZDEqzvqQEEtBD9MCOqiXwV3y\r\nHSbtQhxceYK8MJLG8nM8YuJiHSopvPh6hks/lKOtpHPMPL4odHVF+0pBaQFC\r\nG9DK5EDeuZzV6k4y70uZpZNpyT87nYO1kkmt9hY7n2q40zaGnbXGR0nLZ59q\r\nbrToKbuhkVzEv6Sk70LIF9jskyk1shJv1ioJZeNxF9tCYTlmHsw5uPU5GCSo\r\n4cK62QCDuL4l+laGibEIP+Cfceu32GfzAIuM4+zWTjtCktlm0Xwj93KZjkt8\r\nw2IkHuT0FYCeDu1pezjGmcwQVzY04UiqD5tmlPOOccMJW3bjqW+1P5AESa1F\r\nwjSDerXWeMvAETefhqkPtDiOIguLkPShYR5oPdrNF3RLR3RspmIxLE8FIRMZ\r\n4IcMRPz9Q8GySUbYaWB7Aytnb2EiymaVg1Ua+hr12U9T029YEtDbryEbzfKv\r\nsHis+nFhnIXUDe/lLbFcBJrv5ogzu3mXAYTw3VS2lxBKtPE7rLU+xEi1Es0p\r\nvb4sSwkA2Q/81xPvb8VxF/AinKpEcWrxZKMX4JoYnqcaF+lkPIvoMTiW9YuN\r\nopQaaMDnfMveL+SAFcxv1CHAdVyqHuDdLkM=\r\n=KLMi\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227125217-57c5cb9.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/01a89d58879feb3833f037697fe89fb1/graphql-hive-client-0.22.0-alpha-20221227125217-57c5cb9.tgz","_integrity":"sha512-uUrvbQR0TO1dYMh71Grqb05VZP4U85sx1DEF0/2ylB78UuVJy9hmbKexv9Uh0nifI17MM61otOQ/f3NMS5rL1A==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227125217-57c5cb9_1672145570595_0.5109997862985416","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227125348-f416bba":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227125348-f416bba","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227125348-f416bba","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"cf61b48680ea2d3557a95ae61e5a0cb0fa7fbc7b","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227125348-f416bba.tgz","fileCount":60,"integrity":"sha512-DYN0aC9NZ3pk/xocp/RWXc6bTNguhQTSsaXwthIats2WNuxMNxHKF5Re3tCi0mc1FRIJI/GmNDK/WsE+BAQKfw==","signatures":[{"sig":"MEUCIGhZn9V7noiMquD9DanMMky9+BWhIc3fAdu3Mzqm3SuEAiEAjES8FwPiz/3/74+adMamuaS90oXLLv0/s7DMlru5RZM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqusDACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrrXw//fmWcO4WxNIbhJLJn3SPCxskcPz75PxC3dKZeuQo+hmLRpRNv\r\nGQCQvdrVwylERTlj/gAKtODiJWBG2tE45s1Fub7TuYBFWariGXok9KBt68hG\r\nPbwC3F49iPCVonOAnpB/w4a82Ow2hTZdowLpHkQ/jaj82TZW25dJQ2wRUN0l\r\nY8LyeJknFeD2YSdsX+hRGKyspxV+h78GiI+ikZfmMZO/KIRnj5ciG8LsLEYm\r\np7dt2G3wsVMWNgM93Euza459i3cxBXre0LxEHXfMEtWwEV9wHg/qIiJq3a/0\r\nHJ6gFuLFjoBiA3HhO1/Nqiw3QDagQWAYYl0TWMeJseJxbLii+BIriVgw6h+b\r\nGlDqh3KXTgZZ3+ZwcRHq9loqLA1vH6FH1jY9I+SWcm+Q32MW8rygZmtcSKrR\r\nsMiLhBxaezyq25OD5bBxUw4ktSN5BdqT5V7a7vjWBJz93mruSDCWpHUwzeO/\r\n3C4EWOK5jSLUZUa+KNSjVCjFDRHV3PZC2xvRGP2+JIiiXvF2odds0++lHyUX\r\nTzFZ2TJLR2Ok38kmVb/QzyOBLi2dDzwoBJoFJKKrF7ch1Ykb4FkLtIxy/Zne\r\nfueyIqAtsMWClWQegcgSD+1g5rtXqqwoJH4CFLat4g2qaNeFVQkIbF43folh\r\n5oPZL1Sf0dJNxxwdCgfqKeJLPlzDO2YHpdE=\r\n=KPH5\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227125348-f416bba.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/6025f389eef45ba890562a7e5a418ab9/graphql-hive-client-0.22.0-alpha-20221227125348-f416bba.tgz","_integrity":"sha512-DYN0aC9NZ3pk/xocp/RWXc6bTNguhQTSsaXwthIats2WNuxMNxHKF5Re3tCi0mc1FRIJI/GmNDK/WsE+BAQKfw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227125348-f416bba_1672145667751_0.030807033294522723","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227125611-0295d91":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227125611-0295d91","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227125611-0295d91","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"084259d82c8b1b1d073d30b7995012ef929e309f","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227125611-0295d91.tgz","fileCount":60,"integrity":"sha512-CzQ/Aq2k9fxBJZ519cNczJK1gGFW96lfuOwjj/zJIq4TNnnBrVWRA8zpNKSiBQqeu5gdF+YxXPwWNhc+awe+ww==","signatures":[{"sig":"MEYCIQCa6+LU6je6uUotWxbZv6y5quamYHgS/5wbS5cY+3ufIQIhAPTDm0RKJVqcmkWEf9BvFk8z8LAvnIXTnLAiB+eC3kUG","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjquuaACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoiuhAAnXUzRcYCR9dB37A0IpduG+U3cl6vArak/mg1R09pItgwDPT6\r\nZsENqEFGDxHMLdAOMj/cC0D979wFr20bGyiyAiWtC/mk8WEGm8xf1rA/BHGN\r\n5qzs1/woAGO++dX5cFirnhh1Y4E5mLiK+XkgSUD+Pr8NxAvqra+PBdoopXnS\r\n+9uMBs3FNoVVc/gtQgfWqUR9QffiZcGxuNM9LqcxtDdiqsQyT510u8XPNDzu\r\nhaJFbPLENw83kahl6g5PLjYWDhlRWyI24jb2oj18Vdhg5Ncs2d0Cdmqa0jIk\r\n3a84XQ1ca+bwhj6ApFSo7lFn+fJ6YCSlfcD3bOS0KZmJc76ByMzPvlELf5KY\r\n57f7IAVBTqcgCbGv7jjiuvSZXMAs/KuumukPlGxMJv7sK84GoZfKx9hcCrhw\r\nJ+lJO2/4i4t/zfJ2oaJ1NKUUj9DARUc8NlVBsk+9KfQI0usryaCA8/joRhAR\r\nmqgdjuaQBuF6CfFM9b3tnZ8T4DG4ub8wHj/PEfNaeNxAGytVUstQ2m6B/UI2\r\ncQIXtOnOZjwrSsT58P2Q5bUjhSACFd6iNztDaVAKzAh8I/Lz5dMy0254EnrG\r\nOiVEbx36ceLZSs84fXOdVMTyL592xgvuRCkfxxist78Ra+Rkzv8IHjp+i+H2\r\nJ/E/3MEXvQDKOdkhF0pL/uirlpsJsQ4351Q=\r\n=Z4dL\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227125611-0295d91.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/9b024d619ff8b915c47fdb62a0118d55/graphql-hive-client-0.22.0-alpha-20221227125611-0295d91.tgz","_integrity":"sha512-CzQ/Aq2k9fxBJZ519cNczJK1gGFW96lfuOwjj/zJIq4TNnnBrVWRA8zpNKSiBQqeu5gdF+YxXPwWNhc+awe+ww==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227125611-0295d91_1672145818025_0.262941752333421","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227125833-888a8e9":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227125833-888a8e9","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227125833-888a8e9","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"e57098312851cd3872a058c2dfffa4a08152ce11","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227125833-888a8e9.tgz","fileCount":60,"integrity":"sha512-Z1xKCsorQZRDNtMLU9tylwe2z4vvZQhCNM6WS0BrT1iyQKsOeIBJtDl8wdm2mD102bGGR0kdZRhLTj6lik+zOQ==","signatures":[{"sig":"MEUCIEBgyjzeAtavgAi/9EuBILHutXKx6VN68/d71N3Gehg+AiEAiDoSLx04nobYyXucP9CxA0u9a2KYTdOfgIQsSCmzS9U=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjquwbACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoPAQ//a+kxvAlvrPH8ZKtQeon6ooe/QfHD/Kcwa8OQKyMDX+Ag8+aT\r\nbbFYF3DYHLVz1YaVaGVQwu7DVTILq4VMGevum50my+sU4lwrzksaIwYbMZcH\r\nowUfgXRS0CwFMXfH9laR0iIChIl/ln10WYvmT6MltGhX/Ux9ohDmW3cBHwxx\r\nvILxMhZFOaNMbzSeenhWl78Y6PknTplkHZaqXAF+hA4RnSOD3ECypHpsI6Hz\r\nKw0jWsBlpVCpOAPHPlKOA/5Mfe2A3WcadUqzHguy28di4hveQNyP4uHC0+e3\r\nHBW2cjQ1/34KEefDpQNvE8Dg8ZZ9n4ttrGbO+jxtu445qkKuVxsEeXZ+h4bv\r\nAkxGLz5yUWEzjSj7hnzReCj+6iTlNwmbNn/Jb2ivIW9pudGirt7me6DSBPg1\r\nyTQG12hZnOMsEGhaAl/cCLiOt+d/7T20QAsZTY66NkxPGKDTd6n+bWWf4FxR\r\n+cc86xiyEVG8IXY3q9C7SBuKNb/pTL9QnAebgqOfqI8ZxZyPyWoj7xpfj/dl\r\n/F1qa6ib5vnWaQHWAozNd9Fq8hSMyz90EM4j3ouptG9s0M1eDN6Rlj5nRRgH\r\nWUehd3m6VSrVHoLifhaNakmL9JbJ2vTbJ3a4LtBj4hOWEY1gD220YFcI3SsW\r\ncZ6XmSzluqJtdAUKkD5GluB5GCZi4gqxhWg=\r\n=3fkV\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227125833-888a8e9.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/8da172a796bc15fea2fdc1a392a8c477/graphql-hive-client-0.22.0-alpha-20221227125833-888a8e9.tgz","_integrity":"sha512-Z1xKCsorQZRDNtMLU9tylwe2z4vvZQhCNM6WS0BrT1iyQKsOeIBJtDl8wdm2mD102bGGR0kdZRhLTj6lik+zOQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227125833-888a8e9_1672145947180_0.3734053518950189","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227130815-28082d7":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227130815-28082d7","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227130815-28082d7","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"ba797cd5cfc4c0710647ccaf0ee9231d7fbf619d","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227130815-28082d7.tgz","fileCount":60,"integrity":"sha512-So1XKleh0ku3j+jla+oKod6oYhy2iS5+19pWPq2zSZza7bzG7770BbkiKW4xehbWv6olR9vctZNgSJk0RjEiaw==","signatures":[{"sig":"MEYCIQDxsno+niDg9ZnbVSMGUjjV4URk9s7VFGwlQpOxX/vpvQIhALnQ2XqyeZDeRLl7iESaCtoCpXAHIzHL2Qbw0L2nIN8o","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqu5iACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp0AQ/8CCfpNr7D7OLuL/CW3ZVuS4OcuBkUbJv9MYDeT3z0PD7fKh5H\r\nLhku3wW377Fd5kX3AKPQPAMY1FJQUkQfpX1yZdXCh6ADfPioyQpP4lK4lysw\r\nkwKXRIUtv5YTP4lvAsaCDerPIlDul45eYJoWXXQzPptBgEF/W0x73dRZHWLQ\r\n4+MBWisZuaX+SCQqs5e+bXo0HahZPCtDu0QI8Q4G+S2yh7QL5BoDnCf1c4cW\r\nz1WbHj9qcJ1yZVxO4axcEL7eaJekAzP3nY9+YO8d86Q7M3Z8DfQ57ODKISXl\r\nUjNQVIQpBBwuket/8EZeFaw2TgJ/0d0oz1t/+8Z8BgRbqpwzZPYYDdVywOys\r\nGEwQ54IzudiAo1VXaTyhHbIgrTB8DGoUc2mmE/NpKnBHpRHVwF6NRhHnAdTN\r\nWgCyRDsvmFdppQq/8dwTze3KyCdS5vxz0jdKnUe5gac2Lk/jVg18qCplqDA5\r\nh0HaqYw4t12b2GG1l4JepbNyiTdGonpxANu1gabWjCXNgWUht3/qMCIptuY6\r\nMuUCcKBJ4ep3831atqTu29h+ydPoVyEybz5MA1PmB8VaxIvUKypSrIE9Zc1a\r\nJWprI/AWfnAj6uclVn+6d0IJr8unCTg0zN01dvx0MzZKTL1LhS+rS4Ss34et\r\nYTRKBrdZsWTSkczm1/LJF7A2IRdvep8ttiE=\r\n=dRRG\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227130815-28082d7.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/7773082287196de77cc670953cc784b1/graphql-hive-client-0.22.0-alpha-20221227130815-28082d7.tgz","_integrity":"sha512-So1XKleh0ku3j+jla+oKod6oYhy2iS5+19pWPq2zSZza7bzG7770BbkiKW4xehbWv6olR9vctZNgSJk0RjEiaw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227130815-28082d7_1672146530168_0.41964921746072203","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227130836-75bad42":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227130836-75bad42","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227130836-75bad42","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"ca05676d5bd30d7c009881a41667f79e6a5f63c4","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227130836-75bad42.tgz","fileCount":60,"integrity":"sha512-35kndIH5CB/nTpMDAxrkh2yS5TJIHWvy4ObfB2VIBGgPkVO+4fUK0AJo3f4OUx6XTc18CH+yK9HTDXVxXoN3Iw==","signatures":[{"sig":"MEQCIAPaJK5WaSyjn0KjsuncRdJm7X6ftuvgzPaokW5JWIXgAiBMloEmS/+bzK6TjcOU5uLSE5N/Kx0a4ua8N6ZPO+Qw7w==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqu53ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqbIBAAkUkIPQ/zkbHd/ENKwHxD+M9h81yfoh0DCIGY72ktEDj0G1lc\r\nc0APISIrUHCwPV8gMM4oyNpbu5CHdZxAAGbupBOPDNJaEs5sLOq9RZ7Rj5f3\r\nBIKr89j+rwVeD4R/swj2UW3ncSJOiWe8rLTW3c5QVoc+e9DgXvRw2dhopxN2\r\nzCMM+dOR8hmhF8nLIdE5amwHOniZ6gn9JEU9OyPtT3XH3W+iRUY5mYAidkba\r\nuUbkRLAZ6MSf10jTNucmeltrcRz+d9w3lmWGaGp3UPlnoGp7NmuHr4hSV/YV\r\nAcDkVQVNy4YgrJTLiiXplPW5WDkUYK42ZftcJp45ZZUOEXjSMrrl4GYmjKbR\r\nAiRIdjczbjy1oQJIvlyPcF70XWUcaJXtYN9FJ1y9PqCXpL6BY148iR7A56h3\r\nWrwKRhsenQw9ZmY7/EcezfbG/MK+uiBgHIC1x1i++CpUg2G1A9xfSyO77pRO\r\nO+hd82MzCRdkZ4gSymKIKb5fXFS2GLAtWlVO/RUHuTb/4EzVutBtRrtxDJcu\r\n6UcUb9bY4WlDCYXrbTuTZI47Tzaxz49QRW/Q635wSYfKp2RirWLxZq17i6v1\r\nSFIBgiFbFhAybOn2+h8Vi/0neU1OfBwwEEXAglGvM1JFs8LR7mWqibLxmqBb\r\nkrdDrI9ECcw4wK4MVF5ZxvTW1EjHhX/2L/o=\r\n=xeQU\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227130836-75bad42.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/da89f83dab4c179879a4158f180958c2/graphql-hive-client-0.22.0-alpha-20221227130836-75bad42.tgz","_integrity":"sha512-35kndIH5CB/nTpMDAxrkh2yS5TJIHWvy4ObfB2VIBGgPkVO+4fUK0AJo3f4OUx6XTc18CH+yK9HTDXVxXoN3Iw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227130836-75bad42_1672146551356_0.4732760944572403","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227131355-40f1dcd":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227131355-40f1dcd","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227131355-40f1dcd","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"2918d66378548febcec2c391dadfccfe2ffcd871","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227131355-40f1dcd.tgz","fileCount":60,"integrity":"sha512-RKBUVsOqbios8hKLTlVobpmjGFpboTrciaWKssf02x1THkkxU2E0rKyY1kxLEBENhuUcn+ncbEz377H6/Yrmng==","signatures":[{"sig":"MEUCIC4mAdEBsgfe3rROtX7Tf3Uvs1eC8LYoBW4FoxqhNAkSAiEAlFzuAKAzEczSmQaUSxjAxmGqGAOmclgqjcGQH1GkCZo=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqu+1ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqB+w//QXrx3hf5WKCGsL81kfQkKTJHj1QlGd4MA+XsR1oIDZme+sh3\r\nsogqpJjJOpapJU4XV4hLMI8Ybjbg/IJyaifPR76M+uwDKJp48G2OTdJrsBEV\r\njHcmVd9Zo4ZeDrWJNLPq4t3R4vGla91Fxh51J63Uk9o3KU33NNxVTYns1QdG\r\nDZdlfABvFkYb7YRg9rKlDgXmR1pmGuFnWyVjLgLsGw5eaejFAthXGl5GXRwp\r\nVxR6q9AmUI2tB1RIPwovTiy5ME2QG1zNlmcYCHcL0dAHlhOCiB1wqyfYHms1\r\nV5HbTV3+K1m+O+vngjFYcI1SWsu5Prj7JxPWsPT2y77yNUvk8VdYgq2tsuAE\r\nEjpDw5cXX3NHUFV8iiC8O457P4/Z/rpQ2ibTr3kmGyaJ7oJXawoN1PP9jrsv\r\nHcNi3CziqfsGHX1AfGolXT9Dr1G6EBEHXESSRrLXQ5m0Lh34X3WHKBhOCe1O\r\nI3PI5dcIV5kMkuMfc6D/ePTKTw1ANDElSs7He6yenGY1ri0AWUkIMmnUtyZg\r\np9QPvt8pwPj0ipy+XFJaEiSSrRhZNc7bPMTjIOIIB/P4ZK4CEzSveXXs7kJS\r\n/WlLbnp7NDcs318bF2SDmRyfZHDXMwivbrs2xX4dqpnGer/KagXIrY3DqmlC\r\nsKrMeA4JFlKxauL73+cEzThzf01do3aAN7s=\r\n=bf+V\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227131355-40f1dcd.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/6e6e4a275ca44655ef92f012d295be17/graphql-hive-client-0.22.0-alpha-20221227131355-40f1dcd.tgz","_integrity":"sha512-RKBUVsOqbios8hKLTlVobpmjGFpboTrciaWKssf02x1THkkxU2E0rKyY1kxLEBENhuUcn+ncbEz377H6/Yrmng==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227131355-40f1dcd_1672146869015_0.7426724277488039","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227131738-47f82b9":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227131738-47f82b9","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227131738-47f82b9","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"77353f33b6e2e7d601fe307c5988bc6140e5acae","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227131738-47f82b9.tgz","fileCount":60,"integrity":"sha512-thkgC/ylb2XBDehdQw9AzgwrD9IUAvWyN1Tsb4CDNmuFwHa1AzA/GkZ0F5r/6xeEYyRjc5wy7r7eNe87FCbNNw==","signatures":[{"sig":"MEUCIB59YyBLEXxx89Uqs5zncmq4ru6cz4ud1e96Hglg8mmtAiEA1/ko6Op98H1GdaLojOvbfzky4Z8kIt3OTYTkvU6PuIA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqvCVACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqPsw//SZZKEKRAfgTdd14ZN+WyWtdi9KdCyVR9cx7wTvpDuepiK+R5\r\ngpJdYSHBTQnA5pi7rRKw7JyHz2rsdB8vy4LWg1VNMVuYf6QmsRJ133xvdpfX\r\n88fyM2Z+EvxjVJTINOTBT5Mk2SpuiwwVGOiMf0/t3lFZhczbbqPoN9TbsT+f\r\nHeL6clpRliifWjrf4oINFRGxOvL2gMDhOoWe5NQBeDn4crO0BjbVgg9ccyDr\r\n13aKoymkOLzRfrGFyCvki/aP4Wp4b18nbA6TTCElyU3Gd2OxutMD6xTzvKxs\r\n8paPXcwLEp3eVUeFHLIrXMn2SUbl9JXQtnPZmO25n/O520j8dYrqhTlLK/Cu\r\nzdSqbPm7k+QdLZpLpjdr7JVmGrkdTfz+imfWafp7J41WscydN4l8Ch0no3mO\r\ne9qzbxOVCowTjxrihGreXp9q5wS2j46yaLFTNlc/kwZMbtvUO+ejtzbdRs05\r\nUs8cq7YQv0pC6RjD6RDNkllqD9n/Ihto0IZDCOFu1Eq+m3VY151BqlQv9C3k\r\n9rN5wrdp6MOMmVKcuryyqz1U5GLCfNtqFLrS6sFGR78PhSUFEWoDIdQGignt\r\nuAhDTwrpiNTuWGZPob72ffURk8xWH7m7DeVOSK2aX1HTntdD/VGI5zaJARMa\r\nOHOCUVxaeAJk8EEfzdkWk2XUbgAhKh3qtKw=\r\n=7aFm\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227131738-47f82b9.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/dca41ad082b5c65a5cc660e633f94114/graphql-hive-client-0.22.0-alpha-20221227131738-47f82b9.tgz","_integrity":"sha512-thkgC/ylb2XBDehdQw9AzgwrD9IUAvWyN1Tsb4CDNmuFwHa1AzA/GkZ0F5r/6xeEYyRjc5wy7r7eNe87FCbNNw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227131738-47f82b9_1672147093334_0.009509682421887433","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227132132-82c1c3c":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227132132-82c1c3c","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227132132-82c1c3c","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"0f831052dc2ece55ab6f112f27fac15285940584","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227132132-82c1c3c.tgz","fileCount":60,"integrity":"sha512-wBtM6A4LkgHJBu/aMJ04BoAV3bEwu8hcU2Z14hH5ZoLNPUcUrDcZcni5WAT/p6Gf7HaW3E0/zMEtwlNKVDMM0A==","signatures":[{"sig":"MEUCICImPqMPUx6fI0IYGm19yCkPteBS9DuMRQDtYLebPsEYAiEAquhTjgDwzqP6HPT1WED6u7JYcZzrjFTvOWucW9DaDfo=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqvF+ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqC9g//Wnz4r9tyH4e2aIVC6j5CO2b991kLPT9B78QL8y0xDQUPNcIF\r\nf4V0Qbui8HrZNTGWBXKFrSnC6yIFgLEM1YTGqmQJDP1BuDgIHEs/vXYAdjgL\r\ngVGPAp87C8Xf9b/K8WOuvCt3gRR+9F7pN+Hp4w4VE9EBeraMgqv0INo1BClE\r\ns2zhekX/KeP1FFU5uMK8ORstQR34jrRWNgRFJV/pq/tOU0v2qZH437Y8MpJq\r\nP3HbWtPzuaPbDAwjwDZFbaEafVDwEkg+LuAMlviRZhP0FTXuhoGHMAzhFWXT\r\n0E5lb7PJi0FjdEDlt9L+kJH6HsfmHiUkSZ6kKmhWNir3TSDAMEZ8bkZdz++W\r\nx/TYTiBxDwmP6Ef8wT9e/YW3wQJj7QYSl8kmnlaZIaD/plCFN5pCrcu5/efN\r\nLYc0sNyk6XaTNx1hmRUs4auIrlZDnXmdvcQbzrZ9Ka8sDfTBeSV4GvS0CC+i\r\n3jM5clgoBjCGAx9qYFPzM3mESAToAeVxvT8GZYGuo6JkYukUPhZ0+e+N1A9h\r\nuJZx8pxrG9xk6ja3Ll1zTxgBXIFK3rw1/KwQ/8npph67XiXQ3o+tvBxCYk89\r\n9UH+qojQHr4q0UpHQmS3eMa6c2TCxLbqmfP7+MZvw56Sn2rzA5rJCtExRhQ5\r\njg+cKZTHtbQEeQSGsDuc5NXkqeIPVZYW5Tc=\r\n=GLH7\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227132132-82c1c3c.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/026c2652a6d11e3e24bea1e14e98a0cd/graphql-hive-client-0.22.0-alpha-20221227132132-82c1c3c.tgz","_integrity":"sha512-wBtM6A4LkgHJBu/aMJ04BoAV3bEwu8hcU2Z14hH5ZoLNPUcUrDcZcni5WAT/p6Gf7HaW3E0/zMEtwlNKVDMM0A==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227132132-82c1c3c_1672147326231_0.6600613415366661","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227132310-c506a9c":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227132310-c506a9c","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227132310-c506a9c","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"85e2273d2e96b2ef5a727dd602a194fe6ba44691","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227132310-c506a9c.tgz","fileCount":60,"integrity":"sha512-Z7q6qlNAitDD9fTdqYzxX3AlARtNCfCqYaN/oly+g/mC8BtnZc4alHArP6myimzLZLcHlbBb6tyuXWwLIaB+Jw==","signatures":[{"sig":"MEQCIBqNiUuJs/hKEFeOtdALl8K0NKbiCy9DXA8Jito5g0M+AiBeoNfWNHVWZpeSm5IceOqu0qJ9GFTxzAzs+58uzz/aCg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqvHgACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmogsg/9GMCZvuMuKKxV1aYr4fnTNY7/B4wAhftMpW7lba1KLbD9Ohcw\r\namLePVdN5H/kXPXGCJSru1Vs8K34R1rzYh1cPgU2jUCPehB5FcNfiAmIOUbM\r\ngBrsA/YIFzgqxtAbZ0BDHTY7oAcxy0ufnz9nh8Hb4HAD5uZIqOf1qdugAYy+\r\n5d290eufbc68Ka2uH3LrYPAj6ch0aHYZTg1A2YxgBW5qf9sMX4qy9A8N8ysI\r\nR4gm8NTA1q9bnolLdJhKlR/NaBr5IE0iDN//DmfYog1N4D+0OU0k00Cf7uew\r\ndUWdKZyGLete+/sNeBUyzbouP6VhKf6VoFp9LBiiE/LCbSPV736gXoAPG1yf\r\n5TIpc8PmZ8prmvAYtULlboQpXBrJC9FprZhNxV/QY/RLXG2q9USNgjGu9CX/\r\n9Fx8LMq/5xuMLHD/jiy6WDObckqayr9XL7DoSklpgsctTekklyUSApWe7/+z\r\n0LCBnyvmNx1yYxxMBDgrEAtjF+1wEBa078QKK0WEpC5CWTmKG9Ye08JS5owE\r\nz2wMMjcA2afIkUKtkyhbEwGnz9hHJqtyYD6721ThDXC/iLyz6r/BV/9UnNj9\r\nec1VEZ4amjMZWyw1hFB6ED6QcengbK6LjPwSVpK23nkO+2DEdbo526WmunT9\r\nDOhn+EeDOytwVo3kAJ2bv1USA5e9FIaGUNw=\r\n=52Ri\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227132310-c506a9c.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/7bc0e412d2f3a7add7ee771e1e8f1488/graphql-hive-client-0.22.0-alpha-20221227132310-c506a9c.tgz","_integrity":"sha512-Z7q6qlNAitDD9fTdqYzxX3AlARtNCfCqYaN/oly+g/mC8BtnZc4alHArP6myimzLZLcHlbBb6tyuXWwLIaB+Jw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227132310-c506a9c_1672147424320_0.31234758148019925","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227132900-758dd72":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227132900-758dd72","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227132900-758dd72","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"0be5f3359063e142dde0788fce0ad3e9abc60e98","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227132900-758dd72.tgz","fileCount":60,"integrity":"sha512-NGSeUafPHFnpvXUqJPwIy/kt7IPBv7W+P93pekyDe5697rmgw0RzVfh5Mx2ygRvp7ShtwluvW3/rQk0e4D0Z6w==","signatures":[{"sig":"MEUCIQDaAMU0SiVVuHB8w8eXTke0413PlQIqlC6zP63RUbMDqAIgKushuuhVFIHZ4d7Ml/KnpL0oRB/QL4u5x5t3OR65LW8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqvM+ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrTHQ/9G/6xo91ib2meuareVdj9ExN8wAE1JWiPFbP9QbgzE0U2lziN\r\nbn913G2Z+SHDhXAkm0O9HtYAfJJKxN4WpqkkvPVq+FyNx0R8hbFPXkUc1wBR\r\nrN2Q7kcWIFGEMoPGATijmQ722gu200qMBqDfF8jtN5I0eGuecJJBWU/BNECX\r\nhCK0sM5Eav741rVPiGC7fd9r8ucPrdH3ON5xjweHWf8AH7NqK0juc+WC7c9A\r\nxh2Q1sSTzQ3NzT3Jg5JW0m2LiI1xsERXlvdGUnzZkryu+k81/EtuIORCIchn\r\naDMlYocgv44AvJHzPggO4r6m0SKMzOy0V7/J201bHnlERtOHUdwsJo2axdOH\r\n9v9qR1jzcIkezJ4WkQcjGDpfLz7E6iyRudCQtYQhYdsmZMRJAV3cURkZ5Z1O\r\nMDsISmgjMND3EViyJ+j6fSpVFVfbIUI16OuOZv+ZpG4sQ29iquchbLQqCMFk\r\npRQcjRXc4effK62lPAlEFQYl9xrONN0WqEbSNFKlLFqd5NEmE/SLvJ5xzspL\r\nHRD4B0QuMKLb9WroY0N3iWc4YTRVbltc/PEDTWVmcvtF8ygZQIoGDqdcWlAa\r\n3R0qRhKao8bFQxzVwjWBG3JOAjA4GFHL4u+70a/73py4FSd/FjhcNbfmDn4c\r\nbp0jTvlt/bpvbCSUWdOhenEULFubksaYYww=\r\n=CjNn\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227132900-758dd72.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/00fe595077366a8f10c3810f73d45133/graphql-hive-client-0.22.0-alpha-20221227132900-758dd72.tgz","_integrity":"sha512-NGSeUafPHFnpvXUqJPwIy/kt7IPBv7W+P93pekyDe5697rmgw0RzVfh5Mx2ygRvp7ShtwluvW3/rQk0e4D0Z6w==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227132900-758dd72_1672147773940_0.6491993279263584","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227132945-40ec76e":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227132945-40ec76e","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227132945-40ec76e","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"0346d4f80fd52a82f26f74ce700ff6ac159e21c5","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227132945-40ec76e.tgz","fileCount":60,"integrity":"sha512-gxiuTQ7820BQAiE8CbcBUBIrm0LV1qRVvvTBWHb1YIVmTxP3KeKLssci0219SzaPqy7XP/jtIuRt9kD5aym3Bw==","signatures":[{"sig":"MEYCIQDs6yrzr3LxHsiyx76l53lIVfhvPkPIHgAgzYs545xcQAIhAOLOLfOHsRx1aWNIzvR+dZBjY/B3CltyMKxJ19riXwdi","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqvN0ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmrf7g/+PlO26/guFMVhCzoIpz+Nhv8485vdTHAD0M4ryekHZo55F7Ev\r\nbPQI+1cFeJYFSFXOE2mC/IpA8odQ+fywxGT7tW5S5devTL97ilfu5WBMA1Fz\r\n+SLuqplX/3aFAWki8TWJJtLPGgmXYOy5y/bQalGH7Wq0rJXh0A5Sx0CD2xJp\r\nnga+zn8DL7Ac0KZqQh2qVyc/vCpRl2JbaDjybaDdVlTrqTzf/7YxA+MWgkCq\r\njqyHql7qcjvZD9XkegJuwnI6GzzX6weHuyGmxdnHoU7tehBAG+Ad0Wq65s52\r\n5RO3u/UIH8Sx6Yavmwa+w6WA7catrC92T7JgObgicqRF2eZaLtT9P4a5r4h1\r\nOIbRaDYGvJsfKBpWzGxc4GYqMhRCkf50d3ZChc/Gzl3tFCjizPGNCpA4Rviu\r\nuNmX9G+6GB1hQ5baSTQV8aWurXI+RFcZtf74oSwaBZOLeOgcDTkA6VKM2LyC\r\nENL/kPKZIep3Tjtk3knSGj/EXjHr80+jMpFnDIVwcAVcmNlHzm0/vyHcCKen\r\nKdCpnWmCqKwgxFyvqzbc7QoK6DsQQHvxyydFL7qb6zwzRiKRgyAA0EApv2xt\r\ni2KIWw4184lkYpJ6u2ykI/5QsO+betmuzD4XXu2JI/6xxcUn1TvFPotczhaj\r\nLIUd7LM4m8RTz9z5mhQ2LLDx6V6xCusd6+0=\r\n=7EMJ\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227132945-40ec76e.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/13f55e8be3b24a770dd4e60a1f8d710a/graphql-hive-client-0.22.0-alpha-20221227132945-40ec76e.tgz","_integrity":"sha512-gxiuTQ7820BQAiE8CbcBUBIrm0LV1qRVvvTBWHb1YIVmTxP3KeKLssci0219SzaPqy7XP/jtIuRt9kD5aym3Bw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227132945-40ec76e_1672147828197_0.14930672165611392","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227133458-7dce243":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227133458-7dce243","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227133458-7dce243","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"ad60b63c592b8b6375b1ab4d297b6f8a49121058","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227133458-7dce243.tgz","fileCount":60,"integrity":"sha512-nXWTJBp8E79jS8demw7znj5RP5GQOdIw2lfrlKFxB8WTxFydxpr0h0Ib5YuLiXi47mQim+FCrzQ1c24ur+Wcsw==","signatures":[{"sig":"MEUCIQD78mlaihHmjF24cy4MHrY2j4HtPOc/B6ALyBFgpGuL1wIgZSbSlNPqTEGZ67ExsU/rFhyM87E71hHkbxEG2l+T3Z0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqvSlACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo/BQ/8CpX3WHdgyAqjAJYyRLA/muO+iIEXHTSbUeAEZUbNHje7iIsp\r\nNm+Y6ZU6rY8fiANVSjtB4PlrJKUy7vlkhwlIPO/Im7uua3va+5rCr+f2p5Qm\r\n0kE7Z6esg36NZtzBqnuPbH+ByDwEhAPnXhnSBaeYFQ+tVfAJGH9oDuAo5KHX\r\nHLJFj8HrYGxcBN879wFqJE6oJzvuAZZtdUmbYnof4+vSjBt1XsetnkvEvftW\r\nIAegMMoesJRCkrNyLUH+enFW9a96QeEhoRJjsXSTJd9aX3+aBa4WyuTL/H+9\r\nXwRCVJyDAr5suOcF7nKETpbhW6P320nSOdf9dYODaESXaYAmCtyk7l5fIy4m\r\nlokWi1Nt29tctN/YFS3t8gafuGi9OmrnINXqBYftr6P1w+pJmoUuDSguS+J4\r\nuaQlAo7RfLmBOI0k/zM5g4LXl1C49yHxPePn0b6SVU84ZJI87cnrLL5NZY1J\r\nOjfjMoWh0gYXa+zKzpUDTUiEFCrsBVbR8nRsv+BYpUmu48/2jHz4fIqZc0/y\r\n0xl+zjan9czI2vCXVkKcFyhCAy8PCTmg5adAaKkME5+5hYieP+3RBHYPAS+c\r\nQiRWDMo61q116y9rmNnPXJy7SqALDpG57eU1Dl/H6YFxKvmHVErNcYv2jeF6\r\nhW5zeg2nFZ4kZZsZBAO6QyMae3o6XobpVmk=\r\n=V3S5\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227133458-7dce243.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/435c3db73a1cf6b1a577e02f41883ef0/graphql-hive-client-0.22.0-alpha-20221227133458-7dce243.tgz","_integrity":"sha512-nXWTJBp8E79jS8demw7znj5RP5GQOdIw2lfrlKFxB8WTxFydxpr0h0Ib5YuLiXi47mQim+FCrzQ1c24ur+Wcsw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227133458-7dce243_1672148133771_0.09699333535359167","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227133651-54ad34d":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227133651-54ad34d","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227133651-54ad34d","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"7ef23501fabf704374b1c130a785fb3301113e89","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227133651-54ad34d.tgz","fileCount":60,"integrity":"sha512-pFeKV3lTi2M7OCytRnhC32OAEm8SuP7ezU41OBvYchNndAnpBDwen+YtSNOhJjgJDqrVEMu2aF0OHkr8ChzCyw==","signatures":[{"sig":"MEUCIQCQ2zVJLSOSwue4yGZnT+ndvzb9ueM/vpailRE8m1bNhwIgWKd7YD7EDtIAI7GSvXsNBIldVmawSqstqBTZgFe0dt8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqvUbACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr6Ew/9HEjXB4P+c2qvUppIKzCqr6E/iqt+vMMePKlM1r1RTdcPyoYq\r\nEKaX/p//Sj3Fn0VsY7m+GvAQYjELr4XM19v0pHH7g+ac5bRwiLTknZ6E8brW\r\np1v4dJFgpmDgZ3Yivrey2Y3MVmt1YBuLrnZf1KyyGGC7RWiA2yoRysMeFFjU\r\nZFW4AKUqD3rfBxpDquuVjnhnHNnEkapB/vx7Qnq9FATy8S/bq9s7A1wMKC+d\r\nwaXeGjywgwG/T1QjjXNgSjylvvCmz5IM7bLxj9PvRCYcrJ38YSFu0wpL3DKz\r\ncpjQZk1TS4F+COgeYlvnx9suuTV3j47ibjtM2jO5qL95K17wYqq6OH8pGcNL\r\nmXEU5k43Nl/yslVEm6UKTCtG/BvItOu+CbZFTPPfXdjtcJipkcXxX9oPclOI\r\n5JmSrKUVt7HtSf7cwwoeSnD7gpU2vdUrwjvK3Gg3vJRSdt7PjIBNQDZZNrng\r\nCBcUeUJLCbQ9f8heTo6ZuU91cRbqHnXrwPFJ4kyTLN2bfbvyaRVJoaUbxluc\r\nSr+q7qtDnbjxPZbvnyYdA8UVmy6G2V1anmbVebnTKtfx8y155/91dJbRdDD0\r\n4h0jYK/qPQjvdsqNNpVeMsvSjTERNFYYaCTZ9MYYly2JUB7f0XjZ13txXdCU\r\nPS5fw/H8lp7/O2U92wLn1hXf008a2RgJ4UE=\r\n=I+zz\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227133651-54ad34d.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/5d066a9a2e92f3b737ffdcc1f2815deb/graphql-hive-client-0.22.0-alpha-20221227133651-54ad34d.tgz","_integrity":"sha512-pFeKV3lTi2M7OCytRnhC32OAEm8SuP7ezU41OBvYchNndAnpBDwen+YtSNOhJjgJDqrVEMu2aF0OHkr8ChzCyw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227133651-54ad34d_1672148251474_0.3409871941013545","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227134832-bef032f":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227134832-bef032f","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227134832-bef032f","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"515417666578abc5ceb833e05a4c75ca91e60e24","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227134832-bef032f.tgz","fileCount":60,"integrity":"sha512-a7wS1h167uQaoWRHNPJ3bqwysKbgWdfE4gHqwMsUizzLMqVtkomGnhL38KxJFpkZR1ZijMGNYjyVfbmuyNS2nA==","signatures":[{"sig":"MEUCIGVw+qZ7e0kYH5EQpqmWibHee3Ue/pofkZR39uPcfqqsAiEA9GNGUgoFtnDjhYXcrGt+CzKfwOZ7hHq0OMEkEUgYwog=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqvfVACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmozbxAAoymN6+9QNIlO334el6ArCfay6v6ZKxWkyuG8AqO4orpR3rAR\r\n+OxwehMZeIKiaysPyKxzn72L1IU5HrQmccx4T7drA1siXkN7DSJyQd3hO8D0\r\nwot8g7fKJk0FMIM4KmINwUJ92EzFwMBHj+UE4d8OexMQg6I7uUOCubWMNfKY\r\nX7L9RqMxOEEAdosxQlPlo6NQIJPW/ZMpO3r+RDcEapQjXh0dYE5EyXKoiKZy\r\nad94gwMvxPGe6UMO67RFmo4g5abcOJ3ltZCPLxBC1N1LeAY50DrGR/RT3iXO\r\nyBqx2fpKJC+L2x74I23HXzVvXK8qKFFsd8IHgRfAqlsgGTS2nshQXdyEz1+w\r\nBggQnxQtB2NBffU1rq6isw/FdyZFpn7Z0M1lgsaYvL9MrwrYn2smYkgQ8BBY\r\nCOs0/jfADWg8jK9pSzz200Z0awXChQi//0ycOt8911bkEKJmkfT/BBz+5n7I\r\nVcaA29ar05WvFaGgOhr78qZOtNvyZ41tEThNp43t4jAUZVLB3q3+KgJXBoT3\r\nNmHd5V9ywIK8RdEyYzibFvwfGTAFm2YKROi1E0hFYY9XXmXubUI17+R88NUM\r\n5EzzndfMLCCa2uMHkIQQX8YnW5ohEd2RA7iQdWyVmhfumsdTt3BunbrU4W6t\r\nLdUKH9XzQD5LSzh/1sx6zkSJteIXwtPR01w=\r\n=ZnE/\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227134832-bef032f.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/72af9b972350fc9520beeca76cc899c8/graphql-hive-client-0.22.0-alpha-20221227134832-bef032f.tgz","_integrity":"sha512-a7wS1h167uQaoWRHNPJ3bqwysKbgWdfE4gHqwMsUizzLMqVtkomGnhL38KxJFpkZR1ZijMGNYjyVfbmuyNS2nA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227134832-bef032f_1672148948948_0.8955304825237529","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227134845-64e3393":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227134845-64e3393","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227134845-64e3393","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"cbacf9ac37d4873ebd80f3cbb5228778e00321ca","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227134845-64e3393.tgz","fileCount":60,"integrity":"sha512-5ooWwLpX1s+2hrCS4EZqmTv4UNqyFCgHnFo2OfjwlRMWyJfK9ZFs856d4nio+lE101/NfDTc99OKUCjPFsfjxg==","signatures":[{"sig":"MEQCIDbDjg0YOAlGJQCvSPg3KK0fNeeBNTiqgaA1zRufN7m2AiA+iXWjTlybnvjkUPCUP3fuxBGaJmelNF6tWTfMugN/Tg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqvffACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpXww/+IJpdMwj+gniFrozBpH1c8tiDHrSUjrww0zNB+iQWrUF6WlFq\r\nD7RUSckrTpIaPu12g0S6A26ALlV0GKK3i9VgFwF9Fl09EEfeZUgV7MRcRWeV\r\nj1IQ78qpIlvppBJhTXWbzPyOf515UdFJzmzjFiHKv79Kg3uQtoRF/JGxCQID\r\nP/vdzg65sBEQqYtjPQexYKfS/RCl4g7nx8p0djAhNHcpJjrn678XJtmBZGMp\r\ns5duVUvuRFS1MZmHy10AVc00XVLE/Ko5SbxIe5UduR/b6sPtpsTxt8HZyB5H\r\n30ioe4Qtte7qr2Fi5wgx4a/F8bwuxOfzCkYN35Ri6iJZRG40twQTBAmxPZiA\r\nIC7EnBRnl0e2V+4CTynCy4EUVm4nMP8o7tRvEoV9bqRMeBe310TtTaZoD1vV\r\ngeYkiqxAi8HG1eUVvr7tRJIpueKUc6fCQqTqEySgS7G8eksM1zQ4cvMyOsI6\r\n1eWpR9oJvVBzp2NOFxLRs13hUWXCiIRrbB4fWRx+qC4CLeaVrNVH3KYh2TOW\r\n+MUQOM03KTVsEyg/N1ITVLvC9U6l6+vdnAr3Kpkq/KV5MrHAGIwDtVoEI2P3\r\nTqwGixan+eiEl5WpFzRavT9nMv2yvtXRh9CLyHo6q8lvAnHjUE3/f1y6YEmL\r\nzdse7Xh9Si4IWfeysSj4+7+dLeUWV8ASdGA=\r\n=3oCN\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227134845-64e3393.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/859bd4280044d330fa68976ca9028c6c/graphql-hive-client-0.22.0-alpha-20221227134845-64e3393.tgz","_integrity":"sha512-5ooWwLpX1s+2hrCS4EZqmTv4UNqyFCgHnFo2OfjwlRMWyJfK9ZFs856d4nio+lE101/NfDTc99OKUCjPFsfjxg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227134845-64e3393_1672148959039_0.06255805861853458","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227135445-4e47be1":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227135445-4e47be1","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227135445-4e47be1","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"1e71e75a70b2fd858cd2f726a81724e6c6a77478","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227135445-4e47be1.tgz","fileCount":60,"integrity":"sha512-aGuYKRaHGWtSan8qJpitBay7M4Xiw1lQi8TuXmbKHew/oqFtneal4iFex8LQOfU1XJ4+qGhJ9nupDQ9n5PdCNQ==","signatures":[{"sig":"MEUCID8PZmmhXeyYio8cKjEwm9g5XADjzF4y2eG5sXX8krgDAiEAlhD4O9Wbt/wks2bELtExhuvlFk7hu0VsQF1bzpv6YMw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqvlLACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpnmQ//V7qwIOUJHlahjuRPJnz5Y3I+h7aVFWpvW0mynsZhYzIzOLP1\r\nM8yif5gDt5ycorgVhNzo/c2BG+1vdYoHCciZi+6/qqbiWiN6s03YetfWT/G1\r\nVvif79KIazuyrqZybstBxi+EPs9B6r2fW3AL9loCfpYuh/1EgysuveFNB4ci\r\nklYteiZ+kO8XiG0LLlaue6r3vpYpBPKJ+eaDoMVdfkdSl0u0/Ayz19llprd2\r\nPK8kLIGdVndcVsRJalWEQvV/XRh3Mdl1rEq5U2sQuQWKmcFvuYxmT5H2Wym7\r\nbwHgfxoAeZBXDtLcQpZYGf95WfzNRCkv639oWODgdazPo2P4HOS8IGxm4ObE\r\nM0phHkQdqB1vSAsiQ1Dc7t9KemSygumuTcTl83wxlAELWOd3YXt78h18ES/A\r\nfPsNe+gsmwYC5jVuuu/DNGMBdJCXx+cuDKGc1pIcdB9yVJTl47rlV7/X5nnj\r\n4BTiSJNH2olw/wXXIkYyUQQpTI+eQ07dEw64gNMDLNWMzS796WZNGtmZX4rm\r\nqtlc8fn1RVlnLlhzmUKaE7MH64Qcj0sVtQS+MTZZnzZ/Cyl0a+hXIoTpLdC7\r\n5mBp7shahASrPlfIFYNZGBym/Y/jJR89vfC/heU7z7TuB+4E+GU4QS+/GUcU\r\nb9Dwd523KnOy7Slqe3Kq3JeWRN6BRy7O4nI=\r\n=lFY9\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227135445-4e47be1.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/c6dee05d725a6b1be50c6e5889959353/graphql-hive-client-0.22.0-alpha-20221227135445-4e47be1.tgz","_integrity":"sha512-aGuYKRaHGWtSan8qJpitBay7M4Xiw1lQi8TuXmbKHew/oqFtneal4iFex8LQOfU1XJ4+qGhJ9nupDQ9n5PdCNQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227135445-4e47be1_1672149322966_0.8744413392743033","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227152428-976bb22":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227152428-976bb22","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227152428-976bb22","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"fee2e00090e4fadcb42a31c19f74814c2dfa44a7","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227152428-976bb22.tgz","fileCount":60,"integrity":"sha512-/5CBhugswC7GoFIYZBCxCAcGRTj7vJEgqCAifdsyfl1KfwlhI82ov06W0WTpD32w41Ve74ogvrp1DhWnXEQGew==","signatures":[{"sig":"MEUCIQDvrK/Fqx3IsjZYut1g67oDEKAmFEGh9qROOrGETLLe+gIgKZltfacITetSlePDD1cef/Yi3JHJdouh3ECO7AWfx5I=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqw5VACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo5uQ/7BYA8ypUlukv5QEeKvf2MY59NVUrdhCIk11oZlq39RAoVO68D\r\nIsfOew/bzG7fXydxdAKqM/j/yPi7kEjagaBrlKVLVZmNk+7veiBHIhm5wfNj\r\nhVJHnWsps/sFiAcZAKmkyBC/0pPvvq9qMgz8AuYupi6Oz5UgqgXoEq9Px1x7\r\nhgKiFezVXTlwt0ErZv//ECdYgDsFx7LrwpTjVSOPKU/iE41jDCYzVpB0hGWl\r\nqmWNHenBijVQwUc5B3vMy6jXFcmrYl/i6+fTYAqjIaC3kT9OLaCwjXj/sR/d\r\nvmpn/3s5Ailaqokup+HFjEktvqORUsYIfHwMb/+b5Yu9HkeqLCslYxycG8x7\r\n151H0m/YVucwVkA7sUpMaLxux+Er6mkOQSH+8RHVo4B3jv/x5ehbfktJK2uz\r\nwFxYOvWGfRH4+oiGXeV8y9h7N9FhHR5dciEoQ13/ahzhHSqqFr74UFs22wgk\r\nNpD53teO2xt2IM4GSa0eIdswKP6GLD0Zlp9H9A3/8xfkRGPHZok9K49DfMRq\r\n2xrCfdUCcJm4LsCXEYUxqmByal/Lszb++mT6bB84U2DvekO6Mc43vZCw81nJ\r\nuif343Oav7Fh/yKjRQCi1p4xzkHc9p8tS89/tM2j6Ma5Y2BDD3QAd24XNpeG\r\nKJd+eX8Nk9FKYpaXeVP5JxteZa7UPSZXW6I=\r\n=ITlg\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227152428-976bb22.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/72debef4be9f9841339552dd62bf0742/graphql-hive-client-0.22.0-alpha-20221227152428-976bb22.tgz","_integrity":"sha512-/5CBhugswC7GoFIYZBCxCAcGRTj7vJEgqCAifdsyfl1KfwlhI82ov06W0WTpD32w41Ve74ogvrp1DhWnXEQGew==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227152428-976bb22_1672154709625_0.8082879190220751","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227152912-9f634cd":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227152912-9f634cd","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227152912-9f634cd","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"206483ba548bafea1cffd9c04b87ad2030403978","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227152912-9f634cd.tgz","fileCount":60,"integrity":"sha512-d5o5R3u8Js+BGhJk8GF/0tumU0zP7FFdtTHo7WxQXfcW99sAzRr6ehdvrD/1G/vM97i7iRyVajjrE45ah+2u7A==","signatures":[{"sig":"MEUCIQDdzLBJ9+9LEsS2OPKU0HgzL1vtbBOhvkAfnu/cmQcwKgIgKzpeWoQKOPVtShQZt5VcYXYmMsPj7E5qod1Dt9TdFa4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqw93ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmowCRAAjwuwenOXeKNGkkjZHWRJu4SR8I6V+HQULktzXe+lYPF3lfHl\r\nfj9WxcUIcI+/NfYvalMn607LKg6+6dEuNFuuBbWCSlwdOlrebDshcNhq53xO\r\n9/WJf4lztIa+MaQ6ycC+ssEHjRTJ8Hp3EWumKpWfzuXUq5wAdmfXMhmCZh6M\r\nXriUDM+6keNQM+9qaITz9HyrZxBxJpgAR8HBt6uJU8h1YnKnXhKofvrkU2pZ\r\nnLirLN53bqUP/odqT0hWQ0/ZQgSsynmh5l65wd+oE+BDtqOfQOCplBepsuKG\r\nQwiCoyX/hxN3Q+9WAZAqqpFsHfj/ZPqevokFOOIEMH/7OY7rbEEWItL3NZOL\r\ndRYYxc0H30nknjE8IpExl1kzxX++01W43yB53qUF9eWW6XH2UCJ+kimb2ztA\r\njnirHDSl8YdaaJucsKEV51t3GPkYkfxkD898c58AOSRiuA8NGzhucKKeoV0X\r\nOT5zI47/4jIw4lM10iHeEzshteB+Rr7bmpBUad5BOGEdqhLGV0s4UGBcIzpJ\r\nux7cdoo7FEqn+0vOb0v4+8ksRnK7cWaOK1NdHJcODyFj4mWNY4PzHPlIk3W+\r\nQNFzyj4maykLDZX1vNvo63swL4ZMqJorKvlR/+g4wEbamiql+ILvus0pcn0w\r\n7Z6S6SFX+RRpDCbireFe71+GV3bWnSsOwA8=\r\n=Ds+f\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227152912-9f634cd.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/d34c045f72c9cf12da29f9d32233c4dc/graphql-hive-client-0.22.0-alpha-20221227152912-9f634cd.tgz","_integrity":"sha512-d5o5R3u8Js+BGhJk8GF/0tumU0zP7FFdtTHo7WxQXfcW99sAzRr6ehdvrD/1G/vM97i7iRyVajjrE45ah+2u7A==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227152912-9f634cd_1672154999209_0.7770288951987847","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227153137-0fa1ac9":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227153137-0fa1ac9","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227153137-0fa1ac9","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"e646e57df5c3699f87a4e55512184e0cc25e313a","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227153137-0fa1ac9.tgz","fileCount":60,"integrity":"sha512-tdYGdBDwYJQJarRLlstxhL9caSu/k3MWep2barzAYGIzPXfF8QaHc1pu/Nl8s2bXpUui1U3QH4fKusPU8VDh7A==","signatures":[{"sig":"MEQCIGUAzMQlj1qu/ZrZx4c7Jb+PnZq/ohJvhKMZRIBNVx61AiAXCWbjhFci9XFS2v1Y8Feira7p96gbB0W66UGlr2zpow==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqxALACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrjHRAAmsq+8hPceyLBguoyuqK3AlJlkCj/z0F/EMTtodpGDc5Vns8w\r\n6T38VTbPPvdklBG0dLfTbHyG1im/PcSMC8kUT45VcoESw2hTURuh3p0Gcucs\r\nJn5fIIdj/LHD1Bv+guE2S/hIGk61v7MPu57BeyE8nmWh8Wg3UT99mgVRoDv7\r\nbsc4eh4eAIlUiJKCHth0ccQUqL4MK3cAg80REAldzsLxj3YI8e9FFS9koH2U\r\nwjddHrzvPaxYIlsLddVm2GOVgvPXgpOm2s6DiNUvJaOrgIZ9uOOPKkjTmNXO\r\n66dj2f+zk/L1pLwlg+kqtTKaaJcAXDCveaMNRL/uRKiT3NyiiQ2/7plrw0oZ\r\nCeuOB9G0iA+HaUMqDm0wJ+GVGEOTqHwxb6pilbK+ofB5ILJsWgg/ZOphCVPW\r\nk+LWwGpqfJZb+F3B3nr6qyGGlVWlZyR4pV4y/dgMBik/tAZgDdMnSMQMnHL4\r\n3lj9EMwLgOONhSC+DOyO7fx4I6Oxf/PWRU69YecY+nlqOxqEMxud4OIeJ4/4\r\nAmMiwSMitwjuPHmmYmsM+FWry8VJu46o22OTd7zBX9p6csYBP8bYP1AKvoPC\r\niM60jsS2ht5a/GuEsRB9PxnHXciBic+B0hp4cjuxkfrleUZ/5dMa6CwLdzSF\r\n4FZo4aEHpxxWRBR72CEhxV1CZgMTBYU/OD8=\r\n=D0Nm\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227153137-0fa1ac9.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/755a124152d96ae8ea45bdcd387d729e/graphql-hive-client-0.22.0-alpha-20221227153137-0fa1ac9.tgz","_integrity":"sha512-tdYGdBDwYJQJarRLlstxhL9caSu/k3MWep2barzAYGIzPXfF8QaHc1pu/Nl8s2bXpUui1U3QH4fKusPU8VDh7A==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227153137-0fa1ac9_1672155147166_0.619691628084907","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227160547-b3bfcfd":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227160547-b3bfcfd","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227160547-b3bfcfd","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"470e81cdfccc2d5465f3ea8509ca8409ede801c7","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227160547-b3bfcfd.tgz","fileCount":60,"integrity":"sha512-Ud4OvECk4DQ0tfXatqa3ECDxPdF7vEXe2+z0WMCNWOgddMpOYao/ND5nYrjBvKzP5gFh+lrz2N50HBNX3CSDeg==","signatures":[{"sig":"MEUCICUmjHTdcDSXyfSFmEl42DTt4tU7e2lVCOwqYh/YBJosAiEApETC/SE4RsieF4xqwtGterqclgjYvLTS9iwcBrGNTwk=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqxgLACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmozaRAAkPjhEnztBetTIfiywzAf+vl+LKlS/4JpBpQsQjomMHblqDOA\r\nTQXFq/8xzZ2bwBSkOG4t1oz535DVsCBhnVVXyjcfxsn0vLNyMuMVG6mRzdEv\r\ns3+rfYB67OLOLzE0lDSJRbmbuTUHzcUfkQ7tvqCUBExeUmfK3O2dkEPgmWnY\r\nGlAdYOEHqzkhfJJhYlJWO/fP/6IJUIqk2djI8F+/VCf4DvGxOkDc3MI4BQ2t\r\nYZbKmYVx5PsWE1XCXsLAhCcALGSOVi8DdYyIO7Alu672SKwjJ2cEvB4Ic2uh\r\nSDj3xjI7k0zdZyep/rmM0O6+NIJHrv1OHrbfk9ytpbimL6aGU2uCt30gGU9X\r\nVCHcy+93+/WmdRJ9v1dBWzoH7tdG5I4OYOG4EcO4y/ZAww6DdairMKAK2Ung\r\nIK9O6QUCAbVa8EYTomfe1AH/pauAQH9/SPalpvvJIZSafvjzzS6EQw2wOJVA\r\ngVzO80Ge6ra02tcNgDGWSb/yO/5wuFRcV+NpFfA3hIkTfklzP+HZCwwz6WUM\r\nzPNE6DiqUCyQPisNw6JKLvuOVmo0F60sTXCLK1+bfY4x/7h87vmu6ToBf3dR\r\nOK5M27JfvdaxWDi9/IR+vAEgR/sAK87IT9PHawnoVcobtWAN11OIsIjIpDDl\r\nVYtRQu2qgggq53i/Umop7SoDRwDSLUHZtZk=\r\n=F7d2\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227160547-b3bfcfd.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/5f392de2740463850ce0fe16bbd22dc7/graphql-hive-client-0.22.0-alpha-20221227160547-b3bfcfd.tgz","_integrity":"sha512-Ud4OvECk4DQ0tfXatqa3ECDxPdF7vEXe2+z0WMCNWOgddMpOYao/ND5nYrjBvKzP5gFh+lrz2N50HBNX3CSDeg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227160547-b3bfcfd_1672157195017_0.9580687384497408","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227160912-87d853f":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227160912-87d853f","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227160912-87d853f","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"98c01cf4c654039f192a4acc269a460f122318db","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227160912-87d853f.tgz","fileCount":60,"integrity":"sha512-Eu8sTWeWbSjjI8z475gl0pGyhY/Jlyq8Ap2tEbQE6mpLUduOcqFzEmOImGDi/cfKWlPJhFt/Qc+BbFRGBf1zrg==","signatures":[{"sig":"MEQCIH9ARLGtpaeO8I4p3N3DglFeKVadJHE06pJLPBtVcKTsAiAgepX98+qMqWtBu+4H34Tt8Bw1ZWln4N9mzohC5d0HTQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqxjTACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmpoxw//aPM+yFz+CM0VjkS57ghnoTxAARkVptFvJHiHO/mnPsZg9fgP\r\nx5NnHmMk0PteEGlWsop6tHqc7UinAFMvGnIICY+gzmHx/lEJ3+ab1kX+/bTO\r\noZuisvzoZvjpck/sMRTVvf8si+lg99huQl2NXadO6BNo8f9mK0dg8JF0da6h\r\nCd6BvHBmOceQ8OouPh0jpyyil/8BqEBVoSmZlE0BsAjjVfRlFnLZyGaelfLJ\r\n6KJ13SODD85RTdmWloPMlKuuNNd9W3Miccn4/Pn/aNnU8Yk4XSeFtzAZS2yM\r\nzP2CJKlT79azxeBClpY46GFDKsAY/rFSfiUazbG48smRwMXTWKRL54xWE5hP\r\nCDFmwVkqmUun2hTKvisL22Wq1JsdnA77vVcybcloWpyiqV8s71POPz0gCWqu\r\ndgS/PJjxZRT4SSIR6HZ9Enj+ZxJY2IEUpcji6OZfsILIBVQr2Nrc1ytU8cB/\r\nNrllGbh5ISq8cIJsSZOwKuY0CXdBjWS20sYdIIY94wWrTU+44cwWyCYs0iwf\r\no1TJRCpptkspWcal6aRGtyamvev2frlwBmg00ZtsWb855gblbpntvUSZWQ7F\r\ng87+RHUAw0Rv1reVqgRDUL/oI7K4yxJA9eHVcxtv1EoB2mqUEHy8JQQcn16Z\r\nSeBq8uOXWPLLRIg85ezOL1T+UtoBQj2yGnA=\r\n=rbB9\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227160912-87d853f.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/18c2a76864f9c9fc16a33e81a4181114/graphql-hive-client-0.22.0-alpha-20221227160912-87d853f.tgz","_integrity":"sha512-Eu8sTWeWbSjjI8z475gl0pGyhY/Jlyq8Ap2tEbQE6mpLUduOcqFzEmOImGDi/cfKWlPJhFt/Qc+BbFRGBf1zrg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227160912-87d853f_1672157395672_0.09700722841871001","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227161126-9fd2a07":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227161126-9fd2a07","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227161126-9fd2a07","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"d54f0a267595aca8098443385a465c8d276b87e0","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227161126-9fd2a07.tgz","fileCount":60,"integrity":"sha512-GNrrn1/GlanQjyRKOLiFe8IpddSssykTZDHgtWkSynp5ahyOxhhLYo7q/kLSJ3Rqe7wWx2vsOnPzz4D9QGBcxw==","signatures":[{"sig":"MEYCIQDKxAb1kaNQ+WlKxUqBCFW1HXIhJUZKb34RZ/vK1veNNgIhAO8Fy8+E60pm/ZeIMPiSfxLY7lr0+HOS4+Mi9A/xXI4i","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqxleACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpGJA/+KE/Wx5Fpx/YpTwMYmPGEWfPJvLw681m1m4poBiJ3B7VBmhVI\r\ndc9ZxVsnzDDFFCXN5ZhmjPw6fVamiYB8MQgNJ2Mcsi9Z8YZbSW7zEA633oC1\r\n4Rau372Qh85LGHe8UsQ+HTKZfUH2pDeXJol3crVBZjL626KIZJl5F12M/1Tj\r\nrm23ENXUqMnUVjg9+ufxbZyrdFE2A1v3yHCZOp3+FsGUMAh95P3feLMqCG9e\r\nPpRCRsFBdtBitCpWvwIwfOgWtmPH0CUpoRiBJYNvTimDza3bcpl3gEGhZwLj\r\nEkcYoWz0aVEhhGjdJvRz/yBYM1ItC9ipxi5QWJ7S5PnnkGSmt/h+lrnrm3Yl\r\njKMKN0mzSGSs8ijYJUDZp4dudMlAqaL0M45kgF//sQLZrUXCAFFv8D7I3fJ/\r\n8Df/GZoJG4nM4fwEm8PXs/74sy7ehkpakMVghKdTd3cKFcrNM29JSLhKPUmW\r\nUUdfCIJwUJUjhZivu0aTh8DhHkbDp35ZmHP5AZRxDbhn2T6KxVjkXaNUkurX\r\ndEgdfJQRJoDV5cBCwT29QC8PjJCRqhygH/BcdBp7N59qwfwcNJ7syKqDnPaL\r\nfzfb3Z3ZD05PVw9sIiqHz/V5bBkIFu1rFPjhN6akBFObQnJ2ycty/9+hLQRg\r\nKrQpXd8T+jTrvueORUdS4FSg27j3iyFOBb4=\r\n=X1xt\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227161126-9fd2a07.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/4635423ab3d94612b1f8526265109074/graphql-hive-client-0.22.0-alpha-20221227161126-9fd2a07.tgz","_integrity":"sha512-GNrrn1/GlanQjyRKOLiFe8IpddSssykTZDHgtWkSynp5ahyOxhhLYo7q/kLSJ3Rqe7wWx2vsOnPzz4D9QGBcxw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227161126-9fd2a07_1672157534442_0.6601158095322583","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227161314-f117455":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227161314-f117455","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227161314-f117455","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"9e95a0e66026318dd281d1825d8bdef7e251b484","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227161314-f117455.tgz","fileCount":60,"integrity":"sha512-xGNjeNd70+f2c+rLmB/qOishCaD2Ud7uI5J59KUeHIG2CTtK8rhr3OHc7neQittFPojbBsXNz6+cZUBAtkEkYQ==","signatures":[{"sig":"MEQCICw8joiNXxoKjvJ0VzKT+vmPKY8zGwpdRZcGfPPP1ujHAiAgqMnZtjQsZ3OHlCDYwfJ6D5Vy3kGDYSFlWmtwn/h/TQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqxnCACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqRmA//TH5TaHzSzxpf7umE0a45z+zbj6726iFCqUi+PkV+wxqznDkL\r\nFM3DnbKJdBbp9+exYLNhk2xuyVDUn0vgXEFkbFmAImATDbN3W54gHLSKloz4\r\nWlp9oasFPCFEFiICusFJJm/ENjqf5AL9HSxyZlWP15JidnBwNOvHJSz0yi2O\r\nLJ3gwqV9FmLOnQsnEQT02lyJQ8Vi2n+u1VtJ0DwOXW8Zpk7437cvBBTGoqHi\r\ngV6AdlKrrkJ8vTdmcKllEmPQoJeF3iG8yg1rjV/RGF4hdzQE7XvCqQhhjQMI\r\ni/51GyeLcRkGc+r7Nv0eb5ein2Bzu52ZCfts+T1Hs2+lAZ69NQ5AX3erbS00\r\nFHB/3QQzHIgzPkhOJtr6JPdPzTbzYOnT/SVDcyYEDbIk1nrdi1b5KyK51/9C\r\nyKBvYK8vHnYdUmBwpytZpreV5QiwdmF51fBPklZReMaHJWPjb0Ixx9M89xLq\r\n2xGwBhcuMBpDSM7EXVJFr4TIKFRc250znprHdA1+8T5a+nmGsjEzcAuaQqaG\r\n2doD3+H3xH+xQp6vVyR/LBh8r/LwQOFGjDiSJ93Q3I4lJ01s/QjZ2Y+YoSxl\r\n7OrTnVgW3K1E2KmpP1IpeO8VDr11MUwWR0wSmvbDRQ2BxLvaEaS/VItYYFzS\r\n1vFGKlEIKP6QVNgZ6ELuxyRTLtnoDrM3Llw=\r\n=GlYz\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227161314-f117455.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/1673c29dc09d8f2598884dd8068a1992/graphql-hive-client-0.22.0-alpha-20221227161314-f117455.tgz","_integrity":"sha512-xGNjeNd70+f2c+rLmB/qOishCaD2Ud7uI5J59KUeHIG2CTtK8rhr3OHc7neQittFPojbBsXNz6+cZUBAtkEkYQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227161314-f117455_1672157634436_0.9448477296656663","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227161659-271bef6":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227161659-271bef6","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227161659-271bef6","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"aa06c7dead3a18a147d1b7fdf7e25317fe52c789","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227161659-271bef6.tgz","fileCount":60,"integrity":"sha512-MbuUgFheoRimgqRdEifswDY5t/I5fJssJW/TB3H33f00F77hu1+NjihN6HHC02PjwHUBxLh55/SzGu0NgoWGIQ==","signatures":[{"sig":"MEYCIQDr/sZl7fOPH+NJxojBJDy4OwsGZzXiPlCMG4nu0mOQKQIhAKVqGC+xQLcBbi4ViwHZY551zDDqSmVtv5tcZv9ZqFgb","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqxqsACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmq+sw/9Gr9IpDQklN7MDKzLR0jepJIYlDFJual4PmZ7GUPp4Fg8MCyJ\r\noKfpMrSHkFk0fTdXPhVqB0gJwGzT8dP4qYf2z1bIJ50WeFAZkiijNDaTf/kD\r\nLO+4KhD5or2TuUC7hALbz7PD47t+MDz51R/XdfHk0gRqpbZSuMLSJ/+9xZXD\r\nNXSOAN8KAGlS/RMdjBITncpJgdLuIqtwbqFJtm8batj5S8TTai8S0GXgTdQu\r\nevCiTZebJLp11/cL5Qs3RoG1qkGBqKFzEFv79oa6BkUSGMklCKUlVMKuIlPJ\r\nQkOoOXOxvbBYxrzmoy64/AS3PAem4T2nrbP2ovbfCmew4SROs3jYOdDbNEJ6\r\nkRmIl2u6FnnL+m6aWVEAN4fgZgELc6OCvRgzmgszHGtL8c/NROQI18XgUbWy\r\nVUnh2pcklqw1qYi2djPykIGycE/slfZ9l/11o5sEKLwytLdz6HkZHXkzu7Hy\r\nZAN8af7frW5p/bzgrT2EpQ2XXb7pekmaG8hAztYLd0+Y1w5ZqYbSEucF0Hs1\r\nfcLpMTpOZ3yNvmUytH97Y50QBRqCRynmSRnfd50U22nBmNdP6ZINfwVy2P4e\r\nhzjtBL3lZHywk/xXB2AJUPge/ONERiRUHzQheRove/EoO7LKpEBzX+5tPFcI\r\nBp/IBWjRHpdo9QCWwzDCtcufFj8HylW4fAY=\r\n=tXh8\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227161659-271bef6.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/bc365d1d314f88035922e958968385a5/graphql-hive-client-0.22.0-alpha-20221227161659-271bef6.tgz","_integrity":"sha512-MbuUgFheoRimgqRdEifswDY5t/I5fJssJW/TB3H33f00F77hu1+NjihN6HHC02PjwHUBxLh55/SzGu0NgoWGIQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227161659-271bef6_1672157868463_0.45970938530107563","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227162704-0f9523e":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227162704-0f9523e","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227162704-0f9523e","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"e5a979ec18ef8d115fd0ed90dabed0b8d7d11339","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227162704-0f9523e.tgz","fileCount":60,"integrity":"sha512-pkaRsiKeYlck7A5XGN174X4X87LfwR9d/ZUw7+WRAAkGa5cwEqbielvI/CfdrBiXzDQglJQKApQzZDjRpynVbw==","signatures":[{"sig":"MEUCIDRbcP/VabgLXVALN1W9FQaV3yO0Swv0HzTvhN+5oRwhAiEAob8nnbd+dhHpPiqpPva1IIJLty1d4EuxoBEpnTLsmzs=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167260,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqxz9ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqMPg/8CKLj9wX/8GmzN6hykBJSxwNpkwlwiNYJS9/Ll3D79Cn8/lZx\r\nDF7hcizbH2xCUUpwKY52Q/Ndym2yA6ml0kMRIuhh5AB7fzzvSQsDb++DiZmf\r\nmCRP5gQLDkJBoHfE7x1fqeRB7ew/FH0ZElpdwYrCG4tkzx2ImkT308VQ9qC7\r\nUmcPbzSvK8gTtEGgsiU04Vn+aQalxHLq8J0Zz2M4zpQaG2oavXvaKvEcOlfv\r\nJge7g4QNkhNv0ROcDlQy6vmXmcr4fRHK2COhjQHcGyaW/NVRgqaDMqQIy50P\r\nzfXwBiUeCgOd6IeQmSqvBYsqL6VIqGsIW1VZ3f+ydtY0AkdtSsLFymxQM02c\r\n7J/u4L+DosbHGjwr8XLkB1HW1WYOl1aL+yD3eG15sH8MXHea9L5PjfsWjFeQ\r\nTiIxfhs4SB9yx24mSzqreha+pSExM4JPUFSt+WxBP9ckJ5RApsUx7tmtZ4Hi\r\nWOZwFl2Eda+pFWVSyLYfsmvMjJId46DzzggKTdMhHNYIHpXc/OVDqvxb9oko\r\nEZEo6P/fXa7WUdaKKvjPJcZV5mzsdgHBs7h1a3tnMHckpd9jFMKeTfJCesaI\r\noGWIBmjlOTT891fKA4I6PPsnyL6rQS/7pYNhGb9yo6R7vSJq7F/b1pf7GXLK\r\nqhnzFPoA9WbwmtGC2dJ612VvwAxLAFvh3To=\r\n=Ll5H\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227162704-0f9523e.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/d49f70f2886b402ed817b3f7ccc95ced/graphql-hive-client-0.22.0-alpha-20221227162704-0f9523e.tgz","_integrity":"sha512-pkaRsiKeYlck7A5XGN174X4X87LfwR9d/ZUw7+WRAAkGa5cwEqbielvI/CfdrBiXzDQglJQKApQzZDjRpynVbw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227162704-0f9523e_1672158461519_0.7229151045590652","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227162835-7d91434":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227162835-7d91434","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227162835-7d91434","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"5820cbd57f86df113bc6abfce921a6f5bf14ca36","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227162835-7d91434.tgz","fileCount":60,"integrity":"sha512-xE/dhG8aZQxK8Xc1Z1RHE7j5F07rIBh9hQA4zWA7VGg2h5rr0wpc+sp04ZOA3V3myK7IernFj0RUc0bJiMNxJQ==","signatures":[{"sig":"MEUCICnOsWbfLfDVfZyLUMgWo62fY1bcpX8UzJ7zGKpBIKEJAiEA+3zHU+QtaO5HNd1HS1bzYH7VowBguftT4+EqEDZH2Jg=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqx1UACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpQxg/8D6JbhkUkh6gzcRkFuQ+sKhzs8O5rG/UHVoPNEeuS14+gkkZp\r\necejljR2xnZflN+/RGeAp53EeVetfCwfsiIIYVp2ejvjf8pZrXTOjr5TPix0\r\ngU5AsEL3eRMIP1EZHZqVUdOFtEyMYzyronXmB/prmTYfmMYiPE0ogqERldO1\r\n/ghZuTmQHEn1xQKqxnK0OYJ1q/PNf+aAFGsC90JTibB6Hj4R6AD6STPtkwYc\r\n72uI0GJxxQi23rTvxBTy8XWdo3lBsHeswMNpvetCb8YLunMhIhJdBn4AoJPw\r\nnVa/HhKtaSLoivspGbS4j3NVa9fZXeo1k+ExFTI2qZEQwawIwLO6CvfIrgh7\r\nfzEHvTJcodnY26kkH8C+AYpQhqbf7fKHhscSMDgd2Upd6iBuvSbL6lvQfPuP\r\nN4hgKO0T7vV/qIEc+5cUWCCSnjtdeViJYzSjHx8RlRRoDDLKYYRQl0FWhGZ6\r\nn3h8hk6+OW0vfE8U7PAnO5Su7mjRJKEn04madTXLRyz9TIfCpLrK+2H+ScYK\r\nkPvDCk54lX/JyqhSHrXJDsLhq8ATTtdHDD4sycGc+H5SFV/Jsgcu+Rs0axYo\r\nfQyTXdH/Hp4NhlTICgV8ZUuBqZs4OhjEpPQpUZTxPWJx6kHZXecO42AaHd82\r\nOwe/SB5KP7vOSs/An3PIOTqBuxZCQFNJ108=\r\n=OG5A\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227162835-7d91434.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/637978e54544c156186818eb9104c6be/graphql-hive-client-0.22.0-alpha-20221227162835-7d91434.tgz","_integrity":"sha512-xE/dhG8aZQxK8Xc1Z1RHE7j5F07rIBh9hQA4zWA7VGg2h5rr0wpc+sp04ZOA3V3myK7IernFj0RUc0bJiMNxJQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227162835-7d91434_1672158548103_0.3894922352362993","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227163825-277dbcc":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227163825-277dbcc","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227163825-277dbcc","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"e43744c9ca3d28403279321a0c5a7876fcfade7f","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227163825-277dbcc.tgz","fileCount":60,"integrity":"sha512-MTMg1G1xtFnTf8T7hHu9PEdHP7xamzkSQ8EAmwU/ePZQ30PUD6UOSgX9q8xj6yKusJGPCFkeULct5WmgvpbIDw==","signatures":[{"sig":"MEUCIANCcV56SifJ5O7zMX0wed46K5NEHm9rTefNaRq28Nl6AiEAluncu5KydVjE50ebDCQDpgL/n0pmGaf1YzkNsBZ9fNE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167260,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqx+jACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoA9A/+INanw0jMNE0lhayo4ufc57uknEbCUfySZL5czfFl/iJDdZVy\r\ng70TLqrJyiYr+JyadAIPL6FFFwURuLCE2OIness27NomAhkL5wzD6ugpssdj\r\nXiQiIkfTRimo/nIzvPgdGw+Aj+npRHVmoH3EDCp6a2pE/tbHBIoj9MGDUqFj\r\nTL0WVIMFSQZ4J210yLU+YavaYzQTPCihz7wiI37Suj5hihby95XtXnMsq5Du\r\nNa3vZ9+ZSMgyBH1g0tPDTsbE+HdEWwHP598YDFxYnGAJ7UNNcv8ntQ9vmXU0\r\nvDdCSHXMTSkH/WxoYM/cZaJF1uhHptCb/RQZgugCwMF+0bsbCEAffVgh8buy\r\nZCCuV1L2+FkaY00jXe+H7yJJv6Xarxu6OeP8vTPcnznphDQ3xZ7kIGk4oFy2\r\n6h0zoRUqa99QQAHgoU80T0Xsc5Ia9hm1JfBbDrHB0h8i/WINdsH7fN1gABiL\r\nen7wgFNgK5rCMwmzWihJhujPv0ApyMmszB25lkChZhpGVvyVxss70txsjM1J\r\n44mVP46jA5eOLkBPJKVe0LQIZLPk60iYOJ5Z1tMlkG2heZ7QHLE3hu7aPnZV\r\nuYCrqP/6OhiRqIkHPSHGsujciziilx4EDmMku1n+o5npjIj6wiLWvH1oqNxD\r\nE5mRwLDjV4Lx7ohx32TXfgqd1458OOM3aYg=\r\n=r3y5\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227163825-277dbcc.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/24c341f84cb106b3ec0755e987d05a69/graphql-hive-client-0.22.0-alpha-20221227163825-277dbcc.tgz","_integrity":"sha512-MTMg1G1xtFnTf8T7hHu9PEdHP7xamzkSQ8EAmwU/ePZQ30PUD6UOSgX9q8xj6yKusJGPCFkeULct5WmgvpbIDw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227163825-277dbcc_1672159139206_0.9935292025203402","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227164539-3de2bc4":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227164539-3de2bc4","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227164539-3de2bc4","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"e56a29727683dcd9b491bcc6c2743307b5a1f974","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227164539-3de2bc4.tgz","fileCount":60,"integrity":"sha512-S9kqkDydpJlj8mA208AvrMrAjJBeARCuu6ksPOt/YNtdC/C3tf5StNkdwXOYcO2mhEHRpM07xmbyzoyb1gpmLw==","signatures":[{"sig":"MEQCIEP+Ajven0oKn6trnLqt9IqjFBI7bO1xmSjaBgZvi4U7AiB9OLMVNRXDICSTDi0HhyOhe+2ysu8B1lZTmBEjxMk+Gw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqyFXACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo6cQ//TojVlQbeGI+YMRai8KsILkfvvEO2/K5M5Al9B8vRFFBUOj+l\r\n6nKq+Ps9rgcjvSksi+ljq+xemhxG5w16m8/h+vD6lIFpPHHIEjZxy6HyNPIL\r\nWztpup2DflXXrHf4RBDOHv+mqtmzixQFxE5OHMKDSOrprKZ+wUHQd2+rNANP\r\na/3208QrVkqOnaGqjYQUFXE21EXAw6MBTwHo7TW1H36xKseeh7w4L0rhq4Q3\r\nNcYV3OpKuvI3iNJFMr6O/BcNCwIrl3GA8I74G0C8mldBByvNy/XvstaWunUP\r\nrJj44g2lg0/4p/k/8AXrFVKBLTsor37B2o0QFrBU+n4q9QDomReFYJRwP5e+\r\npiCdPzsWklHvIINn13kjIZXDyVioxL6MpLnJFou3+mJqHG8W7q0IbFBcw/NF\r\nzi3gr7Z2YmMixyrj3LxNGgUKjmGKr/BssFFQXGHuNplAD9nizHQCgalDY5xQ\r\nNNqfuGA4R8tEyzQgWG6ckpqTQ5Qdh1yUMyCczv9HqkwDhr7HMU7BbqsQWB3f\r\nYVizvVlTWMVkNQy83YnPWhS3zBEf3cX/w7Yx85X+pJeTGlPBp0RCMAXsTfQs\r\nP5wnbbE6hG/GqcFkOvNxu33iw7357AxiNYXOTOqgwu+X21a4NFtHXU0BA5rX\r\ngga8Q7Dj+4NJMA6zbpHDJCBiVFx5Esu8OkQ=\r\n=6apU\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227164539-3de2bc4.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/d3ee4d48f10e520863c56c405edb677c/graphql-hive-client-0.22.0-alpha-20221227164539-3de2bc4.tgz","_integrity":"sha512-S9kqkDydpJlj8mA208AvrMrAjJBeARCuu6ksPOt/YNtdC/C3tf5StNkdwXOYcO2mhEHRpM07xmbyzoyb1gpmLw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227164539-3de2bc4_1672159574976_0.9985164315150783","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227165101-e787ce2":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227165101-e787ce2","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227165101-e787ce2","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"8c05c4c94c28078c2e657eccabe6e5d5898127d8","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227165101-e787ce2.tgz","fileCount":60,"integrity":"sha512-kmZWuogbodk55HuPsrZGabBIIlmQ/RTuM640TWAEq45rNKsDgMUP8WAsrzNP0GbyePwi2g7mNZp+d5u0J967EQ==","signatures":[{"sig":"MEUCIAUD0wWoQL2iPJseEiL09cCQvt5bgsr8T2cAtkXU5+XuAiEAmI+jnm7xa2Ct/cCPdGAJ+9rzID6cm6S39aMhlD6ATvQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqyKXACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmpf0Q//YRihHntD2Sd33G+WZ1Ygd7/OfJPY1LEYJoWChb0H5gUIwwRA\r\nd/jY70abVuCxnx2dZkDJKYw9qD3E6es33E6h31ZLdnSF3OjLoMs19+ZQcjh6\r\nXF8ZJV7/jNxqwmGwkfuHqUfGuNIxATecmyJvTySx0B8bWLsLzmvjFkAgCDlD\r\nAe99sQ5mO/K/HqvemGjNlBPvx8whx+RhhQ6GmnpJJ8I8QdUxCR9gj/OA7P+V\r\nS8LdkX4ckNNt11vATqkKQQmqZNomYNWRzj3pEMdvtCfIw+uFJHj8DdhYqeBd\r\npT+c8JdGJBCqbizR7RVfyIJy44Vu30sc94gz6rSbA0cwUFjrUTvCilr2Z3QV\r\nMJ14zqIPxqu5hEBAbgeuqGlPlAAoOiVz3wiVE3nk9JGMjJooLHq5nvxEcHRk\r\nuVtDNz+jQfa2kU6BpXhE0So+iy99HewpgfTkG7B1CSghvv2QtVz/w3kYSBSK\r\nQGZodGDwEGX4yFbdV3AFVjFQ2ztAr08TzlocqeB/dUBf1I6DrIwpj8SjIpWK\r\nCH8ByMaNNXXpCabqaAYfUel/2m8+85xDUAdI6fLxXuCmozogYB5ItD0X0VdK\r\n7VWl49cInWxikbiL8Ua/6iVDxIW3RcUwpHLstdpYRVihY0QNu+1f1QJIErko\r\nHw4OmdFHmvtoVGz4Rrk90QW3KD4WMd8Q7WQ=\r\n=0qA0\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227165101-e787ce2.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/7b56ad592527e8a834540d65b05176d7/graphql-hive-client-0.22.0-alpha-20221227165101-e787ce2.tgz","_integrity":"sha512-kmZWuogbodk55HuPsrZGabBIIlmQ/RTuM640TWAEq45rNKsDgMUP8WAsrzNP0GbyePwi2g7mNZp+d5u0J967EQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227165101-e787ce2_1672159895293_0.44066337116451226","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227165313-f9f1953":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227165313-f9f1953","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227165313-f9f1953","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"d52c4f15426c5facc7c9f4f160f2967e4e71cef4","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227165313-f9f1953.tgz","fileCount":60,"integrity":"sha512-re9gfpGkdUFqWAFRwIJArLkG3BXiSKU1ySJQDBTRk/CSMvmUCieuShxtkPP60ELwmGsXWozZL2yb1ImtrjT2pg==","signatures":[{"sig":"MEQCICaIzZKTh2OGLvn2XkQab4flwIuNjQZApy345BbgjrCYAiBXJdBL+zaHDa4Nm6ZIPUnPEcujyQlooAnxIp3zqsn9Fw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqyMbACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpgJBAAo/oSd3dPzCLNfh2wdl1qgkM3ZGF0lc1oiiPu/s2RTe61xllU\r\nZiSWKGH7Um6tjH91Syo5MmTcq2z0cwWN35fOKxpxpud4tUWmBJTnNOKiM+xy\r\nbbU/OKUBSY8PdfnGv6dje4k6NI6UUFFk3uod8PcHCwyWjK2RXkhNaeJakzAs\r\nHjyzs6cMRy5neAd1uapwMbPvhcaQtyAfqsBqsNqTSp/6OqNqxJ8IUeFjJDmx\r\nFvPj3HbS4wkerwflcGMi1R06LkOtbigeaZEB/8MxpWkrtVelq0n0HBa+dJC/\r\nqvOHggOPIOb/XSmC2OE3qjUOmrHYzzJbiUiLY48z8hJJs9cZ/DRWVz3gm7x9\r\nNs2jTzEWNRk9b8IP5D3afWk1+mqqwe4v2mL7kihkfwaLyrNpFPzmk9lx0Mgv\r\n3fHAoz+0ruG727jP73NQt2K2XKktbsLKupAjXabSMXHoZTKmsvIhl79d5UX5\r\nA260I8IEwx9cW4A7fRmpOcTDNGCKZRnV2EfDGi5BH0hQnSLQpZRI5qYVbCDF\r\nPYlvHZ+DIRA8ZeyIMRKJNOit0VN9gdBiSgyBAJ5OSQ3uHNZxmAeWgVt+5HGM\r\nUhSf+unJCYVUMHMa4CJwI9tOjXJcPX3oNbbw0GQhyJriYlopjEAs+Stt4loG\r\nl8WT6lTPr+bp0eB7zUZJ+Q39LU5q4GcN8PM=\r\n=2FS2\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227165313-f9f1953.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/3e74016f9417b42e1fb52a884dc02351/graphql-hive-client-0.22.0-alpha-20221227165313-f9f1953.tgz","_integrity":"sha512-re9gfpGkdUFqWAFRwIJArLkG3BXiSKU1ySJQDBTRk/CSMvmUCieuShxtkPP60ELwmGsXWozZL2yb1ImtrjT2pg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227165313-f9f1953_1672160027749_0.6031425688106131","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227165512-252ba01":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227165512-252ba01","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227165512-252ba01","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"ea9e85a546e0a0bd4c84b7eb0faf5be87aef194f","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227165512-252ba01.tgz","fileCount":60,"integrity":"sha512-4+R61UNiYHspWQ047Xl1ADoxAj+7dm7OsU4/fzOkRUFe0MZL+OyIfKT5DDuek8KL+Yub+I60ZOD/sm4SxT4Y8g==","signatures":[{"sig":"MEYCIQCiVGcsCirQKqVbepOpob1J3QEQ2sF4dLuTdhb+UZOvTgIhAKzZuyNc2wWY9FVBC5J9qDXG+CZOwpAUATqh0vFVH4LV","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167260,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqyOTACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmpy9RAAlwSWWwnKRegUzZje3e3qBOahReZ33EN7PAK8ZSm1HOOt0Uwf\r\nfDq1+cQyvfjsESyWY2CF+fzzYmGcUW3i6vsNjC6qyxW6suklR3HVaEaEIDWh\r\nr4e0KO61voW9cdKtrfgcf9gFBDteVFv9J8ewk1CxVOpvx8UDSuRPn/kLB9wJ\r\nYZ/jYht6cj8GGISVKeEKr7C6vEIsOzUSRsi/1sUOEYvr0Bmi+ghSwhK7N5JW\r\nUFiT3NtSAg2b8E4LZAeIqrJ7t3WvcmIAAZrfHuhAiZGO2E+IcZWWW9yuYMHp\r\nUTw//N8XmRq9nGUFNe33a/UntgGrp/bqbmwk7a5ZNFgW8o24kYZBb/bgt3Mm\r\nv4DokmuMd+CwKLuIY+Y06Y0zFN1fCw6Nv+z6b18UFP6Hx/2pPXQq0+f0Xdd8\r\nl0RlDrmxPP2HV3QGIApc9pchEN7nl2u8JPQua/1v2kTnRTdtsebwfmdvTybU\r\nPM7rzzNel8WsczVF2DqjcEAUqI06nef3S7ew8AOIhszjV2TPMbDYa6K3nWKV\r\nhPQZcv6DCnwQuK62pAG7cO2ATqG2Ynvq03HbvyXK0CWzfnP2Sbkw6dpQBR9j\r\nYgbPGGw1/RvNvnPXoeiiT6LT/1AS+u4s3hg5YZPxkh3G905FGFAnkPXbp6oi\r\ndRcj0Bon8pYcYHadhsQeQ48aPkHDdrdyFYo=\r\n=wAUZ\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227165512-252ba01.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/8e84f22ab4d42603d5a5fe837a27b05d/graphql-hive-client-0.22.0-alpha-20221227165512-252ba01.tgz","_integrity":"sha512-4+R61UNiYHspWQ047Xl1ADoxAj+7dm7OsU4/fzOkRUFe0MZL+OyIfKT5DDuek8KL+Yub+I60ZOD/sm4SxT4Y8g==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227165512-252ba01_1672160146816_0.6935111711681345","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227165610-ccd6317":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227165610-ccd6317","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227165610-ccd6317","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"518bc482ec3549a55f66262cc03ef2e1215e7a66","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227165610-ccd6317.tgz","fileCount":60,"integrity":"sha512-KcgIrMFcTuvU3rZXN9qlywEvjnstYv66eQWBeg5C5Bb48XRZiY65YXbYR+YLWwsC97GuF4diOdNPpNAlZLoTow==","signatures":[{"sig":"MEUCIA+CYx+R7yiakCsusfdV4Zb+TvzSCJiEvnv8nFpy2hwSAiEAnOGgm6+vDHduEjjdR6Ojojr6XTOmDq3IHQUyl9c6FPk=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqyPMACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqBtA//TidvBcDoKsDrpPk8Es54oF6x4KcJfOHFL81S+4dqga8zEAgv\r\nTLI/L6sL7A1lASf8HRoMFayQmIUyXHjOqV/CQYyvHK6KTzZ5WUFqaZqZslUr\r\nCjv7ZAHZo3rhDaAiA5cQ4Kqx1Ssly4R3NspCw1v46URkrfL8gvfHgcsQAMY2\r\nzv64LgNmMorL/4KkpGefEFhd7IhWv8Thv0tWyg49YA+dmcsHP4GiHQ2x2soJ\r\nnPwSene9UDZq8ci7q4L7wZU43nZvG0BanMGwmfHXxX2gBw0V7XbQtIdO+5Yj\r\nlG7FjHnSt/DQSS1ZiR2qj7h5wCfbrtCChJrL/AZLi8MuRPm6G/kUyoP4Pi6S\r\nxAcbfHHwHIuYguVitA193p6kCYSOSW+G3g5a6ijp520dTlkjsQ/E/koTzT6L\r\nbZ0nJNy6FcpwB1J+B84Bn0c1qeSDhT/LnqR30X+GCIKz7PdNdaOAel0qDvU9\r\nRXusnBLT2WeKJK8l6Yk35xpUShXH7z7BwzWVLv1zwDrh+/NSLnfVRVSlrsQE\r\nk7XEIsfgyH4JEAcjndx39uRqa6AV/byEsA0a7mJCT6IE3xdvI21YT6tP6/Wz\r\nPOpkY3Kt30ui8QB+J8zToK01+zgPSsmxVSo4Oy+J8Ihc/Ul54D2q00ZZL3jT\r\nbz4Dj2ndyKimdvcHdNnBw4vS2q93xcZmukg=\r\n=x4Nd\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227165610-ccd6317.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/e7811bc345bd60bdd8b7e36072cea9e8/graphql-hive-client-0.22.0-alpha-20221227165610-ccd6317.tgz","_integrity":"sha512-KcgIrMFcTuvU3rZXN9qlywEvjnstYv66eQWBeg5C5Bb48XRZiY65YXbYR+YLWwsC97GuF4diOdNPpNAlZLoTow==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227165610-ccd6317_1672160204602_0.999908129562894","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227165759-3de363e":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227165759-3de363e","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227165759-3de363e","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"037eeb37ecf230d6e182f6d6c66bab7b0d7b6cd9","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227165759-3de363e.tgz","fileCount":60,"integrity":"sha512-pJKXl39Jaks/Pu0NSPt9LowgwtEY4GW/bcRv9HX1/ktdR7Z1sB7TfNSdBSrTbOWef9IoufDmcKxmXoZXp5K1tQ==","signatures":[{"sig":"MEUCIQD8mKFghrIuHkaw4bajajWEBZQt/9DdgwwPy2GWzXC2NgIgScJZis+VlzGDsIHrpTCvpm2ZV3UfksOSMV4VreXWQe8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167260,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqyQ5ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo69hAAgDmv5HzoGchZ+ETgHzDueLU4hSXhqG4kS1ZoSsiq+f0EEML/\r\n6qe5j7WU0CP3Ta5+wccRcS9OzMF4V/dcBf6KizaTF6U+rU+sGcdU9WxVOKLA\r\nKPcgaGyzR+gNu4ZVfdDGsWgexL7LGznZBX8usYv5EU+5BdsNS32z9Uz9itPt\r\n9+OXS1wuRQ4EIzic7otghNpZojr+w+koXY4Vzxt5awta1U2lbXOSis7EY9Cb\r\n2RypgC0VKMY7ylcbpFFXMJPryYF+dhZIUHxPBP5u45x7VkakxrjozwXkKR5v\r\nA674JIXCA8xg6M5lTcZ9t0zSE+yu0hDpgN+6V1L+vMGqCISjk00FyRclSvfx\r\nsVWv8WtM8Lr2pYVyIYZcrw9wdGI0IFIoOMxvv20++oES3f4XoNMGH76oNMay\r\nVt96AQNV2QcC+boP0WBT28swhm9LUsQvq1quSQQtodtxWZYimU3j2Og8Wkiu\r\nCGS045KPkp/RvgqkYAr4ekPlnUrHyoBcrGQ+DMTdpyAkt/WrCGzwWe9R9/B8\r\nrKs2Prn22lR8iHAyQULou4r5mlC84dV6qCDiNOHgPHVsLGnYn38apqlzVvpk\r\nsuc50JrcbCTi0YU7CM7c0HD6RZWVYKF9Eg9Y/CCEdgC9nYhGdjXIKpxAy4rW\r\nV61yVYjgGbIK21D6TNqYcEjkv4fwMZ2oi/U=\r\n=7TYc\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227165759-3de363e.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/49ed9811a48f90bb65b3539d418ca944/graphql-hive-client-0.22.0-alpha-20221227165759-3de363e.tgz","_integrity":"sha512-pJKXl39Jaks/Pu0NSPt9LowgwtEY4GW/bcRv9HX1/ktdR7Z1sB7TfNSdBSrTbOWef9IoufDmcKxmXoZXp5K1tQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227165759-3de363e_1672160313044_0.8480715102023115","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227170138-a38b6e9":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227170138-a38b6e9","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227170138-a38b6e9","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"d9116e6f13aeb2238f888db705e601b17a61c330","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227170138-a38b6e9.tgz","fileCount":60,"integrity":"sha512-rs06zAa9ykPxbe4Enx7w6q1blF18XLMejcpJ7qM/3O3Bn3p1DnEK8lk+odyj789xgc6m18YUqjuHhEuZ7WXEtw==","signatures":[{"sig":"MEYCIQC5HgGEdz5prmiCcG2rBZVSeQq9LO0TNwWp74D2LvCz1wIhAL36PoBca8QuAog+zq2WkFJ3svcMwKiecxEw49CedrJI","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqyUWACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrTaA/9Hk/f9RO0SU7t45gPXJaRQ+FwaMD1SPbQPZ6DLHowQB+JNc/C\r\nQSmy88bBfvGbbEJmenD8JNNB8bzNeqp1zFQvOdOP6rGPrquEINLeZ5VKYRFg\r\nWJ1rjdx6/fGoHnvoYmRH2hhB3mfp9ezsKoCgMXCUuui59ocAwuau3N/ru8H7\r\nULE8abcrJrEVYxCEP53NNxI61dAFU4qWDsuqgL1SevM4rNNmTO/vXBdcZRtP\r\n+TStfpgUbCV3Z/1g9wHsxlFgbKgS+tXdww2e8PXyAq9ryjvFVyDz3+M/hYbq\r\nKAzzDPQa56VrwM7L8fpafZKAp+8xXMg/6Z2NIptPC8x8b6dDqdofBwyoAqMW\r\nBbJlL/wSH8ECPRHqKply8rt1LfZxYebgq/itRr4jc9qW8SPa5La/r+wPsHg5\r\nNhVRlcLBQZ/jJw39kmlvmis7SwcxpLF7nEVw7uFn9yVNFG4MMVPUOGsjOVuH\r\niMrcZuVOznzpJo2GYt1DGdG8m/XAbP5IBjPPlJ7UisIiF/z252PQQULiuwnY\r\nn2MhYUSDnIKfc8o9plHBEXKyNAVrfLFfL5jkwCcdNY3vdppxlJwzXwbRfr+h\r\nBAYFviV31YbLbRsjlEcyZ8bJLlr0G+9pqjuN9J9fvUopYLSv/DFnxktYHXDA\r\nKbJGhG3AIhycQZdAnvUGFFF0gkZhu0C83xQ=\r\n=yAjj\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227170138-a38b6e9.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/c9c709c344cca0f30475026d77f54da6/graphql-hive-client-0.22.0-alpha-20221227170138-a38b6e9.tgz","_integrity":"sha512-rs06zAa9ykPxbe4Enx7w6q1blF18XLMejcpJ7qM/3O3Bn3p1DnEK8lk+odyj789xgc6m18YUqjuHhEuZ7WXEtw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227170138-a38b6e9_1672160533881_0.9364629387248766","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227170710-fb7f79d":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227170710-fb7f79d","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227170710-fb7f79d","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"74b9b2f2fc8e70e04c5f6e4419b2790fc09f324b","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227170710-fb7f79d.tgz","fileCount":60,"integrity":"sha512-h3fIzN4AaOSoUKySB5NLCUHIq51icqR2rRmjbIcfrm+HIQmgMW9wnE0GmP+PhOjEn6twKbVNmIfA5OAn0me49A==","signatures":[{"sig":"MEQCICEDnQdgugYRV5kz7aLqtm0xu53Mxqr6FkHozrZIYJIGAiANs96Ne69iOKRUPgOrmMzZRw4HAwqEKkQMTEq7NxWuqA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167260,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqyZrACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpBTQ//U5AkBbpBw+5Ie/VbVew3dBHw+M8Ddrk/ZWprR3MvBSFVyAkL\r\npIUZx6gYqqH0nQocwRkyI7AfFXh/Ya9bABuOQlDbiLotftgmNjH2vYxL6zZH\r\nPi+pr3SOJjkRKEzlG/5OCmin5lSUhFrx2zUkEfbevWMjTj8Z7XH8MI9U4hdq\r\nmRUZ9Z3V9e1byaZ36QGgmU2pgqzZzV3lrAkVH15EVkIs+09Tff+gm0PgCbDe\r\nRYe6jbMHez5t6rW54oPypVwyrqtRYVWV8ygPZMKrj2ey5GowIoZp45dQIyAb\r\nMJlnariCPLgXELO6bhdYtL052VW4C8CMIJDn1tsmTZCjvcwjky5NNPTVaGul\r\nH6eV8FHRpFlgFmlD5gW7UU+nX6n/OXjigntTXnI6bqg6G2JhdAMdPLOZxv7l\r\nn8gx3ZO/cpeMUfL5RIXhNV/XkLn5+XG/QAn/C/6pERtrjeA8ho9rB60PnYoO\r\nh6pHC/e8Ex1aTd2XHDXvyykxi+PeRXJI0lk+tinfPoCdRBJ9xRhgJkctuDYK\r\n1Nu4bYaRJ8IZI5NlAz0tmSE1mZ6Exl50c5nOv5prK1vMiWsBB2X6NvgbyHZy\r\nNg3Idi8Jk7LNuUAO0Sw1yoQfdw4XlgPeJH2IymJZBFY/Ed5TxDebqtdPu+Mv\r\nPqRComI//3onOwyL1EJCwOcFxFRH3aK4eGk=\r\n=M+4k\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227170710-fb7f79d.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/ce793b6109075a9fdc95440b79ba1818/graphql-hive-client-0.22.0-alpha-20221227170710-fb7f79d.tgz","_integrity":"sha512-h3fIzN4AaOSoUKySB5NLCUHIq51icqR2rRmjbIcfrm+HIQmgMW9wnE0GmP+PhOjEn6twKbVNmIfA5OAn0me49A==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227170710-fb7f79d_1672160874926_0.26304013128280856","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227170811-1b98b7b":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227170811-1b98b7b","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227170811-1b98b7b","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"9fd2f43df75bfbb2f23df4cb7c20166c25caf8ca","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227170811-1b98b7b.tgz","fileCount":60,"integrity":"sha512-0ctFUnYXAWh14v7C1sJsCYonno3gNYgepxoJbNOoAiJDSRUHUonmtBYWXvGFqFm/UYzWa/EhVObX9l2WpCQwbA==","signatures":[{"sig":"MEUCIQC5FiYkD/fEVr2ClxjyglRvy0nYWGR3wtjMlS9Q3vvwhAIgf0D9NOUF76mhNKCu4JQwQ02lK5/zH7Ih/jvmwUujmUw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqyaiACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrHvA//T6+5MMUD+VGI3YwsEeFC3XNiGlH6CqjNrMwCk3cAyhiGH+9I\r\nFE2sHFno0q4LYTnYyvtFBBEQVjZfXSEabMNOAtUKsaziWDoh3PK0uC670mbE\r\ngSzFaGvKlgcM1gPCrtCvZSNW0gY2h+tHBR7QSHBw21srm1zasQ2YOne2UyLT\r\nCA0ve35Lys8zKg45KXvojWZN6IT0EQ1tkVQyr18S/Olm+wYKsG7BNaUbspyk\r\nyun6k2O4Lyj6snUUunfMkL2PSDFQLnhJybuiYdHqUSfVDSZBdUsMLgsmBQ53\r\nW4Bc+dSca6cb4CyCLjhhWT49hnm1mZVvtP9GEaphpwvIQU/NAuj1t6B8oBG9\r\nI/yAJ2E21Vb0ApnHsTxkqJ8Arj5jObJCFIFeFILKyjN1Y0YQla+WiiYg/eEx\r\ndJ1E3iG3ngWUS2y3LZkomQXqmBw/ebvt1TDx/pjTtuLQAkp6uy+e8m/f23r7\r\n+D3s+LAGvJW9vwlyJRbnpmXzfw0k170Ym3UaTy/sv55K+k5bPfT2s1+GJtNe\r\npMotPgok1h/Dt04kJ9DTHmuV/2g0sGFHNjtNVW8QecgrcBGm0i7705E9GSPW\r\nAoib3/d2ZGpAFKedh+CIMBcBu0biDjvKdk19wqKqGmJwrPelxpUxCismTguz\r\n/oYOU1RMkiKFS2BtHs/hfmlZrvdx085co34=\r\n=LMq3\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227170811-1b98b7b.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/6e42f5c322a565ce997881efca5a040f/graphql-hive-client-0.22.0-alpha-20221227170811-1b98b7b.tgz","_integrity":"sha512-0ctFUnYXAWh14v7C1sJsCYonno3gNYgepxoJbNOoAiJDSRUHUonmtBYWXvGFqFm/UYzWa/EhVObX9l2WpCQwbA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227170811-1b98b7b_1672160930016_0.38679472298985806","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227171835-7da3b70":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227171835-7da3b70","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227171835-7da3b70","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"fe50318650220a6f73b6f4bad53280e77a35b4bf","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227171835-7da3b70.tgz","fileCount":60,"integrity":"sha512-hlQFI3P+xHDkOizVcxBri1of0RVJn/dcKitJvPTnWJXwj5b5EgQpZ7AQwGchXjFTb4nRhdHuA3L3bx/aLNmOjw==","signatures":[{"sig":"MEUCIBTJOimYdNUP4KA2C7HohyOQjf3iJwu6F5Ot4M8TCDaiAiEAt9ISOa97OL03v+gvszEMddx4091vDl5aNkiqPJyI4r0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqykOACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrpNg//YFUv15q5Nqhr1Yq4AOyTLbRZh+wd/ybse7fO0bM5tUN17tUx\r\nOzMw0b1bgxvPkf3oah7uLHDChC+Dk+9libX6/NHAwxEtWebkPWYqa9+DrG89\r\n8CrAFHr1j5F29GIvqubi3gLwrEvgtt7eZtcksk36SSEZ87StjDE/vmk2WOK4\r\nAw0umlTlZqZtiSGVUxeFxDZePcep89jed7KjhMBDASlMGQu0s/VarG7FrOUn\r\nfuoChPNxarTwqs30Qv/coIMhGHTRj/BsG5RtXmK6ZDwAe6EwuFKz3P/4jCSX\r\nZGPbEy3ldwQzd1iO8UqKOVwXF3i8Or4AHAr0+aidw2qN/ear/aE23JoJH5A/\r\nhNB91LleoEA5svnuB96/8n02RuJL6+awegZ39hdN9kBTRnxPhauIlFLLaY0o\r\nqXe6oVYvTzqJ2Y2XMnz08eS+Rbrg6f4bgA09eoW5+Nr0w27vQVkxYi8tuQeV\r\nw6mMlcrdP6v74bcKh+oDK79HuViJK597ZyzVrV3Uk9Y7dTM6S96AYjrhH+x/\r\n60d513Tq73AlIvBVIyaEPM+Ys46IdZer+VY8kgyM0Bcgfp4fG7e4rTkOG0GE\r\npnd2OzyIjOK76UEQP/oqbL+3oDHZixPHoRVS9POL3KrRM6BYyH21KHfGvi8u\r\nySz+OYPriAT39/WhJe8STH0xkdbB8eOYlu0=\r\n=45H7\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227171835-7da3b70.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/e600cd6e471dabe7c3f97f37b0f7939f/graphql-hive-client-0.22.0-alpha-20221227171835-7da3b70.tgz","_integrity":"sha512-hlQFI3P+xHDkOizVcxBri1of0RVJn/dcKitJvPTnWJXwj5b5EgQpZ7AQwGchXjFTb4nRhdHuA3L3bx/aLNmOjw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227171835-7da3b70_1672161550145_0.2745699874826866","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227171841-4caecf6":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227171841-4caecf6","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227171841-4caecf6","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"62baff6fa2a1a10324e8d7739f865325d9f2b2ab","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227171841-4caecf6.tgz","fileCount":60,"integrity":"sha512-EeoCf8wmErVSQatq2PmV1K4URaVggxUgk8dMCi3wFD22igoaicrdYJaYFOjc+f3usvBfAbD/whmIwj6uuEPNCw==","signatures":[{"sig":"MEQCIGTtXkzDZ02QZ2j8eh6PLQK3Qj6VHoifHk+FX8sfojH1AiA0vbccwfsB5rDaH+9fr7okanHxz/oynPX5QGBfy2ra5A==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqykcACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr+BhAAn8RmyxWThIhKl4eBtsK5clpnzGuDBclV55b8FR+nZMqV0hpN\r\nRtDoVfy4zFgbLQh2lbacPrXC6QNQrSuwdJGpOx8mJrOLu58r79evqrDXKhVC\r\nGCVeOSs6WivV7BCe7dQ4cRjCoXx7kyYyvoht25Fy4WzTk+ZzlGEoPiHt42B5\r\nNBGZK4QmiQ7qjygLD1xi88356W3mqW3C6hHMv8m+UuQUMg/VEmACQ3l7UdfJ\r\nqio401N0l+bycsQ0C5vTcfB/Lm/C0mfw9MK0moq4UcT0PUea1JOb1Bi/WPy6\r\nkhInMBUW5eeZO2sGXPvsfOjx3UMIItNfm4vQFN2pqSwfIcJEHRFhwqHsfMJL\r\nd97cPJVzWW73gvi+Wu/R70eevUeXDhqhFCVsSAJj0Q3ck9T47YmwIZifKysz\r\nGKMdIn4VWYtN0kYCgTLK1EIjTLHN9MgjLLHe5ueYSW7CmJ0axQvYY7raRjMa\r\nLQVXJ0LB3fHAQ3+OPpXE3bKivhdATBaUThX7aHJaihVUaneCH411F7KDIBv1\r\nxnmpN4/n4uj7fghFu7LA88Yp2RTiRQpA6G9b9BumWGb8ZadIPr6fyE8EL8/h\r\nv3Ohb3rxeflDg5cmZV0koPQgeE8DltTkSpbxjsuKKQDCfTGfO7NTT7QUCwdc\r\nLyWU+Ow/vQ1NcDwTVhaOCLokWyGHF1JUAZU=\r\n=vvIm\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227171841-4caecf6.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/d7258e189a9e7b93df9a40ac19fbdc6a/graphql-hive-client-0.22.0-alpha-20221227171841-4caecf6.tgz","_integrity":"sha512-EeoCf8wmErVSQatq2PmV1K4URaVggxUgk8dMCi3wFD22igoaicrdYJaYFOjc+f3usvBfAbD/whmIwj6uuEPNCw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227171841-4caecf6_1672161564555_0.39995406586548476","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227172415-2dcd7e1":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227172415-2dcd7e1","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227172415-2dcd7e1","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"0a43db6e0b9df6b3ebd7c2552b89fb4d2c380a97","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227172415-2dcd7e1.tgz","fileCount":60,"integrity":"sha512-fjbDHr0T04XVrQnZHtPcBVFC2MyVEQ+7aLEi/V/h/6GM1rvalWGKDzuQLWxufofdwjN/Wcgxa/JRi5HXVP8vcA==","signatures":[{"sig":"MEUCIQDCv5vYoowTMy+6X7Wa3c4nhmiIKSNoB6b3Hhz1+BTupAIgeZIRDlAx4ifmHSirWm3HK1D1y1yPIOjL9KynKF2Mkd8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqypjACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrliBAAl0pEs/JVEBBFh9Xki0uIR/N5KFYxR8pOe9MYhTI0s8fEFdvB\r\nc4fqdw9uyy+mSlTQx12kA8Q+Cfs3FicKptiOcksc6W7klfR8/Jy9aY30Bb/w\r\nyMr/xt1YsLwtWCNz0O6uon2pFoGKhIVwTuGy2WCFzSYFKmci4OFDbA1HtVmh\r\n28BVHSoAYItWrVAlcpFomFIuzaZyQv7Sssb1Y7924nFhK0VCvdnCVPTGxXdI\r\nptefvD0vmOtd2gtg8JZEQ4IgiIDPctCuz/jAIbpZRBPow70FLrY7bjbP9zIa\r\nuD+vc5iDHSnayTMMilSnAYf1Hg7kr0o3MRB2YwbLZvQQPlEOABe3X42Lmt1v\r\nL8fLjKO9lH40gqDkAZcrpH1Wfw3NIVPW8NG0oj78jLXt3jDChUaB9Mek6EGc\r\n6a4MbSE8bdlw5UsZ9XNi8FljZfhQ5yxXsBWRsKIIk7wa4+4MZVbQ8Ye4RX6L\r\nTfXeKFfE9/Thq1R45fe2A13PIBbgFSlhgV38TeRgx+4fKhDGGMnd7H+v1UHn\r\nX4pLwV7qYOqsxXFOXyZjKuLJNyC9vmuHnVc+dKztxAoLNKsMX66x7xbL/vuZ\r\noDO15VJ6OWJIX9uLIn8ZytOxFDuJG5E8xU3Kl2mSkJsOagBX/RCOf5oNUAUC\r\nTrZ6Dl75WMTtHBafx03nQkdB06M1Iz7TAxQ=\r\n=UK1A\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227172415-2dcd7e1.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/8788fdeaf9c1507d74b7350e6a20d4b4/graphql-hive-client-0.22.0-alpha-20221227172415-2dcd7e1.tgz","_integrity":"sha512-fjbDHr0T04XVrQnZHtPcBVFC2MyVEQ+7aLEi/V/h/6GM1rvalWGKDzuQLWxufofdwjN/Wcgxa/JRi5HXVP8vcA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227172415-2dcd7e1_1672161891285_0.5672265315966385","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227172516-4556a0d":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227172516-4556a0d","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227172516-4556a0d","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"42601300b06d1784b8e099ccb938ccf65eb50557","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227172516-4556a0d.tgz","fileCount":60,"integrity":"sha512-8gIDriuM+ZtH1HCJSNK8f8R1WhgIkMoymQeIZNnrlnBfRnE00oHMK0lI9auBjKk7YRObG+OXtCpVDuCsCTwxyw==","signatures":[{"sig":"MEQCIB2PYdcOfquty028A57cVaTlZr50UMRizoSSMpye5h+OAiAx2GtVmb9EthF1WaMWzghd+/AWTi0//sOZBGTbrx4kPQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqyqkACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpEqw//Vt+9hCbxOoVIsVnzoZ+DRjEMKTt7eN8PGLrIETvAVYIe7LOV\r\nqUSWSnmu+fIffefs/vTi/mQKfd55IgCjOPPL+B5Jk74Ky8MqDw8ofgO4X2iw\r\ndc6u/xdnnCdbgUmYbgbWPzksytuXamiZK3idlkWY4Sg2bUkXudwmsdL0iCtb\r\n4DoD8bGCb7LDXWyNsjq0y3dBMF0kHkWbstsfbdEVVK6KzRaTKN4BB3O6mHP7\r\negdse08IjJ2jixuKg7Obv+uEs5lihmZYXFD8n8uRSXgDn09+1gf03lUfsD2m\r\nlRPZTlc9qiFeXJQanIFq/ylt86HobyxVFr4GyZS6OMNL8TxbZ3pWya4XzIY1\r\ncw/KCPYkZJNdFcBS+lD+IOjS/4RrC0bdSJNOS4o4qb3xu/Uzv+ogKkglc9Fx\r\nqy9vJ0rI+G2ARTN0s4mZMP5vA5i977sQt7zQ8Mi/9+n+ikyFzI7CaaLdexfE\r\nk47WPeAAcAYZ3kCyQgK6sp2Jr2S1v9JeSgeX6J04hGD2rNDatQQulmtFmwUt\r\nMI+WdCjM9yhjGpNI5i/FPX3QBo5sZdrW+ggGEQTdhC1lpLcqdXtQ1f8eJ7R3\r\nFxOtQbJJutBNZleFyHjFKXf8PDXDDo5TlrZ417HDIE7hZ9qnVr4KhRlVECy/\r\nM3gFABIqjbSbUyDMhrmYRGyq2WsJWTnZIU4=\r\n=aSBq\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227172516-4556a0d.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/bac65d0b503e4a477e0bf4ed3d6ad93d/graphql-hive-client-0.22.0-alpha-20221227172516-4556a0d.tgz","_integrity":"sha512-8gIDriuM+ZtH1HCJSNK8f8R1WhgIkMoymQeIZNnrlnBfRnE00oHMK0lI9auBjKk7YRObG+OXtCpVDuCsCTwxyw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227172516-4556a0d_1672161955830_0.2746068956075123","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227175200-e7e028d":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227175200-e7e028d","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227175200-e7e028d","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"299af9ff826f580c7cc1e867a825396c8408ee84","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227175200-e7e028d.tgz","fileCount":60,"integrity":"sha512-3Wy96lE4BZNjXLkfa2Tm0NOZ4l96XzZAwr1SUOrPtuc2WGGJ7vDAfjTz2HjSN6QOBcR8awngWyQj4v3xGBJMog==","signatures":[{"sig":"MEUCIQCFRamvgEDAMalV6NShZRy3KrWxPjAL2vwP2Ig82AiEywIgA0S0ev7fmEvf8Pw/pTXUhnmF1LusOuTHl6TfT3EuQGw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqzDtACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmqd/w//c3pEZQITqAeVQbq8D0nR3nw9x+gwlTeSm5KCJXDLvCnT4qmb\r\nCN+zMNQB7wnhrj6LxqXDWAlhDI6AiygczhxcZG0Kh8xFazfpHQu4Vo6fllIB\r\nT/N+1r8BR/CqERZCuApFjt4hftuyDGaT1MCpyevsiYnFST1V11YHtWEuE0sw\r\nxXTI01ujsw9ZIktlMi6VQXSoeAVYoQyojpMBWJxyH7UAXHObeSjtGiBzdBN9\r\nalr95G5OkD8JVGS9HGrQSUzPUQrUfTGEyIGfZh4SylpQvzYQOsBbns9gXfDX\r\n/NX6Isomkvfaoj+v2rovCx8gTg9T5ODileKyZi1/sRJVzIFebPcxLxMF+mQe\r\n9ViVfsZG0hKKDmPYyeb05JbSy505WN4XuiyubFnuYgaFA/I5Eg89u68V3Y0D\r\nWXPjykOnyb1o9uYyT9QoyPwe3j0sQ/0TyfLZx57xSF43kj9CwdInSnsacO9o\r\nfcWzk1uaj4UoSnigkeHo6FGIwhMpU+YrFYcQB5NJ9ielKVVFTRFWf2DJemjV\r\nHzt0k4dKOl0KFyqHflMkBwDoTuTkWdMbvjOfE5u7eKzMrMHx9kmkCI7fLHHT\r\n/t645t0Gonjah9uajaY7RV1VKFNl0E7TLgO7X7qeGTmbkT5bj4b2RzxLkaHF\r\nU3fm56MReQT6fzUaecN8oabu+EpK/EsQkRk=\r\n=5rr1\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227175200-e7e028d.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/3f822ec1b6b9f35b770ed691c951771f/graphql-hive-client-0.22.0-alpha-20221227175200-e7e028d.tgz","_integrity":"sha512-3Wy96lE4BZNjXLkfa2Tm0NOZ4l96XzZAwr1SUOrPtuc2WGGJ7vDAfjTz2HjSN6QOBcR8awngWyQj4v3xGBJMog==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227175200-e7e028d_1672163565763_0.9938896413614116","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227175936-fd17316":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227175936-fd17316","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227175936-fd17316","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"9268b024744ba9dd05854b23a8c85192a4590f92","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227175936-fd17316.tgz","fileCount":60,"integrity":"sha512-eqwNeZTmCowgoKqHE5Oh8xleAN4AUKl//6bwbTbiTrIymK8wgI8sXHqiK8wzkZxwnRiVm6xjjYT9NQSHwJ63fQ==","signatures":[{"sig":"MEYCIQD44RC72oKyqHGoYlQXfuV12vu2snwb1+g9++ZT3R7INgIhAIsyaVmMaTtXzEJ4KRCCJ13IXkjY7SSWFts7kz41GTlZ","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167260,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqzKtACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmreWw/+PThO3Fkf6dswRqP9wNe7gpZ0onVCBl+4QNJWu9AGW5ssdcjP\r\nTMr+rz/AnsgBdeXgrHu7FZl+93bCLsnOLnOer/cyh/EWi3u9511RaxTp/2HS\r\nEGc7GGLfiC+DG0otWSauo3oFjD0kUBzo+3iwlBQtP9B2XaT6QcqQfgbWKObv\r\njUGcmJKJirdjr0l8Irmh/t8bJy99nEEZHeZCgTa3OZx+a0FOhizVuRnkFStO\r\n8JuJajBT46KgOtxsjF0PH7OvUMd8ChmCmCtbhR5EGdIIN69ZgsBHA4wC8UIp\r\n63E81PMmwiQPDWY7dItuSYUGZJgLf8nDlSlC35+yPg+IyUbZqxJOxV6ycRBV\r\nGlDtRY60o/N78LXD15mEPEbK+3TjiY/S8svt4CcoddENp04fXPHbPI8iJM5+\r\nid0IJu4fl3cWESzaL0gD0lPIGY8V6XmErUM5LL/kum/j8XTRu2ozcZsIyvtM\r\nh3cn7nVQkuEMrs98JEM9PbB73SchNw7MBxtvp8WVZAEkNn6k3P/HriI120Kq\r\n/hBh7LjOGX4MqXx/w+p15cVmG6KoQSL6Xnw4wx0lrO7mdV5NtysxEI8c0FsR\r\nS0GptZnOuKIBtW3nD3SoSGIyMZ68VbXbKTCYosEDOZNy1eBVtd0zyTWbJNmN\r\nJIB22agT808HzJNKsqBvkOYlXmLBAG6spGQ=\r\n=9Sx0\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227175936-fd17316.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/765ca65d5290474faa7f5700d3427679/graphql-hive-client-0.22.0-alpha-20221227175936-fd17316.tgz","_integrity":"sha512-eqwNeZTmCowgoKqHE5Oh8xleAN4AUKl//6bwbTbiTrIymK8wgI8sXHqiK8wzkZxwnRiVm6xjjYT9NQSHwJ63fQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227175936-fd17316_1672164013267_0.24918964513534703","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227181830-a05f83b":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227181830-a05f83b","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227181830-a05f83b","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"b695b8cd9496ab5982bcf133b46920b8616eb57a","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227181830-a05f83b.tgz","fileCount":60,"integrity":"sha512-Ahaa/+aTDn5SwE8F/k/0btp+cUqdchl5dZQ3DsSq3dumubnD/G04MX9VjR5FWuNoGKTTCJnecuTfhsMMkl0/wA==","signatures":[{"sig":"MEQCIC3tGF5wlLOuNvFkOPw9NIse9eXpoTkFFhpleltK9C89AiAkaN4ILydWR0I/X8mcboRkyAmT18OwDLBILeKMZV9EBQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167260,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqzcZACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqWeg/+JnIuK+8/O4A5CNHOWeoZhUGhbvh90Qu4NsyhN1KlUpvqgpuj\r\n4ZVKuJ9fbG6QhRGNS3a9HcQhYpAndNlzjBi9gh4t3dIKv237fx+6KRZUpn7s\r\nrQez/Xy0KRxgET7MnoSwx951nrP1qBnyydbGDwJyEvd4yBK8S1XY0gbmNG83\r\nJoUlOYGtQaylEnvO67QmSOMAEeci503KW/N22zL7zMZIqKFe+nNRo1xwg3Wh\r\n730zyNI1U2WdB8STJvc/NCh+VKY6TzlA9vcROjfJakuKOkFUakMDSALX06KN\r\nfKWw7s+YTDHzhLHiMFvP9nOK8YVr5dYaFeVIijD2foLoHscsqNfgpa1tWzav\r\ng/BLedT1fm4P/Rh8dpGAswFihSAplOTTNmu18LetAqKyIp2Yu4EBeS/V1VfW\r\n04+wHuePjJQv0HmSEagV1uf/uXhBr2TvUJZpqWQ/W3RSm9hzzwpsThUNOLlx\r\nrj1df3B33wD4I6B2tf4CZPLSakMwrPzGzwW0BtEwaJmX77Vvq7BY5N1UdV58\r\n+Uioyl6PGHVQmYgQGIvri4tjQ3LOenUDLKsKRUtHYRF/g5SmSn5xJgkox0DE\r\nBtjyy3d99IBxVPxaBnwPuJtrwT/hb76SHIKWwW+iwVcsyjxOTQ8vPk9w/nGD\r\nDsZ2WWgYOVpsRiBiMppJOd3+C1LxNaJjb/s=\r\n=K0Em\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227181830-a05f83b.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/0c106232f3e8a654cb074d16f1fcec33/graphql-hive-client-0.22.0-alpha-20221227181830-a05f83b.tgz","_integrity":"sha512-Ahaa/+aTDn5SwE8F/k/0btp+cUqdchl5dZQ3DsSq3dumubnD/G04MX9VjR5FWuNoGKTTCJnecuTfhsMMkl0/wA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227181830-a05f83b_1672165145608_0.492896771102711","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227182615-0c1ca58":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227182615-0c1ca58","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227182615-0c1ca58","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"a7c144f5a6f3811f3ff2cffaa5dd520515611de3","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227182615-0c1ca58.tgz","fileCount":60,"integrity":"sha512-sT2KavoALmsUaeQwyy6wbUuiu9cgom1v03HO9BQaVvQwAEZawzGxeKZPY6N7UadYqRzQtIVsqcSBf931ML+aCg==","signatures":[{"sig":"MEUCIENKBPpCRZ4LIltPqP/K3iqwsT6e2Pl/0727ftosYt+RAiEArYdnBMax2PrA3x3ortgurPrkKf22KQSukLzxpw8lVdc=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167260,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqzjtACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo4nw//c31WAh6cwwlh0AtolpP4qR6TmZBvzln2d41CZHe66A2oozj+\r\n0qpZyJOsEufketnBizFDPRUH87VrVZNNn/lL4ZL8iK9713BxbH57Ikr69bZx\r\n9B2BV81+rSrvnZSm9KHj0cbg9nziruQxAFbKsj8V3/GLLSTls5Lwi0DSVJR5\r\n+0ItsrDYEEAfxApwbBP9yYvCZBWggdyK/dn9NxhG+sz4eH7TEP1UrsmCO7Pg\r\nsEvWdpBO3Ed8LyQtyY+CADKdQAZSEjmzaWzm1/u5E0m3u7IBcaRuvDXL7AhV\r\ngWanDdGvp/5q8M3DQAaHXMSHHgmDcXFJhT8+el/TMMQi7QQ6X5U5U+ZLkHiu\r\nrqUdwZ85YmjpmBrAB1F4FjkYp/62BaGpfmBOrzO5h2g2K38MMo7M+7IUM5ix\r\nuv1Pr7FqRCYEBY74MujKzf2dtrtyrjopZbQwsxzR4N0jPzhLrRTX9ZgqfM7I\r\nbTXeFZhSpG88M6NKljfd+Ba5tR7syJ85IEKmRinJjD+eZr6dUQ476ayB3e4X\r\nsraqd7XFHGtj7zKIJJNP1bICA0/Zq7/tFgZ7lCOJxEwak7qygHNSEeYrjyeB\r\n51MoCAHX4XcmA4cm75zKNiHRM9UK9waTGvSrzNKyQdCFaWxcDy1xYSMqlmOI\r\nu2U4qiLa067m4c5gRCKfq5nygIQdu79XSpc=\r\n=zuw2\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227182615-0c1ca58.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/23c49a50a5cbd229aae3976d8a3fdbce/graphql-hive-client-0.22.0-alpha-20221227182615-0c1ca58.tgz","_integrity":"sha512-sT2KavoALmsUaeQwyy6wbUuiu9cgom1v03HO9BQaVvQwAEZawzGxeKZPY6N7UadYqRzQtIVsqcSBf931ML+aCg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227182615-0c1ca58_1672165612921_0.9458516804779438","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227183251-631b41d":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227183251-631b41d","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227183251-631b41d","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"08d8ad27eee0e3bf0438e17a36ab78c5f832c314","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227183251-631b41d.tgz","fileCount":60,"integrity":"sha512-C5tXH2i7MDQDtreINwLmoGdexaIRJzSOxWLSe1qtBlt9DCgvuuDLKQ5c/rbCw0T3GHUjtCa4q1sGTQP58oP5IA==","signatures":[{"sig":"MEQCIFZ/dFOa4JxmZgtXDNwVXfWi/BHdoyKq1+izoN6c0Ya8AiAjEJSxpJkjTbV4c4pwxSLAcrbclb2w6ApmXAMu2TWcAw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqzp8ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrpPQ/+IBDzIMW5Ex7LzgxZEp1T/RxeSbBgL/t18OMlDnu//9sInwLF\r\nVDap1DJfwjZ0DntUEMVNFVN07A0IGHX7pdn52tWPIL/KqFBFNvZ7k6uTdgp3\r\nGVt0fY405GMRiHyIrZiUsnLoTQsZuHYNClNs2ZU+X+r83ByLNUqpW4QLYFTG\r\nLEj+GAUkPX4Di84fxRWJ1tre4ik74R5Dp07x7WdBdkijEZ8HygvBkMtdzDOm\r\nhLtqxdscTHGQFTw0a3hQARDEJNPruez+I6LcPEzUMYeFAhj8h1Tp0SzYVCU3\r\nkQn4bLKqnK7xOMVOMQgocD37LF2+FnNdKuMFKdmtOVseBEevQzdfGWTlX+B/\r\nq04JCa66zzuunAckqLHrIahA31K1+0UfgvUWvH2v3FytjoG7aETDY8fKBSVK\r\nEd7afoCHqt6wWVYfp0kOc1jg87jjhdeWm/GpXUyeKnVINk02XgDhsGCIVfNN\r\nlHInV3ss+e0B/agBZdrxD2UgKklQn0p5KtfoeRdSsQg73JgnhpRQs4zWBAYe\r\ntFtTxBTQ2wGH1VH3Fs71XSAVnCBOjM/ZpR6yh5bb/w26gtGvNjboz7J+UMnG\r\nc/kx8LN5KAEHs84orZjH8H8mzbTLnqg2po33dnBPojhj7HcgaEaLzeYYjucH\r\nCQqPVSFJjlyM0brxz+7mdLqY0xbIwmpd980=\r\n=0GUZ\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227183251-631b41d.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/bed4394b6f73d9ae6a87642f9740386a/graphql-hive-client-0.22.0-alpha-20221227183251-631b41d.tgz","_integrity":"sha512-C5tXH2i7MDQDtreINwLmoGdexaIRJzSOxWLSe1qtBlt9DCgvuuDLKQ5c/rbCw0T3GHUjtCa4q1sGTQP58oP5IA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227183251-631b41d_1672166012786_0.30595997311773027","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227185406-ae00f61":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227185406-ae00f61","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227185406-ae00f61","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"23c0f16f381318a86a40916eba1600559c4e7e92","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227185406-ae00f61.tgz","fileCount":60,"integrity":"sha512-ZyU5m4+jb15RuvfeMlcStM5HFbfFZfBLx9n+GhuRo1pGuKvPd8E4SEebBGmIbBAExdbR8vMKLbLV2NrWy+EyJg==","signatures":[{"sig":"MEQCIALHvLVaWHR8+kqwgFU6yhzv6iIO87WI0E+uVgU7+nSVAiBjObkC7FmgreNDpsiqep1vRZTaiQ4u136wpwVgZ8Cs8w==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqz+AACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpVoA/+OvUjInJLcD6exfgLkAjxDqNNrpaB2jBMJuidy/tDEXN9umwy\r\n4fSxjazk1ql6LIMwQEyGEKvOP5USKCsNx7+ihme33G2dykaMubCJBvzV/+7M\r\nN1IPoH1BSD+KgGkCJvAbekS4hkzrPpCfhKlUhmlW7zvbnj1HM0B3PYPk3B4M\r\nwFh7JOLujS/wttBiAdKKCMAxigoKjzYLgq0FEo4IOENYdSv3kYBLI6mRj0jY\r\ncFhbUUc6TZIjvq0+EE4Tdvmbs15PGajG6p9MO1AMdDTAWz7as5Lj9tugwp8d\r\nopIF1woJZLjDEBKBDY+CddTDTBdQFfi1PFGLz9dVyB9eaMX4DFLHoACIlSb5\r\nOllsnr50S8qLfapRx3gJM9gjreW9NnUJnfXtUXwUgGgYAviqATbELRc9MLqe\r\nKAFuki1mFjZtlQX65WfOe1N+VutSNGHLXRcYABAkMCCScZktV/9ZU1fhmdH7\r\nmYEH7yxtIfia8pO1CII6mgvcnLAVtvjLN5z4HkrO7Ic7oxf8auadDi/AJBEj\r\nfPT7DurXxBQNyfdwB0L9jNu8Pt0uYVy+QeeMih1Qs1IHIDq8EDSJskMU5Mfw\r\nxfUcZnYOuFUddsDKKE1ZSA/z/6o235U1X+2e/cc0RJwLmx28XTg3vQeWMszj\r\ncbhav2BG5w5Fx+zf1V4RBYvtTHcdYwDB9gY=\r\n=kknz\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227185406-ae00f61.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/53c5b51922bf17f4a09e0c15067b5c8b/graphql-hive-client-0.22.0-alpha-20221227185406-ae00f61.tgz","_integrity":"sha512-ZyU5m4+jb15RuvfeMlcStM5HFbfFZfBLx9n+GhuRo1pGuKvPd8E4SEebBGmIbBAExdbR8vMKLbLV2NrWy+EyJg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227185406-ae00f61_1672167296510_0.4549668982227508","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227185657-aebf271":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227185657-aebf271","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227185657-aebf271","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"c44a7667ea94f5cfcf2f2e766c9e0deeac6ff591","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227185657-aebf271.tgz","fileCount":60,"integrity":"sha512-QDS8ERKGN8PYp3Jwfc1Yu2kiofsAPjK+bXlao4CQAARlr9kO0bMjylfQtyahMAbyw9E84rAwGaQNw+A0HflO3g==","signatures":[{"sig":"MEQCIF5ji4SNt/fwLwGfHX1EPtH+ce9k6AHWiztRv3RXhXYkAiBwU9mhaMHCEeFgOBFouu2wOeJvPZcIOGSbVOODzYpbrA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167260,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjq0AcACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrWzw//f3VnAnwDE5dhNklGnR3eVl/YPYwY5mRZ9GwLPftXZWM0Tnzd\r\n3zj/i2U4R8+IPIInEGhzzU2WxlALlz7A9mE2XfDVCySxCbSCySRnN4HCmLmI\r\nCqTyuCuxM/0u5aYzoAEhidDY0eOsXX1H+8n1Hn6kwLwLLUUd7PGn3UATDr7c\r\nksUoIRVWumo2JJta25F181DLarZPavo4u5ZOo0Uml5c2uSw8BZscWnEnrnUZ\r\nUvF+obCS4QxPImrZ+fXNIGzyAkh0FnhCPjueDHmpW8eW3LiOpPjve6G0+1oO\r\nS+SMKiZD/j3BTYH+4fdR4PakEFHIWzGNYMQn0CBTCj9FYomhKSmNCuRu3jkQ\r\n3FRrdPpkXik14kAl2TthF4O4sKZY7vkFdRfLzKoi2rRHWTQwZDT58BrR0ZCw\r\n4692H1EyDKkYodHmBH5wqPCVRwYHkkpSxSFKBH9gKOGGI1vN5PKLdNuc2khu\r\noG40gfvEhhAA91Oay7csLVvgxwzzUdqwd0rO4UFGRYv630y/DVD92yfU212H\r\nJumTUe7b+MSO9vnwFTK+FM3Z4bFr3FsYO+OyM3HsieQ3PJI8HOwnza/rDt0h\r\ntY4WRb/v4gz5U6JBOxHoJvIZbqd/HTm9E3xAyuhclVPGnHB8MaKL1VD8NwiA\r\nHXD+55m711oL/G0KWnuVVNhn5zZR275P8E8=\r\n=QHBX\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227185657-aebf271.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/f7a9233153d046bad20e5f6a5f578db7/graphql-hive-client-0.22.0-alpha-20221227185657-aebf271.tgz","_integrity":"sha512-QDS8ERKGN8PYp3Jwfc1Yu2kiofsAPjK+bXlao4CQAARlr9kO0bMjylfQtyahMAbyw9E84rAwGaQNw+A0HflO3g==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227185657-aebf271_1672167452117_0.22012563950917952","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227190906-8b17931":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227190906-8b17931","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227190906-8b17931","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"0ed8d4207a2a6635fd320455015fa875f27b872c","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227190906-8b17931.tgz","fileCount":60,"integrity":"sha512-/mpDwI5dV4PNruETOIyZdBtVaJM02v7se7Hzdf96q8bar2u8bzWXSOOCCPrh26I04/oI0BHSt4PsZaaa8wpVgA==","signatures":[{"sig":"MEUCICpLFQPP3/0BkkA9U6KrT5w7UHCwtntUphuHmdXT2NJwAiEA9qulzcivIYsanMH61EJ1GaG9ok5ovZfQwJ8zYljtopQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjq0L0ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmrhhg//aDzh99bScvHJ3YjXl/GNfaFPOa9Pk9fFYjUhQLApm5cOtRE+\r\n7W9tPj79tVY+CvuyVaziQkjos3a0nKBS49G/OFe8JoFD4NYC+6O1bnM7l05l\r\naIx2xVpPeQNS/Ey4lQaoUVrA1ZQyOA0QzxN1/anD24xtwLmCJsA+tCC9hRJA\r\nZBLrLc2/vcyQJqlHmtEQ9qy32iHoysUH2tmz0jkU43bTFvFMNtYlq6y/Akc4\r\n/iv+bFU5dtD/EKMRMd6CHxvCY5hZnECwoCb5YeS8VhsUd7rQk68MOzIuPvMp\r\nhST4ZCmZPX2aWwk+b0RrbtTrU69yodb03Jkq8/EQaCT/Q2V8hf+78ozGKIxB\r\nSZkACpfFMziGTep97Ki9shGrPRDy/OutfM01GEtmA2zUZ7pdoKn9l0wEse27\r\n7qMu7E4noe9QfVy8RZXC2Cqfit4fVqA9EESj2/6FzpWvQQ+a28EYhVHKV+wm\r\nOf9JiIEQ1YBc6uzbZ4CmThobGgZ44ENBrquigtAoPIeZ7s/8WXa2vILw7i4u\r\njGtMy6jh/guZieaPtdDE2G24FklDDs/jtMUZXAWrvWM5kLjdbjReA1qAWZzs\r\ncBdd7m2FZliA8uz7gMj/KygbpZNlEozhbYO6qgVkS+05+sqSQYNxMcsZQmxY\r\nOb+aEh1xPgiXNKtpRGgfV7mGK2FctkzzcTw=\r\n=AyQC\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227190906-8b17931.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/2f0cf4dffc64b8435205199fe2d47653/graphql-hive-client-0.22.0-alpha-20221227190906-8b17931.tgz","_integrity":"sha512-/mpDwI5dV4PNruETOIyZdBtVaJM02v7se7Hzdf96q8bar2u8bzWXSOOCCPrh26I04/oI0BHSt4PsZaaa8wpVgA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227190906-8b17931_1672168179911_0.9470068562243974","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227191211-c0ae416":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227191211-c0ae416","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227191211-c0ae416","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"e716c330b776a139657408a5f64e0ff59c5f04f9","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227191211-c0ae416.tgz","fileCount":60,"integrity":"sha512-oUxltmAswd84ctGU5J/p395lPDUxP/LJ8FrdlFUMbS2RBxE7LtFBg9pudL2ov6SHZ1/nPZPb1n2JJjVsfnHXXw==","signatures":[{"sig":"MEUCIH9ONn+dvTlo+mMnwqN39pW9arKU52h8MgnQd7GehAxzAiEA0E3XFa72s9TvgwQ4wwuXH2tPCvwt7Z36yRc2mVpvuPc=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166012,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjq0OxACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoiJQ//ZZ3tWU6Qm6NMoPP+fxOZNGhUxrP4YAyh3WkyP3/BDavcJtMu\r\nuEeWZ2JvFVmNI7CWec4elVQfgDy/k0gqGMt+hJ5sowuiLcDOcRRf4GhHggis\r\n7xRToy4OtEcn1wHLkdHxVzpv3ivtohcSU1jQ+NNNzlBLkQyhdC+S90I8fzVX\r\nDChKLe1cFYwTI8dwPmm7chzccJowG7ilXxFjb+yv+/tpOmW8KYCWSefVI/nw\r\nNWO4JwzxbcmA8YkpMydWdJAsN+x0ET4hMFaNFMBxXN1yYfueyewWVQc4OQXc\r\n2y5eY4QvxDIbZvL0JKJ38+OjN9Srct075GizBqrNy9rt54iOmfJC2t0gb2Uo\r\n05lcewzGqES1sip9vfkz/hzS/O5/PbUJEdcZKCO7wJZL8XcPunDfC/lYcg6i\r\nMp+gYPEauCFzl2aE3v4abWQs1DuijsxaIr352A4E0cYDroNZu4YnEPODyrlF\r\nFLeHgsvEkgaHYL5M9/u7i0AsmE1NqEmHgElOiP3d7BnXuRzIGdlR16Cqg2Q7\r\nNlMtxyeuq8b4nDxViFRrc9BcvzGqJgnmT+b6wpuBnNwFUgGeGu2iOx+wOspD\r\nz3aoYuHJMn1suPUzXJuh7ql9bgyvsxdaM+uWutJwMj+deLrR84fRN1LFi7pP\r\nwtyuRUSVozXZmFeGkwZ++GrFHkTUx9f2uBA=\r\n=NtXQ\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227191211-c0ae416.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/3f5ee2c3bdc1e4d9c8518e185ea2bf7f/graphql-hive-client-0.22.0-alpha-20221227191211-c0ae416.tgz","_integrity":"sha512-oUxltmAswd84ctGU5J/p395lPDUxP/LJ8FrdlFUMbS2RBxE7LtFBg9pudL2ov6SHZ1/nPZPb1n2JJjVsfnHXXw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227191211-c0ae416_1672168369245_0.6252191606715922","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227191308-f84699a":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227191308-f84699a","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227191308-f84699a","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"b1c1b8b61b0548b799084eadf21cd55d91aa90bc","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227191308-f84699a.tgz","fileCount":60,"integrity":"sha512-K7mij0MKgxdWgg/3dGUXvkspnRoa2L+3vh9YJRLZucfCVY3frLWtWD4KRD7PjUA7RWnMkzc776zEjcHNlFlQ2Q==","signatures":[{"sig":"MEUCIQCbPZtGjSrIo3zn9H7+vZTIQPhOCHpCv0ahk+Qe3OoW2gIgSUN+Y1/gYRZN0gCCi7gWeIUeZEbIyh1BTe8FMxpFVvA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166012,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjq0PmACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrQ9w//cqc97C8cUUCIKE4Wos7o42lwr9qy+MieeObkSG9jj2KECyld\r\nRUUE0lEtlhdEtS3G51KspDGKzmSqcWvN3F5n8B2Lpkxx5VeB4a4D1UmtcCl+\r\ntL5ODBslQzhlxc+M2lkDv8GQQzQpuYGegCAAvS1wq0LiJcBfLxgcNRY+a8KM\r\npwNnFtiNwVyRuSDIchI6eqec4yrYgfVSGbVLgtMkb/HW7fBE3yONy3zaPjuu\r\nch8UH8B3B/ngofV2yHo2e/tmJ0y+ZBpssnYMCmW6Kw1vZqqr7B8vMjFULl6H\r\nj8M8aFRrZJSDImKuBENqn9/gRoXwh6etDqv2UPRkAnV4r8WmA1TXVvDJBfZ3\r\nr0gMDopANuZrA7qXgHIWUXgB7zuADdXBPhRAmIZTW/MWT3dhD0x0nVknxfld\r\njaz9Y3iudQ/VIF5/dM8f8xZAtl/XxN4njP6PuyMP1zKNVbQOjxV5yttGTXlv\r\nraWHscl65uq+8YQSTU4Is2vqY8jxm5k1+E2dSQfyywW14EM8bbXZul4K933a\r\nxXAenZu8VuYe1X1sx3Ky4xaBd7O54GiteCSXl3p4zi35YSTIEzZ3OoegJUDQ\r\noHsuuzSlNlwU49SZh/hoIMNwEPAaZmujnp/IjyYjtbcQfyBD3f/LQqhX55Gd\r\n/EV9MfFHOUMFnoc2eDOK4ga475zZhSMzBk8=\r\n=FSO3\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227191308-f84699a.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/3f85cb108e4b083f49750dd944e1ea02/graphql-hive-client-0.22.0-alpha-20221227191308-f84699a.tgz","_integrity":"sha512-K7mij0MKgxdWgg/3dGUXvkspnRoa2L+3vh9YJRLZucfCVY3frLWtWD4KRD7PjUA7RWnMkzc776zEjcHNlFlQ2Q==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227191308-f84699a_1672168422212_0.7944130454697247","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227193102-e81bfb6":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227193102-e81bfb6","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227193102-e81bfb6","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"16181122a678ed63afece1f3c97ae7c7211e7476","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227193102-e81bfb6.tgz","fileCount":60,"integrity":"sha512-HTFRMHaggpKfreqdTuHVWkrH4XCzHFTx+iGy+I9ew3j57xabGS0wHj/4KjvDKAkmRy5fcpp2RMEEmMrDxUcKUw==","signatures":[{"sig":"MEQCIEPswYc61r6PsqkEX+UqpgMu8BN1feHOp8OMvI6I5iZjAiBpyKL6yinFVsPMXAtMce4ZTel5FujHY8G19sI/W4dLwg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjq0gaACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp2/BAAkWFeprxGKC3RqFCdZqdowuIsQmHSPF+TP2GsnuCQzL63+Pom\r\nk4MparSC2T6fuPx5P1DRwvGZdJBZyV3Va2+SWQmFzTxNPRnB4V4RsFbdFTXu\r\naK3A+3X2YPSflbOC0WlwBAp8di7HWqnmuvt23EkFPXnr0n577HmLb8pIz8D1\r\nreEIACpUMqhNDOb6BQ8YY3D52Bn39zvQQ2DHIs8wO1OvlzUQmlwChpxFUvVl\r\n8NffxtpWT1jC7HmKsohzqMNMoRWaVmJ/S9L9fjd9UiDsSf9xnmFBfHWUTmNe\r\nV84+1aVTOCxOsTvUuo9wIESc2SHYgnTTQAeZv4wD8yQIXLHTn1oVs2fzLyUj\r\nTpGeU5ZzEmecPBoK08kiRgamP0WbgwM+a/4pNrmVPyXk77hQTLpzoqag5cJJ\r\nUoI/aEMEMZpDA50A8aC3Ieo68LDGk0kKv/Lly5cjXarQyPb5NCxmHaShu2LH\r\nibisLkKYLau+911kAErXrAa4myl+JAtVZPlUCVc0J20b2NEw6+YGqrRKvvAu\r\nfT0E1JUNGiYLb9pkOOF+QArWUbtSIlWH4BVY/YwHVuGZZtDkq15dIe+bZGVK\r\nRuRHtwtHamMAcZcR6hY9JvFGopjoBRId3Y/GZBrEn52PKgDggVg+L33B8p2L\r\n3OqSoFU6qzSZImgg/NHjes9PSiwmwAOkQFE=\r\n=ZsIh\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227193102-e81bfb6.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/bb8c73c76d284b99a41116026f5761f6/graphql-hive-client-0.22.0-alpha-20221227193102-e81bfb6.tgz","_integrity":"sha512-HTFRMHaggpKfreqdTuHVWkrH4XCzHFTx+iGy+I9ew3j57xabGS0wHj/4KjvDKAkmRy5fcpp2RMEEmMrDxUcKUw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227193102-e81bfb6_1672169498140_0.786562027010812","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227193224-c4a3575":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227193224-c4a3575","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227193224-c4a3575","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"d80499d535530fdf8127530156975eda7b121a99","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227193224-c4a3575.tgz","fileCount":60,"integrity":"sha512-tNpxS+SZE41XV2D1VgCCXcvTfIDP5OK+cEhKX58ZRMtEs5bm1ukpaI/kutjIi6zTqzQXQdK9gyrxFYZMxWpOCg==","signatures":[{"sig":"MEUCIQC+O05Qv7RSo5CJUeZtGJCHjtyjYnhtdvI4Nf8199ba4QIgQ8cBlnYUnkGCOCo8JtTzrG4qdxWLYMhsN889muXsmrc=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjq0hxACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqMTQ//dW3U6H4WLPiizBGrnvtgyiquTULgXhe3V2VoNCpD22K7R5Fm\r\nL+HqodIpUDp1RxdQd5saKm6sa1WGbuRRarmRTSAu3WGdB0atnhgdtf025S25\r\nvj3+ffygtc1M4DnZng1gI2dWg1XDkhPJPgQUOq5dlWD8igz06kTecoiz+m8u\r\nSJR74MXo0Z4S4dRDnqV+XJ0m3HzbLDvJg/5DFzuSP73asf3sbm0fwZSSDTD6\r\nTk56Jjiou4Y1YisydmO8F6JzNAqnbWwYhrAvUCRnu47Xm1wVBqh13yR3XXx9\r\nOylrqfmHCwkmUXJguNleoUUg0adh1K/hD1MVKhGSspJTSRux1sVvWfBznpAn\r\nGljCJBmAa1ne0mt27eg2QP5KbRQIkLgsmzp943eG5zUXxqTwj56o37E0qd5+\r\nYOne0ySAuw+4a+U7beB61ihLMY/dt/vcmOyDfEGMMFDLLM53nqaUb5XCxX7n\r\nAMXK6vZfAQKdbfzpCJlE9MPIBEloH2I5NbaXScktAy0dwnawZP4bcjhgf3Tg\r\nAasx0RdEkxz7PjM6oS6e+OUqCziOhoGrrKllEWzngkbzeaqQnkz+iwgxcFsp\r\nXr6rqm2kjbBiTyXTM5MA2DGH+iCNixbnAACotAGywumrL0zY2I6mrGCpvvW5\r\nNTp5VykGIvwYwKZNAbuLvtgCkeHs9QYSsfQ=\r\n=QZ8j\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227193224-c4a3575.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/a2e29f14773e5f7ee8b9fc3a229e4f2c/graphql-hive-client-0.22.0-alpha-20221227193224-c4a3575.tgz","_integrity":"sha512-tNpxS+SZE41XV2D1VgCCXcvTfIDP5OK+cEhKX58ZRMtEs5bm1ukpaI/kutjIi6zTqzQXQdK9gyrxFYZMxWpOCg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227193224-c4a3575_1672169585510_0.42987161314046984","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227194321-34664c9":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227194321-34664c9","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227194321-34664c9","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"e4177f17047ae85386aff8185cc0a18776135cf3","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227194321-34664c9.tgz","fileCount":60,"integrity":"sha512-sh9Y2xO2WnvDn2X8q6dABgx3c9gxzrrQiKsKbWPDbN8uXM+2JOjMScjtMTOeaXqqI48ESR8eWeszzuBSYmdjZQ==","signatures":[{"sig":"MEUCIQCroPAXdJpgK+owwA2vrSZx3agYtG+A2KegtWiZtlDHZQIgWCGDCn71jwk/+RdQxBeH2c5MFWM0T81PMA5107vsMOI=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjq0r7ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqFIw/6A8QRpQYHmEr2qGL5Q2as4GNsrUVY4fLBnbmoarB6gCZZkddA\r\npIi2kH1uchf18eEVP8HDdKpQv/TS+2IAW0wvH2ETf028q7O1kdsgcUornsZM\r\n2rModrqJp+zNg/553t0mUqzKE5fLOEybKVeGwCCKrP9WDpKHm+m9CW/z0OKQ\r\nZ/GqKFmH6S6HoLdT+oPX0EfX72HHPFSREKZ74S4vhyc8cIkdcQatwtJkGcb3\r\niVaT6nbEpjuFVGakq+rU90bsBT5CkQVMT3h/z6oapCw6fd0i5aSIJuVEB6+j\r\nxYa05NcUpTKbI3ssu+AoiEx/pC0JBQIaLKCyMvM1A+Te8p/QfCKQk4naIkF1\r\nQ6aHFQ8bynR68U9q8HTGUvaZpt6337lOekr0z8xDqa2RoZ27HdAU1scS2AP1\r\nQo7HJlT7FU7341ul/xkUJVlZKeQDJYr2KrNkM1ToJmxtYRjJZZD5VXrR6Yyn\r\nnZyi2hqVINfx44fw7kkA180CU6s9zDV3hhL6cTTM3uKnAbvO+oG05iTEjywY\r\n99I7GxNYadgeadeEtTOFpS5WhIKx1xMf5CraGwG0n/9JBVqZBPYpPENqpPq8\r\ndRZbT1oDPjzadzDrfYz26vZ06L1HeEcYAHvGUaXsXNSfm8ttnk6X4JHhyDXd\r\noY56pudMDudzFIF2tMqAj8fWXo67tf2vpe0=\r\n=MdkI\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227194321-34664c9.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/4e52d8ce1fc8c350584a57e1aeb04fd4/graphql-hive-client-0.22.0-alpha-20221227194321-34664c9.tgz","_integrity":"sha512-sh9Y2xO2WnvDn2X8q6dABgx3c9gxzrrQiKsKbWPDbN8uXM+2JOjMScjtMTOeaXqqI48ESR8eWeszzuBSYmdjZQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227194321-34664c9_1672170235373_0.9424825250127407","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227194910-a38d1e0":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227194910-a38d1e0","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227194910-a38d1e0","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"9b5463b87a85f95b374dc4e88ee332e9d302aec4","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227194910-a38d1e0.tgz","fileCount":60,"integrity":"sha512-sN+TufT9QgMdOxIzvjwg9s2+QeZ9g6VRoDZw363Zp5AKICq05dAKstcmo0qB7O52UKrQq+akoa7B+FXlQvyDpA==","signatures":[{"sig":"MEUCIQCILRWxl8sCnGcYV863k6A3kkZQRai5zXvp2Pm7Y6JnOgIgB+5e+aDFLKw0GZKOfmzVCVvmmeaB9BJCByKrdDhoFZo=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjq0xjACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp7aw/9FNHpmPIjfxI+9bQqxkGndlKj/+IeJ6uz54hwU/mRF4OLjIUb\r\nhvYRhzPJEn6Kc9nHRZqcbFMIRtWJ0tY2JYTjU/sSsk7hophnv5zEPWJP8yXW\r\nlMJR9ynb1/EzSZ6CO2LDlRAiOyjx3xR/pbpMPby2eZoJYotTICbGICzpXEY4\r\nDrqyv2s4cBSs2lc9AwAh7UZ4ukPvntTnVHJqdz1EOu6yJ6MoPywWKyAzP+3r\r\nORbCPSssCyRJ87Ex04rBscBo6OKCdwtKwINVshNtQSiwFdfHRAI7U6wX+jl4\r\n2e62QgqYUM4KClgDkVOnAThhZ6RsnOaMkCBgXTsG7N0fmJRxnr38MrmExF2j\r\nvYA2Sd6J2ZYDDYXaw2lm/h3RZKWhj8GHdVs3OuHtmHUw1SsUZLA3UX8mfu5j\r\nSfGjvHkFtdGr4pFv712y7rVdyYOSZaOaPShgywj+eXWrlM7lr5XPzXFIif7a\r\nS2khRtF1wSd5R/USKkR4mhrKDlbhdFz3GdpchoJFKSjhbgcUTKCnQuv5rumN\r\nIvtO+EvTIdQ72+vg6o4efRkYWUNPSId2tLPT6FADybyHaxVefhdLCxQf6UNv\r\nnHRmWynf4PUIQ98houmy0z0aFx02SWsXmUlgO+kmDEXHdPEXMl8xumE+dbiM\r\n+934WRtI2wTocvgkmS9Bcwh78oGBvZYoE7s=\r\n=rGjC\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227194910-a38d1e0.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/4a6b8d7e38be2f8798b9285a03c3de7c/graphql-hive-client-0.22.0-alpha-20221227194910-a38d1e0.tgz","_integrity":"sha512-sN+TufT9QgMdOxIzvjwg9s2+QeZ9g6VRoDZw363Zp5AKICq05dAKstcmo0qB7O52UKrQq+akoa7B+FXlQvyDpA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227194910-a38d1e0_1672170595534_0.263496686899098","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227195526-3e2a6dc":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227195526-3e2a6dc","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227195526-3e2a6dc","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"44a8049a7285696febe494910a8d54553f59ce5b","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227195526-3e2a6dc.tgz","fileCount":60,"integrity":"sha512-WvgQazpAivqFEuGPUytkhtFXv58y356Onb0sc4ANC9bSiUk82owPKhagYJ2ZD6OWa7+K/ctp0wyAJ5Lp4JFhrA==","signatures":[{"sig":"MEYCIQD7di2OiekHqSrIR/qjPImdxU32Vxnm4LGE8TFSBotRTAIhANcq24mLwnn/PAWbVB8S2PHSi8ReUwmtWRdNCz9NK6Hu","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166012,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjq03PACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp9Ug/+OMCdnbBzAGNhfCTkgeW9UHYLOKzCBm8kVu5mQCS3thNAt2zv\r\nGojpf8bs3dBkbWDN1KkKUjX0CcI2fMFTV4hu3UZGZZvA+I63w+kKDG9C8Ic4\r\nzExt6kykPu2RztHeCOOtDV3JbsIF35D3DzScvLMV25hCB1jPw9GHqiiURIGo\r\ng4xXb6XhJsJvbTXNOYAzNxnHOOVwxC6iL+m96rlNszrAi1L93TtZxQ+YTvnI\r\n5k2dDdeLqDcyK2V335GQvrpnMoXDMjgKWuQDg95y/BAKAvEY0j/kdL6dtvn4\r\n7UdcVYB6KwJVNWev/GQC3tVA1vKXBNGSjutt0aJRFqoni5cLu+l6NKwur4WM\r\nzLvDJS/UK5G5PVye7L15NOHa4oL7BTWw2ZP5/gV7yC9EWSDwqt2JQeU2gr5C\r\nhh8HsUNVE/slNW0yeLWMwycbWZ4xXhdO+l+IsgxgQhzNtqlJNSTi+xOVOJ3T\r\ncJ0lUWMoSzBmASsfzz/tV20w7SIfOdcX087wSpEHEyR1Am9Lj1o3UQ6L2s8l\r\ng+MopO7PvepZm5GoX5dcGc+fjBcFJawVlEBdgpydQnv5FtR43qflWTmLwYPy\r\nOl2eQnOaiWh0QHKgyXqj/L0sBVTRlHOb95tSj++T+RzsV/Uq+Ut8BerZptJm\r\n+tz+emY3K+9i7saHkuWtDwTZtdfDdFGXg60=\r\n=3ilG\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227195526-3e2a6dc.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/e899f5550617b79f2dfd27b2771097b2/graphql-hive-client-0.22.0-alpha-20221227195526-3e2a6dc.tgz","_integrity":"sha512-WvgQazpAivqFEuGPUytkhtFXv58y356Onb0sc4ANC9bSiUk82owPKhagYJ2ZD6OWa7+K/ctp0wyAJ5Lp4JFhrA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227195526-3e2a6dc_1672170959425_0.9053573471051231","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227195929-e39816f":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227195929-e39816f","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227195929-e39816f","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"8074a27cd9fb5e0ff52adc282cd923c36426e0ec","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227195929-e39816f.tgz","fileCount":60,"integrity":"sha512-G2TN63OKXnKK0tMlLlqL6lwC4A7z9qcE5jGezheLPpWQIjsorBOg73jK9BvaH9Kna2WC/pWp2U+1HrBTNm2h4g==","signatures":[{"sig":"MEQCIF3A/pZdHCR8SqYnALPihXJIrZ/x93W0QYw9V5p3xL9TAiBkXGkz4fBG3I7JCcjLfdgAbQ44HXdWFFR3FK7f77GDUQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjq07GACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrZyA//SBVIVQ+wIEnq9vZ6BLI1TD4xOsABKNphd8DMp3QWyc84He5+\r\nGEQr+qBkH1qAr1DrOx6N2E9uOdgEe24QxS8f/mn6/tQG3/XYA/f+JUYqLyQK\r\nsBlGoo9TDS2CNoX7XMIF4PrLfb+wewdsMxeh6Q3eLKREB6t0sbP+5oFUCZZS\r\n9S8pAHqx367nLo6cDGu+hDrSIm78fXuzz6SPyThoDWwyNYncxxvqnWvedoWl\r\n5WHQtQozYAKPB60FqCl7R/Dp7OZ0p2bkHRHne9LhQkfiv8PLxmfAoNpOvm0E\r\ntYxrr2lVO5v/WaPKBhWiaI31Djzu6z4n6IfjMHQ1QIJvk6nk2CO84Aq2sdLs\r\nB8AE40+vjTmCzo6h1pGO03OR+uPvDBMWtBEx39qWQOKal4CTSnYvTDPLv2Ex\r\nnu4J5btI7noKZQJrCu7SeG0Ydc6hc8wsb8bPml2edUjPK9YOEMsMOUipW76h\r\ntV+Gd4ESUYLRT1ofgKX4TBY54Zh8q3+kISIJdJMV3tYZqEVEN9ArtN9h7IXe\r\nam7bQuH7JJOzWkQH2Y30ZCpQ0MA/5SgNg12c+uiTS8PTPGBYa9PcaFQGTjDJ\r\nwPmRrUgeLJF7tyouRADVYqHMLv6Doub5lNY9PoIoLktZqaU31k7tNE8+y6e/\r\n8IVyTWaP0ZYKAHH+/cYSOYY2hzhylscBeuQ=\r\n=EwJy\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227195929-e39816f.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/0cc891688b84eb8609b23d2d246ba700/graphql-hive-client-0.22.0-alpha-20221227195929-e39816f.tgz","_integrity":"sha512-G2TN63OKXnKK0tMlLlqL6lwC4A7z9qcE5jGezheLPpWQIjsorBOg73jK9BvaH9Kna2WC/pWp2U+1HrBTNm2h4g==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227195929-e39816f_1672171206024_0.6967096747193395","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227200037-fb4badf":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227200037-fb4badf","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227200037-fb4badf","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"4fcaf81e856a5aa1606f106e9f9f642dccdff9d4","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227200037-fb4badf.tgz","fileCount":60,"integrity":"sha512-Z3mwThCM4PcVkSUd5TkHH3mInVz4JVvZw//eYX9bgrIwY1m03mg9dEXPXqjO2Npo/DD1Pc/v17fyfzrc+v+32g==","signatures":[{"sig":"MEUCIQD/gAqJbf+D9kMgNWX7/8vF0HGHVN4zunFC+RxLcnRmQAIgNntY4Y5NNZq21EopMKyWsfVm7SHV9KBXB1UJRpMWt/U=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjq08RACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpMYw//VeM22TrU/LmMvJHqJI5cHSYDhmi5DOyUELqKSmPaGxTxdOxV\r\nYxgDWlcbNG8JCGB2y1GZOD8vc73xrJ/3B/ws2Rjfi5fEK8/Jv1oeqQridrJ4\r\nmr5Z8Y50Or8ZrlLZFK/9YrqhNZozoI9aUc9p41mC6EFkUR3RYG6E1wmyamFn\r\nsZNGDiGOxQDmH8XJOhMRDoP9cFX4HUeNBzsNfrNAIF/g1fGKR1wuwDuFmM9z\r\nQFCMO/ldUAZBSdFVvLXw6BqfzHS75KI5NVm6NB0HTb4m8bD30nJ1m8VWuCc7\r\nZ7xlzWybB+Ez122PKmz/8Kpp2Igc+02UMZklgpIDInqgZd8Q9e7nAgOhscHV\r\nT3BktdF1Ag03yRExjCm6OWHZAerKjQUOka4dGrIi/WyUnvPvByuT2yR1mv6u\r\nGkUrHncPTAVhtEno2HtxpgF0lYH0VKCjFhAu01V+rY7Dsgf6pIXRXL7kjHem\r\nEGTvoEsNvIvZbIkTQKYzdUKfkiRJJmVdEpsxEuyTUF5PZLNgaxme+TGTBVr4\r\nJ/nLrDQO/NGEScEYMNd+S993SHoarAfQgM1nZAParljy/m2jMZfz8rFzisjI\r\nTfL4WBzaUUbSVAUc9CbqpdSvvrZiTdb5BPSnUHeg8eG0ZtxxpuLGgbZKuCxH\r\nigQ4PeOBnqeSKVj7o/PJqdhuMDMUxhpr0pw=\r\n=9IIh\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227200037-fb4badf.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/afc13ea16f88530dd308aa0c28ef3db7/graphql-hive-client-0.22.0-alpha-20221227200037-fb4badf.tgz","_integrity":"sha512-Z3mwThCM4PcVkSUd5TkHH3mInVz4JVvZw//eYX9bgrIwY1m03mg9dEXPXqjO2Npo/DD1Pc/v17fyfzrc+v+32g==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227200037-fb4badf_1672171281157_0.18322430930369737","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227201048-63dc197":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227201048-63dc197","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227201048-63dc197","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"cfcb4bcaa5555e623d06bd624b9117f64cc23f78","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227201048-63dc197.tgz","fileCount":60,"integrity":"sha512-sg3qxxhZb/KuTPhPorfTJcgPq349EIdTa9iD0jV5jhKcyEAJoU76zpR0mMzjzgrbPnLSS+2weECGFXHHDbhS9w==","signatures":[{"sig":"MEUCIQCBnhH+PHRoicr3+FEkuR8VsUJxG+CcXd7l7a+gikrSCAIga32CcNetYs4hPFQ8gy0NDHx7z2c5dwl98EEcMZgUgU0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjq1FtACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpEXA/7B1aZ2N4kllMphSlPGi172XYPkC4YRPR5klNACoOK6Kb7x9Su\r\nG/U2aWdkdTmBLvtx9g1e0vzmf0lVDiTvMpRwnBAHGsOXfbouWc2jk6eD+fhE\r\ng/GrihNV6vGm9tNkbrnTr0UJruZwQCz+tf6kqf4YjKEz8COKMMtJwVuynHiN\r\nzI5/DBqOvGTLG9ncp8XqM0nS/0jN4iEPOg/YR6XfKD8hKJQaTdkQdwh4DpPN\r\n7NLxvYULkm9FBJDZhJ187DsL6oZ82JUoKAabLWlA69rfYqOEGWdJ7LlwxEzy\r\n4mwGz/Yn1r4/Qs9sR9iwiEvrHyTMJNoWF54QrGLOqj1wvr9dG6wXH8VcyQKJ\r\n2GxOcbm9ADZs7jSDZir61ZcydjsQDl69SKix9htGmOCTY0kxSCBTNwDUUrUD\r\nCfIP3WoaizmWRoiJaBZDMjpWaOILVq97JEwZSPqB9N2Lgq96jyE6xV9W10ba\r\nT5fpiP6h2ab/RsJsDZyZ7OLYxPaeYzbp3IzMudm9zBndVnpeLGCp753kdzWt\r\naD85lyt2Ov02VdAq7pDNDwACU2i07g6WzYLO5C2CLA+1sCnTVZLV99WGfYxN\r\niT1zGcfLpCIOv04TSuJLg2qUaYJVm3SZx2JzO0BZv80Nzh9j2dVTAIEAGmU3\r\nV4ctkEi1b3OzwhDCSBTvzq8745jx6YN2TM8=\r\n=dNar\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227201048-63dc197.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/9df938d23221e1de1413191c50c6a10d/graphql-hive-client-0.22.0-alpha-20221227201048-63dc197.tgz","_integrity":"sha512-sg3qxxhZb/KuTPhPorfTJcgPq349EIdTa9iD0jV5jhKcyEAJoU76zpR0mMzjzgrbPnLSS+2weECGFXHHDbhS9w==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227201048-63dc197_1672171884997_0.3128194687363526","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227201114-70cbd78":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227201114-70cbd78","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227201114-70cbd78","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"ce74613e89a12802dac6b40083bd728cbf15f95a","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227201114-70cbd78.tgz","fileCount":60,"integrity":"sha512-89rnOuDq+EFSf8/IeK+muJkt6Qh7Ihi9o3Y4n7HbYkQ0QzP7OgE7gOdoC0MWk3W+wbFUmFxqhamIaGftm1xecw==","signatures":[{"sig":"MEYCIQDzlaixmBfeY8KSxa1TlLIxip8v66P1V66OgxTBaH/uIgIhANQNPLaLSW9FQ/N64LqfY9qBqiw0WweCclPQqLLueQld","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjq1GPACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmrz/Q/9FcEeP23nYcnlSlQHHN9yTVFGvT/rG56thuTlTK+DTAFgeLPR\r\nJfvm9661HbSN4gbhVg1b9Updb7jg4ssQokwFGUQ0fJ/zMELXthNRe75LRRfV\r\nY4xhi1NltolLFOlk4vh7jaPO2qaTFFyQRrvXoLXIks09UPLBuHR+BlcOH2jm\r\nuyb89EV+PKDb6dqeU77Jp6K6E14sXDpJcZCaVXnyIZoSQ6QHL0TfaaqWjqiU\r\n0/n6/W2ytHg3PAHZ0Yo5YdN0ry6DwNgRrjZNCKUpg4ocwzHGgehOGK26nwGI\r\nDM+acrKZaOGbYfyoLTWLdaOFjlogEu/JgnjYi3XYSjFsFi7yrsm3CWVSNg5G\r\nt3u6vmafdGZObodNryV3A8lZgKZOVjsIlv9eOCJkVAteIb2OMGgfYiIYUF1S\r\nrJQMNYcO1xjM5yu2u63ShGME0ty/hm47SfZszP55STlM5X1pl+AhMQSOeSvD\r\nigav9hhbbFmpu537zktxicZrw5TfT8qKdm1igF9aphAsGNujnfiLex0pNLTC\r\nk2pHanjQt2I6gmaOCXPwSRstJRTFSCTbRXpEF5I0posEO0ZlcAvFI0+WzCpC\r\noQPBwOaiitjA/RUhVvgmGC7MOX2YSwD41RWGEHtjuwhTRZZYiDc49Gg8SXUC\r\nRFFpZIZXvW5/L3QSEDBSOylsj9GGuQyMTC4=\r\n=OhZm\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227201114-70cbd78.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/228959aba3097ede2e8b94a202b9240c/graphql-hive-client-0.22.0-alpha-20221227201114-70cbd78.tgz","_integrity":"sha512-89rnOuDq+EFSf8/IeK+muJkt6Qh7Ihi9o3Y4n7HbYkQ0QzP7OgE7gOdoC0MWk3W+wbFUmFxqhamIaGftm1xecw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227201114-70cbd78_1672171919679_0.6122916046256055","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227201636-9ca3e3f":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227201636-9ca3e3f","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227201636-9ca3e3f","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"8c1bcbd232ed986f883adfac4606abe4e45655b4","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227201636-9ca3e3f.tgz","fileCount":60,"integrity":"sha512-XGluotFErAl9+XVn3EhmXkKYi6tNLnxtcCTjVSxT0dI/q8z7DYpKj5Yo8W/HrPMsXwesaJLYASGpIuUkwMCPHg==","signatures":[{"sig":"MEYCIQD33DXu4PK4uO/CuPDWdJLec6KdvniPUJoBWXzJh0jDJQIhAKLZumbg7H9hriYgGqxKDYwZKUik42vydj10Fl2xiI7s","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjq1LPACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrHLhAAiaD5cNdVujF+xR+PgoesLf+hKZ6wgizcQIipTzRgi9QIbMQW\r\na3qjMFFyV6MuC605dpRu8FNvndjMxBlzLTFgDRHhiE2W1e/S2+Oi7rfDpn/x\r\n0LmdD3tWS4BypmCn6KYPULwosk8Xcj0nyPFr+/K9dNNjIXJKEQ6QYtVlclkr\r\nZzp7khyVpaV1ToAf1iI/hxZp8kvaoVCMklmA995+jtQmFGxcWq6Xv9Tnjd10\r\nXoTp8fvg5oiJdAuWwNT6Ole4ttLRlTKZWRuN5fzXbRoEYRswXDY8dzC8QECV\r\nCFiNAdP03lCbK7yz6ofeDG2UpRvl3pKl57Ck6eXIqG6c+h163EP4SbQJJoZS\r\nXSD/IxnoG/R+bRqsPz+lrOjhCeU9EvaeG6416uqqtXuvHDbHnLf0iVphEiYP\r\nOi9p9XGKvdLk7hwjYQpLaTY6fAnsLzUXlU6S/+8aHwNxb88E1UCLhgFsxCAV\r\nW//tmNVqYkZTGaugoKdyHHr2v9k7+X4KbAZdiMdoTADNu68Yd5WfUPQRSm5T\r\n4Ba64aEr7WcYzPxIv+mYpZ4sw8qRsRP3b/uSUgsGXC5+d2ARL3dlAVmTVgLU\r\n/PBbreYfeFHa9RaNM578lN03vlhPLFCBQLSWIDZaPqJ2leVzldEPqwWDZHf1\r\njHaiLChcQ/crIv+ULl3Lr6DHmWlz0vT1c7U=\r\n=6Sn2\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227201636-9ca3e3f.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/0f53ad47c7a7c86c4d01ff9c9222b9c6/graphql-hive-client-0.22.0-alpha-20221227201636-9ca3e3f.tgz","_integrity":"sha512-XGluotFErAl9+XVn3EhmXkKYi6tNLnxtcCTjVSxT0dI/q8z7DYpKj5Yo8W/HrPMsXwesaJLYASGpIuUkwMCPHg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227201636-9ca3e3f_1672172239096_0.8504155577129044","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227202149-e6caf46":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227202149-e6caf46","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227202149-e6caf46","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"774763f6668626e072fd15f2f212e27f5063be96","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227202149-e6caf46.tgz","fileCount":60,"integrity":"sha512-uHvICxAgBMvSsmdWx2GnTBw441LQbO8SN08fUxufj81qmuLDfd8bpZwtshMbqgpT2E8W/WCxGx5MNhRx5bFm3w==","signatures":[{"sig":"MEUCIHdvTpkAo1KcaUq/aP5J88Cellzy77TpnyO1QUYmIBKdAiEAx+MQBMadnpE47arW8SPEvOLtKtq3PoMXblNz4MfDmX8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167260,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjq1P/ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpsUA/8CTyoMm9IW5lGn6U8yD9XfvbiKkYO1z6gFYpDkeRbARibAKN6\r\nzeTfnZ6PiguNeQXskBIYW0NeMMjKk2NY3Htlk4KM2999IDwXDjgnAzrBIauB\r\ngpKnjXfdLrhukAHYreVKpjdOeUivPS/x7RBESeDViECpmDW0KDNKGqIABYCc\r\nY4IM4moBzqcMlZIId0u+w/1z9nxXc/eGUyoM132XH3aLC4+sVcoLfe8ZAHDq\r\n9x/56+Q74bMiqkFZUdwf7bV3R3fiVHi/csVreBWFbtZV1nNec6zk9qGsV/Hi\r\nu/pGpg+PwBZUdyR6Y04fGr+eZblypeUGcq3qEqT9DuyHDF/z+baat3vR5nFP\r\nz8bgJogKrLYrMLjG2NfCFpAx7tIuP8mZWMSpz804BgbPLqwOyBUgXBI23Han\r\n0CE2UGguLwFX/53MseIL+mhb2CpkPUWkuuvE8RpFJSIdrC1V6Rbj+XECEMyr\r\niJqVQACtKrryJCCgJLuLSouP74kSQXLL/aBE4FTAAqk/IRpfiZ8+S3pcmK4p\r\nEtS3rYm/7IbhYz7iD0ilG5yGWyC8yeCoMix/7yJo2bJ4ozr1B1TpEM38cTCm\r\nEu8suyn5zv0X7rAUrtLxFfysyeswgB91Ftf6ZV3BeLW1K5KPeniiIug5UDcp\r\nSvNZiXDQYkmTTmP4NSFmUNWeZZ+6onRrdm4=\r\n=2fwg\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227202149-e6caf46.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/5dda15598412b503c6983eb7f6760044/graphql-hive-client-0.22.0-alpha-20221227202149-e6caf46.tgz","_integrity":"sha512-uHvICxAgBMvSsmdWx2GnTBw441LQbO8SN08fUxufj81qmuLDfd8bpZwtshMbqgpT2E8W/WCxGx5MNhRx5bFm3w==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^9.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227202149-e6caf46_1672172543478_0.941925567094275","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227202929-729cdd8":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227202929-729cdd8","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227202929-729cdd8","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"db35c8c5f7ec615406f282af152f9056773e1a9c","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227202929-729cdd8.tgz","fileCount":60,"integrity":"sha512-mJGHVcELwpJrK2BAQwPB3ZRexTTNim/MtAaFklzW25p5L1WwQe9itiTsfZKIGxJsBZpaGn+wg6woozbh5ib96A==","signatures":[{"sig":"MEYCIQC14qTfh87r10z1yVULukjdSBIhCJoTKTQGC7kRhOFXTgIhANDpPix/svVgKiVjNX3YsPagBGxLmtHQ+bed8VvyUwsd","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjq1XPACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqAbA//TdZo0uV5AmNmkyyTjNOuDYIc/VyAqxNFSfwKM83LDcBFgoh5\r\njj5sECs9N49FOk2ugw2gUeJ2DJk6VIgfFpaz9hEXxKKVVL7mClTStuXKX8em\r\nAPgB/z64xPeazaCGsf6mug626lAlRHVPik70OVxJxJNPV7S+d3cGPxUedymS\r\nFGL2SKc/pw5lKuVmui9XJ1APjU3I9Lp4AQHdyk6hBoVjy9GIvdu4mXD5lDJr\r\nhRZ+m4FJ+X9KnniwZ+arzY+TFfklTmEIICKzigY6Hu0uDaiQt8CNRvP2ogsm\r\ne1vfYAPTCik4orruWPi/eC17+C1g3TQketJrftgsXvn5KF7tYA5az5aKpjAq\r\n9i/II4ySY61Ucd9kR4pp2xaRFWomMyLd1prRmBJn1IT6UdJ7A5wRuhbEY1B6\r\nPSHFogeDD0DA5AG5pNQSWjDmy5sUKTTQ1UEBaTZo1zFknTdztiwgO7wcqFMM\r\nqSrHvWaf2v2KShIVrjinGfy3tejik2xwlueS0obVXZ6hg6A8iCIqHKt0VMCS\r\ni9siQ1VeAc23Oiy8bW6myQJAJK9kBnpzs9vXcf846oaEycooq6eUYn24ilpD\r\ns/TmAGLHXtwfKHHvqSjuAt8CPLOUEqOc3cUmDTxN3pAO4o8CIly+Nnis/ZtL\r\naFn+iia18B/TSU9WQkJNxbLeXn2vm/ndYCU=\r\n=jotd\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227202929-729cdd8.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/1a45e80c86c8d15088d26bfbec2e500e/graphql-hive-client-0.22.0-alpha-20221227202929-729cdd8.tgz","_integrity":"sha512-mJGHVcELwpJrK2BAQwPB3ZRexTTNim/MtAaFklzW25p5L1WwQe9itiTsfZKIGxJsBZpaGn+wg6woozbh5ib96A==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227202929-729cdd8_1672173007368_0.20735112466999395","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227203334-af39fc6":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227203334-af39fc6","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227203334-af39fc6","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"6d589c0dbed97bfb4db6d75116c2f5dddaa8b03b","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227203334-af39fc6.tgz","fileCount":60,"integrity":"sha512-LMt565OUA9FhN9Gc8vzMzkx5kGfFiPkQiZREyGg4O8xLz/URk3Dtycoc7GfgRLVmdTefz9IBFOFXsGhTdHWuPQ==","signatures":[{"sig":"MEQCIF2u0jLS2KmZ/U+R0+MLRgKVgHkxEYaBPqdTNJ7Z0TFrAiAk8uhRhRudEzlJmh4ldtfPgvEN7AejBkNS61lFdlQsKg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166012,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjq1bBACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmrhfg/+PtTHzqIwvWveyo+R3d/VkjXSRkJ/Q0mg8v783Dl3UR4VUpbP\r\nEX58Ra/WImQgxA/TQhlnMNwj/StNtbaKXEw1Sw+y8xAsVVhblqBvFwmcxvWf\r\nk5KYS6RPcDNUihpXuoHWObPe7l03byf/gnxYPxGjsyxSFCbEnMDtKPH3vpeu\r\ncYZIaLXnOjL64WALkpAvVPECiAwhwADwEIkBzZtTto0JIlMEhMjMl5LtUgC1\r\n5kEED3wnqWazE39iJ3XjUAPg15Ke8Xm43mEJ7+i29jYL55r3LzkuHUifD33B\r\n9tZY26HaIoQzfBGS9CXRsEOmnoLJkKbuZVuK1Cmfbs+rwlikw9Mw0mvLjO3T\r\n4y/Kb1V7h2n683MffN3MbXZWd1J3ukePFqfASkabatgNa5q4E0SmoV5TMuAx\r\npkPx4TKeonJZzEuejf0UFvFdoG5TJSGvyO4N46o4y8nIiRpFbziqBRqXSSrN\r\nVa4dG8z6XzDg/WjYlQwisuka3lOvqOwqhDNvU4rvgpetSDBUtq3oxuUlzGwX\r\n8RbMKVnoPRmF5n8yqx0qssGzTyzb6FHk7N5xX0uLp4ovrHgOuOCtY7wSJgDs\r\nIYyY6NUzG/jvIHaD1esy0u8kpzkUiRdSr7pqmX9B02Ma1n/wR8wyATIvdE81\r\ncuW9ewlI6xOhtTvU8wc6kZbTpQO3QVqjK/Q=\r\n=4KgJ\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227203334-af39fc6.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/aa811384f0ec63c9fe91037aa781eaf9/graphql-hive-client-0.22.0-alpha-20221227203334-af39fc6.tgz","_integrity":"sha512-LMt565OUA9FhN9Gc8vzMzkx5kGfFiPkQiZREyGg4O8xLz/URk3Dtycoc7GfgRLVmdTefz9IBFOFXsGhTdHWuPQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227203334-af39fc6_1672173249299_0.1824177672085443","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227203610-1ad2709":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227203610-1ad2709","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227203610-1ad2709","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"7f0dd142a0617d14460dc5f6af082aa5b62055f2","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227203610-1ad2709.tgz","fileCount":60,"integrity":"sha512-n46gyv1Lw2vEvkVe7TNEmMg+6UQopf5tNOFn+EWYX1kSIe2JpHIXbJqwhBw6R1Fuf8sjAcSi4oHFQKL9n2NnGg==","signatures":[{"sig":"MEUCIQCGTb7zMQFCSwzFhbxXvHMLfl7STiAV6ez6KlcNVR4GAgIgHkfALDoon1daJQJWkNxR80NpJM7o/ns5u0JkROjMq34=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166012,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjq1ddACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmq+Wg/+KrXCACTbtk9EnqLqo9JkmsKG1iyr+lJpOWcyX1wMuGktlVwo\r\nOyE5MsNr/WwI5f6CJ++eLWyGc/JaifsLhB+0RPqg8e7ellmlX5eg1hmkpnPU\r\nu3comxudHjfqgwLdQS5xuQoz21HJanLeWUfR+h+QzovKs+WUer11Fs01EKXs\r\nu2NvyJmQDN21QKVj0K4IwBgxRJsvESJDCLbi+NsGyeD9Ke+3YyfH8xTfLnNY\r\nfpX7+/37oTNX8HrppuGDw833eMtNF20GlCM0zadHMZwiGa3qQTnN7t72VqnR\r\niKcj71ZRbpHados2lclvNSfooJdybHua/ql5PzZUH3TAMJTe6Z1NDMq5p9tC\r\npDWGDKLg3lgNFNIvnFnszxfEJZFh82KT1VoOzoOptPHWLPxkRYWcmZ3CPIOq\r\ndQzCsAoDxYKqpRsW6LXyo+Ul4RHXhghf+hsTXCK7XdYhV8aQcsJpmr+mUPx2\r\ngdpwpFKA1m+elTswsu7SQBw3LK0uLCCET8j2zWfKHcoO3eroxUIL7sjwdO2E\r\n5IaSYBqbzH3wi9AVmWvLOWv+RL2/IBnVwr88vxAwWd/p35KgFhE9ykZH0znC\r\nGPae9SxSM3/kb8u/849eTTGrWM+ZeXYyMAsgG4NdSTNx2/XpGMyGLS9cglzQ\r\ne8WgGb7LrquNPAQO+Mgzel+UWii48zGjbj8=\r\n=isY6\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227203610-1ad2709.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/6f09b6b343a7a676b50630e2b48f1cf1/graphql-hive-client-0.22.0-alpha-20221227203610-1ad2709.tgz","_integrity":"sha512-n46gyv1Lw2vEvkVe7TNEmMg+6UQopf5tNOFn+EWYX1kSIe2JpHIXbJqwhBw6R1Fuf8sjAcSi4oHFQKL9n2NnGg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227203610-1ad2709_1672173405385_0.1020416590614357","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227204609-c212c13":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227204609-c212c13","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227204609-c212c13","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"2c661b3b4661a60f1bffeb83bf684767566f7eee","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227204609-c212c13.tgz","fileCount":60,"integrity":"sha512-rNCsTGJ2P9zQl59rGw9sE5ssDUCMONudXLKCaFfzuNEn04m98z/Ns5qXAAzgJzJuLdj+4L0NqwrUJqsHQfXryg==","signatures":[{"sig":"MEUCIQDei1aI9yB9KZ/SLBLYsWc0ixQSF+2RrLSy091xDr0xgAIgYjU91sz5UZwZslrYDWGHgFiOx/rb7ZK4hulTDRSDlX0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjq1m6ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo1kA/8DTFg2fmTlOD9bPXAUCSS87WWv6t0wWUvrsMb3OAwTBwpGSq0\r\np85rBeIxRz6/uLCHNQ3+XC/Woy20FFcYtxuU2LFlvILC8P8keV/5BMkdc8CX\r\nOC7PTbb+2iu0CwkagE20rXnMxwgAXDFgcV3CEc85ZEjkMWMrWk+hg0AmQpio\r\nQTQ8Ke8Ju4F3jXnUvNdhj+NwfZaB6Q/NWqus4KwT4w2+B1c1D7n2Gdrw7IDS\r\nBL+gZpgBg5DOmiWkPoEuHG4UsbN0ml6UymDcPRRuvbbb3ILYdYSZlk+eRQAh\r\nRL/q/dHDTBmNZtfsydnxsryPk/sGys2ZUGbVmKDrNlLarVRCx+9l6znfQapz\r\n4mcc/lnXNf+nsWsWXDz3yR+9xndTo38oG4rfn136eVAqw5W6AgCm76Bo3LU9\r\nis6ZE9HjS6myqj6wDBfeaowAUsl2ZSr3lH/9NoFhE7RPFiUDQQowFLnlQiHd\r\nou46Bvh0KqYnJLmOp4fHDmsRoi/Gf2Qs7JdLNcisEhbWlYb0No6ExZXGYkzI\r\nMdW457JK9bvy4wrbSCwACeNQCpshWHJu9Pb4qQVtI+oLhHm4MSxVMeTKw83K\r\ngmxeGN3lVXUptNctvkjIfCSD0BoM6+1Cvm+7PXtcZayywDJ3R1pO/g2z/4IW\r\niJJO6f9CR62TBhH4/JjX+ZVXdXhIqTRG8y0=\r\n=3mjF\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227204609-c212c13.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/e371dd833a7c63fef7b45f8f0236c4cc/graphql-hive-client-0.22.0-alpha-20221227204609-c212c13.tgz","_integrity":"sha512-rNCsTGJ2P9zQl59rGw9sE5ssDUCMONudXLKCaFfzuNEn04m98z/Ns5qXAAzgJzJuLdj+4L0NqwrUJqsHQfXryg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227204609-c212c13_1672174010059_0.32816259345529875","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227210348-79aabad":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227210348-79aabad","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227210348-79aabad","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"1fe73920f8bb4cebe5da2a0068f851da925acee2","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227210348-79aabad.tgz","fileCount":60,"integrity":"sha512-NnapWfE+cceYAmRpERHFqDBY0bv0AnO8G3fidBElqgqhlDp00qaYn1GlnUc6fQ1f0pnqzocQTl4jHPQdtjN9XA==","signatures":[{"sig":"MEUCIC5XD1INh3u0Hb1gK8yMJNEyli5Pn3ySZhVB++JOrAM9AiEA1J1cFtcQDm+uCmVbBYcKHb0z4xSxg3miuVFWeEhhcKU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166012,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjq13XACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrF7BAAmT7PkHe/4W+ucNEJfaFwB3zGZ0wu9G89TOaykl482V65gDtl\r\nfXkACen44cwRwNccPcvDWJ8uF/8gA7/k0zDw0YD/UVfUAT2XZ/mDDXb3dw5o\r\nPV+ufKvvqyqrBGmPfZA+dlQ7s0GxC/q0CJxLhHyYOiV8O+RGofNY5IvD1Q8Q\r\n9G6pXpw8qM4hwIM56TE25Fe9gLuKyaTWHOFEiyp65zJ9gSbuHpUy6ojnQC+A\r\nddZ6NAvC3eWShzFJ8/oOiruBPcpcXipJNwOMuIBFKm/gmuJ8NwDRkv6KC4vk\r\nM7pkl7RmXUDiJwGXnxPOPTAqHQj+XYoLQUWaWRG4ElDBl1ricvhoqmPlPL+T\r\nyDOA3sNmcJIX8cClT6x2I7YgRAzJprvBhfBRNHX/hxcL3MyGmzdIVnZ5+6+N\r\nu6yt7KCMZTNGz4ODhb1G1XTTViBYykJn2xcRm0lwXgEJLWnXB8yZNOFSMD4a\r\nSecUyI2xmkwdSfkRO31TWJYIQlVBkafgNpdrKsKRDOSeezkxLlDcpaxOvAbX\r\nHeR8O/47IR8BSmpI4Iavr+uVhyVVHRf6MYCVbLO1rR3mmVtkhHLHgQklrFGD\r\n1tRkUDx/II1MtlSuRWCQSJ+zR213ASys3NI5nOMGDm0j+BkiH3/QpgTDgGz4\r\nfn9JNXPpqIM3bm7nLhoWOvv+I0mZtXmY9fY=\r\n=xDhk\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227210348-79aabad.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/01169eb5f86186630a77e718aab482bb/graphql-hive-client-0.22.0-alpha-20221227210348-79aabad.tgz","_integrity":"sha512-NnapWfE+cceYAmRpERHFqDBY0bv0AnO8G3fidBElqgqhlDp00qaYn1GlnUc6fQ1f0pnqzocQTl4jHPQdtjN9XA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227210348-79aabad_1672175063734_0.334554182784492","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227210903-d0522e8":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227210903-d0522e8","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227210903-d0522e8","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"fabfc4fef4c60a2d06880035733853ed66c9b38a","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227210903-d0522e8.tgz","fileCount":60,"integrity":"sha512-hrZHaFd4yVhk1MC+EvXdo8N27Yna/BMIq86hNNUScXfzcFWdCO6JH33s3WsCYbINw5ne9duWKmgezAPnOskMZA==","signatures":[{"sig":"MEQCIHHxtO8ONC+cnn9r7Yfq28YyglM1Uw4HrqbZFqJNA+4cAiBmro8GgcT6LnZHDBflna9BV4xrUkVj6hp3+c/7LlHHow==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjq18RACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp2Ag/7Bp+lFYb/bAqVvE5CVExnRjHnFIGx3dN10tW1kTlV8a8+VRYk\r\n8DrW+CKplJBnUsXixxCtHoDhhQUEN+p+wmUHKzCkaEDGYOZqXn5H8iF84TbS\r\nrTNZCdx0mpZ6rt3FyhxJyqnhIo7WmXdgMsrgkhTg/QCru5olVVqvFu0UGTjy\r\nww4SwFTLbmyfa4cmRiEkuOJ7sZvqrGa2XHxGTOs1dx+XUJkZLSlW0JfdKwy0\r\ntyh3GAUMiZ0TFDm3CMynxHqe4QMZctXjanJmH4IFLPgeZy87Q4FXt9nGWd8+\r\nmn2fiz0K+oa3v5J7pw2Q0pj1fNoxYuB+ACCUQPizVL2UwGvcAzoAEggmKjGH\r\nSELYQQJLNkeMdaMnLhccuZuOlNM1hLS6X6a9tedQWKKkKQOQ1xZjmzFHWSqY\r\n3zE9Z3x35fiHvEEfuxpwgzrM8Su+xSRwstmZIcOMPH/hvS8HxmiUtHHRLEaH\r\n64HxIiY1lKjSLs5i313VDgM+c9+HRerzXUG6mWtodolsUiW9I+9tZa+uACA6\r\nDrw73K3w4DRQMIR6cWq2ySfZF5XYCpyXLeb+PQAOxobe3YBs5bx9reeHq7Oo\r\n+5drgS62kkShVRP32D9fh2dvVY1KcTI7DeLC+gb7+y9HP4zhDOMB2LjJDvH/\r\nHyKQZ3oU591KjcpNZVDgsu28oHPkSLHEqrQ=\r\n=01TP\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227210903-d0522e8.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/6590842d95cfe68be86c85a60701207e/graphql-hive-client-0.22.0-alpha-20221227210903-d0522e8.tgz","_integrity":"sha512-hrZHaFd4yVhk1MC+EvXdo8N27Yna/BMIq86hNNUScXfzcFWdCO6JH33s3WsCYbINw5ne9duWKmgezAPnOskMZA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227210903-d0522e8_1672175377598_0.5500885795539607","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227214806-c15330d":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227214806-c15330d","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227214806-c15330d","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"6bc1284e96fe3054c9a929c28e2c51de9356865f","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227214806-c15330d.tgz","fileCount":60,"integrity":"sha512-Edbhw4x1XAfpRnlvLm+i8S4v/OJLE9lG4H1fyzkQGbHULY/Hy1hviYsdSBFFxy5EeaVKp4i/ehPqIpVTV+8mhw==","signatures":[{"sig":"MEUCIQDdYtSyKJVVaNGrE+icnpTmBlk3mS9+qY0z4m+fVCWsigIgIHhERt80OvPmdSZ+vj+hmhhia6IuVe+Q2lQDWj4NNko=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166012,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjq2g4ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo8hA/+JAAbQ9733Mq0zwCZSnL0YS85D3TYiBrA4xLZ4l8N714gsakn\r\nXhAajKQN+ZqAI6i2pS92uJiB9wAR+XLCqTcevNybBzHsGYE/xJ3bkIgUd4X+\r\nx0MO36XJxE92afojXufMPlJXbhjUOA28UQgVJxIIsa+P8KmaVeNd7uE8D2f1\r\no65kENAQjqV1yQPJ5VdNvHUDX7Hd/PDGCODwhwnmOmJ1jgeitXDCP33Dg1i3\r\n/xWOty+OfEaj6TFdpPCgrPwq8xmpYabH03Ru0ApLXceh7TJ5aSBcJXZrrvrD\r\nliwYaTmsPP3AqzHhJ7aOw0UXdLDpeHQ9xvtnOwyQPrf7vhg7mwwKcCIOeo/9\r\nZX7HfXF6R3O/XLCg4chXTpQSLduVt7reapyIikH2mbIoTUMOMeD7Dy3osHpf\r\nrh9B52iSJgAXFTpeH+EkJu1Xy0l11e2ZWx/xi/BZYGozc6qae+21+Mdlr8iO\r\nfPeeij2T0RJxJuiwoV+B2FxArkrzgk2bZrKxcUTnOs5ySMcqNufrNR5s06Qk\r\nO+tsmuu2K2xS1qCZfBLhJQVi7hgQLXiirpnNYYncxl1cuZu8WGYvtdddcIPJ\r\nx6xm4r7SxkqzkRB35ZprTpfTQOKSCPALAXnw8j5Bd8yRnVvD7Ymu/jv+7Alg\r\nll2act6ix7CfJyLPF8/jSu7Gi7bcX9QHvh4=\r\n=gHi3\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227214806-c15330d.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/b998a8c50389bf49b959fdf378fe701e/graphql-hive-client-0.22.0-alpha-20221227214806-c15330d.tgz","_integrity":"sha512-Edbhw4x1XAfpRnlvLm+i8S4v/OJLE9lG4H1fyzkQGbHULY/Hy1hviYsdSBFFxy5EeaVKp4i/ehPqIpVTV+8mhw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227214806-c15330d_1672177720423_0.40308028030776466","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227222108-180bdf1":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227222108-180bdf1","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227222108-180bdf1","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"a235abd4367667738e621a3f97561dee03e29adf","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227222108-180bdf1.tgz","fileCount":60,"integrity":"sha512-CQ6hn2o7vhqFlswGdDFTJsuDBWutSXs27tY7L/id78rOsXhw/c8/KmIlEUWVvDlGGjYgCUt4BidsRj37WFNC+w==","signatures":[{"sig":"MEQCICv2NtRVbHw2EMyjUwqif3q3GMe83UbTxbY7yODckAGQAiA1vcBVVYxTkC87PYAiykbSHjF1WQxzNChs1VSC+/GOGQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":167261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjq2/2ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmow1Q//bA58lyFtSsFBJXspUqC9BDsPcI5FlsCVUfk+gcd+Et4LywvG\r\n7VgIs1AVyomXYlWwOqujCdubLxMIFA7mJV+QeG+yg7dZ80Kb3FxctgzIFIec\r\n9QLKYOMzcgclGd49tAToV7zfEW83k7AfhReYEPYuPmp9+8xuoPfTBCqnXtms\r\nZWVFIjBoUZKarPSCyemyXkb6WoNk/vFr/QxuiTWvRjDkjHM7c9TLjCXaWx0Y\r\nADkFOU9CoH4AXxrz5iNwFAcMOyJ4nwiSIg7vEx2OBf6M2Px9tM5pp09+1t0u\r\n/n3Ls0kawXoEF/0r2ZiWU/ZtpV3cLsS2w5Ew+gm2xD9OreBEit3ZHCgaS4od\r\njp6BcRjAu+4Pnxs66NV0KjjCVNXZe944K86nhC7YN3OXQXGPNt2bgbTatL+v\r\nd1h9wPZm4DZWbvTgroJkMWSUf93f4V0t+hthf1m+rKlJCDjrsoq1lBchAznU\r\ns6YWSCKlKzmlOpU78Pj7UVCKVU1ZVF6ASAXBr+/qwxZMOp8ywa96V8P4hY8f\r\nGLCjVf0R8Z8iptriL0FID2UUT7HIqXBY+YYJEniyo5RcGs1OSVn0BtILMaQF\r\nopmxtmpZvdW4MIBticigigMuAK4XHWkMkOl6GYgDxeCVHBbMBSoIBEv5UcSa\r\n7A8oJlC6aSSbfzBleINZwsBDvmN77rLrfNk=\r\n=5LN7\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227222108-180bdf1.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/e1886b3bf5992607fee8222c78e77fe4/graphql-hive-client-0.22.0-alpha-20221227222108-180bdf1.tgz","_integrity":"sha512-CQ6hn2o7vhqFlswGdDFTJsuDBWutSXs27tY7L/id78rOsXhw/c8/KmIlEUWVvDlGGjYgCUt4BidsRj37WFNC+w==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^0.27.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227222108-180bdf1_1672179702415_0.3422537891482822","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227224115-1aadb7c":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227224115-1aadb7c","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227224115-1aadb7c","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"82f2ff7239739c82b465867ec188554a6fa1d2cb","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227224115-1aadb7c.tgz","fileCount":60,"integrity":"sha512-Qtp+AkBCqbTEqAqsvU516qDMqahM8dp8ePCmVU1vBzFgKSzmLZjjQuIat8XlyaUxN0uOSTdUN+ooaMzXCSdgIA==","signatures":[{"sig":"MEYCIQCI2mTYT2Cz2fHXpg5aI6NU+B4Ui3ZMv48qvroPYyp6MgIhAO6hKTTNiWeV49QMe6pdPuKNH/Nn4YLf/jMhF2Izt06A","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166012,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjq3S7ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpNHg//fU8aGIaLBKWeKw/57MPdnkwgpDp7qHkDpPrUwc92RteYvr3R\r\nvJ/eeBJ2Q/1Z55B6CQnrba2reGPSQK+H2IVm00P4fiokUnqhQmscDXx+pH4g\r\n065nORY51j8/hSy4737LielFtExxeO7HgFkcDrda8wfT+WdEIwUYmmqtD/ot\r\n/J2iFV5Lo345LkUBKv1fyfnY5nPJVfORp+j5TdVnVVkMbNtDZlyCx5fUA7VG\r\nkQLvTcnEbdEiwXlFOBeobr/F2pF2xFBOhherTxpSdOUPKQHwZZM+WpwMKTlM\r\n319txk9Lf68HnILFGDPdCqTJ/TcXf/B4GpR77mJ582ZZvIpUfnzAzF1pfVkZ\r\nef2lnAhHSHKZo9WON6WJM4IDUL1fyC39KFpAEmNv+j9EZnUXXmNNfb+G+U7V\r\nyMdLRNdFYSkl4Touk9i56J/pTeJhVNrvPaOK1jSyDDz2cjQwEIcN8yvDcRGW\r\n1TNturJKu9LsdbBlvcBwjsdXJ478OWT5AEuVhAhhPq4TtCv2ow5iaot4HQNP\r\n7Y38tymAbCvHZBa+N/sZlVfWnN4Pv9aujnwWTDvSvFmOG4ngfKuGWefE57Sx\r\nrGqxgrA2YZN5X4MAtDT1idvp5b65ODQkz/QJtRVlXrR6D8lSJU7kXmxpIJX6\r\n4fXkqoZHLQv1eh7lDOqnPHTJKFwgfXe3mxY=\r\n=7//4\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227224115-1aadb7c.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/3d2dd825662186953432e3915213a24d/graphql-hive-client-0.22.0-alpha-20221227224115-1aadb7c.tgz","_integrity":"sha512-Qtp+AkBCqbTEqAqsvU516qDMqahM8dp8ePCmVU1vBzFgKSzmLZjjQuIat8XlyaUxN0uOSTdUN+ooaMzXCSdgIA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227224115-1aadb7c_1672180923180_0.595031282603502","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227224213-7225089":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227224213-7225089","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227224213-7225089","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"671183785323a41cac297770131b02e889bf4bfa","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227224213-7225089.tgz","fileCount":60,"integrity":"sha512-u+EBDcofwP8TnGd7zeF9+Zpi9AnR0rF/3LZo/n8KQk6SVsZ29UWNWiaenpuN+owaxFOGwvD6h/rHZ2YYNFYjAQ==","signatures":[{"sig":"MEYCIQDDUacA9Y4HKZnN6rHXjlWO6dN1k6+fBeVAt7kiBO1HKwIhAMSHZCgLWzYj5NUKaCS0ZqjM2AdOvnd2/GA4yUFTrvfF","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166012,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjq3T0ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo7sBAAlSu7XRiJjsARfm0fW9btSfZhlgsK94ERTP4fsCnPCFnXxvGe\r\naQNwY/3iyssFEzeZmOqRYi4DAoXTVwEJH8sDz1foe7XzIsuh8GSn1QVo4CB5\r\nQ7aYqLsDct9HmZiYGVVov9dyQS6j3LIjy/r0h0nttCXYF8seCYG8T5qNK/7t\r\nK3wbtJJsq8Fnx01QxyquzX5f2bRcZ0pXsf28BedSeL9EtD+6Yj56TsqNVU/K\r\nCiD8aZeAlp2FnjiHHYKwCDDMyAV2R5xC5pYaeALwRpJq7aI7QcSbLUg/vbHJ\r\nzrhjORVeIgmvtKdpopOZXGVq7s2Fkh1KaXdr/kBnpKo5Z9p4f5tIRrR8e2DJ\r\nDPjmB2JbomC9LbJfglGJkyNXvWKjMoaSNX02B5VZ5XR3GML22S7f20aKXyFX\r\n+s07k5tk+UjaHZQDunyitel2lxD0lPXhD05t+BMSDtT4N5S8b7cIGflaNT8l\r\nt+Hm79vbCFCYJleNC22z9Lho1f2fIymDMWiaG0pXz/5zRDfJEYhsfdcKCa7c\r\nnZEl9dgCAHnvebhLtGGIKlvMAhp99KoyntTupaBPloFYv5FaHGLN8jsGkkM7\r\nvtHwOil4AD9YIBNQywNNqCmxsEExOxr9DPzAGayjUXFzDS6AH7Z5Dm39qFE/\r\nb+nq3gwQ7GMpUWixOhBXKWv2jmnGEWo4yjg=\r\n=o54U\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227224213-7225089.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/05d8d595c8408df58bf87940a75f6497/graphql-hive-client-0.22.0-alpha-20221227224213-7225089.tgz","_integrity":"sha512-u+EBDcofwP8TnGd7zeF9+Zpi9AnR0rF/3LZo/n8KQk6SVsZ29UWNWiaenpuN+owaxFOGwvD6h/rHZ2YYNFYjAQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227224213-7225089_1672180980195_0.35812480719874773","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227224533-63e0a87":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227224533-63e0a87","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227224533-63e0a87","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"28036c73061ee31ebb0ac2d1531e53f1b867c1bb","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227224533-63e0a87.tgz","fileCount":60,"integrity":"sha512-cwyVntLNvzpg24xArQ9+KIAbauvorFT5hiaQy3AJH1hacekWW51UCSLoy0NzG8LLrlNo21l4OwBkUIprUQNUmg==","signatures":[{"sig":"MEUCIGf4ctzgbMlQcu7Fc+vjtvq2j+FdRhIjYeascvsCF/WBAiEAtI6+8faitiQe1dIhJzESp7uBTRvp0NiiSIdGQ2HypbM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166012,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjq3W7ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoG/A/9ErVX6vmTnRjCF9jgEpscmH7AM/1sLyUPIoU5tdwmey/1FlPl\r\nc05yofKZ+Vv/FGluvI2LTat1jHbWhFUll/udxYd0ijFYqwcUQKgnZLUSRxv/\r\nrQKzkozaSIQw9iNtAmd4hHv1jP9B00v/23NmSZX01GeVr07FowkycxG880U6\r\nB2NBtiq+I2J+WDXcBpkSxHXbASmsAO+WTBNoF9cD9xgwMbG/oyCJBNU6oESD\r\nMmK56BtOv0ADCJuv7NVnGEBxGAq6p05JbCsCZ/k1pQEiBf98GgnOyuM3Lfwh\r\nI3MkBNhjVqSG4Pt3yyTIcgrSXkanijcz/gnt1MIAzeW0SV4Spm0+AUEfPPOm\r\n/6O+DwpHP0laxY8hUAYSBnDvhnW2eN3Uw3hDDAKVPghV9VwplRCY7R5uCu5S\r\nICLhAAc/v1VaxAvy1t4cpuFWip8C/91hJ+/tP2Sz3eB955xZhGOlzPhagHIE\r\nl5ME48ymMbthK431Ye/4E1Jqoce/FQZ+GAcKA4XiWvvGYEH1rUKHoYUeCfXi\r\nO0usKFzVZ0ssXP3nFTzbaFk+9J7D8c948HzG/L5zzrWqyWX2bmWS+EXe7MEm\r\nO0dsr8nW4QJNRwV4kKEcVL6QQTdJOBfY9AWFTO14OPaIIFmwfxKoQ0XHyUUq\r\nArpXxiVDN4HVkE38ibUhI/nVdZQOnn45qWs=\r\n=DUf0\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227224533-63e0a87.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/d53fae5f7bd43a71afbb04deb1ad39ee/graphql-hive-client-0.22.0-alpha-20221227224533-63e0a87.tgz","_integrity":"sha512-cwyVntLNvzpg24xArQ9+KIAbauvorFT5hiaQy3AJH1hacekWW51UCSLoy0NzG8LLrlNo21l4OwBkUIprUQNUmg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227224533-63e0a87_1672181179367_0.56082208922643","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227224549-821fb3a":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227224549-821fb3a","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227224549-821fb3a","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"882524b4d2914ee54e238b8ec41113479f060145","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227224549-821fb3a.tgz","fileCount":60,"integrity":"sha512-c8QiYn/mZ0OLKh34wZyFyYpHsGACC2s/uvFWuR2KvhuqmRJOnPZIb9+QupAaUCiobv0Oa/zXXlp0g/q6SFzfvA==","signatures":[{"sig":"MEYCIQCp/y6DdUYC47w986pftXkK1Ag/sDWB/1OmclktMp20PgIhALZjfmOzij+NmSW75lXYGslgmjC+3k2Exf8YbKbDVxp5","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166012,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjq3W+ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrJYQ/9EPFcd6FgvVxMeA+8uGPv9Q/y1pAvFT1BAWshvditGa6/utKP\r\noRoMhfEX7EqYWwQmQmLE9vQygVL+AqAss+dMuOWikR8ZoH1d75YuDxSLaTOD\r\n8yz79OY8tzprZF/vPwIGPFm5xJ1IiGcyWaXxoGGU57Pryx4TAWotEFtK54E1\r\n0vvz8DbkDux0mBKOEvsPchkEGm1LVKblo+WBrlwpjnENHdxYZvWmi0vk+aIy\r\nSnLl8shQf2Tcavjo3yw6HkkviMqOfPkESZS9vl+lVlX0mmiv8sd0ta0+jgJs\r\nvOpdeSedyV4upi18P8eVg96vVteFi6pv4WC48WIW1pN1k0aywLXGiQr+j4HU\r\nsmcnoU0yK73j/I0xi7dsLO1JLz4rG3pa6pdiBznDip8Xo7r4nYKS+qwT+Js8\r\ngQ0g2vMp7rM+rk5eEAtlirEWoBulKWqgt8j2H4Z3UQ65JQCOV5u2gcvFruFK\r\nPoynLj0X3J9lOzUPIO94DoYnLoWV8aPR8Z2YkNGac4kDx7ZX4y52sCvr18WR\r\nQAZ4yipIpigVW5YWEjbn0W8gV1ZvgCjvnpOkE4sLB6cRQF4d51FTKne3xXGs\r\nmQoolJp01kyzbhCHV9E8DEr7T+ntUhfDsx/0tvhmdzz7DCmBpUvEtgeHxB1v\r\n3SiVpm1y9Z4cxZrLBURPPxAh5Oo8+jjnTZw=\r\n=wSNT\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227224549-821fb3a.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/9983ff4299390800b076bffc90333476/graphql-hive-client-0.22.0-alpha-20221227224549-821fb3a.tgz","_integrity":"sha512-c8QiYn/mZ0OLKh34wZyFyYpHsGACC2s/uvFWuR2KvhuqmRJOnPZIb9+QupAaUCiobv0Oa/zXXlp0g/q6SFzfvA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227224549-821fb3a_1672181181974_0.7283725781779962","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227224954-0a55129":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227224954-0a55129","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227224954-0a55129","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"53211242bd2d53fca9c2ca9fd4c137f78801f8d5","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227224954-0a55129.tgz","fileCount":60,"integrity":"sha512-jGQCwN7IXhmfW5+zDcsrLP4Jf3fo/PzZ3n0vRkjKwLD2rLE1kK09fary3BtDWkPRoaQuwpJFVCv0xZnaWWfiTg==","signatures":[{"sig":"MEYCIQD0sVuOKoukxzJ4JUEwjNHojT4/fEfTqa21d+p5rEbrHgIhAPM9En9H0g/YHussBmmAPO8aSZR/lhWhsst5/h3PYs9S","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166012,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjq3azACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmodog/7BbC1/1ZYbsTRpM10CvzhSvoR7ecc4idMtc4IQHjK/6twR2yB\r\nahtAD9YY7pjFeLUnPLkPSB2WYz2z2h9TSuOk7yE+4ACSMJcbXotxGGItW2S3\r\n200TG26fjROPTo/Dkn5vtZWjEIp7pLpbwbg5rxgf3YNniunbRicQ34RSz9Xu\r\n7xnZtpeRq8gcvxDvdtj6QcBQUsRjzQX7UW9TUnizpIDTHOqCRI1hrzw46999\r\nLnnXPsQ3l5+i6d4U6RFqMrJT+e/0OgWP8XKtMfPiSphTjygFU3MSY1VIdFBl\r\njYTgLDvwo060wNEsp1EanQQa2gP+J+ktwrDH4gBbYgQhz1jqnIto99bnelLB\r\nPpxUVMhMz+u0Pyo5uriJu9vCsToBEuKZRygCWfmoL6qu4BQ4qdel0JJ5taSa\r\n7/OBM28wKN3h/AEjY6ccVLbB1uSXFYFfihzqo8uLbxiWh2C8Z9LEAcCUxpEs\r\ns3gKp4A3+DLBnKnXn6ap48tLm0do62Oo7DwtB0+pxqT006tE+9G4M41xOkqK\r\n0hP79kblD8Qgz5EaKjO5NTOd8zTKQ0cuNdEXUNDjjjIhgEnB1IlMqLQF9Geq\r\n38QMuIf4v9cjDKLQmPURltj4uI2K6nQARtnREpaq7BGBRF7ornXuRzYna5s2\r\n77Ra6SKOgAOMaSYJCPw0eos3awn9rHihjaM=\r\n=aOsN\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227224954-0a55129.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/c35964d8c37ca97d22c812c7338185b6/graphql-hive-client-0.22.0-alpha-20221227224954-0a55129.tgz","_integrity":"sha512-jGQCwN7IXhmfW5+zDcsrLP4Jf3fo/PzZ3n0vRkjKwLD2rLE1kK09fary3BtDWkPRoaQuwpJFVCv0xZnaWWfiTg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227224954-0a55129_1672181427249_0.44005770729091886","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227225008-494c808":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227225008-494c808","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227225008-494c808","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"695986d0bb83b049b79640ed911c04fdc25c1eda","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227225008-494c808.tgz","fileCount":60,"integrity":"sha512-FVFgMk3AcMYOd1vUJj/Mu3YMD4LQb9xUJLt5yD1/FGdxETDrsEKNPeNt4qc447x+bhckr8o7cDkmvD3q31f6fQ==","signatures":[{"sig":"MEQCIHNEaExaoUVMTdz7MQRB8Shrzoncv01j113pEyfPedM+AiAwWGKNLAqRyNuD/T90eLN2VwYpVGKmQaLD42vN12CWhQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166012,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjq3bCACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmomkA//aLRdCiKXPa7UVwlk6bPmCmaZYdT3I3N4Q4yvG205QPeEV3i9\r\nXKqhZEG6W5dC78HjwFZj1oZE4Daq5dSEbaLtnz5ul77thbkLmXJkEDRhRT15\r\neXFOFr7KXIC4Wm4cwnGAgrVkQu4pSaOEu7gltGrEIWNEzXjtLIGFd1jfZYkw\r\nOzyxW4ikXz0jjdKtFSQ6IisT+3iOJ2xwdp/bcyinlJG9hmhpVhjuvXsDp3QE\r\nB+1i7G+6+50GCO9dfETycvOYO2zlZdZWm0mUrn/d7v+LJ256HCJTj2BLBN05\r\n0JNFOWx9ld5hzwhW01WnYjpoR/t/sKYl3k56zT6ptoUuV+8wxcj0IuLx+pDI\r\nWPNQI33yAC9CuelkOyM9y5dl0WtYtvtOitx2lg2KKbCN2wlwpK6Fy3PeHiMn\r\nEa1wLUfuDDwor+gYBhMK8T5yF+5lvgbmQ4Tgb5TkwppRcxSa5Rdj0akJ5sdb\r\n4GYoA0pWH18WT+x235cl1o41Iy5YYQsE+IYWUY/fDQ+hcgrhtG9hRd7w50Jf\r\nTSyJXeiAbzv0NZWSm9OOeHN+XfbnGiy2DUYewglAQ52nW2c4TbU2e3ZkJkwM\r\n5FxbVVaKWa4o5jioNDeX/KgUBnq70wGjKx+100m6yaaI4S0qlWC4CpNXHnqu\r\nGW7LLsnSmYTt9vS/9su7KXTUFOg2mJRPJgI=\r\n=sUM5\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227225008-494c808.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/ea740b1015bda653f2527b34a573e044/graphql-hive-client-0.22.0-alpha-20221227225008-494c808.tgz","_integrity":"sha512-FVFgMk3AcMYOd1vUJj/Mu3YMD4LQb9xUJLt5yD1/FGdxETDrsEKNPeNt4qc447x+bhckr8o7cDkmvD3q31f6fQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227225008-494c808_1672181442310_0.5708334766731717","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227225137-d03c5ed":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227225137-d03c5ed","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227225137-d03c5ed","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"0286427c561b70fda1d0a3fbb2edaed78a978913","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227225137-d03c5ed.tgz","fileCount":60,"integrity":"sha512-cwXL5Rcngwu2q7NP2e247vkrIxpSkymip6M5vXhTYsNiGcnRLm6AuilzWFVMCKxyFKCOb9coQgovKLKCfSlafQ==","signatures":[{"sig":"MEYCIQCDYDDeS/oKz1ZrjOtXy/QH8EPFVk6CIOH9uQrLdTpo5gIhAJfzuHjHShvfc1rPp5L/NoA9gFZ0kj58ejo8gTjOHexb","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166012,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjq3cmACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmopiA/7BpVMd00FZeBK1JCIejmGmrlh68526V5tDPBjMza3YcJiqh6q\r\nNk23cTK50ODLOp/x42+DPbMyktGHpc/GGBYv1Wez02wCgjMUbMvoxx/UaDxQ\r\njCmjoltO3zEPsQJieZtnSZk1xohRdX9zEOJedPVpZIzUuciLhRQrbyhqVCNj\r\ntmEvJmsok+UsQiSmRyUEivSxSVK1SwUsswshj5HmoyVMu329z5a6HAEV66St\r\nEgH+P+y2kBzbUCHvxgH6DVlwUFSgy9yFjdQq063fJ8Ac6OFL6114dwcGJw4G\r\n7UmZd4nhhTWkaWe+v4C7mYW+qJcjcyY5I0ux90toLP4FCSFRLwA76CSJaQjT\r\ntVIbgw69AfJbY9qXcjkidA2Aw54aOWge4xqwVYI3jtPWdANq3mvL6a1FqR/s\r\nxHG87iNz1PfjxERzgIzgl2tI4vgyqYE+x1NosR+PX+tYrrb+hpJf5nHfUmFU\r\n/bAj0109YsQ7kEcgmdvI9uxUXdTQTWoGOdyZlQBqKzI55jhv/zDQVOg8Je5D\r\n/TrwV8zXOv7FNOW6sqBxVilh7FSCj1ZVcKzvCeV6dvdalqf8Mlev9VxveyGP\r\neaQZZY/3AbbkDMP9k9yWUbNhFUJ0cnhNUbQXaVDEN6oXgVJuTuthsgyUiPZr\r\nBQbusv4OmbaQn9oYh2HiutcmXioNdS7zes0=\r\n=Plei\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227225137-d03c5ed.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/df455f1e9d8616edbb60f08ae3488357/graphql-hive-client-0.22.0-alpha-20221227225137-d03c5ed.tgz","_integrity":"sha512-cwXL5Rcngwu2q7NP2e247vkrIxpSkymip6M5vXhTYsNiGcnRLm6AuilzWFVMCKxyFKCOb9coQgovKLKCfSlafQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227225137-d03c5ed_1672181541906_0.5221620717887425","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227225400-c7a379f":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227225400-c7a379f","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227225400-c7a379f","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"36e9cefe6d2dcfbb75133e1bc43b29709dec982d","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227225400-c7a379f.tgz","fileCount":60,"integrity":"sha512-TJm4V87Xx5mPcs64Vbhf2F1NwkUzLR2Szi8cxfherwngXewK9bRbNFubGf4TghdYPITI1F/Z/uangkLE5UK5Og==","signatures":[{"sig":"MEUCIQDXkIK08I++VMRsoVLHmCUp5gEazNO8K3XoYib/VIl4NAIgVaxCvTQlhSIJVJUnfnB6A+WNXciylpsGyk4koAWHwlY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166012,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjq3evACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqmBQ/+Lp0SHHhnP8Y3ZEuhnBphNfOjJI8mJnlsSvfONm/aVMVlqoeB\r\n75YqkyYkX7KY6v49N9YcFOoKPtlgqb8x75jj/HvHBW78PonThz1/ZK2VXYJ8\r\n0NPoNoRBDTTFVFG2TuYiKR3ycvbXbhmmnih5JMnf1yOdikchhfJtu1m/tgvu\r\nPpfuc/jxKk5PapuKlmoZmj2EgXew+x/EEXLkREFPSVXy+NWjANWhA/TmKBea\r\nwK+jRSnOnV7O6koEXWyIMHDEXFJmQ19eLw5rWY3dJfNBlduSL1FNCKdx+5+a\r\nGiHH/qv6DI13dwKF/WRcwPXtXJ4u4ZfUlnjIJGCUGJen429w4SguwnugWeh7\r\nNFRA05QPtOXKvN9cITwT6/DNZf2Zqm18BR+aXQgg6iij5GnEKBqB6ZaVuz++\r\nQAutdsRbMJ7jhjGodARYULhxTKrCerZseJdnk3bwKw20IAPinMyMV6EP0tVE\r\nt3zA1P8c1N8EkEOHfRKJI6wKM2hJDLHaEwQeF909ubyMqWi71NxwW2mckSxz\r\nxtV5Ha3UCl1XnNOL316tBU/b7WQbVaX3yBtkpAHZI65GOS4SnrRQXqRW7PC8\r\nHCNftpGDu1o+tYcstirAnOkPnwqDKaW/dVIisDXZoEj88X+vetT8krC0gReD\r\nnlAmsZXGecx3IAtnEkoDjOFVf5B4RoaHBLs=\r\n=wU7T\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227225400-c7a379f.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/61b3f348d032bd8d1839c92c6046d9e6/graphql-hive-client-0.22.0-alpha-20221227225400-c7a379f.tgz","_integrity":"sha512-TJm4V87Xx5mPcs64Vbhf2F1NwkUzLR2Szi8cxfherwngXewK9bRbNFubGf4TghdYPITI1F/Z/uangkLE5UK5Og==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227225400-c7a379f_1672181679405_0.1968709283032093","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227225708-827c98a":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227225708-827c98a","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227225708-827c98a","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"2caf6bc89ff5344b7bac9f1e4afbc91b3d95acd8","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227225708-827c98a.tgz","fileCount":60,"integrity":"sha512-SToZJtkxxthw8AsmK9d+Q8Zxxn8aTPCk1x+fs1QETtBBTWK1C4jA9k6kY39Q02/dxdPrMQuMKbjbxCPV+1VvWw==","signatures":[{"sig":"MEYCIQDJEdzGgXZ3RhsseMZ9z4CUT65KAb73psTGNtnO9mKadAIhAN8rtWvTX7xWyeuhAEBK5mhkIU/PmVz1smG6849WktYm","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166011,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjq3hlACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoIGA/9FTiydofMDZxMhfCPYPpEXqPTo0m2O4IaHTMarFSENIvb3uIN\r\ndj+4WcAL7Lk/mRWnU5sq/CGc4wHnp5t5e3ocPga7XFsTYCP9xa9csXd5wYFV\r\na0otcSAuLaBwk34duNJLy54r2S+bCR9gRifciJKWVb+hlUtUO4eNjhJkQ6Yz\r\ncRyHRPZsO1/LYML8HAbpuWqJnncNI56xTtFz3bTfCB29Pns1tmAqhkI6Uxzi\r\n+z8Ch5kTNEsLYU+mqfRA8tnxqJ3B+Eg+FDJYagZNDbE1veA/voI4pRwst+uw\r\nvT1RNEJWx+q40RBIHLJmxiIgl2Ni4as5UD1+u70y3ah+5lmyTL+qLCnaHMNr\r\nQcu7D/muxhE61NLVIEgm+x1P9eYno1VizMcbz4QCHt3PtUnrRY4ckpYuj7aB\r\naK2EPvaT4c5v7NzAXTS73LAoKj5vjMgV1iJeCOX4ENHK9ZHzK+HSpE5yS9xA\r\nXDI1xsQyLbtF74QszAMmPz9rG8JxQzeh1osOk1SDiIzR69hS4HzhXfCGuUDe\r\nVqzqHWXs4sQf4dqP64bwq/FEvBD6jXQR9EUcYLCZO2gt7btpjZ8R0DzK+Ai8\r\nWXSNbgls8E+m84IS+0sj0Zpu6TULAS5F56lu9Dxwv8OMwD/VNuuT5AV5LCMO\r\nKaeCGK2St84d/UiRxcEdQUntewXnH9k/2pk=\r\n=CWfT\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227225708-827c98a.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/8042c00892b3f26a33c2adf39f202bef/graphql-hive-client-0.22.0-alpha-20221227225708-827c98a.tgz","_integrity":"sha512-SToZJtkxxthw8AsmK9d+Q8Zxxn8aTPCk1x+fs1QETtBBTWK1C4jA9k6kY39Q02/dxdPrMQuMKbjbxCPV+1VvWw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^9.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227225708-827c98a_1672181861177_0.6980059031085586","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227230040-9d224a9":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227230040-9d224a9","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227230040-9d224a9","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"9c8eb2ab8d4667431c44828061fcc30e213efae8","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227230040-9d224a9.tgz","fileCount":60,"integrity":"sha512-kOxNg95teuNk7autQeJJfzHXbKnyGXdB2Fa+MjY4KXf2BXPvEvgmG5G4P6yK1PVkPoNe7RlQNL5+8dIUsRWzTQ==","signatures":[{"sig":"MEUCIAaT/iphtMURmmzpNTxrf9e+gs44DcNZR1LmhY5t4JCgAiEA1WMGvE9Xcg3GIj58mGZsBuE0eT/+thDknLU8/l64sqQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166012,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjq3k7ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmrq+w//WoY9xS8luxG9P03oYVErl2Ac+vc8DVgGGkwRWPu6zHtKd0Lb\r\nHMdq1a8wYuNOjYSVGNn2dvvv0D5bHupanpmsXccNIjt6bU1hd0b2gkvhnvN2\r\ndjMnFXm6rwePXN48NFPWClPzSYl33B9KqtepkbUx+MS/i8TlpPHIk1vBfUFj\r\nVfpRnGo2lQ5PefABhr1ixY/VC89rAIcARSUuvhuaGyuBfgHW89ff66PX2o9h\r\na9FBty1R3qxQ+bEhUu+dWBx96f/Gde2bdVdEVKG3em1T9lhEiWhPkxHsojhD\r\nY36+MzQpCaIXsRm1/0RDJWl+62/hMxDTcXT+RCJLAgqfzOKuEnRpHvSKvDdc\r\n2550HenOcplbpzwIIVb638KwCmC/SoGIeo1GEs8Vp/2zrAavbrJIcjNCOnuF\r\nCPMh5mOTr47jy+H2JHzJLX2s+VxdyZGka0XRttqodxn+pkMjjTHfbg3M20/q\r\nzk8pg+pY751utXvq/ye9LL/ryk6qyeChq1TNwvUOYSGdvn1J3Jd5pGdqekkp\r\nufb4OWhaz5AmRyjCAbuefWhlJTZqKwUGPOhHGa/sBfoaMJY726Lfth/G9/rq\r\nAetZcyFc5dklscEx9NS1ND2mmArOPuowY/rMrMVqzeUSPYd2O2SE9Fg8vfGb\r\nX46APSRzBf5Hp2Xl2YJxgA0sG28GJu0kcbA=\r\n=GPkQ\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227230040-9d224a9.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/d52aea2b2af4eb740cd8c8b8d37dbd61/graphql-hive-client-0.22.0-alpha-20221227230040-9d224a9.tgz","_integrity":"sha512-kOxNg95teuNk7autQeJJfzHXbKnyGXdB2Fa+MjY4KXf2BXPvEvgmG5G4P6yK1PVkPoNe7RlQNL5+8dIUsRWzTQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227230040-9d224a9_1672182075125_0.6759706320898891","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227230500-cdebbde":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227230500-cdebbde","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227230500-cdebbde","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"75211392f828f846e52f13e7d2beaa64d995cacb","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227230500-cdebbde.tgz","fileCount":60,"integrity":"sha512-KiH0pSbeod7i1LzHQ6AhYYmw0/RAv0rB4kgm+H0LmJ1Z+bRrtdPtYcSBSNXhVXONf7Tes4Y/kbDsD6LFp7pnfg==","signatures":[{"sig":"MEQCIDqYWA+Klgq85niZX/8Ppzh4P54grr5ezlalabWFlNSiAiAZTz8aclRytR0YIJrjFBn45vKV630EFgiuz96tYlJ6+Q==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166012,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjq3o+ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo92Q/+OBfTZCQGhIfD8wtm81eyy8MpyTSZtdWz8/r6fI40hMoOabFf\r\nt91pyvX2px/UP2n6QkxaeQ+3bBZP6dzy37aRyimNjW1YT24wu1adsQ0cTA7b\r\nBdsmBUPFPv1JOZfUWatYnuQUgvc29LaIi6fS6x5oPeLE/WZCnw7mwQ3e59xi\r\nN5t8Yr/iYMUjUd66o/NAtsTwIuOCjawzh9uMJozVJO+3+//buGeOfYTEcjEK\r\nm5ornkA7bJUvN8MCnQWaC9r9FcA4Y1ftwy6+IoQJD/Oa1iUhIk/9+mv5Flbp\r\nyKHHdOeajlLcXwETVYuOGL4Zg6OUKSZSALWlYWZd3FzfTdjIqwViefxvtvtJ\r\naToghHfV5AQhwIARyyu5Dhbuy9Wnvh4T5Vcjvtqx0w+lEApAFPx8Tpw5gSQb\r\ngC74SnPb7FIsEdR0hyRh8kpg0E1LfBtLYByTAJzdMgcIVZvo2zc34fDPvfXA\r\ni7ZD3y1bQQN8KsYtpe7NsSifJerX4XoeyWsvTBZWdjXhSwyRPDjT2TT8FXIZ\r\nKLikjHp8ohwaMRa475KkPv2aQUsvp1UDfA689UwdN5qmdEeytP3QC3GV9N+4\r\ncTs8CkqsY3H5F5XgH5QOvsMALQaaz7H/t82YMHXwZYeqD3LBKkyJFXimZd2i\r\nEV0Odeor5SZKyPiaQPDQ2N3+ASG/meMRE8k=\r\n=/A4w\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227230500-cdebbde.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/2106d320d7ce9e010aa2aa68ff4506d0/graphql-hive-client-0.22.0-alpha-20221227230500-cdebbde.tgz","_integrity":"sha512-KiH0pSbeod7i1LzHQ6AhYYmw0/RAv0rB4kgm+H0LmJ1Z+bRrtdPtYcSBSNXhVXONf7Tes4Y/kbDsD6LFp7pnfg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227230500-cdebbde_1672182334349_0.5845891326643036","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221227230943-499e3ed":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221227230943-499e3ed","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221227230943-499e3ed","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"b64505b4a13fe92b5c79861e19114ec02f8e1520","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221227230943-499e3ed.tgz","fileCount":60,"integrity":"sha512-JTtqanKUtoCYExUG41O3Aj7T/urvgpe+HnmrbfwjKJizMsqDb0A0edkdj8LZzoMspeRVEA/vdJhaCD+Zv/Wrlw==","signatures":[{"sig":"MEUCIQCPxbC0odDYWHKcT/Ewq12nViHrGO3UlIkUpkJEfihsJgIgGT/8ia7Q8waX95jl+3bX+VDdyObAs7t4Vw9UP7FKbAA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166012,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjq3tYACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmq8xg/7Bt7dOGVwTGLytIPXoDtCZt3nhlrTMW+1KnTTDPs1sS2SYIRG\r\nk6QnKz+tTIzMsCwUmRzKeCItxbbK46rhUAUt4grh0HdBC1H42S3gCMkU2kxF\r\nGB2w8lVf3CpC3oL3ESWlUBhB3nv8W+myNReqiAqzZcTmIw0SKmU5GkkkswBZ\r\na79R37585Ji2en+CICALRySonrXmnHsXNbT5pUKSkMVq0MTzty/zouLpqHrk\r\nhmFMCplR7p1VQM3+nXJj2bluCnxSQQi1Sz+pah5OnJwwuduSfecGXfyplfyx\r\nRA+yaXOphevoVQbuEOU7GwCQic4f73OXlnVWYrrARISDdVfEPqX3Q8lCPw2y\r\ng4lFGc8kfNDcCgaYEMJK6mCV4TAQK+UHbL1rGBOBscBK1Quu9V9a8rVxzwD/\r\nttA1s/1fnHSA9m/L/mjC3513enW2pgODDlCJsGPlVmi9ot1Ttl7Wdbfs+7BL\r\n8FSboCg2R3o+pNYeo8v1MHEXH5sKfqGo1FyEZ8NskGhjogt31dcY4EEkEpLP\r\nGVhlWSlzhE/W6VPFjKr5llK8mzqFY9SagZM8RYOqz0/hlXSp6Vvz3EwN8Rwi\r\n1hU6nkHcdllcue4Bf9XKy3aj0Vv7Gh8ZcGfzrNyKF00zPGzREf7cd5mIgVfo\r\nfBrVe8XQjKJGNrkeJPIVP+CuOZ3EpqVcRro=\r\n=a5le\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221227230943-499e3ed.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/0d71b9cdc1eecf1887bc634327b6d7ca/graphql-hive-client-0.22.0-alpha-20221227230943-499e3ed.tgz","_integrity":"sha512-JTtqanKUtoCYExUG41O3Aj7T/urvgpe+HnmrbfwjKJizMsqDb0A0edkdj8LZzoMspeRVEA/vdJhaCD+Zv/Wrlw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221227230943-499e3ed_1672182615961_0.8849570818447647","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221228014729-9f5976f":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221228014729-9f5976f","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221228014729-9f5976f","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"4b4698745bd6f522b4c67d426673621a76c2548a","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221228014729-9f5976f.tgz","fileCount":60,"integrity":"sha512-jF1QSk4iMcP9ihsQnRRF2LwU3WjKeDpGxkfdP5v/rIVI6VydgCnhrupf9juqXmS9ko5QMY06pQzjPAH+A5jF/A==","signatures":[{"sig":"MEUCIC2DWAZqj3gnR6RyzdMbomzpzudxbPR28YRU1UTMq5DSAiEA2WNckgPQc7VoOjzY1is9NEL5BspnKKknNKXSuUtMOdw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166012,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjq6BXACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmq6xA/9FWSaD3+k7sRVCB3sOsI8Xzfd9s2dEF7LgoCGSBqEwFqOXADH\r\nRu9AbjaGT07RaBMfdyRc/ufehLOLMYOXd98pBZYQQV1u5DZ41w8UaYgI2EaP\r\nLFhXs4yBIFPtSRATKMQ1wAUN8YhmfGfCOynmcnPIcEKwBBwGzqebioQQ6Vqj\r\nlQ8YxnluWiYD0uRVPLhGvny8kk5AmOzODmwSwmPWVfwZjuSRcGOzcd0XlQTD\r\nEeCX/FAsSTUOKfNp8heyiJseEZv2tF0IePwgbrsABkvDrJoAroIcrbRvIw89\r\nnWNkoDHFDCx6J7BhVmro0gjTutK5DMhw8Vm3RbFYX/XXFheoPpjJLk7amqBx\r\nH7Tm+hKw5dji4vw5+UfF0sguD00WDinc0HlgsPHVlYVR1MZQlULvQZLzu1i5\r\nLzpT0EnCSSAMC+GqGcrZLIJbLm+zEqJItHjigOEkgEF3qM4BMj5VuCLsCpOa\r\n3HX8EDunkrd8LYvMsxMLbcaIlG7tLlk86z7G9GrNJjhOhBb9C0lx3S6JfFZ7\r\nOeObppdC3D9qMXAfeYiv+gKs2NwWcRoqoPz7g9Q/K75SCnPdubUytxGsQCid\r\n7LRnLDtgCoJNmhYDJP+hRFMX/pgLWqOJirWnnGmfwQ9gDLypBzA+3ltXNq1P\r\n7xCRkypzjo1geUNxbX3xhWpD1TLxzCxhNyA=\r\n=58PF\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221228014729-9f5976f.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/5bb586a699576aa1d54738d6be3e589a/graphql-hive-client-0.22.0-alpha-20221228014729-9f5976f.tgz","_integrity":"sha512-jF1QSk4iMcP9ihsQnRRF2LwU3WjKeDpGxkfdP5v/rIVI6VydgCnhrupf9juqXmS9ko5QMY06pQzjPAH+A5jF/A==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221228014729-9f5976f_1672192087080_0.8750253012428844","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221228015318-e80f5bb":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221228015318-e80f5bb","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221228015318-e80f5bb","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"2cca9591f1752fa1ce183b1cfa5d9571d4b28580","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221228015318-e80f5bb.tgz","fileCount":60,"integrity":"sha512-szTaoormSVDR+kti1ZWrNcVt/BtignITHp+UwFrfhJFk17ys+py2H2flBfI17LqdZIfPCsVwcFc9y3i+sGgifQ==","signatures":[{"sig":"MEUCIQD2xjH9BMPl4Vmrbo1adDnifv9CjPtDoBAgxf8s42cP0gIgePTD3XgwrtpljZ0GyGaVpopUAyt6xKVU6PvzU7C3mhQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166012,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjq6GzACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp/0Q/+OQXGeeEF8RY2aa9OZfSj8urJCkyi4vkK2Pq8OnDbZAcP1vWn\r\nrTHLMFL9Y0BhnogHEe9LIaXBrgdHwyR76YwVoXiFXzLUbbLyPSEEw5xTKe2B\r\nLjK3koK1CsVXiZ+K8pIUzhLkdvROd+5E9CVMDxG6JH6NZZYej2YLisUaQi+X\r\ni8YEQXh4/8A0mu88VUSrScEzI6OCn+IQjqJOLbshsPdwQEGxe/1GO04pPvcL\r\nGTEPIkfY+n0+VeMakv4ZHW3Jx0XdxDZzRjH8yUea2nhI8fbvmzqesqRpQWLJ\r\nFkreinNJ/jQgeQYyauUGHMNIA71kWteRbx8h+eCJ0Dmu/4O9M+VzBJT6FyLj\r\n/wEgMBb3/3OQjQDwfUiIyEU7BtJCp0uu/eHFseH2jTxkRVG9pZne3XIV3cZP\r\nKBxX5dclgETSIOtbvgy2zjrhVKVxDCFKrz/u4C9GbThwePlgztipI3qlktMn\r\nXIEKDKRZ2kAdkfasv+KEIJf6Z3d6d1rzl8MuFMlH54c5P7Jio3S+pqNO7eJB\r\n5uSqUp0H9Mwbhx86vnt/M7yoESJWi3q4EdopPfjGUm6zXpP8g7eRQ3H0zVin\r\nQmM7VlAz4J0Wmw1HjeLuO5q4tKLciNPpzsJIWdwiZm/6ZyOd61NuthVw1R3F\r\n643HvM9v7C7wJffHCkQsnBPNL6tGOw1VEz8=\r\n=F5Vt\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221228015318-e80f5bb.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/992ce3d278f4df01468be46a0d590b95/graphql-hive-client-0.22.0-alpha-20221228015318-e80f5bb.tgz","_integrity":"sha512-szTaoormSVDR+kti1ZWrNcVt/BtignITHp+UwFrfhJFk17ys+py2H2flBfI17LqdZIfPCsVwcFc9y3i+sGgifQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221228015318-e80f5bb_1672192435745_0.538457443570481","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221228045416-2651bed":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221228045416-2651bed","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221228045416-2651bed","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"5ee2959f0ef466f4eeaa0131b4c97c128277d3cb","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221228045416-2651bed.tgz","fileCount":60,"integrity":"sha512-DDY5YlNIvAKMrWY7rJjgXC8jrguVm2RpXYMihkvxnD55HE2QJouiL/crlJ7yKu0PECJcpDWf/Rx/ELi+LlcM9A==","signatures":[{"sig":"MEQCIFqrDhbYjOzanYQiLIwjQQQo1YI7VxjQcNP10JnCL6z1AiBWpOMsYyDiGslgIlKZLI9HX+cPSaOeloBQXc+7B/URow==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166012,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjq8waACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoZOw//aJdvs6tBf6z8wUYdHlc5kqU0kwQpQuBlRz6aRS+eUyDB/iTz\r\nWAV9R/jf0FAwcN+wWu/MlmYmUcCfXFelnKiJAZOaHx0Xg+FqK0uI1ZQ9rJnL\r\ngN50PuI8HxoaWqwcoKkDY2KO0h6as1T8/bZw0ZjQFqhDSu/G2dYbuNmzOZSZ\r\nE1XC2XCGWAIwxnadsnSqdQHyVJMtFLPWl3jdRyLXceLJ1JCM5Dse5XiiyJXI\r\n++klZm0Z6opDQc7jOOvD6PnBc7Q6rkFtSUr8ZJk5qiQpDVcrssV5GPL5hQir\r\nWZ0UcAUmP5oMXdUMF69NIxDMkBFv1+4+hlBUSVNHhhAYsIDaQRmSwov7/7WW\r\n6yS2chIpDsTVQCx0oWMJEBQEQFbGxdDdK47+RE7iP1GpkkRyVbkjQrJtPLqU\r\nE3dWgxHB+SNupxmAybt8Wl67f/z/ySCF374nuOcOAiJAZN2bFqXvV08dskIG\r\n2iA6TinxUkbnzNPrEDAWaScznyCvGzj2eOasfBGARAuQuAkXUpNIhURoJoQN\r\nCGDAFQoSrkVDgMxVQf2aCvthOb3Qal09UxINGWPlG6hR3YZkO0YV5gwkRZRl\r\nTaqYqUx5X3oBq7ub7+WMn0TD+qbAHiLlm5/eQS38d3SCOCHxjStDoXVM/gnN\r\nl/YRkZ5QDpsz2auMlcG7AQnbH75cQbYAK3U=\r\n=tl93\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221228045416-2651bed.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/a8070797e9602c4fe119519b5f7021b3/graphql-hive-client-0.22.0-alpha-20221228045416-2651bed.tgz","_integrity":"sha512-DDY5YlNIvAKMrWY7rJjgXC8jrguVm2RpXYMihkvxnD55HE2QJouiL/crlJ7yKu0PECJcpDWf/Rx/ELi+LlcM9A==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221228045416-2651bed_1672203289769_0.20950002746199647","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221228050022-d82b625":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221228050022-d82b625","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221228050022-d82b625","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"aa8610e07f117fcb7a5161ead3520723fbf8f86d","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221228050022-d82b625.tgz","fileCount":60,"integrity":"sha512-G5BcmDuWZKH4DSocv65y4/fzVHNht/1SfMU4Y+x4sPf9aJWM3jeTbok/tdPxBy/WdI9CrYJJ2aYnPD5/gxEb3w==","signatures":[{"sig":"MEQCIH764MZGi8/BFERUK5rayZGJtMVzWU0gkJxtUyLjVfo1AiBbs3Xw/B7bZLDTuOgoNCgihIiGNfR72eZ50/6o8zHTxQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166012,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjq82NACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpZRxAAhsnVb1E75wCEaK6QHcE7b/fp3aPP3l7Q6ftq0hHwbyZyoTr3\r\n3bs6OtcmoaxCzX4NVHVkSU/qDJBrIF7Ymh6zEWWKXHggZk7VebED/5SbWHd7\r\n0bwB8S3Us88IkYpHkqcYx2neEeC4SdFL2PnGMTaNBeOT0+LKjqmJOo+K7f9Q\r\nWpV5Q7cDW5aeCN96MQbPNaE40M1gNkzKiNfY8GEceVQ0q8QZuAEJUjOSx7C7\r\nrRHI0GkAcKIyRIgIxtRVYAjMCLaX/4vO5MCn78hSePlk+d/L6U9j51Fi2r9n\r\nf4G9eZVETW2djCZFUSFyzvKkaxCbnk83stvtcmilK2Kr8fMDuvrrz4o9IHia\r\n9F7ZtQpOVqXZyrCPnN/tHuuBJ+TGd0gDDKebQfTH1OJNsHyDxV52dovBlPHt\r\nAKoPRX0OBKze3Hj5N0bzHWPnCSNdJL+2eOvIfUmlixFKf2EW5FBOvBAa5zR5\r\na681BVJgxYFpDmpacpzaXZSrcdNMROWQognKuexrmBr5C6cJD/FTdzjjeety\r\n6RHfks3Wf3HwOZz3lGYSOR8NCfYzhyQJcVVoz7POjn5vmcwUYN0r8a0d9mB+\r\nIkxOfvTJLuRMIl7vlR2aZRXwDnpNSlJg60XUfG+awQOyzcKHoQXKHshrW0OI\r\ned5lEQ66r5P3GUwZRFM0hdHDhRKBRXcWxXk=\r\n=jL3h\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221228050022-d82b625.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/81e5951cf6c3ffc5969f290c5cb23644/graphql-hive-client-0.22.0-alpha-20221228050022-d82b625.tgz","_integrity":"sha512-G5BcmDuWZKH4DSocv65y4/fzVHNht/1SfMU4Y+x4sPf9aJWM3jeTbok/tdPxBy/WdI9CrYJJ2aYnPD5/gxEb3w==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221228050022-d82b625_1672203661665_0.5317592451144284","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221228075306-7cd1311":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221228075306-7cd1311","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221228075306-7cd1311","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"71ca4026e197583fecf07abcf7877ac91d998207","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221228075306-7cd1311.tgz","fileCount":60,"integrity":"sha512-sZNLOkqu9vv+r6bX4xsZxzg+VamTpoAQZuCAQKyVcqYwR5SkeZH0CCK0Tl6EX3/t6gyqMbHNgyg9p4zPeisrOw==","signatures":[{"sig":"MEQCIBGS85fimN8eCmW1XLFdCBwnjcGd4to139OrXlpMB/tKAiBz1G34S/cHU7dz2HgfoUULtxNzBR6prpwGlU+NlTJxLQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166012,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjq/YEACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpedxAAjeTYL5RJ36csPhR4E6C+Cfk5JrwF1JFVqpMCyha/uVrcArDG\r\noDCRKuhwE4hUZ56ZJ+XGYh7a5YxGFjXH3OFP+vrdErvvAhcdvil7cU8g/CxR\r\nRlkLSvsu6HaQ6dWEPWUhv260lt0iFfsRuRejYKDhM0sHhkIKLnaWx/GZpJYf\r\nPQLSKtODHliOdXGe0T29ttQvXkFhH+Bd/sniTjiLwhw1+FYrRb+obe7HcE3Z\r\nXyDBy9Eg6HNA2Yky8tuh7OatxcLvqJOkBb9ozNFXtufHWMIgDUg8ExluFmrL\r\n1jtzqmijxP19QAQ1GlXvUCssteE0ztomTGOSWsPsH+6ZSd+LrR37Pw5IORuQ\r\nIP3ztak671wL7mP4mtUM/Xr3dazO0m3wpNIejo2YhQAcBs3zqGOIltSRcl0I\r\nHneYI5AF9pO8d7ByvO++ADx4uf2/sC9ZS+g/WsUZ7gtoi8uPtvz698yV2WMa\r\nZ/Gf7KnMEnyCiydxNe76Qr1ey4A83buX8YTXt5Me5rU5ub/iTDWDkSsmE9HO\r\nfQVhL523sYz9hfaQMDUyOsR+N4VwO99e2NJYfr3Un6tFTNeQNaubbs64IXri\r\nBTCs2OoSo+U07LmEZ5Lvqoe6GsLmTc6xTyOaLtXJux8C7d0Z2+PUsuwsC+9y\r\n69Y5aiQPDu+GYEyEF29aWa4la9Ib+YQUrO4=\r\n=23/l\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221228075306-7cd1311.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/980b9502c5e72854fa300501ab93c39c/graphql-hive-client-0.22.0-alpha-20221228075306-7cd1311.tgz","_integrity":"sha512-sZNLOkqu9vv+r6bX4xsZxzg+VamTpoAQZuCAQKyVcqYwR5SkeZH0CCK0Tl6EX3/t6gyqMbHNgyg9p4zPeisrOw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221228075306-7cd1311_1672214020548_0.35767460469800927","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221228075306-1bb4831":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221228075306-1bb4831","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221228075306-1bb4831","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"ef51d3ce1430006ae154acac27adaa8e5508c53d","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221228075306-1bb4831.tgz","fileCount":60,"integrity":"sha512-Cq/yqRi/LfpxJOWfRThCyX5dddeciwQLsmJNhTB9cZYqvW4U5gDwej1UMaf51itQk+WZzKqgi2CFYWZ2TSvcTw==","signatures":[{"sig":"MEUCIQDW50VNqM1z/fm1v+X/0Aw7wi+rH//jR75Va2GxEh9qYQIgPZTU+WR+4O6O5JsqTCfmD60cOKPKXso6N/m1FqEPNbo=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166012,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjq/YIACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmpl1hAAkZ9dech8P12Tqh+6Wkhx4GFa6ph5q1k8diIEubjx//1SEtk+\r\nFV79NV6ATrasZ7dQoffcAUMPShyht0Tg6MHGbyB5iWLMFTTcQ0yGEWVSdDd/\r\n9oeKEc79F9DMuqRRF1Zpmyl/er0RpKdATXHtZVqYvdHCEmqPrXrBz0McVt0w\r\nz1nw0vgAZ0ptlLWW07rXWifKAZXOxq1zicBQng+r5rHuP7vfgI1HubmeGxyk\r\nuoS/FqeiaFGgLgjcWANi/qZCo4VKKhmMESz9fxMcWLc+q13e/2fq/l125xGR\r\n2qFe8YoUD4ISNh3oVHKyuBP+CpdlH05bTSIVdLTFgKv8vvPTWzi86tfedRwl\r\nKxxLi/IFxLePauSQCxsNMiET1snxb/Wa/6Otdf52WcU7w6yRcvyb9rAJ+POo\r\nBWvH353vcA/yXBrl1eCOpL7NdBl2JUYInYXVjevR9rXPAil3Nxu2dDLVwRce\r\nHn9lWsUgHblmUT/A816QNZpZaMa6Hss4jFRAEEOCXaqWoSdwfAzL5BjdqKjb\r\nmgrqo2IEPv17VQVVG+LZwaC7m9j0vG+KFFgG2aJg9TJbXDwPqbFr4cwh+s4e\r\nXekAiyWhIjzF772b0DJtyXxLUoLcz/98u5at36FE2ajaJIrYueZOafsleYKM\r\n1w6bU60a2fk2hKGvz7qDA6yuhz+h+mwrDns=\r\n=R4QC\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221228075306-1bb4831.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/e5fcb72496a2ff09ec91139b142b8dc4/graphql-hive-client-0.22.0-alpha-20221228075306-1bb4831.tgz","_integrity":"sha512-Cq/yqRi/LfpxJOWfRThCyX5dddeciwQLsmJNhTB9cZYqvW4U5gDwej1UMaf51itQk+WZzKqgi2CFYWZ2TSvcTw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221228075306-1bb4831_1672214024168_0.2751017848024506","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221228081416-cb79950":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221228081416-cb79950","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221228081416-cb79950","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"0783d079e9b0385e7e7e02b4d2002080e894bf8c","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221228081416-cb79950.tgz","fileCount":60,"integrity":"sha512-rvs+L9r7JS+w4k+zny/kP++G6M6E/KkT2dfMvevJUWhAQ723boFtKHif/nX7hj2RWc72/r/neXvhiQ6LohZRLg==","signatures":[{"sig":"MEYCIQCJwO4d8cjKJFKF50RIWHlAZQ+HxA5ZQySjWlrCthHEfAIhAPSOPw8edR9Q4oUv8TyvbdJNOSRFQ5hDvMVdmDkxfVNC","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166012,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjq/r/ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmptHw//WI4ieXMQAtCeGKZN0o2CY5kuLr3REPKoTmU8Y7UpZCyU3UWv\r\nAqon+N7cSfl4vAfwMpOhFFRxytZMbORoa4ZotO6yTPrZFA6VpiQ2RLnmfiJ5\r\nNpzfj7AjRBQsB0w4zupE5VtJk7oT4d2hvT+zp+ZZ/sdlvdZF213LAAYSwreG\r\n5WeCN5QD+f2hdSUTwgP3Udc/OXaFnzPfBiBuw6CCNOe0jEQxluCFGZfZeKfe\r\njeJWrJAYLzo0YX1H9sDkDz4KgK+SSOPlbxfumAhxrn/q/tCf4mqg/74WXNW4\r\nhT9FqWmgsSHikwAmsRIbyHIzrF1mNli1NCWWhKrhDdYx+LrYMjcqAQnSo4hN\r\nYjSxsUtdMFvnatmiMMks/DCLuj1Hjjy9m9p8fyirKadKw3H+UBd2EScH+DWE\r\nrKg2xtGupWZyzByGky3RedqAfAxu9hawtzY6ZhcV2hxglPLHu4S2T5yL7HmG\r\nlk1rd+PJ9UQydU4r6UKCn7DWCekvB8XpNvBELZGVruAhqt5JtNikuq1xIezX\r\nSY+i4oqu1vUFq7yR5JYClwlvXilPRLP+8NpcVADWuIPxUsAi4H4dLyuQjMD2\r\nXHbJVhl+4hG+Xdn3iLNdkIkGlo8PGOU22pwIEJ8Y/iVRYjXs5MPkAWKqRBM+\r\nB4ChcczUW+THDYwogCziLDXxiTVEBMax4t4=\r\n=luuY\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221228081416-cb79950.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/a88eab68461018b91ac9267c8f822390/graphql-hive-client-0.22.0-alpha-20221228081416-cb79950.tgz","_integrity":"sha512-rvs+L9r7JS+w4k+zny/kP++G6M6E/KkT2dfMvevJUWhAQ723boFtKHif/nX7hj2RWc72/r/neXvhiQ6LohZRLg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221228081416-cb79950_1672215295001_0.3933293368969768","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221228081753-7cd1311":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221228081753-7cd1311","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221228081753-7cd1311","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"12ed02c213b0ee94e6c228c46b899aedceb63c2a","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221228081753-7cd1311.tgz","fileCount":60,"integrity":"sha512-86NkEN13DJ514+4qb5+c00RNrt2tJLQeplF++0BQckUpBnSRooIw+ri7AYNNtmk37VqVf+8qIbrdyxpxgQg/Jg==","signatures":[{"sig":"MEYCIQC7iGymCvRQWK232yz/7x8kZl4I4L7+q6i/x5ALmkE6wgIhAMfI/RzEEeuzydnq0zjReov2Pzu++53acj44NoQdGeSX","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166012,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjq/vXACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmq8FQ//XTdnhOZ6gVmqfiOn5qkVzHrACioUCFJYZm/2i/rvgo+3KNXt\r\nhHwuMXmfJkxrG8HqhMxBc4vJ8ZuY8j9hUax5onjWQLBDDKb3DHFDI6s4k4ST\r\nu/t2YDBmNTWyBzYBzSP2rVRDPzYTrmCSq3v4q3744Azi4c6fcD/MHB+GCug9\r\n1GsGYITUmfYmvK8UCsPSdJ5h9YuR9RIubMvOr8K+aGCbKZcx59V3NLvJgzZp\r\nIRe6qtcJttnwqzWDMR/3oQZNya1ivkiOW2l//Cky7eXnS32bw+I4s4A4nxmm\r\ndty8qurr+rTTh0hg7ssDciXxe4LqPY3/jhQB2/NqdtVHCUnu6+i57p27Q2Ww\r\nDyLGl0xh4XegSn0c1eDYuPcZsH0+MEBRZCQR1ghIK6485JE3h7DGLpq9EcoR\r\n8OsM9678M1L9VJIJo5QewTIv8T2oGnzEZZTNmK7WPscjf3GJkr0mBpmkU1Ky\r\nuj/uSDwQMTUo4EglJfgrEgeXSe41Zx+eTRvlTLTfXaFhBYHi9Le5d8U99xBK\r\nBuc9yeezbsiXOZwaB12xDzSISCJIbf7MUFTdrwdEhVDq6encZyq9N/R1EAnS\r\nKuHcj/PfcRQVZqKGz4fa/jGTX2R6jNFKAmSD8zWlxLhcREwCLYiSC1pj98ez\r\n+R6mpLS2VwiyGvSD6wZLpS644uScQVrKMgc=\r\n=Yf3s\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221228081753-7cd1311.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/4763f2511a3b6ae14f32e92c86f15a69/graphql-hive-client-0.22.0-alpha-20221228081753-7cd1311.tgz","_integrity":"sha512-86NkEN13DJ514+4qb5+c00RNrt2tJLQeplF++0BQckUpBnSRooIw+ri7AYNNtmk37VqVf+8qIbrdyxpxgQg/Jg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221228081753-7cd1311_1672215511033_0.9167637967730644","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221228083047-372ae13":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221228083047-372ae13","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221228083047-372ae13","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"85d7f77d1f341a3bcff33ef360e2c91c8fa7e2b7","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221228083047-372ae13.tgz","fileCount":60,"integrity":"sha512-XhsV9Q/GxszgEmC5VL38NqWx4v8IvlYS5Ok4eZY5Omr/IXf2LQoXtovnCZv/iR1y6sZiv0V6XVcm2BHtLzV/Rw==","signatures":[{"sig":"MEUCIF6g0n8lZWRTtWa2XYQubKzcP8tQBY37okFvNkbjTrwHAiEA6UY51gjfT5ePWt+tg2whNk4VCr5YhZS+qYcoWSJA/Aw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166012,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjq/7kACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpNEBAAjpwoeZrQO0eUcdHLDa925Egm6VJVNE8DpI5zsWSiKgqHRqfV\r\nFGsQoyF9ApR5bMWv7CbIPZlTZJtV9UyzFaU76pbcGAoYJ51Tlc4tDeiT75E+\r\nPuqznJbStm++C64FrkxDIbidkeuk7mbc5FKLqB9fb1f7ALENkmAZ53R9CO0y\r\nSaG0AolvylChPub6I1CbTQMwYb68cNsjbafAtyp4Z6vnpbjZXDQMXmQ/YYvw\r\nQUvPVSBXcc0CT82hfQdQuhLNiqOp+OTBMOKOvJ27SagFyhlUC94A4cx3s2qp\r\n3cWXqk9Ye4fR1fWRdVZdjTU2d9sG7j9CTpWNJeUamrvNL/+mnYHPMY4NHeu6\r\n8GgS53cEyEYUaOHtEM/aaWUxacZ0UHBvcteyZ+Y9cPBgsbvsUYLZVHw9ZLub\r\n5luDlajpkRXOGH2fChFT76JbDRK49gTNauQ8qgABzg409dJA/9JM4gP/061R\r\nRQhRWcEYztJ8+EjRJQIVo0sfQikO4wVNgBOrA1/5l2Ek1S5MInC3KRCNsWGv\r\nwXF3u2dY9nLlOg30U0PGJoJM+jN9O06i7D+HIFAIfjYrODkrYs98Wa1z6s26\r\ns13YqfHzAUzvVTnntwgQP7hAPRjyeoT2wdkxi3H0w6wPzYCI26nFBYKYHHaT\r\n7e6WhnVeWHPh3HqJt/ACCL6PidYOI15bGTg=\r\n=px5K\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221228083047-372ae13.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/9fdd0e56cf3234d9c6b16f82c14e2e91/graphql-hive-client-0.22.0-alpha-20221228083047-372ae13.tgz","_integrity":"sha512-XhsV9Q/GxszgEmC5VL38NqWx4v8IvlYS5Ok4eZY5Omr/IXf2LQoXtovnCZv/iR1y6sZiv0V6XVcm2BHtLzV/Rw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221228083047-372ae13_1672216292192_0.2912289047593659","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221228083204-5f1b359":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221228083204-5f1b359","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221228083204-5f1b359","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"9c65c1537ec479dd4bf2dc934829f18fce21dd3b","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221228083204-5f1b359.tgz","fileCount":60,"integrity":"sha512-6QqaTU59iteUvo4BG3f0AU8r4aLRJL31yA1KryKnVvXuxsB4O3MJOznuhRUJK5i6LeZXtSjH3OMrDfHWIyjVzw==","signatures":[{"sig":"MEQCIHHqO9TYdLMDWzx+UhspZDPCCjlcU9jnUm069jeoQrZEAiASBz81aAJ9SOZHkA1RrRBHH4foUGp/i2wndOIb5+BlCA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166012,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjq/8mACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrAkg//Y9qWKGNXcBGDi6ZAsP2jnyK/j6VNhoHtCmAj3p0aHxJf2xub\r\nBA9HPkTXCTJi1G+fFsOu6qYCelRXnGdYzGB0iw3XB1yDzX9Z6O/8vHRcNtu9\r\njveOw2tz64TPuS3jGIAaziUyfoODoRLY30YKRhEWG5zJ8dYXuSAaqwXO8wAP\r\n473RZOIn/Q+jVhOSQbWDh2ho0ZSyc75/VXVm46nU56yc3nA5SYyua+SYr0HF\r\nrPULqLdH4FUc2jHUmKcBkxRTHYg45tGP5eBU+vYYrhcXjhi4q7mJGY9fE7lW\r\neKxzfV2HLDHHAemmMgIL81TmUpi6euUc2yHax8Pm9IwQCgSaBIPo+EmU34SD\r\nITyf+2vYjleFHIqn+7+mQRSbwpq/C7yIC5Be8SGo6MO8wznn3RIH4QFYWsds\r\ntRkSGIa/j4UzvIfn5fgyxg9X3caWUsOMbwU/dkawvYzK3ahadDbseW86W0JO\r\nBnG2V4HzOz438dPUrp5OZdB3THFD6xL8Z6IxrnylyS/GOyqloO0/1jVntmzN\r\n7m+ECtlFl4Zsi/XcSuHI9PDHE217FsPAN2gZhKOeu8TaXevkdbRxqDH370N1\r\nBYMNEvxsv2+IZ0vuBQ1AnbcwhHa0ts3As9ZxH91QZABd484a+DsYpxOjfSBj\r\nt+MUJ8yupRdfJrA30N63w0zsqIhVQTdh9Co=\r\n=f749\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221228083204-5f1b359.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/6ab00e9ca50d644e2642129c73dedbbd/graphql-hive-client-0.22.0-alpha-20221228083204-5f1b359.tgz","_integrity":"sha512-6QqaTU59iteUvo4BG3f0AU8r4aLRJL31yA1KryKnVvXuxsB4O3MJOznuhRUJK5i6LeZXtSjH3OMrDfHWIyjVzw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221228083204-5f1b359_1672216358735_0.5153827439661569","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221228083735-fd03f03":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221228083735-fd03f03","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221228083735-fd03f03","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"97a8f54ac03dd1ae849bedde99a01e280f2d38a9","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221228083735-fd03f03.tgz","fileCount":60,"integrity":"sha512-uZ7EtHe0SreutXCaME+P3o3fT2sTGUhMeM9SbsgevcN6G4FwxmZqfT9lBwa0dYHOdnIoxoQVHpsR3CM98UBFow==","signatures":[{"sig":"MEYCIQD9Rzu8HEOtHusSUADCI2yE+exh66pt+6OqeZPLTeUGbwIhAKKcerLVtmdIWkNZdYs66cMHXnIzyXfgFZHAjA555nxi","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166012,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrABxACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo5vQ//QTcmW1xkHGFvlXAlBZe2ZkJWn5vuDyw0Adk6KkbvWR9bBy7z\r\nHh5spWtR6FpdMfYiiUKx9f5mHDe85/iH71yQWWuqWTZAiWM7g1QchW2ag/Qg\r\nsPi1WFTkrddi63hvGzQFo3Fm0cpya5QULEOI8ux0frnGRlU2WKbM9Abhttk3\r\nDJzqgikduJyfyQ/q/kLZfSxbNynkTteVE152OrY9/UHjtAo4h3I5+OZLLQn1\r\nlSC61Yge/AWf4lvvKrqBjfhxRFnFd6z720KbY1UZ22N2eJ+z+8H6Gl78df+9\r\nYBe+8EzaVzYYuXCIwCZO/rDp6IuY3ms2V355LDbfVHm8zmqyACl8MGDMMVbk\r\n2aKB1L8GThdeTUOI633L99tw/NYcNc8ZZnpI+JAfhoN1pdDL/eK5GkQMuY6v\r\ngqh+dxUWLDI69caqxJQS3BGUwfY70+GwPpeqHdg5x4sAGUCgTaToSjJ2Lxc9\r\njcTIHVRDHjJNROnAs8Zl7R8eCjiF+IDJTfBy/8bYflCHWHUEhlhzD+KFdGzu\r\n8nz/Bk1oiQqnmZK4mSaPGKAl5DMQAU8mUMLSLf3GTqGeTLu7wiOjRgictSDx\r\nAD5QxMQcQX1mWrs4ExdVmEY31mpBI+kWDQ7B/dbO0e2r5Ou05I+PbHHw9rdr\r\nOwemSKNVlfFBLVrlgcQfUZturtzVYbM+sME=\r\n=g4By\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221228083735-fd03f03.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/5a59f762657782818ff77fb1fb639d0d/graphql-hive-client-0.22.0-alpha-20221228083735-fd03f03.tgz","_integrity":"sha512-uZ7EtHe0SreutXCaME+P3o3fT2sTGUhMeM9SbsgevcN6G4FwxmZqfT9lBwa0dYHOdnIoxoQVHpsR3CM98UBFow==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221228083735-fd03f03_1672216689213_0.8529641085714277","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221228084755-59ca637":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221228084755-59ca637","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221228084755-59ca637","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"8dfec8c810e9986b699afeabc3380e38b12bdff2","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221228084755-59ca637.tgz","fileCount":60,"integrity":"sha512-Xiriw/ZznKjikaPdrO3hlrvL9NIywKvwjxS7S3wXiscF1aum9scVLqxAyHcO00eF5U80au3HE/L2U1R1K4z8Hw==","signatures":[{"sig":"MEUCIQCgfHcYU+71xhqIyy6iKgpcZs9os4ojbkSaABUSsWX+eAIgfdunvTKHYtlmByuGNVh9qDB8tEmXf7XO1p2YxFKcuaI=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166012,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrALdACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo2og/+M8CdGjGisKodmYjSOMGFwfOD1Dfi9yc/xSXE9/GL0SHV26QI\r\nf8qtlBoFhZGi+57ZJ2jq0ZlQD0zCeOTfD6CKIDTClIMnjYUmwWxZPr2GBDzT\r\n+OUzf1nNLGjkb2GUYl/ct1GgZOcLwYolxVf3m0ui5FJV1/Jye5MeMv8NmzMd\r\nbD4/4tMm4clXyxH7Qkn1EBm7LiS/VUJu+k/oBNzUB8HOOz9a4fJney6vfOTj\r\neF7WoWMc0WiOUgopQtIME4sJWIKOXCCPLAwYO7sm3wUk/WY8H2IbId/BqsFa\r\nKe51PnDPmqhWYQipr49LLclhztYhyTZSB436lSaLsQDtUnpo9rycqI+NgHQo\r\nLX+hYnk0+JfSDP59M9oZzPMTXfi6zWOLGeqA4dkh9Jh0OazKwimYEdM8P89l\r\nUOpRltTDl60KIIvDF2f2qfb2t8NnszvKLKR8qV5I1LABRkh5XpSrj59SPI2+\r\nQe8FOOXLeD28qRc0AFR7773CRcGaS5BfosTig0fAdiptfWcINf5MP1zYYDvv\r\nxuDJKQv+VKqb+6NYpteEK5Ayf+edObHTqF2stXou2lsfLVZJUJTwOvlDMzIQ\r\nWsl/zfQ6a3D7k2/xW4/8+p3q7xdzKEKdi6vdY5+JWSWFSMlrAiaE8ztkeJlr\r\nIV8GW9ZGzCCaDMJ5mkgGbC/G94bNOSwXdMA=\r\n=WH2u\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221228084755-59ca637.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/41b0f2df66a6ea5d8436361a45a94ce1/graphql-hive-client-0.22.0-alpha-20221228084755-59ca637.tgz","_integrity":"sha512-Xiriw/ZznKjikaPdrO3hlrvL9NIywKvwjxS7S3wXiscF1aum9scVLqxAyHcO00eF5U80au3HE/L2U1R1K4z8Hw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221228084755-59ca637_1672217309392_0.20187952263137388","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221228084759-e043f40":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221228084759-e043f40","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221228084759-e043f40","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"a0e09cffaf697b251e44139022efca63ae918278","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221228084759-e043f40.tgz","fileCount":60,"integrity":"sha512-nuv5c5H8T3+yncT0EnzPrKug7O2kDkWc/mdVaXGNAOpFBYTr08WOtlSozOKqGE2Up4z0NmUhqdzH2PqB9rbw6A==","signatures":[{"sig":"MEYCIQCg9kpsai18BhIebPBpZORSDB282N3D08jgbRObJnXhdAIhAK2bLJCl59YmU00Nb1/6xAEws5vUHXLOCH1QwuaQBsO2","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166012,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrALhACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmq5RA//aXldjzAqwslQJ7YDB+XpgFSeCvIKHrAk5RgAQbwQHFwJK6dk\r\nRTvj397BRREBBZKerYazWu2Eglhlcemlqib0ntFkeh8HxGHFISponmPffAG0\r\nIQIF3nh5leQMbrRjE7LRdd64/a4Y4FTqL9t/0t52WpsKE6WhpwUFbKzZ/NTD\r\nbUBXh1DE1eulNb1LZMqNx/fWoVHFS5JTrUQl7BDC+uxLXE8zn+AMgcInC5nO\r\nof6dzFWpdTQmb5QqsuS6BQSfDSJlhpQkv8Fooo4yNdXtRIF47Ej8o5zwdCvg\r\nNX4uwlt7PFRC7VjU/mtBFOSff8YsJr/JQ0eBjnWrckAQhE6mTTi/xBNRZpIy\r\nheLST8rL57T/RTi7FN2qQLwi5HNvVZ1bEhFCNccvfSkH/AKcfLbbqo9zvCym\r\numm/z4YCeAPIQ9mQn1dkz8Ayok3sf8kIZpdtEQgsDGB22IdjMBu+AzevBznN\r\nu4YrGu8+LkwsLt2emuV+lIn6hTnGqJhh+hQ7GSCKr9z0/pB8ixeaEhIxQtn4\r\n5g4gqtlQN5vlGdtl5h5CbqIgNSsOPICFVgaghqhNcf0fXIhOra1UtGlJrwCS\r\nIknxVBuT8nSxceg8qdqmg+AMK3NPOtuvM36eN8gIIAm9DsFw5vOt2B+vsK9J\r\ncFHbXJhWg/CWjv4+9gKfkoTEAscWnybmmaA=\r\n=byiT\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221228084759-e043f40.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/90f1fe012dba92a6ebd29b7bbaa48568/graphql-hive-client-0.22.0-alpha-20221228084759-e043f40.tgz","_integrity":"sha512-nuv5c5H8T3+yncT0EnzPrKug7O2kDkWc/mdVaXGNAOpFBYTr08WOtlSozOKqGE2Up4z0NmUhqdzH2PqB9rbw6A==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221228084759-e043f40_1672217313165_0.7475369429483589","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221228085348-deb47a6":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221228085348-deb47a6","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221228085348-deb47a6","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"ce462bcbef4e2f3c5000e99189f35046bea1d148","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221228085348-deb47a6.tgz","fileCount":60,"integrity":"sha512-zUYtmQtwb9zirPDBZUflvSgocB56jEw/Su00gfY68ZFbyHmHqT/bPfGg9YOAcdKj28dUCPjEXxyU2sD3dHBENg==","signatures":[{"sig":"MEUCIDqAdyB0ZoPWf0RX6VCtrIwGV4XqAudZkywscPq1nK3kAiEAkkmv5GlW08AHPkJVOTMHouCkYCdlnPqZArPpH16gYRs=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166012,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrARBACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrDFg//cBJetfcIra45aP9gDLxhVHDjS+YEJrCDu2ukyyA/FiaOEsCZ\r\nMSwbuoujIpnzH/WQkelMKEB7qUFBGNvuadKEnjH9K5dCyepsumLtpBdN0ZX9\r\ntZ7DpVFgRGpoQQUXzh6/eMtzPR7+GRb2ROwQHtK0wPO/TcUHu4tu30IfPsVA\r\njFlq6BUsYROKglljRqRYJoFDNEoJcFIP4ltL0yFfS2L+mLmDT0U/QuVF03sB\r\nAjdW8ui0t5SfSITZYDDBiUA3dWlNIEUSt5YlxPvpxHvewKS6vGtAM/WCc4QS\r\ncAXVW6TGnW1NmQjJ7zVxYU1ncnkDywrq7O4tQJoPpCs6bpxuiGKl1aV79H25\r\niDtbgUgZFijUwUD/jU81XR2hx6BeWUrzTcqK3Lc4LMh4h6p5tYnMXBcI0oVJ\r\nSqLg+z/rLIm0hCzbEi2gsqYNj+f7UIYTq4+Sw2D1VqSkOcXwDTWTkftBrOAf\r\nWXBYtkMVf/VRPXKap3onNXAH8GOE7TtOEDfLZP7bSxqJgFoMpBVgbUhuXdWM\r\nbRkmk6/l/fPQb/TaprT4B0/KykOHjWWkNRpUp4P//4cKYTsbESr+1Rh+tvey\r\nQb5NlEHlIg/RaR3BscavXXjeYdTfi1/oKxjMRqQDgQsiMJHDcY3Lz7CQ/t/g\r\nHo0Ko1j/9nUThplSkWLJeN3Wgak2O1WuF2I=\r\n=DWAi\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221228085348-deb47a6.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/4badbc7b08462120595d8004bb7ea0f1/graphql-hive-client-0.22.0-alpha-20221228085348-deb47a6.tgz","_integrity":"sha512-zUYtmQtwb9zirPDBZUflvSgocB56jEw/Su00gfY68ZFbyHmHqT/bPfGg9YOAcdKj28dUCPjEXxyU2sD3dHBENg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221228085348-deb47a6_1672217665096_0.13953175115874306","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221228085848-2ea4401":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221228085848-2ea4401","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221228085848-2ea4401","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"8d5d23aaacc07522e18436c1ee1ecc247636cfae","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221228085848-2ea4401.tgz","fileCount":60,"integrity":"sha512-ddB25VfzZYVFBbUVIfqIv2HcNI7vnhJiaB3oGj5OVKc83EgOdHVMDyqMXzJst8LUKfrBdhFkQYnC1Jy7HJyoJA==","signatures":[{"sig":"MEUCIAgQITq6H2IfTkAVdAVkfGz6VwOl6LRLNZYjFLmdE0L/AiEAjcmY8uI8gB+7tm+b7OQ1YLesjlyT7dhUXK9fl5SLpXU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166011,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrAVsACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmouQQ//RkLt7DUobms+GISzQRK8AHdJIaL5tdaN+YJJ0jNo40WsVkun\r\nnn7xAQF8uReAb2vvQaf19Zme7hnN3SsaoeD/cNkYRd7FMbq5mI5g9oofN6lT\r\ngVi/np4NDWoz0LeMM2v6eUwAL9es24Am3cGOm3ga0XBpx3/w2GSJEiAbTtO9\r\nF2legZODdjKdeSJFdqzZBzpQkttLndUJiE76HqEtoWUgVgbwLDHbQmM+3YuX\r\nx+4QMOQMQEnb+BIobND26Fuq/DIsHHRYAwpJxEkID85N1WIQl22Wud4bxOTD\r\n+qDgrYfB5n5rZPHzBZVajixMIggBF5ShBds5se3JYqZ0WhKyl8qTQzNhq+zA\r\nCLE276c/I+8Fwxud7KmCEHjh+f+TMZn1byoHMNMgUuYZGE4//ivIGuuLJsnR\r\npszw/au2r694GZFesI/sa0QwbSW3EwHJu54LBQlcrtDNMLLAQDWvTDPZFkm9\r\naL0z8yfIh0aaPZVYjoZjbv8awj5USUa+CJ6C+228C8Zf5iF8CoiUzNaKMuU1\r\n1tXHWJbu8mswKjQFyqZSQdqVAZzCqdqf2eYHVPcLxhDa7ZGSZJLoTjOrjath\r\nLkfYE7QThUxlkG5ZASFRyux0LLffIOpo/RLzG4QEOQTJwrxcTxobgEtqE45v\r\nNZMU+orS1SsOQN7MAlMajHeSCRaNkP4Q6sU=\r\n=VGXR\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221228085848-2ea4401.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/6385d1b83db299e0c2fcac96861728f7/graphql-hive-client-0.22.0-alpha-20221228085848-2ea4401.tgz","_integrity":"sha512-ddB25VfzZYVFBbUVIfqIv2HcNI7vnhJiaB3oGj5OVKc83EgOdHVMDyqMXzJst8LUKfrBdhFkQYnC1Jy7HJyoJA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^9.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221228085848-2ea4401_1672217964016_0.5899934496197876","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221228091809-b4f66ad":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221228091809-b4f66ad","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221228091809-b4f66ad","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"33b79fd2b8537504010683f2828ded8cb381fccc","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221228091809-b4f66ad.tgz","fileCount":60,"integrity":"sha512-A8TEXU868KgRVNVuIgB0XI4jLdvRlnxrk5vKVQm9JlyIoqf7fycpALbUWptIhoVz8uH3aIoJfC6bXN32/E6BQg==","signatures":[{"sig":"MEYCIQDJwi4GsFzU6IHkschhIMnPzT8jI+CwJxyobR3h3hslkwIhAMnfDA8Dq0xhjk61WwwRrRbHyfWM9E8WranbwCSMoHWj","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166012,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrAn1ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqO3Q/+M46tfa972EdCceIgLmpcTFINXZDWTmFgak4RT/bSPTY1ZiO2\r\nx8Kn04M5zvLrrokVsaymf/vjGpKVK+oSV3xohL2HgYdqQ2QPfIg6j/kTXAMc\r\nIEieeMiBfKMuZ9MJ1N0Als5VXfeFLefl9XxixzSHP3MmqP3r4hkFVzXVEtf4\r\nAVLJUQoVxUumGlPTiOUOLDWJlfuW9IPNhKV7zeDZor4TGeFUzmTuc4ZXkTOo\r\nY1aZ5kGmzQlrzJuHEmB72s76aQvT58WF2/oOYy4Qt8H+kal8AcpFwejAk/Oe\r\n+Qqz7dtWtlX+lGdng43tMz/GX7WBU9b9VYVW6Gp/I0HeOfR85DNX1sIrUp1U\r\ncGhbY9u9mjbBXJB2a1GBPh1aqZItLbvobJNbnZUjl1Z3XUwIwQWZui/THOKJ\r\nbaSsevkAFCtz4A3SUjkDgC+ZwH5PDE2chHJbFrD9CkAd4zeexUFG5Hd8ZSxA\r\nJU4VWZpwD2COaAxdMILLiRMLyEfqvo7GtDeKQHdDeHtw0lgLXV5IQZIv6/wc\r\nIzJ1bK8erdxy8Ao5SQsnhVSDnDuP31+gPWMA9vHLXMhIqdteaCIqNexFwwaM\r\ndn2wNKzxSLM7ej/4qPYOstsGfreN+cZGq+7lSr5MqEHE5kQNzITUNSZlHmpu\r\n/6bDSBI9364cEurJzLhBAqnlkl4HNgsfudQ=\r\n=Jm1O\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221228091809-b4f66ad.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/637a025c16311b4c4a259008bde71370/graphql-hive-client-0.22.0-alpha-20221228091809-b4f66ad.tgz","_integrity":"sha512-A8TEXU868KgRVNVuIgB0XI4jLdvRlnxrk5vKVQm9JlyIoqf7fycpALbUWptIhoVz8uH3aIoJfC6bXN32/E6BQg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221228091809-b4f66ad_1672219125027_0.9828200032526093","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221228094652-3b02987":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221228094652-3b02987","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221228094652-3b02987","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"3c89b354ef557f0203fc5800921761bd3017fa72","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221228094652-3b02987.tgz","fileCount":60,"integrity":"sha512-nvOTbJPgKCpp4eE6fQHhza8ALNyqugk49dAod6Brk/gqCnKQZC0ZwKdzUv3t7nGzPVkaVAPmjQYKQBgI+kFHiA==","signatures":[{"sig":"MEYCIQDL6kqGCqv7tONmTU2KmR4kPBR2i7/vQBov6fRlKYqpzAIhAOdrISZ+Mz8Z1Sa5Lo7Ohc2wocjViYgpybdCJ7x3+ABO","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166012,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrBCuACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqrJg//ctfpZFKIntHNIdh/6/RDcT2u7M6s6nA0JJCEKCKJRSDTK3sz\r\n/MQm9oF+vhDnIAe4BH2t/DyP6MaN9+j05c8jJS6iN6klhLCX0CFOpBQOzojv\r\nPXtNdnjIhsOU2G90Q9Hm3XUk9ioJXF0YL3QILAq+U0pafu5rh9wgaqBzSVND\r\nY4nuFg67W/QL5VGfR3LMCyLvcnTEfChXanViJVb4E/7TxuS/qkWef+Qsd1R2\r\nfzYeBNpk875aZn0f1UePdUf46Ny9XY5JzSu6OS/BD+ulk1KI4rUIVZ22Dg2/\r\nHKwsBF/fj/f8Am3JmEMz0RxtkEy14ySk9DSdSEoWC5ZjuO0DbaUcNs4m6ZYT\r\nZiyLg1rgH11ZmuETYEd1lck2+Mbo/fA79xSTysx7yfZLMkVH9YuB7w32zdHD\r\nkQsoQHBIEKzvL1I3wjkLsafbzT7lW27UQp8Tg4hthVa3sRuFZA9e7AV//28k\r\n3ezJm3b3GaycyddDzEs7J9v1WmaxUb2BNyFc964c4G+Cu3gZBFL9xF/qOAiX\r\n3+jw+I1gG0Sdb7jphwdGH4ctDTQJ3pxmLonxcWEfhcq44/J4pizCEua3PzzP\r\nb/9to79MTCegjWpynUYdopTGlFMKLlX9jho5D+TKMUfYJLdDYYOMMsw++ybj\r\n8FRwstzZg/V1tPj/FS8nadCuZbhAac8kC5w=\r\n=EGx3\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221228094652-3b02987.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/6c033d74f8ef19c6d4f3d2849b99dedc/graphql-hive-client-0.22.0-alpha-20221228094652-3b02987.tgz","_integrity":"sha512-nvOTbJPgKCpp4eE6fQHhza8ALNyqugk49dAod6Brk/gqCnKQZC0ZwKdzUv3t7nGzPVkaVAPmjQYKQBgI+kFHiA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221228094652-3b02987_1672220846328_0.5717854614091977","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221228095353-a83d4a8":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221228095353-a83d4a8","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221228095353-a83d4a8","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"39144b2d2058bb6ac0cb5f1bf771dc6799157d5e","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221228095353-a83d4a8.tgz","fileCount":60,"integrity":"sha512-wThJChF0TFsRjPxLKgEZPmZeFkxEZGwzFONcluWnhvSGMTu/qt+3tHh0FxH2lx2mO3b7Z5bjUQ8HuWfcYMX9Lg==","signatures":[{"sig":"MEUCIHgrFRMVIusvBVXdwCGz53jfI0BLs4mDPu4uySIk9scMAiEA3qbrDLBUPxElBd7aL6V7FBw4ZmtN2p8/6Zuq/gKXelM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166012,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrBJYACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqLAw/7B5oRTOoORixAmw2wvq27j01QYLMjzI4pr8qJavMJYwtpHc01\r\nzMeAXtrkdYzIpC4MAEZ5PMSqcXE7dRd5aGLvM9RjKhvLkfJCHRYSXapgccXB\r\n5kfF2MEY5i4LQr0ARzXbd4NKEdPgbKRYfOSzVf4Nu1O0aIeFnP5d4yHqVDg6\r\nasyS3Hca7Y2E4eV5YI69YdC76vXU0XI4/37c4JI7szXrW6UavGTEbOq2iD6M\r\nnWUtYQKMmhFU0DQkCnNQu8xlUwpkVmJLbzdzsTeErNfSMLbzynh8+ZK+/Qze\r\nK5gUr1Beo2zhrvgNR++Oqtb+GsOp3f0jM1jzDdzRKCH2BZtHre1u9tLF/PVH\r\nwiXfbEfrZTW+KV173j9pS9D5CQiTwVyz7SGD5tgw3YspdQbqSzZygDbQjfIO\r\nMM+qN3/1x74L97UwnFB4sbMlh9R+APs8KsK7gAs/oYfyd4fCSKNiEBYIbGOS\r\n48VPWFES616M3kXZgELXv/R3RAKCz8Z8Q44/601pqzoPAC32XfrDoQXyJjGY\r\nFtfgDlfW5a++lsqhsuMT6BM7sTMRSEvzz7poCBHdXDqZXnjGueh+K2MXoZDZ\r\n5COwYNyDP4Qh4X/RvBTtdGwG9sRpmwdcT5fyrXMfv778fIdISN2D+NJinCME\r\n0/DmkHyxxiHx9rOcC7iS8chZGb9zkaH79Bc=\r\n=NdQh\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221228095353-a83d4a8.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/076c20564f82fce2668597f3a8e18f32/graphql-hive-client-0.22.0-alpha-20221228095353-a83d4a8.tgz","_integrity":"sha512-wThJChF0TFsRjPxLKgEZPmZeFkxEZGwzFONcluWnhvSGMTu/qt+3tHh0FxH2lx2mO3b7Z5bjUQ8HuWfcYMX9Lg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221228095353-a83d4a8_1672221271996_0.9282716885187161","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221228100317-5ac473c":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221228100317-5ac473c","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221228100317-5ac473c","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"3754c4ca4f5ed416671fbea4f3cb974fd87cc017","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221228100317-5ac473c.tgz","fileCount":60,"integrity":"sha512-HZJMsbjryYJUkCjBa7amNX3zF8H+9gqQnQ3iObIh5vUO0W0ik1/woEPas7vEJEX6341U4uAQ57q4CjGbsPjqFA==","signatures":[{"sig":"MEUCIQDM3vklIrY0dmwAJcHYzMPsA0pAtQreLDplMD5OVSoFIAIgGMTHXV2Cr4Bkvk7uyUb5ftNEY1krBVLJiJtxtK5ziYY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166012,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrBSIACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo1WhAAjqK31wAMbcnQKNli9Hw1P+qgtlfPjSg6WMs/krcA4cutNrFP\r\nk9Om0ZNi49BbRiaZJiGKjWZrxK1VGUEm/hz/RPQ0Xd9Yq+imwnJmGV7cqvY3\r\nk7zfQJpStVVNOzoMq2rZdMM+fa9XaoeOG23M5dt0do8aLDbwzGTrzLmwZyVn\r\n0Ede4hBxVrKB/Baa/YNgtcQwDoec2kfsdqc7gf+WK6/XjyGlu78i02lMCY/T\r\n+c6g34oD4cn0tGgbTqKWqYBTEMzLRzzrAPk6EXj7xRtYCrUaikPurkoZhb5a\r\nZIENF8yyeAJqlnytsTkE/hbpEcWjwbcsxvmJ7IYy3RqqhqsK+kU/gVdhDkhE\r\n2PW1jWFuvaQtBpsLDT1DBr0E9Hey690tpmDBYtNwJR9Etr8nShs3ImXgzFk3\r\nX8wyTHkRKmjPhTz82cCQozIPJ01UmYeDIqScOd4pRUbyQ91ojyDabAZqPBkQ\r\najgR/YWYwWC7HspKJdJ0wIFRy0AEfiOcbM+j1Iijwo8n0qLspKiRCAy0yOJy\r\nMQFTuL+gBLYf2J75yx9+dVDg8umdIeHL14htpS5KucK9E6XvudYqjBFah6U6\r\nB2qdEj/jWPgjVHUwduwRHkGUlmBhIZr4htIiqdHLG2400KNAJNoFtBXAtAwQ\r\nMJ11Dxgv6HlZQZ8tGLB3F7YJ1BuzBZhPdiY=\r\n=qLbD\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221228100317-5ac473c.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/0269e10f366fc23d3bf691f7e96b2248/graphql-hive-client-0.22.0-alpha-20221228100317-5ac473c.tgz","_integrity":"sha512-HZJMsbjryYJUkCjBa7amNX3zF8H+9gqQnQ3iObIh5vUO0W0ik1/woEPas7vEJEX6341U4uAQ57q4CjGbsPjqFA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221228100317-5ac473c_1672221832112_0.23980848195667281","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221228100346-13d76a7":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221228100346-13d76a7","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221228100346-13d76a7","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"ffc09a60444420ad4e78fbdf87b2cb2a6ddc5618","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221228100346-13d76a7.tgz","fileCount":60,"integrity":"sha512-BVA3n//6gxSVZDX7imn+tBJkhH/+mgOFSyvNy+9+lNPbf/g4muRWzhtPJOkq994qNnflpNkB8t0oI2Aej7R4EA==","signatures":[{"sig":"MEYCIQDw51yaL/CbBCLHANNEJnjxsY+P/RIoBqiVeT1v3awvegIhAJFNFXH/r2lzj7NsibcUDG+rr5J4BEQsSFdBZD1eU5XV","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166012,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrBSqACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmq/eg/8Cd00Dpo/Br4rY9Qiw5S0Gt+E15zPdra1AJPSZoTqVC06IWI1\r\n2vKcgv6eygNeDMnJjpLOmfcCWUYiNkKsb2lsO7XqwnIrkKbdB20+guc0e69l\r\njGL2D1AzKbRZ4rKWgjBTTUJO7vHrU/OeLpbFwsN+AQzZzLxwy78+Mc/ZO7Pf\r\nwSRgij9TPRMQInnY1DBlwzX4cGyuD4OrLPl8SyhV+P0OUTplzCtQhI2jqIut\r\nOnVONuPWE9n+AY3HOvx19vrcdy2oMs/7+Gb3yWG5qxcyBQp4orY2/hzhDP3b\r\nPwQDhziTFhs5UDbK44ptEgfDUb7COdOLUHgCy7hNqAawAYYVyfnQe6z5styo\r\nXEUH37RFO5Li1VtdKmwA3/oBd2A/04RZG7M+5GKo939WznQzKl+qmwNPSikO\r\nQ69ZAJCt25O0RFokWkI7Z1M52LGRy093ndIrqn8aFJ9TvCTueeqmCENIDbXA\r\nFGWApV+cmkvXg/UAs5kGd5DkuJiRbemgkLEaq34LTFzcyUKBD/xzMPRe9jj8\r\nz1RvDRN0YTxZjwN2mK8++2PML/v6isdprYgSSjrTQPoCUuU+zp5vByzf/qLo\r\nT7bFYeUGFME7ipcctYTJ0JdGqJ3pVhcTgiRJnUes+TfLKeu4mxPh2ZjVAOXW\r\n+fG7tnsn5Z0GsWZHnWtndhC9L4iPeCjFIHA=\r\n=Zg9W\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221228100346-13d76a7.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/453e1ba7437a0e7c3de6cd91b37bb30e/graphql-hive-client-0.22.0-alpha-20221228100346-13d76a7.tgz","_integrity":"sha512-BVA3n//6gxSVZDX7imn+tBJkhH/+mgOFSyvNy+9+lNPbf/g4muRWzhtPJOkq994qNnflpNkB8t0oI2Aej7R4EA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221228100346-13d76a7_1672221865901_0.9780133225389052","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221228100900-0a0275e":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221228100900-0a0275e","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221228100900-0a0275e","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"2f769a4a23557a3a12430e87fb7d0210da14a74a","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221228100900-0a0275e.tgz","fileCount":60,"integrity":"sha512-xBsDttpNPjdx5vpQxMQbzpL41gtMn1n/y4Va65YrIaoOJW12FmuFu8USKElAPASTs6RdNqrmqMQmmZpUx1j9PA==","signatures":[{"sig":"MEYCIQCpZSYggzXouH0KGoc5PEflWKGrbDz2crvP8CmVjkiejAIhAIS56MkH6uKGMW2+rlx2r2h6kG1V0PysmmjoLWuTfZ7L","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166012,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrBXiACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoApw/8D3SuHk//PgekFVwZRMpGvytSdiBVbCkffeaJF45cx+/MUTvo\r\nHMvFpHR0ihvO2GHFr6cE20/XHWFtHe1P1yvGEuaobG0jbkLj/9Z0Yuhvz+xB\r\nuE7N70EAONkp0SBg6rjp4GYLD+a4FDn06i14Ui0wM+ap6VSoEXFf04yFXWB4\r\nzrHnZxv5CVjY4XYMuJqJta+gHlU8l2xB7ggJhvtUcunWWqlyOQMcM+j9zV2q\r\n3ADBDsYrJbSB2sf6DDzW9m4IvOjMGkYz9l7u+1qTNnDpy9CzZbph4l7+FEBZ\r\nVYZ0h/7DcK4iUVCPmTu216BTyGN8jGJN/JBVa1akJNTTxNhyka4foymO0cOD\r\nzdb43+Qd3rsY3E6IFd43HkOX5RoqN6ZGHYBY85h2oUHhvW27NBBx+VjXt1SX\r\nHrUOZ/7w3cQcc0lcNId66Eath76dB9wMC7YzC1Ya3awp9ZiWpiZXk2JZeCmg\r\n6eSp+rHNnQHUPj7x+szXw9Xl48GrB4gTkRH1ihoX4HY2UXv3h4lnMgPngWsN\r\n4RoxFY0bImgaWNdOExqvHmnq0fkRUyOJ0pf1//Og7Qs8qXrKtF7OMJEZOaPn\r\nBk0XjENIJ07UObs0ZTWafy4cgrIkzA7Sw/jRoPKodIrCVghju5ZdoqcE1iRK\r\na2lCcZ6TVu7/Slo1Bf1yFuiUQHkdlriIEsg=\r\n=jIgU\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221228100900-0a0275e.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/33d11707a27713bbc4a7da1abd3d2457/graphql-hive-client-0.22.0-alpha-20221228100900-0a0275e.tgz","_integrity":"sha512-xBsDttpNPjdx5vpQxMQbzpL41gtMn1n/y4Va65YrIaoOJW12FmuFu8USKElAPASTs6RdNqrmqMQmmZpUx1j9PA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221228100900-0a0275e_1672222178212_0.4567754396012438","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221228101430-af30b73":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221228101430-af30b73","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221228101430-af30b73","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"ed2397f7b2ac71e26a8e5bb5963f0b9803836bbc","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221228101430-af30b73.tgz","fileCount":60,"integrity":"sha512-/ee4KdIouxj74iLkV6Xjo9jr0t66a8UxvLSUmDFaknr1vzUIT9u4SLRLxV/5hhqJ27YT/r6V8woiKa/78f3QYw==","signatures":[{"sig":"MEUCIDUoKh/XRTjrkmOlqkNn8KlJdk4wpDGoAheqwlbvGuVyAiEAjga3KAV4mFZi71EG/XhQ7ejsmVn9zxfhyO9a0czOWZQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166011,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrBcsACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmqw+g/+NPAyRkeV9efbn+KhbWNbqotTV1OLnU/HQR0KYd/DKBSf3BMJ\r\n6qOtn8ix+SypPD++NXihup1fEOwFMoyteJZHiWpCF+wuk053tDi2/kZ9IanH\r\nqpBzYUQ0p6QBc3jiGLdD7qFgHcCZZVMrxcKMkIeggmQU97sA8UB5uzmpnjEy\r\nGexNuy8aKjwZIk4jjZqhEw7HJVyN+xaFOl028bCPr+FRdMx2b7wQAkbrQinC\r\nMVxBAb45gaxJW9muOyy8o21w3SOl65xwxCYRjfPoI5GaL77lHsC++0ONkpZN\r\nsbJSt7QU4wGujFrMVuRnwfubPQepdrVZo1J6M2/j1MCHdE6yF5RZNiCY4y9l\r\nhbzkLb1cpQ1bwZqCW5A5RysDRbsmf/WjZzWmv5Qdf8wUsaFkCs3ZsFpTtvgI\r\nQ4N6A5WspR/+iFW0t9iC1VHDlhYIbED23gg+BKM1k6BjEWRmYU/Ip5YlVCIg\r\nwEkB04flNio4FLzMEuh1GT/c1kXXtB3aQx0URMr5SYxAqd9/9ZpMuK9rZkrC\r\nwBc87qbhBsdIN6Q6eCxt346cB8/0m1/Ft9ejhuvsZSa/ZYbfjhyaYwP3MKWQ\r\na/hFujnsfQUvf8Sn0ri0B6hLjH2XDqk+ZmkLVv9F+wH0pU/npYgEAA0kyYcE\r\ndfapwenBxU794x9kM3zww4Xtj1veX2XfBDY=\r\n=ePL3\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221228101430-af30b73.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/d97edb866a0fac5bfcf70acf96ec53a6/graphql-hive-client-0.22.0-alpha-20221228101430-af30b73.tgz","_integrity":"sha512-/ee4KdIouxj74iLkV6Xjo9jr0t66a8UxvLSUmDFaknr1vzUIT9u4SLRLxV/5hhqJ27YT/r6V8woiKa/78f3QYw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^9.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221228101430-af30b73_1672222507951_0.8030838415710642","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221228110830-674d41b":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221228110830-674d41b","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221228110830-674d41b","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"29088d4c490175fc8024a35df95d66fadef5b687","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221228110830-674d41b.tgz","fileCount":60,"integrity":"sha512-zb416SeU1MSnPVoEgQE/CBl5V9u9Eq7kRNCm5ZF15YHQ+ruXtARJqkIxLHWGPviSZpbmIJYFWGux9wR+QZPyRw==","signatures":[{"sig":"MEUCIEyEShmtCTvilsOr4ARy8mmwK0AFp/A145tuwTg4eJbqAiEA7A8nRl1RDr4M+VGqWizZ6ZcU0ftrKB//TB2b0J1bzd4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166012,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrCPVACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoQJw//XyXQMnycfnxMCE7nIXrdcUlg2R2ipPbbF7ndEDtVJqNrxXg5\r\ngWkyCDkzsz77Py3mgho0GQDQrNPesWcnd31DH/+FXB3HqJA87xdvV58DAaVC\r\nUrV0wVddS/XK41FHxuZcf2PwyvMwo37lcrXnNRV1ja7EDyF+A/YHCGn/F4WN\r\n2t7eL7LfAtl6G6iPcHNAicy1pM7AwChhvyNCQKqIjdDvH2kzRfSvfHtEU2sd\r\nF3APfAD6blrXDicBtJuDm5KEMpyCncvZsj0/Jg4FG5S5N+ZjpfDhDoBaKC/P\r\n7sZek3g42rEvEKdpYKZ2TEcnK1vOXWRnIMbIqcG++4JvsaFwt1pBy7yF2geF\r\nGgPXCjh+WSizvzDbRYrvzd1T9afyEXtXgkLnfcPZ5p8DTmyNvdiZULo3Fmot\r\nTCivSe45SZ+OAf87Fde/tIngalbOK9uUnci/9zPY+Luql7nMF1geMAYEdTMK\r\nJUbbsC5gDZz1RmewmK9AR2XyQtbBwuoLQhz4tNV20BCCr8oU8UuKw9jdz7p6\r\ntEO+8fBrX7AYv/Qz0Xc//JieIRjJsjlI3a/BexDIriG2clwRK0H+foxsHGER\r\neoMZdG6cAYOXHo2F3fisiz29uQ5rXWfUzmrCSlpOlUPNoEPfQtFPQboGrt06\r\nj5ZKwlQFOYgCXhcJ4TcsDtQUryuTotz3Z0Y=\r\n=/hmG\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221228110830-674d41b.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/381166b77a46a1da568b27b796fcdf40/graphql-hive-client-0.22.0-alpha-20221228110830-674d41b.tgz","_integrity":"sha512-zb416SeU1MSnPVoEgQE/CBl5V9u9Eq7kRNCm5ZF15YHQ+ruXtARJqkIxLHWGPviSZpbmIJYFWGux9wR+QZPyRw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221228110830-674d41b_1672225748922_0.11239234171170565","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221228112226-b69ec31":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221228112226-b69ec31","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221228112226-b69ec31","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"ec785f108072c7fcfd3fa810abfd132de36b48dc","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221228112226-b69ec31.tgz","fileCount":60,"integrity":"sha512-XIl/+l69d5hJ936j41lkrI0Mk0GBSsFfeTlfP0ox9gGMlyJBefSxsZnSsDDOOw0+Hn+tTVQktsKYFsH8h/lUrg==","signatures":[{"sig":"MEUCIQDtazFVr0BUGC/gRKftY27KWSz+bZ1kzco+tmE/mzn0FAIgRaTpYCTbjIiSmSVjv959M7F4iA/1FRo0jgMjZAN4uBA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166012,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrCcbACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmplQw/9G56IBcGzfGWUXKCvXYoy9jXjsuFxdBxTRYM6TyFoQwy08sjx\r\nz9sE8FhdUbk/GbRi84/trj2D/IdxigYknCcx+K7VwNkW9zb5FCu93fH2BNrF\r\nfL6ST1/f37boCRKbgpHqdNog6bbVTjJ02vukJvBGTjQnNq5ktkCDvU0zNR82\r\nUzAUb1h84aFglyfR0kCVizmU+PepIXkFkz73jUA8sCTg6+wBBkHZnBbV4100\r\ntD/WSNxvjyJVFNbJeGT3U9ZmlWOCMTFyfdBph/uKuSiX5sznsOJM05TW0jWx\r\nBg5pND98BpT3HeUNMuAfdgkIOgnGJs+yjrXg4o3Wyb1eIDO5sSz072Py5Yr5\r\nzaGrOV4W9VdHTKVzAYvcecvGn4WPgty3s9k9asTyFMnUxEreQ737efocRq9t\r\nia4H8/FakbT918UMvQbiiceBBJY8L/UWkw0s2VTSnefXF7b4eGT0RGLSAzZ+\r\nDCKfx5O9n6sczrz8ZcmUS/0yZ6d7usoP2akQ3SRnguhnPkh+TTCrXQpnMV61\r\nA4zQsndFpO++5dlLsBnrwcmLPWvX7N1NAAX9lTFXez4ONuZEtyqLmtjzQsEa\r\n0BaolPoC5c7A89JDaLafqD+JX5a0oOU/pskE/IhSJk2g/my4hof44WIdqKCR\r\neFKcDCCHiUhvwxPWAKWJxqzcFVc+Rd//Gjg=\r\n=Bi96\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221228112226-b69ec31.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/e9b4abb4125a8d0f507786138808d5ca/graphql-hive-client-0.22.0-alpha-20221228112226-b69ec31.tgz","_integrity":"sha512-XIl/+l69d5hJ936j41lkrI0Mk0GBSsFfeTlfP0ox9gGMlyJBefSxsZnSsDDOOw0+Hn+tTVQktsKYFsH8h/lUrg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221228112226-b69ec31_1672226587538_0.22643051545142234","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221228114830-6f027bc":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221228114830-6f027bc","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221228114830-6f027bc","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"388bd37d9c1db83d49e091b47312d522b1ef15d7","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221228114830-6f027bc.tgz","fileCount":60,"integrity":"sha512-hI5cjDsExqJAqbDeb4FAIaps9Ua0u6Pgs7i08trVP2++ZhKCZ2NCmXnWV0dNihexW8EQ2xoPYqWGTgIrbPBIRA==","signatures":[{"sig":"MEUCIQDBg5QBlexsS6DDWgf+Wq8hdN/9LfrvhVmZHDszQF461QIgeHX+xdeethG89AswoPWMsdoIoRFICV6evGvlzqAysQ4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166012,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrC02ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqgNQ//TuVztKYLo+/QqA3EF0nsfVq2FIWuSveW3veDE4VQTX1b26aG\r\ng6Zo4vlBkP+8oKNBJ2OhYezz56mpbT4eXmUEUXO+QkEBJ3FQ/Y6x0yA9MiP9\r\nGaQFfuyr97dKjzKJnZegBI9Yrq1Qx8rDs61K4M6/3dqrYjzuQ9Mpi6/9eeCR\r\nLEZ+b4VWbOoj+ncrvsUeejJsVAzorbFydOGd0+Az4kj6tpitFkiz+VNqG2lF\r\nJiHdZR+uIsN9lChIgazg5ZCYNsEj9DUpDy2mbG6PiuPvOHIWcvEQUtuAlsWL\r\naAo/TC4sZzFPsbGtNNdbQMe19i0xrvSHGG7s0aDZGba/Pa8Z2fTxqqmmmFCB\r\nKSf/ZOSxNUlg/dOXrLkuoKLS0iEs048Y3CbcmLAcQqOuhyVISqnKeHBUowey\r\nY2E6dmjzG+wuPIUPdg1yhJAqDefa+GDFsDCZlFNhW/rIhi4BPShVLNY6Vgmp\r\npekEQX+tz2UJZddIes81WMf+Ce1FHOaoMKejKP1etUJVKXQuERxh2t8tPEZ/\r\nqa6m/MTBdApT4aGSyEppVLLLPgQrYsFrL4WQVnOKndD0CLGEBKH/voLzZw3D\r\nFzbILbwez0D/j1+rpO6vmMVrHB3u+Uxu7O0yXgxuBEYE/yXa5UFpEwIdwM8B\r\ngMnlDazpDHvOVVMHugIVXNs6TXh5ulFKH10=\r\n=EjGe\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221228114830-6f027bc.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/cc6fa8bcea9992b31fa6705579990c15/graphql-hive-client-0.22.0-alpha-20221228114830-6f027bc.tgz","_integrity":"sha512-hI5cjDsExqJAqbDeb4FAIaps9Ua0u6Pgs7i08trVP2++ZhKCZ2NCmXnWV0dNihexW8EQ2xoPYqWGTgIrbPBIRA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221228114830-6f027bc_1672228150497_0.8026391312031695","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221228115509-2d15c95":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221228115509-2d15c95","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221228115509-2d15c95","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"d6db119e10187abb75319165735571bd36d02119","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221228115509-2d15c95.tgz","fileCount":60,"integrity":"sha512-0e3dm0zdbyHKLqoUK9L6tDS2l95aPmmRqUG7kjZGXgPdB/8EF8oU42imegpkOp1N6c75sbATy2DZNkfF6fLvFQ==","signatures":[{"sig":"MEUCIQCSJ8/frraRKa4P2VFcIm83xE9juksjTMF6i6jdsfVghQIgIgLb6cBiqtlFKSpHDrXQ6T3cj5tjPxkhW4AQcslhMLQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166012,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrC7EACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmphEw/9Gx0zkRvEEo7wNXhYRJlo5C9GYpl58AuSdNP9D7jDcvgj8EwN\r\nPUTmkTxCDbjLl0eI+kg30hOriyIVnyyP+IJtrcSsN2dHSw/6tjGQlgH+LyZD\r\n2O/Lh/gL9p1KwQSe9KvEOUb+m/eLSccWx1X1j/9mVxuMu/ljSrpISdyAtAxf\r\nE26L0vIfPX2zbAzZ3bxytRUjKb13VIB7t/HOHoAMAH0AXpZrUmB1smIFDAmK\r\nxcYaphaWFOV1BJG+6rATvu1ibFQ1BLwMOdOugTJmnhpGtvpxDwTd1KwibunQ\r\nZF0rEqMk25A/jFxu+MU7YsrMZfBDpoM1yaLnvCBfVozQ2+38xMei7lS2DHby\r\ng1J24ArTxSR/EqL1S4DMBUcex8EKy/9rG+yP1l3Ikr04tAgNkwd2UiJNLkoY\r\nMkduHpcjw6gXpSgDXy/DGkMnroeP7pkxpIL3nhvcAtmziOuV8dFXet3gahMC\r\nXDk1xNbvXeVFdvlPvA+lbfHuVCJb5er4Mnt6XEXcaJfFlxk6gIhd2NxypyhY\r\n0HLfkjeTwNTJDP4mjoIj8WkrhwWxOXioGzHtV477a0WKYzI3wrT1KU9bYrpL\r\n4v7uGVHCzBV/CJ2iS2HTtB33i3/acZcpy2Uj3xH/oQjNYJsqfcE/fWf844KT\r\ndY9hsLvxXBkJd+CdmAVptiELwTaDJp43X5Y=\r\n=EhRB\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221228115509-2d15c95.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/f34689b8500edbb8fb8380a43aacaa7f/graphql-hive-client-0.22.0-alpha-20221228115509-2d15c95.tgz","_integrity":"sha512-0e3dm0zdbyHKLqoUK9L6tDS2l95aPmmRqUG7kjZGXgPdB/8EF8oU42imegpkOp1N6c75sbATy2DZNkfF6fLvFQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221228115509-2d15c95_1672228548056_0.8697981507628008","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221228120437-c4329dd":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221228120437-c4329dd","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221228120437-c4329dd","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"c7ef9d653a754a6d631a2c70666fa52565033aee","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221228120437-c4329dd.tgz","fileCount":60,"integrity":"sha512-YeR8R2Sxk9NbSXGK0BYbzD0YNtWUeulqBj/uVd5MLWyiggFCNeDgkQaHNKbJ0ABd0EUmxkMp1396SkjIiPLmlA==","signatures":[{"sig":"MEQCIAU08kNqHgOaGhVUCFHYb/28nMilEMqDB/MgF1bwmTo+AiApf1GbrjCKcd6HlQVuUnf5ZWvXILtkr5zOA8hvC0t12A==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166012,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrDD3ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpEOQ//RLTm0zuBuEDGD9+ulIGJL1TidB6YIe4u6FuAx/7SK1zQuzhz\r\nKKMlppMYdXj90h3EBGFsG6yxCXcTtSnn/EVNUmAVmQkiER1dd4CIf1Lej/Q3\r\nO44XAZZdd4CddQrLDCvBW+bXiZ/UVapBqm6JbyKc55Rh7Ey406PJG1dIb9JZ\r\n/8p5C5vaZWfnOGIw1agqhguHzl+1xpNBoAag3EbejsQEvIJ+do57bxu6yXOu\r\nI9OIKCEYSOFA0WGM45lItIBGPMO5mjGXVbVbMlfD04u9+GiQOL0DSPWn+bPt\r\n2MYsvGpv6UOjDtLL5tV142jS7IhYLBa9TLnXk2SsWt0RHgRcTW/OgnueMcsc\r\nB1zsGBvYRe+5FxZlCw+iqso2es12/DboYKv3hdlFMCRx3Q8dUarckecAtcYQ\r\nZQBUMpS/sBjwbAJgq+qq6+NeCnTDj/ANhfoWOCHpzhLZsOgWr5kEmVZz/GXK\r\ndQFMhBKpNfWReG1AUkCWDVGZrs081oSrGfDJJ7SpDyCcYZ4hWqu8FkPJy6hY\r\nYDmCeUHmz5Xmf+ZPVlFu1wcB+gUFdvps6X0SQUVkU1gX/kLKiRZsItLmdyiD\r\nAxzjqU5s3/82r2vtrvSOkb4V5EasV5WLJVYoxuEsakyVbDXVJzYNKuPxz8vP\r\nGCvwi52rcubIexmlQUE7ZQ4OS7gEmhU8hXg=\r\n=5EnW\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221228120437-c4329dd.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/eaa0dc50d97a93e6d5ee8745d081be3c/graphql-hive-client-0.22.0-alpha-20221228120437-c4329dd.tgz","_integrity":"sha512-YeR8R2Sxk9NbSXGK0BYbzD0YNtWUeulqBj/uVd5MLWyiggFCNeDgkQaHNKbJ0ABd0EUmxkMp1396SkjIiPLmlA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221228120437-c4329dd_1672229110698_0.30455426279162645","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221228120504-b28e7fd":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221228120504-b28e7fd","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221228120504-b28e7fd","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"3578b6b35915d7749878e4957221687581a425df","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221228120504-b28e7fd.tgz","fileCount":60,"integrity":"sha512-ojQySsc5ZmtHD76sfQBoyVINzkJVgJgDHmPZbZjxQv0SWrKwR/aIhHZcjZcgeatE9MLmOWB5xMK33J8KdzA7wQ==","signatures":[{"sig":"MEUCIQCG2+6+KNgcgbOArs1xgnTz3U7NfiMXJZR1bLrUPNEXsQIgaMZwEQmtODeiPRjlEmmDqwUotwXM8wrxkVQPXTB/rkA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166012,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrDEaACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqB4A//aNTjv9wLDtp2yY3xxuyl4daVRpEaD/gKur8ne16FXJNlriy3\r\nNRMjyabK1/UmRHPdTfYQDJDtioQvcWu3t6ujqTjeie1MS4b95uUbhN0CZ8DM\r\nU/0HD6kCWwMje5mzP1u3OwjZMGL9irXTJXELmuoaMVdSJBNJMMYghMDraDi1\r\nmS3k2AynGTME8jXptsZUDAo//B3mPNzrzZpDIPxOUaM/Zg5bXQSCBpB7LEjA\r\nX3CTrEnvRjqngp/hHLvaKZcjW7/ZHYM61mgefkIt+v7Co7ZUQ+OmPzL8zfC+\r\n8sFikkE45Hqd/3bQmgu5Vrz3QXMkbl0ZjvSY2NWbZn5uWB1fyf0dloUGp34X\r\nzIzp+2IVzXrqsZM7zlGf9Kw2hObOObt0/llSI0jluyMoz0TB1oYf5gN7eDoA\r\nInPuIHhVH0ozxNgz4eLrh2SOBpxnlekh8iXKSCAL8rSUI7Ve/O2EIruORswF\r\nV8qa+801GRDKHBHkDj475ciJp6Vi6XsVq4IP36DSycvsVDQa+UXS3HzjWASb\r\nJjNFZkeuYKKlhJ9mWAciHeLCuFy3B8cljpdCcec3iXIUjizBvERDAemH+JAE\r\n9Ezp2fZpx36e07sZQStuutSn2npj0GPB1blVLlbSk0dL6JoeN+rgAbVp1Tdl\r\nEExvfGpIZs3aYEW7602T3KU46kCjJq0rr7U=\r\n=SzGx\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221228120504-b28e7fd.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/a5c81084f75fed1cf0bde9b849afad4b/graphql-hive-client-0.22.0-alpha-20221228120504-b28e7fd.tgz","_integrity":"sha512-ojQySsc5ZmtHD76sfQBoyVINzkJVgJgDHmPZbZjxQv0SWrKwR/aIhHZcjZcgeatE9MLmOWB5xMK33J8KdzA7wQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221228120504-b28e7fd_1672229146723_0.4338392080708573","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221228121015-feb12f7":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221228121015-feb12f7","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221228121015-feb12f7","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"b2724b91b96cb97dda2fc53298dc72faafdd7324","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221228121015-feb12f7.tgz","fileCount":60,"integrity":"sha512-p0AuktBBrR+BMkGycxfIXYkVl4Xol2JFRulh7dsPkE/ZZb8ivmECSk/NKTWHhqJeV77WJJg6ix8uzSq7vUAGOw==","signatures":[{"sig":"MEQCIGm7wwxyO0Gq4gE+Zb7CbquCYhyPD262e7fCbFkRwQISAiBAzqkNil8jgEn9np52dgO15JuO6BWhIy6qp1LifzoBpA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166012,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrDJMACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmojmQ//W63m59uQ5cIO1g/eNQmlcRD4MNaHppblk8BG9/Piw+LDjgpt\r\nc8ZLobxnrpAEWJIfWXtJ3MCorVsP/3S+bMv3NrZ4FzBs4T4JqYuS3vJzul9l\r\nu1USQxgR9B1AOUemWHlcC/cXgr1LymsgQSBW0yc5ONkCtByh8UiKieAaK28k\r\nYiyRHVNjuG30zIZY5VAynlFB7+20x+Wu+4oF1FIm0kY4xlpkCjYRSiGgOguk\r\nrY9QZ4RBnbVn2JrwlEZsAWNcrMkrrBUYmHxMNTU1Y5PN9dzGf2EqueMdVBJn\r\nSraLiyEyPLXPJgyqwkaNG+B7Qs5DkjGxjo/kXqkvop5rL8XPpYlgkoAip7g4\r\nBo/yReAZHpcZkGq9GPW537H0FubGAFzS80lmQvpucp++k2vk9muDnOtqYvo8\r\nER1cgg7KUPbUNWbkk5cqYS//sgyvZJQm2sLnRgmLGoK/eOQ1BBur6LqZcl/c\r\nWI88sWYP6fuPxlmYgwShyON0ju1fCvjQso/xGM55/hLpyU5UrmiZWPr5IAHx\r\nUYgvjbYIaeD4PAt8usLnY8KCTAGtZRxsuIwnWQlv7AYsHIbk/t/H0aeTL9GG\r\nA2qszdYmy8qo9uGRlFqqTr217pIE18gGIm9fQ2EmdXSaR6LVj4TsIY44kxDt\r\nHTiLK5I2OYiMkyuwivc9R2xOi7tl20EtwM8=\r\n=OYnJ\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221228121015-feb12f7.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/c1931554bfa166a59271d0590be620ff/graphql-hive-client-0.22.0-alpha-20221228121015-feb12f7.tgz","_integrity":"sha512-p0AuktBBrR+BMkGycxfIXYkVl4Xol2JFRulh7dsPkE/ZZb8ivmECSk/NKTWHhqJeV77WJJg6ix8uzSq7vUAGOw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221228121015-feb12f7_1672229452580_0.012003820746354199","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221228121322-122c3e0":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221228121322-122c3e0","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221228121322-122c3e0","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"380f0e33cc2fa2cf58deee70548fe26728da9aa7","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221228121322-122c3e0.tgz","fileCount":60,"integrity":"sha512-PYeEMx4m9BoogkeS3nLUWCxWVGaC6lux4PRPPqjmRuIMIqEA3adqGNKxKfYT0YENrf1qoH6VM987LLIxvcSi6g==","signatures":[{"sig":"MEUCIArXc6ZJ0y/fTbfXyeGkWTScnVYeapjsq71Gw2L0ZWtCAiEA8lUqMtc5Mz33kSArpZ/AFGGAyAVVKWtHEw0la3jy8iU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166012,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrDMLACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrEog//cSQqlkhVl1Dq0NpscRqHdsgZyqL9csR3zrp301VtS95YZpsk\r\nQbSonESe5hAYijxYiPoZf8j6jrgPtkyI0uPyqJnA9mNZ9rNhbeQUgWdQkrN3\r\nMks+r8SfWC5xGE02UjPFUxMt7xJDPT6ARLqLM8wVcz6xTZxrNM8Zw0OaM524\r\nalcPu8+sIiZhUG7wC54GRk2Xt4GwzpkDhD/n3aQblwAsHpoANQHayKxxf5qC\r\nYIt6VVlk7p1JUSaAMu14kMCMtRu5NBNfHmaWMySguehZK2h1wdnF77BjoZph\r\nDmI+A4UBEfrbGd0u2EHypA0qgRfr7r8YBcsjSNLkKvUjPeZtgjzb7ys+ghUu\r\ncy63N/b+8219AK9qQfeh2Lz6sOhsxQYwf3ZyXKacbIpycTa/8OPgVWyEHtzZ\r\n/D5dwFpocwTxJ/H4gqTGuZeSDT0WIlLuIFms94+7nfh+tsL9QskgM5EaJo+2\r\nDfAAYORHpxKPRF5+pFMxujj0S6CTKFHQLrHII9vk4PTdu7kRTmlGrRAubJPq\r\nHwm9cB8bkY6NuszQ8VpuVhQ+KcA3VSDjdfyldH1uGniKKmhQ2DmfgHoBwH1t\r\n9f7xyhAAhrIutucacPLFnD2E64gC9b1sbSNBNGUJE4AMNUqvJACBluWxOw+b\r\noOsd6p5lQ80kOcayrmKkXfszQ0bYbhchQOM=\r\n=nQ4t\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221228121322-122c3e0.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/64154e107071782233d485ab58228a45/graphql-hive-client-0.22.0-alpha-20221228121322-122c3e0.tgz","_integrity":"sha512-PYeEMx4m9BoogkeS3nLUWCxWVGaC6lux4PRPPqjmRuIMIqEA3adqGNKxKfYT0YENrf1qoH6VM987LLIxvcSi6g==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221228121322-122c3e0_1672229643088_0.6318418505721075","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221228121545-6823e21":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221228121545-6823e21","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221228121545-6823e21","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"d5411d3d4c508b842ed85435b1a79b44bd0aa376","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221228121545-6823e21.tgz","fileCount":60,"integrity":"sha512-3DuP5RiDhWa4aC88OmpTAiQga/dZ1TzHHsJ7wcHAS1aH9gD6SHN38Mtnr00eUTfCaFwI8DMGbhmRb7F5ceZC4g==","signatures":[{"sig":"MEUCIQDZ/dlwQo9JQLTrmi+xK8fynx/1tHjcfmGfGTMzs45QbwIgBPHyKkOMDpWuYw0nU5d/fa0R+9OO2a9V5IfIy5dLnIU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166011,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrDOSACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqfbRAAi7KtFRWoyVloPnbCBPTQWvuEty8DgzfTZFPp2AmIwV86aSm3\r\noAI2IN3D2wMa2pi5Nu+0Vtt7j9l/iLBxp02HhwA70lud2IKcsSINFOxR0VOc\r\n5T+p8tSZYvEK2vzDDqwfsKBe1ZDQ1ixnuLJP3tjvG0AEl1NTOZGKrqoM5jeW\r\njmE+jvd007GXWzdpU46zNb2XYFy05p5EfYQvN2CLAhAfi3wUcoPkC29tIAGX\r\nsznOM6q9YkvmmV7cm0CiXPwRBXx2gHEJMqN5YT24jisimj+DWZXMGuyPp/fb\r\nzMyjOByRSdP/9EeptkyRVjk05PRlSH2az0CvbzsdairwxY9cNmwymBw9Legi\r\n9DGtLY2VdpqAQXUfd9PhwDOv3tOHI0BD2IoGZlE0wJ++yCOkjekNZF1635pT\r\npH9OG1OupjqWCv9iz2FqtR/zfNhK3wf1jcfi74FFK2hQ5GoMhvSC7uIyMJ+p\r\ndFVj25bckS143xd2BGgg6rbmJafY+YOPOyP2BL3yEGgJWjicrvjhTgjRrxM2\r\nhJMsPrSUXd6RxXAKSGU7xTpnAZ86ZzW3yfMW3CWPfpY+h8QYAz6yVcZ7x+rG\r\nx4U+azGvIkSSCw9RerzvZk2iFeySudW8IhsmQRG1cJFk9kytE2DTkW9wPCJT\r\nlOZHOFxtT25HAeXCnN2UGASTQahbhvmQ038=\r\n=3niR\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221228121545-6823e21.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/0e9fd9c06baaa0f218a0c5713d7884dc/graphql-hive-client-0.22.0-alpha-20221228121545-6823e21.tgz","_integrity":"sha512-3DuP5RiDhWa4aC88OmpTAiQga/dZ1TzHHsJ7wcHAS1aH9gD6SHN38Mtnr00eUTfCaFwI8DMGbhmRb7F5ceZC4g==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^9.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221228121545-6823e21_1672229778165_0.3172232351266875","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221228121653-c0930c0":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221228121653-c0930c0","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221228121653-c0930c0","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"48c2bfb72cb5e23f0def9765843467a06daa72e6","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221228121653-c0930c0.tgz","fileCount":60,"integrity":"sha512-OMIRVHAxfAY84DDCk7ugv7MMrPjvdq7QhZ7PliBAxvS0SKD8eu5f/D8Cblnw8azgWZaZe/mvt4dGOhAXhjZQxQ==","signatures":[{"sig":"MEYCIQC3cfWGisp/UY+Sx+6DmXQuPUw7s9d3xWCZM3jofakGQAIhAOKem2mgh9zK0beDni5mIv1+20sckpNrqFn9CAGDN7sZ","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166012,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrDPXACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoxzQ//WWO7WQ2ucWfr+evuHWWk2GgIT+W1bWFji8cvkJHPdnhSp+bj\r\nO0ZNGpi5Pwhiuxvi/HDmc6Mxpts5sVhMcmReeIH32N4p5WjLmYF1Xnr7Mi84\r\nGWEqjrSSafsVx6QBcJaHc7jNb3MQOc2nKliVOBMieq06lRmW4euunepNKgRT\r\nXIHFajz7QMAlpTWFBRV9COIoBhY61VSfXfpBU+l3ScU9D/w6mQ29imKkm4en\r\n02AiQ+fkSqDDeasGx1Un7jYpjlq7QV4ooYhQhkg21shptUgIcwZ8hKe/vXBm\r\nt1VfXo9K9nkOAJgi/r5Y94d2D2m41JXgNq8FwFBbigOHnY2z5SOdIcwklqCU\r\nQ/ElBJxTrC3jmKm8HkBH4WBFpp4t4hX6hy3/Dw8fAMjBzNy3QRRkMjxIrNPc\r\n2P8KrcUG46IKJaklfT1k6h84b9sXQipt8HqdE4FfL9SGA6gTP+lFIUNEP7jZ\r\ngdcIhLo9XWn/Vo8xoEvpdFRo3pPbeI3WTyxyxCL7XEf23wp6AlPg9CGhZ6bK\r\nkyaffIRqsIEsNJv5g4Ht9Ga+8dzBCqCvZkHeMOKkldXT+FDl7LxNJ0EuevW5\r\nO6UQuyt48bYitMbTKeqeWvjUZ2Vu9XEisw07LHi7usYllFjEUdM8jJUivn01\r\nPP6R8YODKyDFkhtCocRyKTPL6y2vf5slwVc=\r\n=yV1M\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221228121653-c0930c0.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/88e253e4022c8e54c1e037bf1863b2cf/graphql-hive-client-0.22.0-alpha-20221228121653-c0930c0.tgz","_integrity":"sha512-OMIRVHAxfAY84DDCk7ugv7MMrPjvdq7QhZ7PliBAxvS0SKD8eu5f/D8Cblnw8azgWZaZe/mvt4dGOhAXhjZQxQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221228121653-c0930c0_1672229847254_0.5538512352559304","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221228150858-0e4efc6":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221228150858-0e4efc6","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221228150858-0e4efc6","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"bdbab71472a0836d6794dc67d23333d5ece99284","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221228150858-0e4efc6.tgz","fileCount":60,"integrity":"sha512-FqSOOmnDLPwWbPNpn7HJ2rTkENKkJKRKBGCsLxIRqrmdTeKn8WZfvPAItWfW6yxCGcrTEu+1JW6GO2DN2skTuA==","signatures":[{"sig":"MEUCIQCNVQUcnT377SB+bH0WjJBy0tHrKCA9zi+BH27Vb1W9owIgVZYFE7jJZo+eQh6eq7UiuN1k7D6oZFftk8PCD3Ai8ko=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166012,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrFw4ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr3qA//Xi17mrOXdbYo8huNZiKU7r5E84RvR6bcNXJLLJkO6nTY/2Ue\r\ncEFwnH/LRKSlQcvcEx4zvEYM3duVvjUDAzyXX8BkhA3T62tcM5RhHvNIreR5\r\nLlouqFHX3BBO6rGKuyNiR/c99nfgtroKTm3Nedd5wnpkBU1jAMtNhpBCEvFb\r\ndkfeBhCsTCmPp7LJLhPOK5kBJc5OFD8lTsEPeQR4Hu3cjkQjlNdzyanpz2Lo\r\nRM/lSgam0fOOTuD62q9IGDIukmWPhHHZwoRRz+eQP0iVZCcV+/ZtD3q5YqGs\r\nEN+KHsEeNZXNmejqFesTGJa/rHxVp1kYSMAY7hCEaPfd0kwYmtjptk/gOfqE\r\ntIXnFALR+gGjzfYogI1p+yYXo8POKB5qxEGlKzz5Ws60GZn0B/aeVBVQU+Sn\r\nS8LxBZr88qnsSvdzdME0+6RzFnGBzQWq1r3VZjY1XhvqCJ2FED6oX4oC2A1m\r\nK5S76ENdBdQ6Qyfz3hWkfd24/9mD4NtcZfGUxQfJzssPs/Xkr1cwHfFDcdrq\r\nnUza3rDp39QbA1GdTjv/7vQv2lrk44VMebBndNEmCBLdvJtEV7OMenn7QXxu\r\nJQYbce1CiE2zmFpv1DvbERHHBL0a3iFCyJuPaF12jTiS0H8YA4yhA1dhOdkS\r\n+NBOUb6gDLv8+wRm1My142fU286p3kObuWA=\r\n=TJtv\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221228150858-0e4efc6.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/f12f26ad7f54744c0a912d490911b3e9/graphql-hive-client-0.22.0-alpha-20221228150858-0e4efc6.tgz","_integrity":"sha512-FqSOOmnDLPwWbPNpn7HJ2rTkENKkJKRKBGCsLxIRqrmdTeKn8WZfvPAItWfW6yxCGcrTEu+1JW6GO2DN2skTuA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221228150858-0e4efc6_1672240184456_0.8127231671969932","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221228151505-7fe67e9":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221228151505-7fe67e9","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221228151505-7fe67e9","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"db253d6fd46587fe65d83bf3b42a265e08c5702b","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221228151505-7fe67e9.tgz","fileCount":60,"integrity":"sha512-f75+j3gZJY7FRUT+29mS0uZ3N51IFxsHjd9Y+4B4twYhkdoTZ6E/TtDOkA3EMQ4pqw6BjsQJ+exgOsmbn21MOg==","signatures":[{"sig":"MEQCICGrVgGHXQ6/UnYErR/wldYDqHwKcWcb6/wwbJG2NCd3AiBZjNLaJqjd/QohVIayDimAJxsDx+hccPi9TMGW5qYSUQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166012,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrF2dACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpeLw/5ABL5QscyzexH+Q46FQXgDFbBormN15X9gLrxW9fOShkecjKA\r\nasePJqzsvNEjZ1Tc5SV10Xw3pM/jlC0IbPMWEcuHzLZLUI5CydiszwI9GJaW\r\nKO2Zd5gDoS+9sBnJG9wBwtAdnP3w5bCEBjwbT5Apc4pM0cQK2JuJQlscCtX6\r\nH6l4VsCY2TS72kR6JXXLmKQwTxpl0oxCUSf4v08dLQExa+TP6UNVGM67mxtS\r\n3TmFWhosejG6/4gMp+CC35yuL+sD/SlFUYFAWgdNG/U00lxuyJuhEw3upT8g\r\nUEdXlaqoytnPgThq7B+qONdZZlIYfvxoHU5d5xgufkRqxUKKrcI5Oqgjlmt9\r\nGdAI4u6Z0RfcExrAYsNuIFBm20Y4uFoGp180jhozTCtKKjS7bCKQlDGAsMwi\r\naDpZ55vEaw0eLUcGK+nx7l5uGpzubwj5EMX6te5RkhGspy8xLxhYD5Yl34W9\r\n+MiNS+433Xpumjes0ObFEstRsPVmV2YrkiKC9A5qnI55GOrF/IKlV72aM4KR\r\npnnLE6yIYRMatTnglSdz0RkdsiVYSswLsV947v3zB56gbYGLt6FHV9uhmJR3\r\n5RU6+oAhYAepN0LvWm0QwVTIGgAUq5XNXpkSqe5rkcTrVhofUPqdwlDSwYGI\r\nELX8RScw+qwRC/GuOh3K1txbvjWyrygOLk0=\r\n=r8MR\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221228151505-7fe67e9.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/c10404b6f1cec83463c138b00de80f0e/graphql-hive-client-0.22.0-alpha-20221228151505-7fe67e9.tgz","_integrity":"sha512-f75+j3gZJY7FRUT+29mS0uZ3N51IFxsHjd9Y+4B4twYhkdoTZ6E/TtDOkA3EMQ4pqw6BjsQJ+exgOsmbn21MOg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221228151505-7fe67e9_1672240541076_0.6950927660840922","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221228152453-1c3de86":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221228152453-1c3de86","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221228152453-1c3de86","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"8adce22e3d15cd5aa40472cc086a4240417d71d1","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221228152453-1c3de86.tgz","fileCount":60,"integrity":"sha512-oXQzRxV5XVnbyBY17/A63crXBUu+PrwU7nJbBR52ccWyK5lSIvf6aAENmYzNa8tbZ1zdcG0PAhorKKxkDltTXQ==","signatures":[{"sig":"MEUCIQDEcf3OUsJInpmiI4wM8ISpoGnlKH/l1/OcdPekTjyQRgIgNl6QXCvh7HbT3dO1c3iDy9bkNm6aEtDsXhECIZUo2p0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166012,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrF/nACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmrc9w//Y7pClVFtnOm81BZtU9EPKimgSiswshFM3gL1RkUNSrsUmBVj\r\n3VbY8B0RgNy1C/bcOudQRswfB6f4QulLJe6vKQGDfxBx0PdFd7TYPZl5uA0x\r\noRbITBg3Tn6EbI7wZEOPRoB28BSW8U2y2+7BtUkMNqZaLvbl+UF6kohfGIQF\r\nZREYnu67kn3LxsH0VL1PeGSlALMZ9IDdPB0oXUykdlHGhGe9NS8cURhguTPz\r\n9P5vu5Lzz3J9I7U1mbjf4gEMGNgBkQHh5dqFwGauiicLXrxD2NWdRl69QkXj\r\neMtkjMz502dKTgtPqXgaqOXXI3KsZYEvlIQ4IJh+99vhjI/MF0U6hYW2RuKg\r\nMXtM441sZrbfQH5/cuX0DPCja7AF/s9EIOc7J9h/AfWz1m3Es/xaziE35JD/\r\nUT/P/HllxSxPUvZVV4YbuyTBkSHqryF0qMwgrJnYldh44UxzgnGi5WxmTc9n\r\nEvAoijmUbxf00mCi35iExvSNbaNVty/dhv/sMHM2T1z0j4l99OBktuV/kjot\r\nQuHeD8StN5Ae+CtIXpXbtdg00qiPV2PqJVw9V9WXrdNzCLlkf9OOnrXr8VPm\r\nWKT4472T2tawnRiC4QMJLZt1mHaFmKYb2iIyC2scjMWmMwZUnBZzO7tPgYZ/\r\neRaMXCF3DNrI8sfA08Skf5Dk9zJUXO4NW9o=\r\n=fEAu\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221228152453-1c3de86.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/461698e65248a6445faa524bd4d674f1/graphql-hive-client-0.22.0-alpha-20221228152453-1c3de86.tgz","_integrity":"sha512-oXQzRxV5XVnbyBY17/A63crXBUu+PrwU7nJbBR52ccWyK5lSIvf6aAENmYzNa8tbZ1zdcG0PAhorKKxkDltTXQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221228152453-1c3de86_1672241126964_0.18011598482381475","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221228152507-2fee5bf":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221228152507-2fee5bf","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221228152507-2fee5bf","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"cd52af82399f2b8eb3737a2027e49b9b5bdc19e0","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221228152507-2fee5bf.tgz","fileCount":60,"integrity":"sha512-tbSSBZH4dFo/cBJKkZmIZbhAgKdeoXPFwItBB/OSV/38cM9/7/H3Lp1cEvlPNYvjYpBWms7LAhA9co6YRi2vUQ==","signatures":[{"sig":"MEQCICo5BEpmY9WlPBzpQsQGiBfu9tZQSeE7tnKUrMD2abC6AiBGMtK++0N3Y8Jp0FJDhik0UkClvv/w9pHKDh5ibNRK1w==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166012,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrGACACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr84A//WJ2nZicG0qBoYbir9bieGCUi0H2yKLZpiHBxn/d19AzAGteP\r\n/ybntAYCkK7cs++DwgmoU0ktyyQKpJBAVBF64vLVuA+RLsxJpLakubRX0hij\r\ntNNYZizNBO4SXDXh8ZyDmK9zK7UYEIfF3AenFBdn7EllggmLs3v4CA2zcp6I\r\ngRfSem03QvIDjNjKKQZKaieZjHiIgyDdLCZsT2HTtIaAJ7I3QAp4RzlPc83I\r\nE6Xov+paus5yJMdm/zm9lQFsg4JT5kKJpPyfHrjmZIpmGC1MSZQuTDXVO4D8\r\nE1zEE82Cd+x7rlShWTquFIvHvKUVXcMenywKm01TqJ/3Ltd3KqR1agxAyCqQ\r\nka/37gRXQq9I1VTKi+epB9wqq+xzN2bLRC2cpPeWYgMvSAbZ8NCi17L1TtVF\r\nQYICSiobI7WFBNwuVf+32pDBaM7ur8nBYpa8LHp2WjHXukUQOb0c1pgrFIM4\r\nIZcuGvm7wgbiWwBgz35v473owkQgiad9EtHYVH6klEHbe3OIs348rq/lOQeF\r\nP7RT/cPDj5aXl1UQrp9eO0qMGGnY6avyjYRKP7BYRONbMtxWYoswMDcNYpTd\r\nKqw+PPyCNEEP46AiHG0NYWW3gVbJVe7QBLVbfsGWtkoWDmbFodtKGjvQ7yUn\r\nnkwvFv2Gg4Gx/ILMoGadl1x1xTJLwPw4V2c=\r\n=Qq5X\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221228152507-2fee5bf.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/f76a6dfa622d26cca5908148f04bdb68/graphql-hive-client-0.22.0-alpha-20221228152507-2fee5bf.tgz","_integrity":"sha512-tbSSBZH4dFo/cBJKkZmIZbhAgKdeoXPFwItBB/OSV/38cM9/7/H3Lp1cEvlPNYvjYpBWms7LAhA9co6YRi2vUQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221228152507-2fee5bf_1672241154331_0.7157677848102135","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221228153012-e9f9ec1":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221228153012-e9f9ec1","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221228153012-e9f9ec1","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"d4ba79dc8047ff0a94af1e31f51a383ead2009ee","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221228153012-e9f9ec1.tgz","fileCount":60,"integrity":"sha512-FXDApCa5VkzsyKMG6UmzPx4dXV5xP6/mvDh1cdsyNhF44AMEaC2GSvGo9w8cxZzOO3idsdZ6ALlAYf3G/T2dZQ==","signatures":[{"sig":"MEUCIQDANYm1NfrJ6F1xptqRuFaDKTJQy++Pb3qqV/7HfikLZAIgUKqTjaZSiv6F6NijYcaLMm9lr17jzr8qAAZh6ODorNM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166012,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrGElACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr/9w/8DP0W5Q90aQ4E6RcliH9LjcFFyPC80tuQVw41lDlpiIakt9Fw\r\n90Fl4aS+iXJWpWcBib4yqsn7hPHnDl5NDxt4JVyiDLmkv+UfLkBPjxOQUQcS\r\nCvmY6SCeAXCo8BRB70/NgG6v3U65dTW2AWiEyag/Dxs8BnHFNw9Y3Bax4hwk\r\nlSibaZ6gvgLA6rd/P8LurSCsGkgIIJBsok2Hl8idwynC9nI76Rzy6JbZHi6I\r\nJ921HHDyQ7BwsuG9m6Cgem8XcfsU7kqoHreHenDvuWDyQOovAgv1lDDQBgl0\r\n4bGRdvp7b20aZhtLV3rsGlLAn90tOueEzzxvvyYMfmVx3JqQSY31LL7LwUKx\r\nTqdu0gaSGKfsNFV0yv+RTe5q2KdL1wiEC9wKje8P3Pd8Jx7FaAkMYzEirGY1\r\nvNSgf+EKTFcMFKp6CvZD0/7YW7Pflg9zY7ijp2TB0vZJJMwH/1fTe4arb60Q\r\nzTGvzOBTS1Tz6P3NB4KO5sfQ1qHK8s6MFThpj/b+BlGEKKkNB4WIRaHaZw1E\r\nZ5LmHRM9jQGdRswBRBQc+Ifax/Se1HbCl5We5FGj2+g98NZ4WwxUsPrmwZ/I\r\n6aKDJFYklOV2P40EP/nRAlj0ukROo2sRMPclgS4ii3K4Ij0Z9CfuFCXicigU\r\npV3F85RAJwPdVcuaLam5BsMX6FuYanrBbwI=\r\n=B2cx\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221228153012-e9f9ec1.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/986fbac92d344e21fd931b1f50e1f9c9/graphql-hive-client-0.22.0-alpha-20221228153012-e9f9ec1.tgz","_integrity":"sha512-FXDApCa5VkzsyKMG6UmzPx4dXV5xP6/mvDh1cdsyNhF44AMEaC2GSvGo9w8cxZzOO3idsdZ6ALlAYf3G/T2dZQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221228153012-e9f9ec1_1672241445563_0.523318562045505","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221228153531-e5abb7a":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221228153531-e5abb7a","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221228153531-e5abb7a","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"db37686bfcc5aa30cc9108b1d235b2ed9fea90b7","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221228153531-e5abb7a.tgz","fileCount":60,"integrity":"sha512-+DFp2QqQjTGShGONYMCUR5TfdIA9RnWubfgNs0HomH6GOlfUlxLzgmqLBlsB1UK+OmOehLTpiVQ85ne/rnQH6Q==","signatures":[{"sig":"MEUCIQD6v07Kpn0JtSYYZ5RzcUhBNuErDqRW734hkaLGX9xxlAIgWX6knw+f7h3ZOzy5uV7FHlH2jm7C/jd7vO0Hn4GdIxM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166011,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrGJmACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmrq8w//b6PThG3kOIJYjeYg6As2wkeKRX2ig46JhYp0QwRiMbetZRTX\r\nTqGEIAxnEMwAvhbaB19kK5W9Yc3H3nEqUalHydciy1mVKuApiFmbnB6SJeyO\r\nQIG4LAXX7G8a8ok0rf54jiTPTMOjGHpUGxxic4e5RwFP3VojHjogPpjZNdYC\r\n1V7k8I9w+8jVnnoMTeIl/cBy0AWMlKNI6ShUkKyPeevncqBv1CtbCRXx6L/L\r\nCBMO7CYBG7T2jkLWovMxXj0EYfoouIfg0yVcCKRSHbYoqrG/HyEi4V+XU0Wp\r\nLPrvAXOu4W4cvSqAudfFWhggB+QcpN7ADC62aeuocqdCv3RoAyqg3LnNnnRj\r\n/PxMWYd3ZnDNSRSa57+d82gVWgYlqk/+KXXhicZcYNHiUqjfu79svy0W10Kc\r\nAfVrgqxdGZcyRLJQNHkb5B2n0r3t+POVD7GrE10Ryff7moE4GXKNrLwKs1tI\r\nv1Z45v+O0LtXZLW2nr5sI/9nz0r8IWLB8apS3HRZw/j+8tmfspnxgY37FCs0\r\n7joX5pLd2FKisgLXCevK3oSr0e9lfsSoqsbSRUa43TF6JHZXDenHEUOy9at4\r\nLVzqxwnKGYf5cW45dwc8QYeaqksrikl1v2D/LNlgZOc04KUpc6Zq8Ffgm/PF\r\ndWRcdOU1HnH5EXKwO9YJMvPHYWm/RBXyITw=\r\n=bU00\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221228153531-e5abb7a.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/ff7c29eab91da859a6457cef33b9a101/graphql-hive-client-0.22.0-alpha-20221228153531-e5abb7a.tgz","_integrity":"sha512-+DFp2QqQjTGShGONYMCUR5TfdIA9RnWubfgNs0HomH6GOlfUlxLzgmqLBlsB1UK+OmOehLTpiVQ85ne/rnQH6Q==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^9.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221228153531-e5abb7a_1672241766512_0.491423394723252","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221228155711-d204484":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221228155711-d204484","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221228155711-d204484","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"b738379a693d3cfd2727201edd3be63006e285bf","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221228155711-d204484.tgz","fileCount":60,"integrity":"sha512-nqgX6ijPnBD4P1FVZ8F66Flz1Jok7YQWC8E9jD35axfEM6cffuZHLMmfUwWBPkJ+6GInSYKaVhckec+avSME8A==","signatures":[{"sig":"MEUCIAqS8Kfsf0XqKohVNAenr8HTO32LH6lSWsEHkWFFw8xQAiEA0CUFjv9ubjupoYocrHVmfQpEUXOHICjA1gIXrcU9S5U=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166857,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrGeEACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmrn/g/7Ba+sk8hqEFzi3J1p2jgc49qgIuQqZIh4EIpJyDkQaUw5db+h\r\n/l3rtYmX9wQOqcGzqiA9atXMdEH4gKfiKzsiRzDq82N/rtULxtjZSQLrYnHg\r\nRBU7hm66QowYiP77EnGr4MpYf1FmLtOds2pWJb+EaeS+HuDDvGW27ypM5BB9\r\n3uEmWHgVsBEn+3QaghqlfTLgf4Pv2UW7ewtrk1QsIc08bmGt0nzdfoNEXNlZ\r\nHoaiopre/57tpIpvBeduh3PacEFFVoG+6WjCmd02/bcQodzci1Ooc904qX8v\r\nmoeVytQP8Rw4lf+ldswDwEyviezUR8MKa3avSDgUmOKE6Of7VqNT7gyCJzkF\r\nmzvyjUA4GuE5Iqmc6TXUwo2O5t8Z0XBz/1bi8b7pFklXxlVRcSrwNEaksNAX\r\nSHwVwSd0Ay8Cq+ohLNl7OUCy/nYu56XmQXVYG4pycN6CR/+UbuYCsaAe13tm\r\nVkxfeD7XqClcB0amLA5XlsDLs5pGNyD9/YQKm1iulhQMEw41B4wtzPF3badE\r\nZ/X7JVgCnstpRGC2t9CmhXRZe1FfHAV/b4yFCuzb7fZKF6RNEKRZGmTBizmZ\r\nKE1HmjfeJCLXyIlyl8cllHDAyGhaf4sxUosWXJdcSxPmtJRgVR+8LMw4Qznz\r\n0h8OQFG1dlNaeJRfF1O5UnjKyVn3L4CVeRY=\r\n=D6sR\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221228155711-d204484.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/e6bd9d68bc421f509f67ff56dba80298/graphql-hive-client-0.22.0-alpha-20221228155711-d204484.tgz","_integrity":"sha512-nqgX6ijPnBD4P1FVZ8F66Flz1Jok7YQWC8E9jD35axfEM6cffuZHLMmfUwWBPkJ+6GInSYKaVhckec+avSME8A==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221228155711-d204484_1672243076179_0.7474432335093051","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221228190307-626bccf":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221228190307-626bccf","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221228190307-626bccf","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"fb3ec158cb5ff614b475edcdbad1f7146b202037","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221228190307-626bccf.tgz","fileCount":60,"integrity":"sha512-HOo+w2IEpCCAnSULmi96J8EJUGO3fP0HqB6LKVm+Sc4JIFdPxabM8i4Tt8KqjMZowcPhUzgqwyWfbbeSyrnIzQ==","signatures":[{"sig":"MEYCIQC9eQwbEPQoSEi1WzPxVLxBUQO/6vWqMfzFUN5/3xxfGAIhAJ+Tiv8Gt759R9XTT8qiJr10uvwXttMG2QYxyuleo6AI","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166012,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrJMNACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpnUg//bGIBDOmNN56Qrxah3UgYAF83KPYXaQujoxMS3k7HJCXGMXtC\r\nlQENZBQG6Wx42s+haPq1IxP4YHMEXermp5eVLR4wh5SPOYFoUlvtnGd10iRE\r\nPZIMZJ09i9t0E0BEUliXhHdYJtjMX48lBkasPLJKF2TG6pfKlND8ijtTOXmh\r\n0zORjlgjpH4xmreLRlimzkMqqNjACtfbl2wU0rauaM0uQ4IfLkIkaUjMvV26\r\nqbJWgmRprw68csgPrtNYc5Y6UEghk2i/YAJtUFXhjpDC/dEKsR19FF8b4cLw\r\nklduIX33PvwWuZLZ4wAx/OGLTqhgMzBJSwMyrkLJoN1Maw7YBdKx+q5stb4t\r\ns1XtF/i/gRUI7uW6Qc03oqVbyYNCr4ZeO1Rzj7P5mK9ambeQy67F/PIiFOFq\r\nc7Mih5hpj483zWQE/U5Vw+3ri5iAC6cENIfY9SWzw9rZj4P2/0D9/egL3/t7\r\nJAvq6bg3CdKLIumey2VpeFL/ShVdzZIK/VwBCp6jukVZdZORu7peZc+7q5ZX\r\nryscV0sbXJT71iF0Yfkp8zsCfmKezrgtRkq2x5K67u5ZBXwSLK8t0XJuELl9\r\nhpj+fYiJIRi3hKZyR8TM2SEd3LDgGfTbVXOftG9dkkewZfD5Ot1RhC/Tk0DK\r\nHW3h2x/TS3opPGf22+XUb6oOjJP2TCKAzHc=\r\n=lhWg\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221228190307-626bccf.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/8d299cf7af8d7fe180372dc65bd9e53c/graphql-hive-client-0.22.0-alpha-20221228190307-626bccf.tgz","_integrity":"sha512-HOo+w2IEpCCAnSULmi96J8EJUGO3fP0HqB6LKVm+Sc4JIFdPxabM8i4Tt8KqjMZowcPhUzgqwyWfbbeSyrnIzQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221228190307-626bccf_1672254221437_0.4158830400420277","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221228190747-eda9f52":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221228190747-eda9f52","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221228190747-eda9f52","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"89a57af6562815906fa00b6e06a1c8ce02c90e43","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221228190747-eda9f52.tgz","fileCount":60,"integrity":"sha512-q4IPkUYzPz5Tch25C2kiS/w6GQcBVNmk+ToCErT9nq248csjwLE01fif/LPfjHKzSMEXzBGgWC5kwwr82OnsPA==","signatures":[{"sig":"MEYCIQDVlUvbRI/Ux6qrWDNVv65xNoOapQcWGRiLAi6V8g2mRQIhAIcts51x62/GbynAM5K5ycQR8//sp6ENncpHe7VlBtYH","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166012,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrJQlACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpDJg//aQbV/5IPjgp8cByya1VlHXUm73ZQDPjBOwLAC2RMQ8Af3EUp\r\nr2dHipnb1VgvGHBs7QJmIGh7DUgzfAA9uwtfE7XDwCbXw3Zu6zjHPrWo0N1o\r\nCploUgD0PDROCeHNJax3rjt6j+bE7vsAI48wEkHI0U9N/XQUTH5e0QkjLRqP\r\nSHs4Z0wBumQbGfO8Gv9emAbedAaGPW7wb+3YHqYhq7BWVZAncWOzPZQMuvNx\r\n+4LwpclYeifx2cQwMlYgfkPa8At6hD5m9DJ5MQ5rD4bA7KzzFhvj3yjgZvc8\r\nF2J0zwQRIw0erTfEj4oSHxPm5P2y/ETECRUFSQ3yCLgNHUU0cZTvEwdjvwIV\r\n0nf12mKjdOVwdhlLciO+2pWjYtfoz0gbYZMoKW7v5rnPoMtRc/tIDauKQ+bx\r\nFLBCdMT/PL7E57z/dRS1+nopgTtEaNwqe7kp1XdNR6uRheo7i3E/lydQG750\r\nvez1O4T42saRJ4Imn4SIxReK9MI6n3TOwjYOn45GEsmL27jyweUeOF9I5niv\r\nBBx8LePFBQX855VCJuEV/CNgtFxc9jkf5QVzhzS27MnTbDgsY6mmkiUbI9QP\r\nuEJ604LlJuHLdnDbZEUTJtXteHgH1Y/EnAmIqzmHH5KeN/9GVGwmyVQJtTzC\r\nx2j1Z9RdUZ1KNCFQWWglxWKCrxVCCuljohA=\r\n=sCz7\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221228190747-eda9f52.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/f1e02a7307a2abcdf1e4a1a0388c5387/graphql-hive-client-0.22.0-alpha-20221228190747-eda9f52.tgz","_integrity":"sha512-q4IPkUYzPz5Tch25C2kiS/w6GQcBVNmk+ToCErT9nq248csjwLE01fif/LPfjHKzSMEXzBGgWC5kwwr82OnsPA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221228190747-eda9f52_1672254501726_0.028893939499569532","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221228192756-b9579a7":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221228192756-b9579a7","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221228192756-b9579a7","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"1a99433d56e02300c45aa71d31251068effc7db1","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221228192756-b9579a7.tgz","fileCount":60,"integrity":"sha512-FPu09flgV1dI5lue/DfySGrvu0V5uvRDPm0zGbV17WQOkbzScBxejXmxnVsGaI48cBrnmW0tn0BuK6QexCduFA==","signatures":[{"sig":"MEUCIQD24O9flHco7jAywCeG15e/H+bzILQwLaH/Mj3jKvqa2AIgDujxLHBTMVaLikyAe8U46pI/m4DMTtp05kJxbgZoeHs=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166012,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrJjrACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqZwQ/8CTuxq0AD5cKKJXIR4UapsARHJEIoU7VFI3ClXMnTNGneSbXK\r\nbNmQnVoMaaS8Nuii99XgCtlmHQKPNHaun3Rbh9FtQni8YcJdrzKiguLITL3A\r\n7Q+c8LCYFrIXz2Jm68isL797IT/V7Aup9UUmmIrVJMGsNfdri8FsuNtGyB3d\r\nmbEZ4tdDvGLeXVosq8k0dInZLfE4PiygVjebPF01s9K0IHWN+DhK8rij2edV\r\nstty1bzzSzbGqeCJKN4tLrzPj1xxrGOb1R9p2t07WtK3WzX95Mf7O19IoSMR\r\nz0/X2QelEbhUJv2O3ZPr+j4281N6Imqgqu7P0oEJ+oaS/mwuT2E8HwvY/vma\r\nCH9WSDBC+fl5H6b/5Esh0l31S7zcofZexUdfQYLRxt8UlsS4NeRWvUDeZ60u\r\nubDZQ7f10oG9wBAeab/roBm/IF8vfVT+Hzqcnp21ukLGEcs1ebVv18qipOnO\r\nJd5sdoEqvcuwpBC40NUOwGTkoJXZS5UNS/bD6uIFDbytkv5V9+Q9vTF38XIq\r\nLCvO3XQU9HeO5Zpqub64M9JQ3OkDgxQORjVuz1hvVMa3Y0Yg//Tw8MsObNBN\r\nGHLhvJKYccuF57sO+CLqJP3E8JWnJJVRSXYULFRv5BUJgqxFp+e96a3zEz1f\r\nfb+v1gArz+pRQFfvxajjE9NuXmkpJvdae7o=\r\n=NyXG\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221228192756-b9579a7.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/080712b958c0f794e9175a2530e59351/graphql-hive-client-0.22.0-alpha-20221228192756-b9579a7.tgz","_integrity":"sha512-FPu09flgV1dI5lue/DfySGrvu0V5uvRDPm0zGbV17WQOkbzScBxejXmxnVsGaI48cBrnmW0tn0BuK6QexCduFA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221228192756-b9579a7_1672255723602_0.880178729680402","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221228193157-e626e03":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221228193157-e626e03","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221228193157-e626e03","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"7bd68aa49ce1de907ed2b0f413789eeb717bd32d","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221228193157-e626e03.tgz","fileCount":60,"integrity":"sha512-CNyzFn0zmOVGMGyLnDZqo/Z8gnM4pjVf2/4veNza1gqsPu31d+KtPibjglx0cMg6vv26NC1C0hUj1rh2/U6C+Q==","signatures":[{"sig":"MEYCIQCV+/q4yoEXdSTAQoB0A6hnWwEO0bzpewYVc7mAGXQADwIhAPYGhRPq1eRdAbykHQMzF4xHVGdXnc3i6JOPYhtOT6Oy","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166012,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrJnQACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmq3iQ//dQAuZuY2AfdEGPdIm1lPPntjplNbFM6gK0yifOtkQi8PkcI7\r\n0O7ZCnR//BjQz3no/JvYfSBDmTnulory7YTUrecW1c/w8HynknsPqYsZEaMx\r\ncoMUv29bFj1X3WsDoFOClo2kbB76t57DERh4JII1zDuXPARFEYSk6G6YlWuQ\r\nrNnbce8lbFxZcS3gSPauY3VX++ZduC7mf2I7d7lhT5OJYj97P7b/0ssRcFLN\r\ngfvJTw610zvXD1nzCYISUFsG6XXpsuqTkuFG9chin0/Dy4+y8Nrjh0ezzUfj\r\nLmbtXwaxX1Yid6jKMcQoYGnN30b+fXVKJKQvXW6Ixp7USAB/NYGx06SIceYt\r\ndDIh8oGKopG2xHbUXawYSQTvpuw0g1NN9C5vIAciJ50FK/deX0NlRp7z9RIk\r\nTS2dF93u98GhcG+K90hx0gUA23ByewSkkU2A/V1cX8Lk7NdFkZH3fQ7lXzKc\r\nSIH+1jh+UVW9v5z06i7NhjWnfAjFkGGqz7JIGc2mdS4q8K4FZiqJA8ZoglnK\r\nBidF4wOtSYJaRnbN7EmthSZnlcDOPMuMKmkKmUJ/mFWVjSqatgCTgPEfc+fy\r\nOMbhZPb73Y6HNp30fm6+MKU3N1B616V7hBbRPdGY30aKYNdsTo6toXHjdLxh\r\nQe2pfbCzjwxWsUjDadf+f3jPviZZvu47InM=\r\n=Tb9f\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221228193157-e626e03.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/354811ce63cbaac79f2da801829347f2/graphql-hive-client-0.22.0-alpha-20221228193157-e626e03.tgz","_integrity":"sha512-CNyzFn0zmOVGMGyLnDZqo/Z8gnM4pjVf2/4veNza1gqsPu31d+KtPibjglx0cMg6vv26NC1C0hUj1rh2/U6C+Q==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221228193157-e626e03_1672255951964_0.7219974462342511","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221228193809-9d0665f":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221228193809-9d0665f","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221228193809-9d0665f","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"513f7a6965de6524885351f27d4e7b0deb20197e","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221228193809-9d0665f.tgz","fileCount":60,"integrity":"sha512-vcsvtDKmgGsQpSmMAwqB/d0RdbiuxSBed6jP+HI4oJwVrQQkEzv9K6JwgWxlrepssqtskC7eqd9hBEkZ+cNJ0A==","signatures":[{"sig":"MEUCIQCaYJcsIK9awYFiz9d0JKFyXIe6F2sjf/21HmpATdGDYgIgLKKA9LYwF53VHEfpFDPKO6SwW72jTbozDFhT2Z8GNBQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166012,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrJtFACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmqu5Q//UpxeaAmBqnQv3z1i17hmYtDfjwiF+tGJVTNQJ2mnEiCWpRx4\r\nNZqjpV/Kg/DKn5ElF66dGm+UjLdr9EmXlyGUgFMCDjKENWqelnKyQrMd0wLS\r\nwrbJnCrPUk04XAaEUTv9s3f+4QKULQNVlF4gwGvMOvR0i+qD4/khjBCq3m3j\r\nEiPZi0IlkGhK40jb/kJAXQg/b42io+YQxKo7wuNPKyzgtiA+Bi133cQ5mql9\r\nVcWKwo6Jr6/CpT86Gp1asNYv/0/Ys0XxJMeaqcfisfXvxjlYlMA8bVYnFxF8\r\nFnt3Lq2Bzh923HChoi9bLL7nVTVdMLkzfuIHOqldCrvxrDZ3N3oaUIumOfQt\r\nnLomPIfAh4d9pSPIthur0T3wlNp/CVqUCaInej5jKrfcD0wd6maLFvn6eggT\r\n2h4PL1e7t8HWinU4BH6BKCaLaJUzBTejOAHxJL5p5GgyKPso++4WIAGGIgmL\r\nhrFjqMf09thqeLQzY9mWnigr0TTdgn33+1rQEeRkytw7xLwSGOMkoVaIbjC+\r\nDCXdLushdcxr1pIJNNUlIrNwermXCtazeAVEQRNGY7y5QNogiZt09QnYecdM\r\nc6DZ4uk4H0aSjBuP3Ntc5+/l9Sohi+xIPCUwp7GTz5Y6e1BU9G1p89Wnu8TO\r\nC0B6E1DCO7ZAk7Lt7Q0vbkxBZgh6uQnfaxA=\r\n=HZGb\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221228193809-9d0665f.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/9fb323e96972ea2133b587fc5b684998/graphql-hive-client-0.22.0-alpha-20221228193809-9d0665f.tgz","_integrity":"sha512-vcsvtDKmgGsQpSmMAwqB/d0RdbiuxSBed6jP+HI4oJwVrQQkEzv9K6JwgWxlrepssqtskC7eqd9hBEkZ+cNJ0A==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221228193809-9d0665f_1672256324818_0.07943510093927864","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221228194416-955e611":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221228194416-955e611","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221228194416-955e611","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"eb798ecc81bcd72f530917c0e664b4f2b1333fc6","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221228194416-955e611.tgz","fileCount":60,"integrity":"sha512-0N0a1eLgrdAgoALijmT5y7VN6MDc5ua9a5dl/vdcl3mrFCyrcwJllVT3zS1JDockQX8+RNCNMR4og1w0rkwH0A==","signatures":[{"sig":"MEUCIQDbh0jk2d2w1NlDu4PxvASTg2HrPUAFuvh46q13XdPMigIgbGnM9SXuLwbfuIB8V1pZAUJ5JyCopafIvvhkSqbuDCc=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166012,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrJy1ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqNaA//dSfqBVT2aFTtuC10H1Lo2IakjuD8h2wo/4HxuK31OQIuDsin\r\n7j4X8bcrrdNJvlUaNwY7ef8mllAi62TgdR7V+cnDbuSCboksXKRiVDv8p0Mi\r\nxZ/KKiMixqhTFsnDGx4N32Co+XOQsxf5UEuF8tR4alz4gT2lobx8FiGAD2qF\r\nB98TYE8IYxgUf1krTdC41InjULDsDVyVFj9HpgjkQARuJylrA6Q5VylrmdD3\r\ni4OJh4oE37hGSvE+DMW1MgcUHavV9w44+Xn66SHPKPtf3tTVGLTrtrSnSrQr\r\nteBK7T1/hN/lliPrkNuOYyhjv5nb0GneYQQYtV8lZoeFT8VmXHAVVYKyXKA4\r\nwz72XFEDIUjTZzbMRtkauuytQrlrETai50EKTpSVUCD0DEC+72hCdrG97FWQ\r\n73AKmnI/GjKwEXRAoy2xnTsE8pCJ4lAc6knqFBlVcW52OxNw8kjUXtUeCLtL\r\nphNiToem/2KsOMgfMHhQsAyS45JO+b/uIHlA+CXbcOwQ0rmjVb+A2gO+LaQb\r\nzNPECofVtE7IlRIh2nRds293/YgkqXx7K0ba52ZUNAw6XK2UxzOxGO6yL9ZX\r\nyLraP7c2kDS494QSNG2LEg8ejInE3Dqd4F3IQT3IZzWn9fH/n10V9ZkJxK8r\r\n83Vym2Ja/CzugU8cnaLixm5kKeoSuZFAwtk=\r\n=BHZP\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221228194416-955e611.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/dacb85c6ac0967f6326140ffd9dbc2c6/graphql-hive-client-0.22.0-alpha-20221228194416-955e611.tgz","_integrity":"sha512-0N0a1eLgrdAgoALijmT5y7VN6MDc5ua9a5dl/vdcl3mrFCyrcwJllVT3zS1JDockQX8+RNCNMR4og1w0rkwH0A==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221228194416-955e611_1672256693003_0.17966916336425953","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221228194708-aeffb47":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221228194708-aeffb47","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221228194708-aeffb47","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"d4a55707dff26fbf8bad655b1a4837c0c1358186","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221228194708-aeffb47.tgz","fileCount":60,"integrity":"sha512-mqKoa/rJa1HLySLI3Jfz40njVL1d9yw0gWafgvDx5DaAsUeJM/8SrKosuNIqm6zk9lImMAqLa31lMSRIXt4PVg==","signatures":[{"sig":"MEQCIGHC/b3BHiK/sw5cdc2YXe4Zex1jy2u+VvMvfSUBIATBAiB4Edk3PylBRW7msVdN3MSQW8A2f0K6UuM17dmWoiAhlA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166012,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrJ1hACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmow/A//QfNAfzSUNwI/Bn/llnwdC2zV5eUstf0talMx4DIsHT2CSIHz\r\nhnwcNkTgMU/TSQHbbazU/GcngM3E5XJB8KZY+rZGtciiDsXxhjpEtzMLLblk\r\neD66z5PwqRSYrDclLmS6lOZdpliRljxbTNLO0Vr4zXGoXV+VnBqmDEnQVMez\r\n7zFbjKpjC2bHS6MIMXqf7of1LGsY0g3ELyHcMZYyFjMAYVm60JuAGbAo7Cfy\r\nWVZ7LPr8tBP5I9Mr3YbR3OD/OEDn+TIJy9xgBMw4XnfAYwbUsmx2hJ0HoNAC\r\n/oXLzW3sjV0vbHsXM+LudndWqXqzidJ9TLBLYxOkCKa0Exgzs7HepR9JIe0p\r\n9OMMz5/d8+qR6eGoxg87X+BNv5qPR71Y0TV8lEMUOc2QQSMczprvSXTGD3zF\r\nWH8WlwSD8pPAahOxQBxn1A3OObRXOGbn+C3CL5lw42IRdpHv+U2F8BejjiIB\r\n9HO9sNruMW+3Mt9bLw6MOFhl40DTxD/ZaYVqvGlHY+cjMYCHJifpjGwp3Kld\r\nqsSG8kJdAqoyKBq2P7K+x+y3xXnXhHa3EzCu9Ub7jRZwAQ6gdSay1NRDw9+S\r\niw/wl/whTgXrgFcd/pOPjdDwoN/jxWhdN0FJVH0wUpUPymmzIlcUBH4PvdFK\r\nSt4jNaNLVvYu/slEucRMh/iHOHHyJpXwSz0=\r\n=QWJx\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221228194708-aeffb47.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/a30493cc3282a6158611e3b9a3dff820/graphql-hive-client-0.22.0-alpha-20221228194708-aeffb47.tgz","_integrity":"sha512-mqKoa/rJa1HLySLI3Jfz40njVL1d9yw0gWafgvDx5DaAsUeJM/8SrKosuNIqm6zk9lImMAqLa31lMSRIXt4PVg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221228194708-aeffb47_1672256865572_0.755923430196864","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221228194714-bb26be2":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221228194714-bb26be2","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221228194714-bb26be2","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"926395911752fc5f97fb31427e1308fd65a7cd59","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221228194714-bb26be2.tgz","fileCount":60,"integrity":"sha512-HzndFfXgNDcGO3Zm0UpjCBf9/ytHREW1UYeVhVIaiPt1WUgkjZo427LewAcQiyNn0NG8ujqlKAbO/K9/80xt7g==","signatures":[{"sig":"MEYCIQDc3EdvIKBzOXfMOj7OOFcxNPc4YBOZu6ATBBFprHuLVwIhAMm2wXuXFrxzgPlbsPyGKtghj04J76IIAnFwsA2gNZj/","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166012,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrJ1oACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrRBg//XA/wdn1HAnVNO5Ro3LFu6o3NyxT0dKAhuRvU36S8cfxlwlJ7\r\nfAIldAxkuXFFCZcrKxA8TIaN6x5ohw2WtUyKoEDK/bZoaaMIOXi06pSC1D1D\r\nX7XReFKR8Zc2GEGCfD58ktyQ7haORpgtrQBXdvGykCvJAimc12jneyCVYKZV\r\nN9taRCMRcLQ5XF6dUnZ3MBbQIXmAwXLSBUcux3fezkBQiADJMXeIbxM1efrU\r\ndUNGod/m0mWN4QRiFo9QZ9nW9U/BpCYTxZ5SLhAdbbsxnxNCYBvbcqmoQpSF\r\nXoHKAyRJW7FIlWN1oMcFKdQxZJkVO7ozfg5CeFfFSIOE6COj9SZ6KP6AYR6q\r\n9Ui5dNAdKNWs2XW7O9xT7Gha/sjwhlBuoNjk2zAq0hhWy51AVAYWmB3cjakn\r\nvuTUQSJKAperMum64/PwV2bVraFgT6h3JDl/hGBQhYzlLDeJtnCTtnQG5A17\r\nb7keudzCG3USrtoBO8L5HWwOI2MzT3NNNgNvAO80IfSUQ8eZec595MfWcmUH\r\n+57estX3sO6WQfVxpeRI+E5n4totgcR167U8udPLGVMLhRiXLvt0xOYgfz5+\r\n+GUBKHNkYdC0MoRyEoPn1v92mXLZsGt2CUWnPssVXeVs91nVJ093ana7pr74\r\nlhO4LREwWjg1oWxkhuNxeg/S+YDweGaOpNI=\r\n=vDi6\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221228194714-bb26be2.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/8fb3b6abcfbd61b566674dafe6aaa585/graphql-hive-client-0.22.0-alpha-20221228194714-bb26be2.tgz","_integrity":"sha512-HzndFfXgNDcGO3Zm0UpjCBf9/ytHREW1UYeVhVIaiPt1WUgkjZo427LewAcQiyNn0NG8ujqlKAbO/K9/80xt7g==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221228194714-bb26be2_1672256872571_0.7201149571467114","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221228194733-2a82637":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221228194733-2a82637","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221228194733-2a82637","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"95d58d4e8d10f437d19cd0120c1334b73cada4d1","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221228194733-2a82637.tgz","fileCount":60,"integrity":"sha512-2nUmAx6W7Q+MQQss9jfJCrvop8PEHmIDkfOGF8P2nk9szR73KkopzTqvZInAKL9VG3iVOvVAQTRtU60TL3KRuA==","signatures":[{"sig":"MEYCIQCmXqauFTqiTeVAvJrd/gsTMM6piUOC11KEuc+n6xqFdAIhAOlnE1XorY0d9Yw1N1CqEXJNOS39/G/D+/J2Junl1Q/+","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166012,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrJ1+ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp/phAAh6IiLStNd1aiedR7RWVJZlgm6kSyxZ/NvWCZcBQwYrfZCeJR\r\nBfCiMAQKZBBfj21lybqTTicAVZ37l5jNq7AYMVYLhA92m4AB1NYQiPfeNsbV\r\n3aJS2kxw/+n1trzkbkJ2+nyrbcAW5375e/XJGxexr9p23quqXgFyiCAL2MXp\r\n4bljYxDQHyILUAivzlPeipKBl+kHRloRDgkzNtBpZLu2IWJ0TQwSJ+Name9m\r\n8htv6CCKZ5GuZKaxLPnKA6sbNVNFPmJm7KZ8yuxIKG5jZI52WjEhv2cJBDCj\r\n8lPCR7LlHOlxxOduQp1VLENSsTH+C/Mm+k3ZGFkvBtzehcPkvxxGvu5zqXFc\r\nQBlG1uWZj754Y8Ij8EfepJa/8yFS0khBdK3oSWYYepMJCgH6SL4X0jEqusvy\r\nX78suHd+W071pckngLSIbdZlHdlhZnQLQ/4ezNxuC8EpZOgHflGzQBtrFz1z\r\n84G8kAsOKqDO6CsYR9XZiRWWgtL4xaluebABL5IT7IoNzWgaZ0eci7TsA3pq\r\nHLGmMRjm/bbhJaqZ4Zl2J2NudkTaO0UyTT+0DeJY+sgISJQ2LQ7Sv/mzcq7L\r\nenL95PUGcpHv/pyqNmHoIRHI0zLvzT1m9VEvp6IlvEId8d68yy9VOl2O9dNE\r\nx+l0DOlx2cvh4MZbmAN6NMUpF9Fg1imXRtI=\r\n=wFHl\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221228194733-2a82637.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/3305cd72b82162470ef6c8fad0273960/graphql-hive-client-0.22.0-alpha-20221228194733-2a82637.tgz","_integrity":"sha512-2nUmAx6W7Q+MQQss9jfJCrvop8PEHmIDkfOGF8P2nk9szR73KkopzTqvZInAKL9VG3iVOvVAQTRtU60TL3KRuA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221228194733-2a82637_1672256894746_0.7613070034211697","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221228194835-3618377":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221228194835-3618377","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221228194835-3618377","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"b0ad42b411576f6fdd135192eddf65d0f3aeef55","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221228194835-3618377.tgz","fileCount":60,"integrity":"sha512-i2HSsBdop+QHhbxu3Ebn5PIrAFJmEXvgla13cNxL8wrH1K5vp8mqy6bBS8xUdOtHwS2u86887aLHb1w04lx3PA==","signatures":[{"sig":"MEUCIBmvKb650Yl52aciYZCz0/tnWyQZxJOTMRFoNA0UfFrrAiEAjgaejzS/x+GvEQBmlQ8L4QYsm+bJrLf/4UZPRISboT0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166012,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrJ24ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpZrhAAg6PNso/myEJkusEi0oi9n1lYEa5r4KA/Nqjdt/7RfulG+i0b\r\nHihSxodM1/ppD059Zk7KcQVOM2fpWc7/DGCukTTf0DN6M6QIeD2jISXbTHVV\r\njbF1z40waLnB07bRdTllJ4pMkwhPqbcm34KudDZKsSNBGYEZmz0IKp9HHsFd\r\nG2std+/TyMCyNLELqzDKHMkyC2Vde2BiS3G0nUvGtxidDvdEtlzSamG8V+Gq\r\nMtPFaRws/T2u36DCDY12TfoNVam5o5Oi6JCXqfJlOkipSsQLEOGUhv7tcu+b\r\nC9DdOBB9gBcb/O0upeZYdgjdP6MEh0c9fOlwpa57JHfunUIaLgrPnXyi/+8k\r\nyD9D5ryV2YGD0tCPsfmNrFpFfJp6hd9AB8gmt7A8rokUQJqQi+GPwi8j47KO\r\n+xDJzfpfom2Lpv4SQyIh2m0Vxma62xscuvJDhjAeCmgscroRqPmJN5zRAyy/\r\nvREV3BG4oKXS0kVIvl3XALUsvs6xLSGfS2hQqIoZKfwCOIUd5p2+QvDvz3o4\r\nPHsyeI7+q2HmfHEzdHy1kvKc+jjN4850HIJt58rUqNS0iTSciwUX5aUKh6sG\r\ncKXgoTNBJRKxZQ3DSeeJbEXrRje8R9hxi0mOQShXaFyAchwpVUebyFfGXxSU\r\n52XqC8Rw4g4Vr4sAcMXix80YqyIyNHvjNbs=\r\n=p0Ur\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221228194835-3618377.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/bfeab3bf53bd940baf75a0ba1689faa6/graphql-hive-client-0.22.0-alpha-20221228194835-3618377.tgz","_integrity":"sha512-i2HSsBdop+QHhbxu3Ebn5PIrAFJmEXvgla13cNxL8wrH1K5vp8mqy6bBS8xUdOtHwS2u86887aLHb1w04lx3PA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221228194835-3618377_1672256951799_0.9256399605778418","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221228195207-6dbe245":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221228195207-6dbe245","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221228195207-6dbe245","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"3a0b0960048a28fbdefe10fed0d6d35794520524","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221228195207-6dbe245.tgz","fileCount":60,"integrity":"sha512-mhFxCqJdLzNdbyZpi9MrvAWajCobFGLMdCxp5+LvRyin1FNdv9by+wpIdzdouq15udmVyPTB02LPbcP05iP3NA==","signatures":[{"sig":"MEUCIQDyUzbBNHlH3KrQbVpkIXxvsuQrErxipvZNYnYMw8fTzgIgR3Q0ZxsH6ku+iyYc0KhLrGqYGRx4+JL/83iVWmUXuiI=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166012,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrJ6KACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqGrA//SQhk77twOiBH17gb9PqDrLLfic22bQjzomi3AYvhUGVWMvH7\r\n4Dcq59GhaOTB4cQl2S5hTVMa1hHD0VKr9sG4LJpOPJrts8+7apJB+cxX3/wq\r\nGScFaziiJfPNJIA5x/c8yd011MJ/mxx/Ckt2R/B4qFfjpj7PIhp/xtiXY4Sf\r\n8Xy2EBS2NEgB+7QQQEyiOY/JD0+zXQJj069WbmHQR/OjEy6efcmgwBQ6UD8c\r\n3Dax3AzNfynEywkOO+ckUOL8VffoPfPJu+IVv5igmZYZUANfs3/qGTCPMar9\r\n0IHX0WZmi3NOPG84omi6gRFA9aL5hLa4XukL/f9ImkLcEMSYBdYPx6gwJIDb\r\nNGxglVkgInxtca1ISBSGACTYbRFsHPN/9da40fxaw4utH8FU2wptGKx6XAZA\r\ncoQ0iNcbfG88bCtM3bPBEUCz9Qr3mXxTS+5RuDbrztGaqogGRmsNYnfCI7ax\r\nWFp8FIkBOBcwo0CmAdLIIkFRwJDH1MTYNpZpoKEKxE8L7VsfmJEFz73azJ+u\r\nsc0RkVdvzobCSHsByM+VkvYyQwdTeeCwukds4U8O+qO3gr7gYE0Y78WDFdIR\r\n+qffgK221ENUsHhX4BZn78bEh0isCfwAoVTa55tk61uaYQp277ROcb2BFe8w\r\nPoNXf5n3JDPUYyDOge2xapBiy+lkx6HTHbo=\r\n=9WK2\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221228195207-6dbe245.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/48e9423c3859eee180c962ef5b722c85/graphql-hive-client-0.22.0-alpha-20221228195207-6dbe245.tgz","_integrity":"sha512-mhFxCqJdLzNdbyZpi9MrvAWajCobFGLMdCxp5+LvRyin1FNdv9by+wpIdzdouq15udmVyPTB02LPbcP05iP3NA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221228195207-6dbe245_1672257162523_0.3548065230627082","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221228195644-7f8ae9e":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221228195644-7f8ae9e","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221228195644-7f8ae9e","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"71256f89db74c64390e09162f9b2335a5a1a8648","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221228195644-7f8ae9e.tgz","fileCount":60,"integrity":"sha512-7jPVJVB/cxQhK4jjFc4QbnXS2J/ak4W9cRPUMApx4RvZXR/LB3iQe1DNV5ss812PNkokFkF1q83UfDMJyos81Q==","signatures":[{"sig":"MEUCIQCwdgmu/9SpGet+sk6FHGtYsXS+nFAs23vMJ8ax091/kgIgTdz/+xlwaK4gliIvTLmDNfCJJplURYySJ8FuNrXHHzw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166011,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrJ+eACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmraOA/9GJBx2cpKR0wMxluUHwwdpcqLy6J1vRxJacKde9EnUdet5f7X\r\nkFmfae47LVGQNzOdDTdQ0XsySp72gedwaibkvn/xShxH8XmujZo19G60e8r5\r\nYyNNXtiaSbBJSvzzyJWGoVcxj2NZUfDdWBuj/MoOS3c/eAlKALZ0aw3wQAq4\r\nqJO3MLcKb52hprmsis4zYLNCVeSRyQ9c2b050XP3xDS03ZsZON+74Yow3qXZ\r\nE+mfhf5nS1XX5HP0bVdP+bQ9KVQGHv3avo8Rv6ApS2tD4o2PD7W6RjVRyfUL\r\nnXc7T6AxyggLtDqAfd2AErssig2pOE0DXeVB3Y8/bhwAJ1yFHt3+F44cilh7\r\nH2VT5KVWcHsJod+EGlTOxzYZVYo9bfnsmkLY4LeNYmmrD5eyk2HXwQv4BpmZ\r\nmtbJxCTnQPdP5idHMvyOHhUFmQ1U7Fug+HkNpCoicaCnAidrpeMcn9HC1Aka\r\nPUuH6cGSmWDvNozFu04PyYTvR+snYBAshljXdicOOlQyuXpk8ffqJb4ayudh\r\nygO6jLNaySIZaX4HMIExjT2Vt0ptvwbirTvrqX82Ys6dTdt2znGNEQQzk3Nb\r\naTcKkP91WPWH70tPSae14ykzsYW0+fQus0z9Y+YPRz+A30eKYxS1xFM43Oyg\r\nLAhwX29pDuxi4czypeUZpvB2Eg/JVZy21z0=\r\n=kX5v\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221228195644-7f8ae9e.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/4537e34e97bad26324951bd4246f8aab/graphql-hive-client-0.22.0-alpha-20221228195644-7f8ae9e.tgz","_integrity":"sha512-7jPVJVB/cxQhK4jjFc4QbnXS2J/ak4W9cRPUMApx4RvZXR/LB3iQe1DNV5ss812PNkokFkF1q83UfDMJyos81Q==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^9.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221228195644-7f8ae9e_1672257438518_0.9658672170972382","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221228200851-2945c7c":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221228200851-2945c7c","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221228200851-2945c7c","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"20774a6c1fdf22e2405feadd7983c83196cf5833","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221228200851-2945c7c.tgz","fileCount":60,"integrity":"sha512-X6hvQ67ms3AuIMKyYS+Gyjz8VoIyJR9fj//i28cY8tHiZB63LDN4zSWOfgrXOhh1QotrUvZfTmjkKu9JMPcxug==","signatures":[{"sig":"MEQCIAGu+vasxO8etXdGee3PiYd5h0gFWH+SBYt2Qij0HkB9AiAZLfoc4BuF0o9UVyOLA6SvdDYaX5JGSMSf8w1HB/k8TA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166012,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrKJ7ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrolA/8CQD/DmYaw3EqkokOprVGCKKGDMTGDooG3dMaH0JjMwQN9JmH\r\nQwv8SFC9v0YBK+YaFLTqE0DV1wBLNWHg36eC8cW1/pyCbQw/7Oybc+OtlQ1h\r\nzPuSySFMYl9EytdVoSRxMIYaph9VQnYrQl4QZyQ4xZPPBKxmWdaN81EgA6H9\r\nbfZB833UZAfQ/F6/y638R4Ydju62xA74O66+zOvl7sgPR+7azq+sOA98i9x5\r\nlTCwv8EXanVL8Z6VJYI5itnMqKty6ThQUAW+5X4CVBath4nVzIWDc1UZuUWy\r\nAHYOrcQgbqRBXosLTfM7GWvWiFx/X9M154fppvC3CbFMsfy6vFAzg9J8yU4q\r\n/NrUx1K51yRvyGRqwLC19OKZwU7B4t2UVFJ/YjZFfjOOZ7IMDBD7LZXEEw4u\r\nzpBKUF4gGYCN113XuQL1cFzMe996tJVVdze+CuXFea7z8FcYKR7nQOF6v3O0\r\ngQCHqRzdlr8RPYRNHMGtt2EvxGESdOYwRJwj2yd4meex288VMHeZJcpbnUGb\r\ny5Fp16CJTe5tuewPEZy0Tdug0EES1lJ0CTW4PbmqL/jiV+SXV2aYVoDjjeQM\r\nr6+WNPtH4NmvKus2BWNb6IvSDlEUP482C9hQpDbaQoTaT3/wsKyRO8Yj0qhL\r\neoAKgSqfMs2Gb//6+gkw1xO11dccyEM1BWo=\r\n=S04I\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221228200851-2945c7c.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/f2316973391229d0649d3cb976e3a3aa/graphql-hive-client-0.22.0-alpha-20221228200851-2945c7c.tgz","_integrity":"sha512-X6hvQ67ms3AuIMKyYS+Gyjz8VoIyJR9fj//i28cY8tHiZB63LDN4zSWOfgrXOhh1QotrUvZfTmjkKu9JMPcxug==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221228200851-2945c7c_1672258171193_0.13155634919074033","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221228201510-38eb2f3":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221228201510-38eb2f3","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221228201510-38eb2f3","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"d025c87a73f742770f1e875af9ad0d0764877994","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221228201510-38eb2f3.tgz","fileCount":60,"integrity":"sha512-9qcFH470ILoShJjyBdGh+r9t0sAtk7POYn+xKDtXtmMeHQ0Nvg02eIPDnYj1ae+Ax9eTTYi31xevxJ5h8kD2Lw==","signatures":[{"sig":"MEUCIQD9Ym+SQv6Ykg3RPZjBbm7TCqn2j6sCLhhynnx+OoQaCAIgBtNYqv5oCF+B2xVG6NWuP1kZU6J2OcE7wLzalbiK7s4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166012,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrKP6ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqxBhAAkMd6mWtuaJDIlkb7GIhNRz88Ms4i9GKzWy2Wms3z4Q9XXFbn\r\nK18D/Wi3NATZMycKACp1woG+2AOpJGJNTzt2/guFbdVT+NCD6eSuFiOQOfy8\r\n4ufvPxN/jq+735oKOWjkM0xJ1YLvBWhPAPuxcMY+iB3Vgp8VR4Bg4d+Cc1wh\r\ni4M3VlmAdk7zeIGiY4Wb3N0wAm0YZp0rzbIMNzPlIjUdZkQqKZkEhzauRAa8\r\nNnn3TpsN1XWSCBSXUiXUpI50Bph0JeqxXG5e8M4V7g93JAjRLqui5srKqKxL\r\nXi9IfMFTYXcHtuB83fdVPW0wcP7Z7dIoiaYCntxdU1tJl7ogua7LyZmq5emo\r\ndqQTVazvLrMk8yRzDetEfUK3OWsAMe87MxRekO1HvMiZblgR7wv8avWvejvd\r\nhRSt4O1iwT3jZh9jBbzkYQ//xjvPWKZ3FYMIGcXxMC6xgLIZI5IG3WeMJUQP\r\npo+0rHJ5/Hui1xS4y4aEHQYLGCgKlVkLpE+gWXZs0cxCfRMp9KvXYJJICiam\r\nUL0WIAp2VGFsbirF6/pg/i7fBBb2O368KkGit3vb81hw85ikhJgymIaVDg8e\r\nYrxaPFpVWL/5AHBG3nnj+qFttpJoCppeCFI9n+D5PrK8dIYyj78Aw89YWT/+\r\naYIc1je0d5WS6lbaTm5dvUr2lMsnznwQAZ0=\r\n=xa+7\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221228201510-38eb2f3.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/3ee91f0b219e68f23f64319e9d24ac36/graphql-hive-client-0.22.0-alpha-20221228201510-38eb2f3.tgz","_integrity":"sha512-9qcFH470ILoShJjyBdGh+r9t0sAtk7POYn+xKDtXtmMeHQ0Nvg02eIPDnYj1ae+Ax9eTTYi31xevxJ5h8kD2Lw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221228201510-38eb2f3_1672258554002_0.08306116968192856","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221228202318-5e1c0fd":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221228202318-5e1c0fd","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221228202318-5e1c0fd","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"8888184c6b41ec8f1765bbb8a4a23c94c5b1c970","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221228202318-5e1c0fd.tgz","fileCount":60,"integrity":"sha512-c/PSVpTrIuEBKDxlpuKMVfd6MHG9Ps1pHjiz+mrIjhEBHnYzZrR6RjKvtfe3gqAPcvzfTMwNPJLnbuGFFl7s5Q==","signatures":[{"sig":"MEYCIQDjT+PRXDG1mhW/HIf6+kUquKxgYH/DVacmQ2VQBUhMVQIhAPf4C16fmiDqoOUmuhHA2VgAjlMnGxwLXS0tcz2Osfj+","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166012,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrKXYACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmri7w/+P3bTZZZZ1kmdoZ5n12R6MAnpjFq3PxrvTVFt9s/tfiEQ1VDJ\r\n83VDcipFaeR3493Z7vFswcE+pVjTFvqG8EEf7OcKRi06ldYlJZQp0fVCsj8O\r\nVp1FpQxcoBoaSSPwmI8cmZxhfyBHtPimfsq7szw45arEbMrlEonNh9KwmL2E\r\npNCN1/ueDjFO/vEG5apIKIj6o8fBXqSwUohhCqNI0AVTNf3WtD6groVjeuDC\r\nG+Wl57oQTJDEpDy5Rv7VRyvE+Guk6US1PtnFqd42CdvxBYLMc3/JHjVtRS+L\r\ng65Tf3zy2Hkl6pkFXue8wdFfeOpzC0ftzvoTC10MoIBaIXJv13/ScxIueI7Y\r\nWAm11pS2qGd9C0RwoR32ura9rVFRH0u0G/VgQTtF/Mz0VjGOQJOq8yiuVZPB\r\nTHFi60/bAkyFWYxLK7U8Ue95gNISM4Kwb/hsgZAyyMyAAXBtt2/K6LDbXEuD\r\nNTi4FjWUd3l7LnDaaLrX6fF5zo5v2VhprbanAyBIWHHTrhgva4IGvw1drqBy\r\nP71XhCtOqY3X7Bv70g03ywaYkLm5rk1KarMjLCmfSlhTt+SRbmvJx/Eb/EBI\r\ng+7SbL0aK6gnFgUtJ7bvrb02jW3Rwlx3ckmkinPCc2R8jaURwR9k37Mg+Kb8\r\nFHTkv8zFc1faJGW4hQeYdfFId5RBaNyRfho=\r\n=Ya9C\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221228202318-5e1c0fd.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/2da789d86b5ae39af7cb47d9c2faecdc/graphql-hive-client-0.22.0-alpha-20221228202318-5e1c0fd.tgz","_integrity":"sha512-c/PSVpTrIuEBKDxlpuKMVfd6MHG9Ps1pHjiz+mrIjhEBHnYzZrR6RjKvtfe3gqAPcvzfTMwNPJLnbuGFFl7s5Q==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221228202318-5e1c0fd_1672259031916_0.5927628325875212","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221228202341-18cfa21":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221228202341-18cfa21","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221228202341-18cfa21","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"4330a0e7f224afbceadd5c4a43c12600243161dd","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221228202341-18cfa21.tgz","fileCount":60,"integrity":"sha512-5ho0vOe8xUp/wscb1viipVlTf59GFf2XhTcZPPk5G5qPoOPhdLQ7IARkuKqEO61SZnO6TLW/FLN7x9N7k3oOHg==","signatures":[{"sig":"MEUCIQDT6B11jIuZY+XK9V7jJ1dtyECyimb7T/yXTj4VUSHT8gIgY7WXP9my8EH1vQuVo6jhskoeJj/DmN2gHTw8US69ajA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrKXvACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqEKBAAkhGHEvtZIDI+mjK1mz/C3R6hqlLjwc3ta135pdYUZvTSHT7F\r\nrdMVjui1CHYkliM43nW6R2get1GvT5optgmDA2a+fjDAFLF3SyMwsWw1o8Y9\r\n0H9tXwds/3jYkfXuy1AUfOEIxrDP1blEqPr4vZGP6M51ZGFBK15hZ44D0aZM\r\nkYeu0yvqPurt6bHk7I9ceIp9Fdh08FdmP+NwVGdFTbMylAg6dRrIdhT9SZV1\r\njIlPRkqUVZ6I8sN/ZRcnLaTGOIbcKeHjwN1Bvz5WwhSMLNU639gWCjMVzZ7A\r\nlX4O1Ge8535PTbzZSODLH4Nabn1sE1L1rKhsv8Du3whZFFowhDE890w/W7jS\r\ngXBt6t+kuXSFMznxQ1Tmpx9ZyMvl3NejSnXSgHHW294nKF72Nhr7cCSD4EN6\r\nQTvgj+llMupnHVrG7YJhxjMsb9+arP12stDtA4wde1T6lC+PabXWgX3cUBvj\r\nbIVWAihW2vtq4hUeOPqxxlWQCo1FhLYKdUmOcvflSS7Ss95uqDpyKqRhEXr5\r\n9LfgiZtShAb4cIw8Br4Ds5DrNVBoiq2p6L87rDSVNOCgTKs1ulzTf5xMxHXx\r\n3/qB4tuJuCVX0gWx/81gcpnsVU/lQxbZ/LipDtJripkoOG9E72EnjW8/OYYs\r\ngB+5FmhNuqjTg8+lVJRIoKL6+h1p+RMVnWw=\r\n=1X27\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221228202341-18cfa21.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/c33c52b29e806a9f7322d3d6cbe91ed9/graphql-hive-client-0.22.0-alpha-20221228202341-18cfa21.tgz","_integrity":"sha512-5ho0vOe8xUp/wscb1viipVlTf59GFf2XhTcZPPk5G5qPoOPhdLQ7IARkuKqEO61SZnO6TLW/FLN7x9N7k3oOHg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221228202341-18cfa21_1672259055480_0.20856161854370536","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221228220014-163dcbc":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221228220014-163dcbc","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221228220014-163dcbc","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"98e5bfb3752b13b3c542cb50b37ca038266a0858","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221228220014-163dcbc.tgz","fileCount":60,"integrity":"sha512-8E6ldWjrEix7VgXINeEfTxd78vS0ftAMxZGFE7KM+9jrLtrCHSEGdwxdKE4FRrHOzxZshtFyqyEtKNJx/52QZQ==","signatures":[{"sig":"MEQCIDYsFVruEx52XNvn9QUOqxTjiFLel17Io+U8RklLy6VBAiAQmNDgqjt4qniP4e+MH0qwomxU8O+Zc0/aatv7nH18WA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrLyLACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoOOA/+M6b+fjaCq/fH93TJ/DEY0ndUPWFk8vO7al5x4CH2hz3tGk4K\r\nICdcsYiTvTcghNItfBij0/CyoxHw4Qy00e7NacH40PJFn6P/uM0jf2N4snJd\r\nTvzHgwdbEimiD8XadiPFwtxfOBMwAjyqTjlvEPSouDQxJhrKMKWthKZuGgmo\r\nvFa0EHcuYwbaJkrcSWSXL1X07pieDiZNp8uDR6KK0gbGcyCeRCwzX33VJIIA\r\n8cq/kv1f5yyLqPVA4V4i6H1D37LPt+zPi41cm14Sv1OPn3AS/CpWoKZTl9DP\r\nIcKeR2cWb839nchXEyGe8w4oqsbp024f+PcnNIkORtXAw8glbGxd3fhxw0WT\r\n3qMUeEfTfu35bxYklpc4rYw+6GJfbzDNR8N9XWK/82kkDpGcofVidlKVUQE2\r\nUggFLEW0STQCeOtRD2w2CbLrtenXRymcoGFMitUpQEjIORoWJWIa70fwM+X/\r\nI6T4K6Uhm1/DRrQ9VbqWMwQLjbc993oJ9V1erNhz/6Vs6XFWlDb39EE+NOr4\r\nbHnGS5XvIkfkUwamFZ6U8X/ECHowTUJUs3170J5kptXcFo2iULG6azXmtm9p\r\nK562yZZGtYKDZ6qfWL3kCI3ukQA/Tfg2/X70kby79XVn6P/p2BkoULfti5eA\r\nTuwaZlaHcGhwnBfMdyLsLZpFPpRpep9IBHU=\r\n=2ogJ\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221228220014-163dcbc.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/f0176259742aaa43b647faa4d9185277/graphql-hive-client-0.22.0-alpha-20221228220014-163dcbc.tgz","_integrity":"sha512-8E6ldWjrEix7VgXINeEfTxd78vS0ftAMxZGFE7KM+9jrLtrCHSEGdwxdKE4FRrHOzxZshtFyqyEtKNJx/52QZQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221228220014-163dcbc_1672264843209_0.8789167173443067","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221228221123-a0a5b8f":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221228221123-a0a5b8f","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221228221123-a0a5b8f","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"f9174f74805f9a8411753d9e1e22ba1cdbbe788e","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221228221123-a0a5b8f.tgz","fileCount":60,"integrity":"sha512-vczsknFH2m+ZXxHZB4/vxtKYTiE5ZfA2Sh4FZ1CIT75ZDecfdeA77v+rz3e92EWURrZ27uFNCPJPzXATQAVWng==","signatures":[{"sig":"MEUCIHkXJP5hmp5jZ1cssMWwzKEijMZBdmRzTQQxfb+JpC58AiEAk3rI/zrpk3it0lUUuMddEHHtatOAeKFuT/DzaC1+LR8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrL8sACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqJWg//Y3Z+ArfMycFL7ZCTnyM/Lj+ufolHiktc3tjzUTCE1kAtylZR\r\n7oQqjaqdj5wsba+jxgGUKso/0NWYhHgASUwgeoLjbhwTweIvb8Ysl1KrM8Sh\r\n3DYtwYSWvBU8/b74KmZKLpR/Fl4Q9gn+yZPsnXfUqqsaQza7G8TScwhqX7rz\r\nKxiDs7iiNd/T226dw8kDuPHi1n8B3AdSJe0ihXqmI+lMsOlo/tGQyyccEQdS\r\nowLnmzrVlx6EnpTO9LHp9896arO14I80VBxA9MuMO1SYP22zU2NPHdtr45vR\r\n130BC7nF5jHYLL1xfYxhwVfAjDmBm8remWHIZbs6r4msYgZNoYnCEF6hXRTY\r\nm2FVjVDBo4CUhlbRpAMlRsx4DPHPoW9KQaL6oJNE/UIjQpZNQrpM0lsi5hRR\r\nQIVgWeExtmtkxMz96UdUgwDs2oDBmDmTjI2jOJ6TSKPljBwyP3AsuFVR43Pj\r\nlG/RgRml1tsLTIl+KFS7iKAr95luYGsDnSSth+Fyqa8wmSEKFHcoASwqjqMC\r\nVoVV8n8qGw1naC8NOojjG1bOc8xuN1Kp2OAMKlZMzazPMN/s+odBdDk90ZL9\r\n2+fBhW9KknedtALEj/xJvmhXGPAq1ZHo5imx0Oq+GNo1sZ3Sp/eFZlzXtx1a\r\nyxh4fTYcf/QCwxm0kVB79XJIhKLqbMWajEA=\r\n=+Yt4\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221228221123-a0a5b8f.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/772120fa6ac49acd604a4ff7930f71b1/graphql-hive-client-0.22.0-alpha-20221228221123-a0a5b8f.tgz","_integrity":"sha512-vczsknFH2m+ZXxHZB4/vxtKYTiE5ZfA2Sh4FZ1CIT75ZDecfdeA77v+rz3e92EWURrZ27uFNCPJPzXATQAVWng==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221228221123-a0a5b8f_1672265515920_0.06141236971182007","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221228222415-a97f524":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221228222415-a97f524","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221228222415-a97f524","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"e1278d9519003a9468cdd0eeb8b7cd866ab5e5c8","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221228222415-a97f524.tgz","fileCount":60,"integrity":"sha512-BjfCAXtuhOSXN4R3f08hfGwEOJeN2hQNszD4U2zghNK2kac/INj6t4ApRVl3DV99667+tqUaCwOxwYeFbVtvHg==","signatures":[{"sig":"MEUCIF0zIf9FWdFHghFsiXd7kEfc8rYSCDtJIAIfYzi4plxHAiEA17t4R46sWBHY+uzWqVSg6RuXBb0cI0xn/JN4ZN0P6Mw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrMIyACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrnYg//TNPT+7XC1WrkHO6EOuvphBoPJ05U6FpL/Y/qL86lH+lUVZuG\r\nyw6LXoNwAshz3w6Pi6DJmGHcS8JrRPkY4O4OvbsPirT2tIlo5gvBbKkxZvyj\r\n98O+ktxzh/KsLuZogKsU+yVyAUFJMdXz/7x6j3NSAu1pD4LrT2Ic1DlXAltd\r\nNOr12oLajjnOr8aeWbm+60Q3aFEcJNBnfEOcNrJHI6ngocCDYh3uiJqsGRu2\r\npXGHzrjl8bgEjyx6foeS3ztrAVZv2M4ilPLFZVgTGzg7Wse9nOi6aREW6nBM\r\nGhZByE0ETXOp1kOdie7EsVNxOmt60snor7091hNGyzeCRCKtBQ4YV7kOhy/r\r\nE05NEsPonSRW2ovRZX+JaJhtb+yrx0c6WZhjH+ZHfbG6iI9eylwUXmNyBn7J\r\nPy3qe5Y5NYR1MbSYVKj09ysmSHDUFuvcQ6+GJ6wV0JjF+YxI69hKaiOBAkkz\r\nQMI0TXoU8Vb10WAZfzjm3+fcrazgNv0hktCof3nwogl+7B3Q/J58CqgkOsJU\r\nC70bIhtg3mqJPGF2U4pOSVpbVNyhWNQkomOnikOE4GAAz2pb2DAqeIWzShvO\r\nBFcwsuthqvuhujueqwGJ7OmEhwyGgzqGJC5pH0aOrf0lJJwRg+VFysQO/Ez3\r\nt5M91SV0oCLHcuYGmQod4JQ2sQe2PaQY/mM=\r\n=O2b3\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221228222415-a97f524.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/d6ad433351d50e4a7eab42de0580c8f4/graphql-hive-client-0.22.0-alpha-20221228222415-a97f524.tgz","_integrity":"sha512-BjfCAXtuhOSXN4R3f08hfGwEOJeN2hQNszD4U2zghNK2kac/INj6t4ApRVl3DV99667+tqUaCwOxwYeFbVtvHg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221228222415-a97f524_1672266290053_0.09188020516380102","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221228222814-703363c":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221228222814-703363c","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221228222814-703363c","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"034e4637e5283bf7a12686bdf64ad90b0be95132","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221228222814-703363c.tgz","fileCount":60,"integrity":"sha512-DUczWKSZfz093DSgVKwLANyd19XJNs6aNavM/JLZWVvkuZy5tfKVaSNG5mmM0sm91yMmhya9b58dU5oeKpJqfQ==","signatures":[{"sig":"MEUCIFTq6H1ZsOt4Qhs5vaSjGV5AWPjR2MZyTeU5wXa1faYAAiEAt0Hhlz6iQ/+nI2AN00Z4RYqn4+Z9fzCsSqAKoR3htk8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrMMlACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrgMQ//cxC4+3xD2wVaLGf2TgTwy2/Zr6w7PX3F6kCDvd6DW/rcTAGi\r\n7MyK4aRlvVrveXSPnUDZN9tdHplaq+Po078ZSsIln9wJHlu1b3Qlgv0L8mdO\r\nIARjcUxLpJVuGoBT8Ma0TYUxSVYhDnLETS8y37Tl9q0M+cRbDvXfuDehBqzS\r\nq3GoX+qc7Bj7lwhrYSig3F3Lok2nawhbu8eSTFRiHynsttRWQXzBnSHkWeSv\r\nC5idSmUYJR2/YG0a3TbRQwjJCs6ZcU9PGMpTAj0rrLNccnDy+tawPZyIocD0\r\n9HkpF9i6OZQXisbdnccD3Se1XZ9EAaMp0uA0zlKb2Q5DlnvUY/dh01N9XMPO\r\nnVBriqak8+lNzZ+SgH9Qyy01qM88auR2YjteFpKItjxw0KwK6I6pmIMl7VQx\r\nAlmPtHVWCQ+0Qj/u7sSkmJqQkgwWXEdjSuRePBpzbqPpJ/HPXX25yeI41j+q\r\n89dKp31m5k8w46UWm8pmx9NSyo7eWD0s1vh6KSuyU61y75NaLugqReDca4kG\r\nIBnOrDjMahmE3roNhA0htdhWcxVMUD4CIC9wT/X3alirz8DjYDm7N7vXaWeN\r\n/bL2lxua2poBrv/A+h3xbpnIMLkmXSjy7mgUz6MfqRlgdKNixBUGkzp4cicq\r\nP5kqbNPFaj5ApGLIcPRwciUGja7vpRmfU9Q=\r\n=0LVP\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221228222814-703363c.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/f3001e0cd76b8ef41570f7c6191477c0/graphql-hive-client-0.22.0-alpha-20221228222814-703363c.tgz","_integrity":"sha512-DUczWKSZfz093DSgVKwLANyd19XJNs6aNavM/JLZWVvkuZy5tfKVaSNG5mmM0sm91yMmhya9b58dU5oeKpJqfQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221228222814-703363c_1672266533333_0.3225481078466135","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221228223209-6d64087":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221228223209-6d64087","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221228223209-6d64087","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"05fc3f6114ac7d3ea96cb4bbc7b72dabe6975d1d","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221228223209-6d64087.tgz","fileCount":60,"integrity":"sha512-xXOvWNDu8bvbLJtJFZYSyOaOkr+N0CZnjIdhluyMTLvDAcZjPifCGvegt6oAhA+HWsYFNefavV59WRziFiMZHw==","signatures":[{"sig":"MEYCIQDOEgOz66hrfZvgToEYNYzUf9C/zsXtF8FY7roXsaERoQIhAJVuHA/Kg7mgpyvD30xGTX0DoGu7OqcePn113GuY43IZ","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrMQPACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrAew/9E0+j8Hs1Be8+hln6nATWoEakDp8O05kjN9wr4+FmM3i5q2na\r\nvS4r5RD7FOjRChQDKhF5vr51ulg/p0iu5lFwwv6RKz5TQiLY21xQPYKU8APt\r\njKkfNO1rfiZHIUbNO90TalQGoddAayeAP5C7axCaeacmYNX7RQ3cUw17D4T+\r\nr/B2WHTnp94iw59pJSn8ZZK2Eka4uTSd3jumAEBuHcLo3jxS2BSSCsoMmw8B\r\ne5xWyaVTNC3ETfL43Wmd0VtY1VEugJJv2tgusfB51mWOnyO/Mg0vDt8DFfL5\r\noOOtrhSHsd2W12f42w6vqyhxzlnqtDZH4qGFP7Mv9F2lbOm4unYjS/NidqDy\r\ny5wB4bg1Z5kQZq6TBWdXVg4QqbkYyuT7XfOwVl7nnzoehtXIFzZEANo7xssz\r\nWHJQf+lktENbRBarTKRSB72vZdp942iE9k556RWeAKd8RVqPeWBJWePcsJBs\r\ni8Nz2LlRUWmGlgHsiwMmHht/CcxkUs6YIbJls887TlZD0ZuSMLovo3dsIpRh\r\nqQdozJV1iV+AraB8bqlGHXFJK/IY3x8J8BD71VG0eFofODFgl6xhq3QGBc6F\r\nchsswWTnoftGy6gkypSg/EuK9cjrXdVr5mst9rXbpxDn90KpAJp5xQqHSrG8\r\nDZebYPUAIgPsKJEPFS5gX/F1fBi1QqhfZlg=\r\n=Bune\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221228223209-6d64087.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/e41fa63325f83be3afbeca0bfa40d521/graphql-hive-client-0.22.0-alpha-20221228223209-6d64087.tgz","_integrity":"sha512-xXOvWNDu8bvbLJtJFZYSyOaOkr+N0CZnjIdhluyMTLvDAcZjPifCGvegt6oAhA+HWsYFNefavV59WRziFiMZHw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221228223209-6d64087_1672266767021_0.9339871347916799","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221228223504-1ff7bfd":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221228223504-1ff7bfd","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221228223504-1ff7bfd","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"dd8a3aef2dc64aafe14afc22866d77eaa759299d","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221228223504-1ff7bfd.tgz","fileCount":60,"integrity":"sha512-e5yrzSLKi3/N8uabDAJ7LgLfZcb7zmybVbtMXh3gzwzjRXZpVkSPsnmiNbj2+WZAnw3/931555CeLCjSVZJvTQ==","signatures":[{"sig":"MEUCIQCL5sGSRUC2K97WcFJ5HkMCdK75rXSoJ+gAGjSWiFGEdwIgUFxImv3cxPpy4o/u9Rr9ha5EwSotqs82jhn1o1y9BKU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrMS6ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoV0w//S6riOrZQxmfKo+q6l5y1S8NwtbP90tgb0nmA+DPeucVHVqDq\r\nylvu+I2Vo+TK8lJTvj9UwkbgY8ee0QUNJzq3U9aofEu9Yyh35c1m91MI00gV\r\n0TW9sPOSWqNtwVco3pLWbWYiJa3A15rDinHsU8gCcgp3SufMV1wC/I1usP4Z\r\ndQbGG4B6qugnwDX+XKdKB4Ae3BskKSbmexqo/9nWlPnPnJNxA7QnqoqivcLx\r\ncwmpW6c4wC5I3Uh/OVH11g6XSmUyepVFE0/UXU66ipYO7wAIVJV+rn4JFkrC\r\nnze0Kko76ASfSJpYHfcHGuAO+5UXUZc+OLlBl9K/8b7KpUtsBaYYGswPWVaK\r\nV1kv3QVATy0b7EAnGJBCDu6fyLGzO49WKEuVwKaHMQ8JnlDHIqPWGABBoStK\r\n8A898d5bzF4ws/qxQAoxydouDrrU6IbCeLRGIj/ORSqGZX1LLkJZ5wOThrht\r\nTtw+9PkNs8dIR0e7/Wh9TRxhw0hRMt9o1BlhOzk4QJPxW1e+cWhADN0E3QEh\r\nCQHh6SJsyO31FJfr8ZAFqpeLNd1EMtgj6YbV8CTSefrOKWLueS9T/OKekQNe\r\nxwRSv2BFf518RbRXm8pjBRhUUF+jOAyqrjTsvdWnvRAc/zzIzS2V6nGqG2Y9\r\nplQ0hbAwYoEEJDBBo7PHo0nMF4vsPnimQFA=\r\n=/hn/\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221228223504-1ff7bfd.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/862e3a98c1ac483cc25cdea75cffa787/graphql-hive-client-0.22.0-alpha-20221228223504-1ff7bfd.tgz","_integrity":"sha512-e5yrzSLKi3/N8uabDAJ7LgLfZcb7zmybVbtMXh3gzwzjRXZpVkSPsnmiNbj2+WZAnw3/931555CeLCjSVZJvTQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221228223504-1ff7bfd_1672266938500_0.27908911893181343","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221228224437-44fb12e":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221228224437-44fb12e","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221228224437-44fb12e","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"742b9ca4a2a7062bc108241e763ba6cc8ae39fae","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221228224437-44fb12e.tgz","fileCount":60,"integrity":"sha512-ukIEsJzyy8PvQAN5dLmKjTgxJ8xaD6+r1JuXNmvoEsHV1iFTaqYiJOrPOCBS7x2v7waUb+/cRPw/Cf/xjzt66Q==","signatures":[{"sig":"MEUCIATHejaXFUIJBPUElS1chaoDBT/5/92GJybfr+o80mriAiEAyjKtmnSLgOYXjl87d5q5CQEQWV2HBkGMAh9ItdsLEns=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrMb4ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp3Gg/+OBo6kBT1gGHp/FsVbZlgWQZ9IqNrLdDx7QtTereQF58nDCxd\r\nnGILU0qWCqTJcDTfDxTX70z4IL+CAsx5t2zCcmXNuYCXFauWrGm7Mw/IZuNR\r\nwzxjY/P8XpK3LosMKh/44ICWqhYnrbILGld6qRIlVc4FLRw4xMmFJWp12yYj\r\nA2Gs+94Q12S406SkQlm7kssesIXRdonnVqqPIgeXLGPAh/XCNCQ5SgXDdiZW\r\nvWv3xs13DAOUpGEGLJehmcecDiO5fnprWl5NgnIbpcGSiLvjBT2QraiSBm8v\r\nHHjKOoQrkvSRTAyJAHnBV8guUXMA5pj2Fvr/GdUYRRXipQ8f7UQTweAyvK+C\r\nDM166G6BaZsGXLJhh1R26lWsoUmXQYK6bb6PqXfL9PJyRJ1vxrbT+3H5FEmm\r\nbxuHqvQ3FADOAHo1PoQSx80u+DZADnIKbQ6nzg0QQJ39Y+tx0XWxeHyNhb/y\r\nTSQSBu8QirMS/8C8fH+FSFXxHVsBoyu96NCPqzlVH2gHJxeiAhq9yhu4ilOj\r\nFh984TytcFmFcP00+7UMdH15Ltoj/WFQ3KSetr/cfPTCNOczkmdJ5yldxpC1\r\nZstmcWu7PcCsoExaNW+v7JMzJq9boymqvWMPf9DDIj07qKTujvlQ+TdX1+bo\r\nJSWS2EtmV5qaCaMw4dfv6SzbizHE9IJ+Lc0=\r\n=r95c\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221228224437-44fb12e.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/71af3f17dd71ca274e3bc3f819a9f599/graphql-hive-client-0.22.0-alpha-20221228224437-44fb12e.tgz","_integrity":"sha512-ukIEsJzyy8PvQAN5dLmKjTgxJ8xaD6+r1JuXNmvoEsHV1iFTaqYiJOrPOCBS7x2v7waUb+/cRPw/Cf/xjzt66Q==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221228224437-44fb12e_1672267511766_0.2132916976087238","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221228224520-3ec6f56":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221228224520-3ec6f56","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221228224520-3ec6f56","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"0c7646268afd9c2b8ac2f32eb458ebf690306bb6","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221228224520-3ec6f56.tgz","fileCount":60,"integrity":"sha512-FkdzgIEFpmXfUxBPkNTbRSRGVz6a5TFnOXsp1GEeGkhXm7+GrM3tJ9dByStG57rr+w1zrE/4RADhDXU5IBE+5Q==","signatures":[{"sig":"MEUCIGtpYiMo0i7RjfB7uL6GlkGUwyjDVaKN5erkqkus303aAiEAgzubdKnKV7hO1YWrO/Hfq5NavL76NfPLcgsjKK7e+BE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrMciACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpNERAAlCw77Iepk826/122S9BhXf3upA7md3aNltLZ+hHs99rtR/Ug\r\nBUdjL6Q2SPS4SiKfpX8Qh2iptvJOhU4N0ojx86hkEjYkrsnvJ9JKLzmFF9PF\r\nwR8exSB8tiWlHSqGJlDLGB3g7FgG2wwFOSqmlr2Vtty+mL9Ic8aAGPdxFK+t\r\nqTFV1v14LYDeQa3Zo6dfay4cWFhkjvHOuSgZ2kC/mWpIKg0zuMhhF2cLwr96\r\nVFaBvDCZ/e+DJ6dW+mIjLjFPPHech98tWXILNnk46JrIXTyIx6eZvSCbALkf\r\nJYUc8Lb94n8CVrPY44t2Pn5WYfHv79mpb8DPy0n1a4HRb3uOEuTXOxyV/pJH\r\nsIHMBHuFZp0dLvaq6RYhbMGREPMsu1yL76okodK0GCCvoVIdGw+SB3sWunP4\r\n4/O4LRm/5AHPSljMWukgxQV9XXiSVKMzGF3mch0V3kLOzTbyxfN4KsZcwyk6\r\nbhIDb0V951ZMy/i2KmjTI2oMJmMSGk55GcV5D6ZN/Y8b6pTwvHTrzzm0eXLo\r\nOkMFEpx3xztFTd+pKN5GYPrBGcK8X3O303Fx5Q6T47SNcdD4jXbl3rKDOtwb\r\npC7wXuntU92btWIOMSTXVaYoHdGrKrIuLVt/zfsVK76YCNy+A1XygIlXs3No\r\niAp90Hdc16X4LN6K0W25w2CapnrZhfhNYAQ=\r\n=jYGz\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221228224520-3ec6f56.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/31030c38ea2f66c5633c26c26b26a4ef/graphql-hive-client-0.22.0-alpha-20221228224520-3ec6f56.tgz","_integrity":"sha512-FkdzgIEFpmXfUxBPkNTbRSRGVz6a5TFnOXsp1GEeGkhXm7+GrM3tJ9dByStG57rr+w1zrE/4RADhDXU5IBE+5Q==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221228224520-3ec6f56_1672267553937_0.30136798544374566","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221228225115-a0fe06e":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221228225115-a0fe06e","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221228225115-a0fe06e","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"07f2361e86385dc924dd9c9b78a97f3573f96949","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221228225115-a0fe06e.tgz","fileCount":60,"integrity":"sha512-6yekLGzt4whi07vAfV/a3T40HTMXMvQdIHBm8JuvvEVGqgV36em1/TfFCP1nywLWNxAX1d9w4hBg5qHJ6juoBQ==","signatures":[{"sig":"MEQCIDHxsdIzt0MzAy37yRk+lL+fiJTJtPO266vO7EDYkymsAiAMHdS+223iu/UKP3yNz98ONchCSmwrbkhcXF6FjKMa2g==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrMiCACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr7Sw//ezkgcXKlaGeF1zlaC8fyEDTSUOa4YH/QB8qGowwje6lFhCTy\r\n5Fvv2DJcGqYX5X71GopOUkeveqMYbPMA2ZJhfUS/BoBciKMKiSU/NZYemWiR\r\nncKU02RetZ6hqQtdcTHtu1Ipt4fkPaxbxmg9F6hxlCg5l9v1g4WtBepH+/Wh\r\nf+AFvh4QA+ensPS9Zkhsn24wZsbQF/6VjRwVMZhKTN7IWc78w+3pWL6KvcKR\r\nUSUyFA3TWQUIVIK6skHgs7rfnCYi0YDSBh9V6WUXOZjgEkzeRc/zyLV0L7MY\r\nlXjbhjBhftHwOlBFg0krLYwiedliBdBoghQqWMl5kXYgYFllPeiLbUKon4ul\r\n8iUdpYqROibXCR80dGy+66wo6UefUgaAZndnYWBRpn6Va79Ij2keed9WM0bi\r\nkmn71aCboOSOQfaREZJHr6VpdIpuiVmFpvUGR6/bX98bErlQM5O1+A+fMkTH\r\ngC1HF9jDlCxrZFSLZNLMUjUHy0WNWuwlelWWX6uU3LlkABF/AeIFk+fa21sW\r\nQ4rScK/Lngq16BaC7S8R6oEEaLNF1QkLctMZrbTQFWLToFfDRRH0kSVH3oE2\r\npGHC3uHZS3d8bZ5BOacgyCnTEAoafYAn8H+4BgVk6+VDZpTG6xjeje1xwQ7Q\r\nMdJA/lKrdpNz2CrtL8POc4pgQohWKxHNciU=\r\n=x8hy\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221228225115-a0fe06e.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/384bd435af4912558f758cd0d09c81fe/graphql-hive-client-0.22.0-alpha-20221228225115-a0fe06e.tgz","_integrity":"sha512-6yekLGzt4whi07vAfV/a3T40HTMXMvQdIHBm8JuvvEVGqgV36em1/TfFCP1nywLWNxAX1d9w4hBg5qHJ6juoBQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221228225115-a0fe06e_1672267906562_0.15513156012128637","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221228225144-90fae2c":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221228225144-90fae2c","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221228225144-90fae2c","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"56c23ec061abac572e2ad94b19573bd4e69c53e0","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221228225144-90fae2c.tgz","fileCount":60,"integrity":"sha512-OratKS4YX+pKhVfCNELs3tlxW42vINeJwekfv8A6aQUZws8QAE93/bH2oCdGSk9P/Bq9mTK4euUzObsEMOfa0A==","signatures":[{"sig":"MEQCIERin+FQYyNOHMO9rLCCj7oNANY23Ro89/Khzf1mEQDWAiAarsOoPwF0Sw9kDGV4E89dcQIyvc3IS9QEQNijrRwZxQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrMijACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpBSA/9FMzQ0TqdEweaCWYOpFH5wflmKaw6JOS/KJyl5aJ5X9xJzWO2\r\nWWAGJ1RgX1mJMS2a3dCX2WACfkjLSPnyTh8twFuVujyBoAqA2JlsPLWSR4Om\r\nEy1G5KEJ5hzwpXPXhtepCkIB3A7ihoWfM7nvNEDfPYS3uT2Ck2fLmVjSt9IS\r\nk6KlBHZ5ZP/P661+ghg+i4w4UmnW6WlcV5IcjN9nUpmkFJ35CCwk/Ak3D4YU\r\np+4VjenHzBPm4Mzte8E/ohxtGQrE28x/XJBHvZIkPTWg/Bg1cF0SnGjah2KP\r\nWOIFxRrOuhF8LPfqnXtj0dVtRAwaUA9ehcalOZ9ZTpHW6tz/UThJJt9y6KmY\r\n0KlBFBoUzgbLmMXdiod5sBFYeWsOvYXCHc8KgpaMmyuM1NQhVFZG1rCFQW0q\r\nQDDIv4uOnQvdgAViUBDnzMZE5DaYc8Ocjl9FNRHb2oOIC2GjalItdNwTasl5\r\njtVSDTzsfWnggSmFY9ifEu8HiTkPVVOY49T/375/EjRHTASXeN98QH7Icu8t\r\nUZoQa4xIQ1Yrylfu7SRXvfwHgpMQ1nZEkfW5X4v4OIwmyn1jWYJJQWTcx9qB\r\nJd2hT1Z38Hqm7UrHHrrmJrRCeXB7aqR13n4eSgJuiGFwdYHVOnW5/gTMZST2\r\nwkDvX/Gf20vUXuflYSUkMW3z/XCuxDMWNdQ=\r\n=2/+F\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221228225144-90fae2c.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/ac62474370cfc91d1376c4f1a069970d/graphql-hive-client-0.22.0-alpha-20221228225144-90fae2c.tgz","_integrity":"sha512-OratKS4YX+pKhVfCNELs3tlxW42vINeJwekfv8A6aQUZws8QAE93/bH2oCdGSk9P/Bq9mTK4euUzObsEMOfa0A==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221228225144-90fae2c_1672267939264_0.9037762423017226","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221228225745-0414393":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221228225745-0414393","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221228225745-0414393","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"e583501c4e2861f01042a8c3a9a6495a67f29e6a","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221228225745-0414393.tgz","fileCount":60,"integrity":"sha512-GMGM1vcn6ANJHLciCS6sMacTWdzH/UPhmy8D0pxITrQW7/KVK2ViczhEVFAOw/GC28qFWFPX2xcDIcY02c/pAw==","signatures":[{"sig":"MEUCIDPGdFdelPLeOuFGwTKCTBm0bXFrGAHNkYbtvBUZjKeNAiEAie25e/TBLP+vX1W5jRNud1GzTbrB7JIQiaXxQdf88BY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165581,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrMoKACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmq0tw/+MT0AWJFMNkDTgzqY+jJCu23d4rJPPtYzqqiV/ThVwpIvNZLQ\r\nKZ4o813GRO24eqvDZVFfnKqc5rxFFtZO96S6IMnBq32PPlXIgLPAGT8Nfr6H\r\nHSRsjdl6MH7WrhGGfGKHVKPKmNmWX/gg8roq5/0EHg1OrZUQIL/hcvHDUihu\r\n6zWlIne6dxhosuKMVulMNwJ5h3lYwP/dIysL4YR85zbcNzIwAu+YJFg0zB1H\r\nPjukPDQHbVWXxyhBmqOHYJ4UzyZi358Z4hCBwvuZsv0U+IBVpkISP8WzjDGi\r\nJGoj6zXfqLetlzflnNS5chAmKRjhWFtNihq1qp/vhUp0mWuwTxy9m2Xxgn3/\r\nSx2uQQUhU3FAhsV3pKOhje1ReaENR1xCT63jZkxBqPUZFBAJKeGmiKxLvS6M\r\nGXxVLUoCgLfg5q83qfi6Rbpqd2LecSv5qwKCacTIrwINN5aaEwab8+Z8Ce7m\r\nNN/o32+I5nPB578Gu2za+nHgpP1uzF4zTBO+5Kb4P8FKhRhCdSraCmZWuPXk\r\nLqv2TbkGjhABq45DFMYN0JceFpRmJqO92Ylrs2eXHgDt7njqm8w+crD/kv2t\r\nyYyr7zMe746gGuZTfRbDjCr9f623Mdv4r2REz6IPngiCnBG6XASP7SwC0FBl\r\nBUBbe6JGHiKxfujrezLA4LJC8VekXgaUUso=\r\n=9A2N\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221228225745-0414393.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/748f7165dda57785106a5b9db0afdcae/graphql-hive-client-0.22.0-alpha-20221228225745-0414393.tgz","_integrity":"sha512-GMGM1vcn6ANJHLciCS6sMacTWdzH/UPhmy8D0pxITrQW7/KVK2ViczhEVFAOw/GC28qFWFPX2xcDIcY02c/pAw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^9.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221228225745-0414393_1672268297980_0.7752011493604847","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221228230959-521bb7c":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221228230959-521bb7c","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221228230959-521bb7c","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"dbdcde14708b7e029178406eeaeb5b79c51f7a1d","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221228230959-521bb7c.tgz","fileCount":60,"integrity":"sha512-QqQMh0IS7lZKeoJcHhL07gHTa2KdWhRKRjy4r4hde7ToJQRGDZz7VAs2M6Q+IzCizlWw0hxk95COL4c1PB34Rg==","signatures":[{"sig":"MEUCIQD2gyHZlsxZYSz/hwfBHn8wh4QO0tWgvae5SErms5RPvgIgZW43aZD5nzkC4k1S+tw9bGJJYhnMzf0zwCq6cVlza/g=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrMzqACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmot5xAAkwFqRq6iUYMLiDgdGrLo7ZGkC4OzbDd2IWUU3FIsC2+Ad6vg\r\nzixrE5j3ECTG9J8C0UQVCYoTJwmOw1k8s+2i7pc+Ij9fP5ohay6HmiZj1RwI\r\njuk+0sC+CRSp6RP4JHJwXeVoiSPsxvKsKmHgZddoibfERv5v8fZQlCsncYor\r\n0na7o1ibfH63hBXlqWP5ckVG6jzNojzY8YZiACIbcWP8zoTgQIdpDxoU7Bgg\r\nPgKgBzRuW3UcdTvGGORF4RM8NqFOfND9QsN70KUdT3UXPSnRHVRlZMCYX6hy\r\nL3NFpYR9g9lIpzVHi7pnyzYKsIpNIB6rTs/C1Vk0tWDoNE19rXIAjwhT2oGb\r\naqIp3r5NRFzl6T9m83cExhKI5I1PlrfswDgQWRG8SS5XHi8urC7qeUKTipn6\r\nzKKTbcSXkRhFFK2JWXhj4ls0aiNrIASOM5dnw4XMbgBerTwE8uFxJiLg6ZRg\r\nJKzaijcDKb0kjv3w9HDuIDrJSKq/cth5qSbJyYf7+XKDF2MyHGe0xv+/a1cM\r\nllgq4TM5DDxNwA1YkX0N1bEHELLPNuoPlmceDyZ/pitRmTUlB61iYfIJc505\r\nJFCbG92arHiIt2QaqfAu/T53kZZMBwYttxCYrErmtPZgzGmB1z8a78TErBc4\r\nNa8L65QuuFm+OmYs0Kd05lnjMMOUzx4b7BE=\r\n=N5ks\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221228230959-521bb7c.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/49af112f09cf2c31a5fc745406898cbe/graphql-hive-client-0.22.0-alpha-20221228230959-521bb7c.tgz","_integrity":"sha512-QqQMh0IS7lZKeoJcHhL07gHTa2KdWhRKRjy4r4hde7ToJQRGDZz7VAs2M6Q+IzCizlWw0hxk95COL4c1PB34Rg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221228230959-521bb7c_1672269034415_0.7643603770867822","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221228232338-33a960b":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221228232338-33a960b","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221228232338-33a960b","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"e8391ff5c0fda5a6b479ea4471ffb392fe106aa7","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221228232338-33a960b.tgz","fileCount":60,"integrity":"sha512-+v1toUZKDuADqWy/BOwI2y0TfDxXpCEhUFdMcX3ez8EyZiLnWgTanobkQ4t+N8KFEMdKrUul/zsSg7QT3jhfkw==","signatures":[{"sig":"MEUCIG0M/Mkn5BLOq9R5IAyfzkM31VwLMxXV1ZbMJxRkbGnqAiEAstAWzcBROlpDNuxVtYSm3Adw7fZhauNhLdlQa5xsEVk=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrNAdACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqXBg//ZdbuV6egUwQtbRlWrFUcm8X/8fGzVxlnTuQn0cYBZa/qTXuk\r\n9eoyuZTnvETBUCnIvZzHVKj16EcAZix1zl/EGCKv0aykXcApfzcvXrHaogNe\r\n5awRPEMLAwZd/zG4EZRB5EYFZeRdKgtV+47zsk063WpjucgeFtvxgCIS7Gla\r\n/86YRpJbCeB/z5ba3f4wW3F51jkhN9/uCrXSB9uEOuMjY1P10EYKNCBfJ9CG\r\nh76+2/lrO4sR1n+U0yoSoKR2d6s+lwIrIV6dW+U2ySfNRPJsdnHDDhVrAJMk\r\nk2lFpZBBG2gS5ToQaKV41+ZGEQyKNUeT/FXT3EwL0rEoUGKHSqWDwNYqvA2Y\r\nQFG3HrX1mZET2C2odKBAle+TnSpMekWscS3c/8lhdF0tJQ4xoLfb1cXXrr4W\r\ndJwfsd3j+Aa8lsk21JD9K0EuI3hQaIYpYOlmJJBR9yLHhEswWY834MOMX2DA\r\n8wtNVQghGPn74pWWgE/yAogCFkimeL9/54G4AXTNQDittExMBJdKQRyfOw9y\r\njng4leq37PWOQ53dybMwXAEwT/SurU35vw+cYuL3rC/T3mgkqbZ41dgGqjgN\r\nbGiBy/qn6zck+TwjApjA10P7vwizbgWKj8JrJ0j5ujHrjFeBOmvjDLEzJ3ez\r\n6W1srs1ah2siMXwMTzDUnMHrzAhSNEkDJ7w=\r\n=dtX/\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221228232338-33a960b.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/51abf7c658467829cc9edede99d70a8f/graphql-hive-client-0.22.0-alpha-20221228232338-33a960b.tgz","_integrity":"sha512-+v1toUZKDuADqWy/BOwI2y0TfDxXpCEhUFdMcX3ez8EyZiLnWgTanobkQ4t+N8KFEMdKrUul/zsSg7QT3jhfkw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221228232338-33a960b_1672269853424_0.30586358971048977","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221228234734-3644211":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221228234734-3644211","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221228234734-3644211","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"9ba69dd48d899e63026b419e819838029191f73b","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221228234734-3644211.tgz","fileCount":60,"integrity":"sha512-G+3ZiAewFCDLTA5sp8XvocaPPBM0IDGPj48FGmkOX/CjrYhstK53tT0Wc/WZSjXvhJxkM+YDaHA4im8Dmk2DXw==","signatures":[{"sig":"MEUCIG1rBfmLuftUltcZfxR6pQisZ1kduH56o0A6lxeRxg+UAiEAxlTMnzyawgQWxDs/lAtIIUEgtPO5I2QLHT/DBFvPqt8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrNW4ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoPKQ/9Gk9VxQjkFjDyQb8T+468YAiTezY2RjsfnOBnVgzzSXMKAhAI\r\nVugba4v/cKo8WwYp3sibat2uv9bYwjesGc+HgeydtwxwnAWEN9AJaW5Ltlfs\r\nbz81vbZyB/wquOoBABNeyDe0x1NBYRUtnPAUwTPdQEx/3inojp1xaH9ie2/m\r\nP8TNx0fJ4SOvt62OcdM9sgyhKBVRec4Etjv87PqbRvL5GEGBN2UPWIKSiYyc\r\nOKNtfA86jt4wyS/7Qver39JVwMq5yit3l4HD12xznfCtOTA3QKTWhRvV5Ijd\r\nUbWj/mZBrGu2BSCTPkFMgjeN7KoCRxLdl0M8jEg8I6a5RfUoIhLbzrFTQaBe\r\nhjtczIfaEoNq82MO5NllV/V/9Fe6/GpblWiQMBc81RivMhjT9MNYznfs9mYU\r\nOTMC1xcSfJ+2i8QLZJfHOAaTsSV123jzbNnU0CwvKGYwnOJUzHQJFu0gOrCd\r\nSLPwpFy4NTaQ+HwXb40cuilF1+WTsb/8qXDLbEhzCssR5hy5H8MnWmZ9BtZb\r\noaopefwJtQX/3cL1kx6DEncQqBTJoompbYoVxDOkeE+CqAxTF4MM96ty559Q\r\npV7XBrGJ1EK5KCunSA8wMhmaO7OqVPaMUWgjrTNc1bHhSazFSm8nAwMt5D0B\r\nq0wu54wtaAgPuV2x8EFd3b92lem2qxreg6I=\r\n=O0T7\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221228234734-3644211.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/17192202bfde10ee9d94873f087a45d7/graphql-hive-client-0.22.0-alpha-20221228234734-3644211.tgz","_integrity":"sha512-G+3ZiAewFCDLTA5sp8XvocaPPBM0IDGPj48FGmkOX/CjrYhstK53tT0Wc/WZSjXvhJxkM+YDaHA4im8Dmk2DXw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221228234734-3644211_1672271288732_0.48550794858751556","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221228235829-6c280f4":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221228235829-6c280f4","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221228235829-6c280f4","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"8ba023f3bda7ac5480f782715423ba93023bad09","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221228235829-6c280f4.tgz","fileCount":60,"integrity":"sha512-BVncxbNkvgah7lvlxfFPtkm2UJ8sSvGOuAMhgeszjXcEf3hkWETZsOklt9f9E7tCqlS9dBvgXNR34WsV6XkDsw==","signatures":[{"sig":"MEUCIQCW6IEdgkRM5kpIwCcfH8VAXCSajv9L2vVBX53ai43PnwIgUJgKoO/C/ylnCKxfx5bpgqqwwg/yw57uMisAcaZuMi4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrNhSACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr1Qw/8DHnqWGw7UWJjvvdNYnNHQ+npTHAv2HYfGcgP8X5I5OLvwE+k\r\nxPp6Jw95xhh1SG/NAER53E6SRR3eTuB3kVt4mQDFHFqiYz9YvJxQ4LsZvfSz\r\n36TTPRH5aeJJ7XRkZHxvlepyxT8APlJS7JRLAkarEbjZNl3TXz/MsPDdSa/R\r\nDbwpIoTE7DE+ZoAiPcIIZAkXht3gHfBgpA1x6q4R7hpZALyIMLAJQoixeJnJ\r\nW0vsCH5kj+R79yNua4TjFcJ4qFAGUGJGcwL/q6rQkmPElPOd1wFQYvR156Ik\r\naOJ9U1sf/P6Swo445622D6qI4UMiULT0bhuH1GXjOJiB3VtA3gU3tfcgkvXS\r\nYJo9fMzTvLs6SEGVTMS6hK6xkNKhZI+mxo2CyXtq7AeN2PJRQEdvIS7XpNcP\r\nXITtajoU8AVQyKyXWpPpy/tE9yL3kW4BeGJi0R9HQKTuJUZ9CnDZLsCd+B5J\r\niS85pUeSa7/2Qtbz53Ciej2cSBAscBC/It4GIYdR5GriLrCLpSUC1HsHt6fB\r\njT5Ovq77CIJJoGMfAoAYWGsUKX8V6fgXcWH/KmJi6ncwSSALaiLVXzgXyBMC\r\nygaYtkre5BzSfO3Ss0GF/THYeATpKTwsCBzDS7WCmC3J6OSCs51oHR4k9PHS\r\nmpIi5IjB2CQk9h9EDvyNU03gPKsoJwqo90o=\r\n=0064\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221228235829-6c280f4.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/c57ac95a70e611f98876249404b3cce4/graphql-hive-client-0.22.0-alpha-20221228235829-6c280f4.tgz","_integrity":"sha512-BVncxbNkvgah7lvlxfFPtkm2UJ8sSvGOuAMhgeszjXcEf3hkWETZsOklt9f9E7tCqlS9dBvgXNR34WsV6XkDsw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221228235829-6c280f4_1672271954547_0.11504031912563373","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221229000444-013116a":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221229000444-013116a","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221229000444-013116a","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"064a0432f2417c682446fb687eb9246e11ddd625","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221229000444-013116a.tgz","fileCount":60,"integrity":"sha512-d0IR8x4MffByWe/vf0rlfb+rS5vopcJtfgan6IJwltRmsF7uUOh2tUA3rmYg5tQBZXYyd5gYURAL2Rnu/F5KPA==","signatures":[{"sig":"MEUCIBT30kxB3dZl0PpRKNESY2uZmdX3EUtRJQgRUgchgXt2AiEA6gc3UB7rZpejSziy/ohu6eU4nlkNOtJBvoDNQSFiH+I=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrNnFACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoPQw/+OoJhm9nCQCPp0Q3wo3RjgspM8VzHGEhYoVa8QTNkiJlKrSoU\r\nulp3YUYpbe9t/McNZCsWKlzO2fRd57H4hTN4OgBPok2RF6MjXQuQGiCNc/EZ\r\n5z6xdWPX4q5mXR+nQG2M6HKzAEpTUSOscC3/hFyCeW4H29G0Ky+WgoZnHyP2\r\ni1esQ7FOLU//xQu+a6VuBv+43LHrDPWt+jSa2h70Nf5u/aNgXTvKHcj2etLm\r\nUv14b8oW1n9cOc+OcrcpgEtdrkfZSY/MMeQR2314xXAbNMUyYN+QTFevqs1P\r\n0s7vW2V8Jvbf1E+73B+YaBSYsK0KCuWsEIk7ca0Kk8E/EcOTE9hFscCCqq0a\r\nO376WlHfT4TV3MJ55RMlYsgxw4PVxuDD+dOACuXMYrVa6m8I33bUFfT3gaEy\r\n2vqHk7/Yv5+RLOKTCAS2/J89sJIvniOg8bj9HJPkWw/g7C04ShvHujjmpFFd\r\n3cyt7oc3LlsoUNCMgK7BmQsiVyrbDA2jRXlj8cSYLebJbCePzwypL0NMgRoG\r\nefszNIjwqkuJDZVTNTAb+/8MWzTkbzdgagGO7tExPmw3G8nsp+w0qW4Sjv4m\r\niBZV90AS/yvlca2iJIGtIgkVy03xkgOFNE+KdvgOXqa1X/e9NRsC4ge6+ZNX\r\n197oVpujtwL3TGc3Cg9G9Xk0gkTmMbIb0WQ=\r\n=QGNa\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221229000444-013116a.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/67de12d754d31ed870af529c5f581d04/graphql-hive-client-0.22.0-alpha-20221229000444-013116a.tgz","_integrity":"sha512-d0IR8x4MffByWe/vf0rlfb+rS5vopcJtfgan6IJwltRmsF7uUOh2tUA3rmYg5tQBZXYyd5gYURAL2Rnu/F5KPA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221229000444-013116a_1672272325544_0.7385027622070888","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221229002446-ab59114":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221229002446-ab59114","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221229002446-ab59114","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"3cd31e17e0646ec80f2d79351f04815491838023","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221229002446-ab59114.tgz","fileCount":60,"integrity":"sha512-0ZBLXzyPPbd7/42RT92IZOspDOiEhVrvgQ6jr1ZM7cli9Qkf0O1wHlYq+IWbUPDs9NmeLg4oWI1qUM+0DKaPUQ==","signatures":[{"sig":"MEQCIF/zbucFKVw9JFGrYOmn8ZkYXVylEUNEQK3qtAgh1v5HAiA7Z8bbaEpXrhAj3vbbvblIXYnQYnw/iKmwCX0l4put8w==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165581,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrN5vACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmq/Fg/+LKzNZbVsRIdjGiIdx014k0BlJzdKeOrqwfdaR69D1pDB6iSW\r\nrWJVZ2xThj3FKRkGfk0ipeDNbClNVfhl7Wv2zFmvUfr45LHBTX+Sq7/hNANe\r\n0GnPBogS5+qIpbvoi2/9Mv/qQ9rUCz2UV0xGTtpYV36DwHRxXE5nipUDG5Qo\r\nazqn+IK2OgDUkK7IX0jgIUSmVGw3kyPpZhDX5klg16N1PA0SB5IVNglg5Z83\r\nEwt0RLAh3tH16vf+8nrYDe8tEW3QqVjWWqSMxL48ppPOzd/Y49L435AXaL25\r\nhLXs4p1TPRL6IQZseZTUSSYnzzhJrevpP4zWtF+TLuI5Gmz1R5J6eKSchsux\r\nEfHufTQ/EK9zAVzrcxBzU52DMAWe7h8fAYw91E0TtkY2QTwF+zq/tzZAGY3w\r\nCnBLRjL3gNIIQr9Wqv/fN2oztmSgmmUvtBRKVkmqUheDgGsETS1XWTO4Xy1G\r\nfpFSPW32v2m18CZh5cq/QFylShZcaA3AbF/gpo3d9TA9s7LkgnP5pyYeLNYl\r\n21Z1j9ViZqkkGtMWeh+oFPcyIj4Jb3C3E80SzmWDav9F8ABbdHtz/zsW9+2j\r\nH75j2mqbAlOHfViMruq8Y3RdxOjou+kuYUCp70ewGu+s2y7PjYe7m+IQAQJP\r\nE8USDMGbl87quNXVZLJkuyce9N9Nm65dcDA=\r\n=eiMJ\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221229002446-ab59114.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/6163276ff6b81d4bd770e3df3cf456c6/graphql-hive-client-0.22.0-alpha-20221229002446-ab59114.tgz","_integrity":"sha512-0ZBLXzyPPbd7/42RT92IZOspDOiEhVrvgQ6jr1ZM7cli9Qkf0O1wHlYq+IWbUPDs9NmeLg4oWI1qUM+0DKaPUQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^9.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221229002446-ab59114_1672273519566_0.2634704762428053","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221229003450-2eb2d32":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221229003450-2eb2d32","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221229003450-2eb2d32","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"f183140786c678a1545d4fd1fdf6e32e929553a2","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221229003450-2eb2d32.tgz","fileCount":60,"integrity":"sha512-97sT1aOPCeA2tXrqWEsxNP8UDQEDHDTQVQeRQS8ID2jtaND3ZvPQR2rQhKFP5So8aJVC9KEvqYPGSJUe6/4WCg==","signatures":[{"sig":"MEUCIFWiQTEF3NS4czSie1a9naniwpS7+hQtibwcj/k4DN5JAiEAuYjGF2DvMnZVbf8e6Ss7W61gcu7C3z8h4JSCNIWFsDQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrODUACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpsTg//TGo5hXnP07d6HWIIL2FkMhAnSkNY6HO5HfxcZJGvhftJyfJp\r\nHLtPHlX2GO2OyUTMkM+GWobii0FooXHU3ODrcpE4NTpJjZUdI6aktjQ2jkBC\r\n/6VtQau2TcFs7obq37OWcP22A9CBsHlIyfTTpuVh7Q5BYxdB4/V7lbgOe7oV\r\nqcmd+/0LiPLGW9qzFyPfha1RRHd9LUMihtY9o5NpLNBKtflwgltNIIlA6lr+\r\nu2jZuF2BFb3+/so0S1KgLqzObd7cAUJMSBbPuuLtP5hjbs1Yws5Vxtfkwrhs\r\nMb1UIrrRaYA/RCE90xomtyk5uR1dYrWgbct2CuOeI0ytolocYKM8WK5qs2Sn\r\nwZcXkv2ow1d/RocHFDa2pb4h91wLXO3x585HTBtd/MAmMFTICZUGk674D/74\r\nG4iQctXLHE8tyRBbO14R3T4keIF4edndpwS4ZrMwmV3tbWmpynZlKPb/vBhq\r\nJmK9aVL9WZ8Jn0e5BwpEEXh0CdD3GEhRkbWIeiuff3EVvGKzJgKyxj2EmYod\r\n8v6ey4VkIi7qctm+icXPaz3zUKeaXb8FzpXIqXRkQr+SSNRxFGJyMftfVUAl\r\nE3TH/F6okOsvnM4e+bDPKIEbA8f7qXW+JbN0KvzwJvnuFQVfT8RTEwlNzBhW\r\nCbi7G0KNd/9c3lX4cGNgNbFNXC3knkI1wpo=\r\n=brfE\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221229003450-2eb2d32.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/3102ddda3844c33e48ae53340ec18a93/graphql-hive-client-0.22.0-alpha-20221229003450-2eb2d32.tgz","_integrity":"sha512-97sT1aOPCeA2tXrqWEsxNP8UDQEDHDTQVQeRQS8ID2jtaND3ZvPQR2rQhKFP5So8aJVC9KEvqYPGSJUe6/4WCg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221229003450-2eb2d32_1672274132345_0.9723720047466009","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221229003944-30d8c10":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221229003944-30d8c10","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221229003944-30d8c10","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"229937214da198bae309d2c3a786240e294a8887","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221229003944-30d8c10.tgz","fileCount":60,"integrity":"sha512-ElmStpUjC1ExM2uKvWAklLIu2SWb0zJH8uenDfcvJTKE+AL7pn47cg4k2aq2OUeoCzF5tWaRPPtrdMKpiJ56Ag==","signatures":[{"sig":"MEQCIDj4IjlD4L+fB3priuJRjNk2Ew0QjlfzvGAq8sBFCA3UAiBx7sDadxfAgywq+t8Ui1QLp59nkNwyDYmi9bMMP8X+5A==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrOHzACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmppjg/5AUYGHB1LeSap5qZEjKAI+UAWy7ULDKdIED5bjsXibgvXJ8JX\r\nvi0U7WxIQAyNkyvHUGPqyahTq67WHt8wwLMVBBXxA30Gl7N+NJGr/SXDlcf9\r\ntTuK/O/0VK42RSY765k/Q99u0/mH57iAx5v62+qdLnuW6GnAvT2kof+qTx7k\r\n0d7sLFY4vO6AKbVjTTLjLzRJsDH9CkA9sD9r9rsNVhT0V2opgLuria62jsVn\r\nKPXMcno/ne2esHPr10dcLXesz7hadU5oBpqazQ3fQT/aOMz8DqCnPB6Iv1SD\r\nRRKzkA8g+PuYrKwJtGBVguor86QxKR9D/G2snwdWOrbmm1OFkKW/nTekYz1X\r\n/FqU7lloaEZJvCrXrUXhwiACa3xBj5sVqDjBBoswdS7bzfiRJ0TkA6VTz80D\r\nwhCv0EcrjCkr1pHZxEgQXkDQy+O3X7qhzDQdENTYjtrTI7ZtyEL3jDcj68/B\r\ndUn7ukaRlWuggzSamu+dukD1AkMq86PX/dFOJsA7wohKMTIL5DHjNJ5QvUWG\r\nwFQwUZVwUB2GnDarqjyubySRiVbt9OGMXq8iIWP/wlaeknfFAg+XxZjmDUoG\r\nNc9B8T9ycrBzuRu1+OxitqAJYVmM+4kf7912uS7SjYYc4YQDXIaX9/QsnFAX\r\nnwD6UUTjcqO2HjWbeSM6c+feh7c6Jt3lGQk=\r\n=eH6T\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221229003944-30d8c10.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/e7a864d548454e977933979d03eee7cf/graphql-hive-client-0.22.0-alpha-20221229003944-30d8c10.tgz","_integrity":"sha512-ElmStpUjC1ExM2uKvWAklLIu2SWb0zJH8uenDfcvJTKE+AL7pn47cg4k2aq2OUeoCzF5tWaRPPtrdMKpiJ56Ag==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221229003944-30d8c10_1672274419639_0.46082210320898964","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221229022315-9516e40":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221229022315-9516e40","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221229022315-9516e40","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"d8ec31e21f4a575efbd272ac8f3a1523930b7391","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221229022315-9516e40.tgz","fileCount":60,"integrity":"sha512-b3MNWsQVkTJODq+ZNZzmXIoHkYgHVKLTmO1+3FIBV6Op9EQ895ZSpvvRNgf+2C9Wskjd4/HRN87zG9cxWhfxhQ==","signatures":[{"sig":"MEUCIEmJQjlExnghXbhGTBvFO9KeYhjS0Q7NNVTjj18D/N96AiEA9nkUxKq9kFXBmrFg3bI+saTrDS6U9qNrhqOwUFNv6ho=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrPo5ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpTXw//YBmOmAQ12++MYcMrkzsg/i/lgX9DbkjzPWdGzlMIlwhb6VtB\r\nvq1jGuTyXS7xSjpfL7xdV6+pM4znECfGHoBMMTozkIOLC9hi7Xopq+jygx1n\r\njq/W9YTO8ij9n4Zb5d4KQAUdXQKC8a5xqR4w4IfecLwxBkerNaOd/9emkEay\r\nkYnbLJB8rnIopU960evNpl2EAjoEpmybshUmWI4IwQryv2Ja6YhmQkt+Ixgs\r\ndxg7j3Fg+jba5xdWIxb7WUzuLWcgu62y22yBNIag9rueTzM0B6Mkn/cu+G6M\r\nQS82jiE9hdWDo5bG6AxaMFZ4/ACr1CzSnuZ0XxCb4Okoeak7tWVw+diYa3uh\r\nB5KVSgXVgLd2gA8UjNM1VxjV7dVn9VyH6AvWsWhm65b5nWbDoHZXmnr/+BlM\r\nnBzvg5glgS6NRGbfdfzfHoEMtOBcz/aYgGtX00QVv6gQf4h14WBPtB0JBivh\r\n+ftNLeviFHi7pUAfVBZ9KuY+lqEu5DxE0zCfAwTiK01P/Wie8VDY4yDr3iV3\r\ntJmEYq0bA9UUvnbVEAwx0YU7LlpthWy8YVlwPMLZ/y/YA07cD6mrjYf4bPEK\r\nVvz1z0QwqsDu5oado0b6vWuobUcbcIsVa32NWnbDcKcE3iHyxR88BRB06Yf6\r\ny2NnD7M/Lo+a04Qe++3vkwpOhPHJdnqD6+8=\r\n=D/Aa\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221229022315-9516e40.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/8a796e7bc1a670fa8b769c3d4bd78675/graphql-hive-client-0.22.0-alpha-20221229022315-9516e40.tgz","_integrity":"sha512-b3MNWsQVkTJODq+ZNZzmXIoHkYgHVKLTmO1+3FIBV6Op9EQ895ZSpvvRNgf+2C9Wskjd4/HRN87zG9cxWhfxhQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221229022315-9516e40_1672280633105_0.3403218787970763","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221229022818-ba0c8cd":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221229022818-ba0c8cd","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221229022818-ba0c8cd","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"27e91d71068aacfe0ef405ae4aeb065ea0d7b531","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221229022818-ba0c8cd.tgz","fileCount":60,"integrity":"sha512-y3OXA7lv1Az6WjeRvbEovYzyW7HjLHEJwBNXbUfGfD8rMUuFIyvVBw6j9gHak9jkE4dmnu++rgcYPU2xhfDtEg==","signatures":[{"sig":"MEYCIQCRr63i6qP3bTIq/JZ/UjDkhrna/TiCN8DlJbynpTkxSgIhAIDe29vs0eAtx1ZTF4jQy9u9ZBVDQeoMciYBMCyeGGAL","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrPtrACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmqsxg/+NqxWypxxJxaL8K/u1UD3i6tLuvxqomEdRgekD8CVJ3oCUeqT\r\nYMfwo18g4H3e1+i1fXfc67FW6uJVq5fLkU0MgjSxLqh42z50qFcD2St6FKRy\r\nEkZBibC+HqWKawmSVAIf+vWDUyG9/TlYb7nZsn30/D14D5yXBAorLdjIFRkA\r\nDLoh8qH+3uDK44EgHjQRNZkKb86gIsPf2FfY5ptU+3PRDE6ip5MZadSGKjJ4\r\nQYvSqwTIWeNcTvU8g1lbQkj4I06wFAcpsM5UsyS75uUEtx9HcyEM1MvcxT3O\r\nkARAqVD7ZN4mA2pS+DVmfd9Qqc5qKY+xkF/eXsCO7tyLKgYbMEMjGOepkU2Y\r\nKgyZaGhPy4e3iFUCT5UUVgr3SoU+YoUlCwPCX4CKqPxKo/Ad3TLTdx81JNxJ\r\nEvaPR2uNYIM1ExHFQb0ekMzTPuBvJZ/fOJ4XQBFK9KhvP7L+x0jtzfwau9A7\r\nqNq2euERnNlWv7JP2ClATHd9vonOH20J83PYoW5hV2NwW04JmBUS8ZAX3+Lt\r\npf8tv8yJmtDKXIVZq7fZNGJ27Nd6fGNCVofPwhtslwiGbhSgSeETMoALudqg\r\nNKLisR2d2zrGl0BGmijIscJrVjGzndHFX1GVRi3x2L+A1lOFmyI7AyrEWm8n\r\nReth3tB3sxElwU+KMqmzfVhwrMCAabJxEnw=\r\n=REQ6\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221229022818-ba0c8cd.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/b1aacacc264b7ed0d69b2c0bf31f8277/graphql-hive-client-0.22.0-alpha-20221229022818-ba0c8cd.tgz","_integrity":"sha512-y3OXA7lv1Az6WjeRvbEovYzyW7HjLHEJwBNXbUfGfD8rMUuFIyvVBw6j9gHak9jkE4dmnu++rgcYPU2xhfDtEg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221229022818-ba0c8cd_1672280939763_0.288543223659929","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221229055023-fcee8ab":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221229055023-fcee8ab","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221229055023-fcee8ab","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"2c793f4d13a274c2f9ec13b42bdd04dfb4968cee","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221229055023-fcee8ab.tgz","fileCount":60,"integrity":"sha512-mLZjDdxqRy1G+IzpYLDWhWytmSxRUbEXMORVH1wWXdz2E5ZT6uXNIH9fsuTMFk/BNRncTnpy4GEKaFK7VRWkmw==","signatures":[{"sig":"MEUCIQDrKYkSBtfZNrkDhCLottJM+3+iOop56ZhTkVzk82e9hAIgb1NfBhoAS0li/rIicm8lbjB98L45SxXMrrW/KWF6Bo0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrSrCACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqVLw//fVK9yG4LYlaZtYR1uBmlcMOQO9Uabp/Lrs7sVD6jI7g3C0WC\r\nCYTphwfhBSFPDjPpYMjDGNdYWFAuLwePVgQc22fVRlVvAE8go6cEasN/vHhM\r\nVVxn8/ys2Xs7Xcu6hJGqEYU1821F+Wu+DDViwP2WsW5h32Pwdla88YIZGJur\r\nkimS/cHEdeILrrgHNOJOLUszbKRj1Locd1lkIEO8SNo5lB2cmi607TvrXJlY\r\naGKql8krHCCmJm8RWdc088mgh/f9FrDOjRAwOxwkWRAsl6jPMcK4VcZOAs4y\r\nS4WQPvwjzGGwdAwv0X52pBwD7/IVHaU9cVCLOqRZQoej4k1JkFTC8qlsQ9aN\r\nPx+bWIZMV7b6e2nJfvfbH9aegPh6dSZiriKtuAk2Pmm6mAf+Za0zzX1KS1I3\r\nABswMPmjZHV/WsTCCMLBqsvoZDvHgmrlnBPrWQLz6lAPi/4z5rTvNRp6f8t2\r\n0AjkK5o8BbGOc9SqjqG6sT6GfHZS+L5X9YCQdmJTlHyFwU8k2iAbAr3OQTfg\r\n7QogJifiFJKUhiKPbj5k0T7tidVmMBDWB0VnXGlpNzj9n5GPkAC64x5Mhp9A\r\njT8EavrtDNtjdFpVH1tBL3csW0BGTi65kxDU9M9AsFNNjGsliY2PyjuJFPtl\r\nsdiaxuMKpHET+bBZX5YM7icFdmSWZAnTNIc=\r\n=ypH6\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221229055023-fcee8ab.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/f0c9a700bfcbf2a444c05a926be9c14e/graphql-hive-client-0.22.0-alpha-20221229055023-fcee8ab.tgz","_integrity":"sha512-mLZjDdxqRy1G+IzpYLDWhWytmSxRUbEXMORVH1wWXdz2E5ZT6uXNIH9fsuTMFk/BNRncTnpy4GEKaFK7VRWkmw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221229055023-fcee8ab_1672293058721_0.1539749681628646","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221229143447-f7a7621":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221229143447-f7a7621","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221229143447-f7a7621","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"4d051478159af442a8886fa4215482d3d175e19e","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221229143447-f7a7621.tgz","fileCount":60,"integrity":"sha512-Cgj20Ju5Tnnp28btmHE6KFtkvO2vY6GbEdy1pFgfsCDPY4OkPkN8yErj2qyi4IassFh4aAQYQxbf+vMZntAJXw==","signatures":[{"sig":"MEQCIEcJplkH/A8mw/hf9Jq03kiQg81DcFAl78J8js+gPtjWAiABlAHa5FA9+ddSfe/JvBL0A7uisEofUKz9R0zcP7x6ig==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjraWtACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo+AQ//dBJPPkz8A6EZslga2pUCSAsRp2d321Gheg1/umUjnFPQzTBd\r\nm+MGtmUSg1Cci+GhnnWblGQHYY/0rx1lFuV96zxaDLaqT4UKzuiBIGOwyV4K\r\nLKr9a9zSvXTBsUkCyKkR6vSQZPXLTKI0es07wgQ4p16u14zrldH1FBuXRp9O\r\nNe4AaGn6k5AtaoslDp7R0BCBmFwwL0E4YbrYSvpAi7SGbwarINDmhS/a84ZJ\r\n/JVz3c9cwfJaaPtieK+lKJ45hLZmrb38f8O7VydHOX6swZpBZH1lPvmm47Bv\r\nJP2402ke69kghOe5x+X8/J7CCPhxHPH1NXRwLaCe4cEFIfOl6+nXaQPi+U5f\r\nKOYN/0JOusDaFBh3RbeNCEKUlJBalTN2txbkjcpopkjrKrmZNZw6X9qEPwyf\r\nCubBpMVyxLnjjQRFMkRJdgbz5Jptqm4LQErQZHnjWOdCL7WpGRPaeUqsjodS\r\ncppMqAby2uVvtAsoZMBt+SRXMQMZsryAyGonCHXYG4sWPy30lrGMTpwZ3QQx\r\n6O35lyDYRIvqYAkJyCoSmEHi/6VnuSTT6Dr+y9LNE5a3R0R8nNTylRsTYyTY\r\nRSSWZ+akK/qFg+wwP0cJwPzNgrKnkopYpNA+1drEQ29zhFGOh5NSxm1vf6vN\r\nm5Xe7ne1JEip4R9gM1WZVSVpKANZEhvp6E8=\r\n=RdMu\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221229143447-f7a7621.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/739ad8b549a6632c87e5975ae1f58487/graphql-hive-client-0.22.0-alpha-20221229143447-f7a7621.tgz","_integrity":"sha512-Cgj20Ju5Tnnp28btmHE6KFtkvO2vY6GbEdy1pFgfsCDPY4OkPkN8yErj2qyi4IassFh4aAQYQxbf+vMZntAJXw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221229143447-f7a7621_1672324525514_0.5848813511438875","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221229143644-5491165":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221229143644-5491165","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221229143644-5491165","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"81b22ef30885da3426a31db3142fcfad6e1ee522","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221229143644-5491165.tgz","fileCount":60,"integrity":"sha512-ThOosxeEm3qR0yzli6GeYPiktCeApwL++9WkmFWIoSlb8NYZa07JYnwXXN0hoNBCE5jzUKO2eyQqziJ5p6KTcg==","signatures":[{"sig":"MEUCIQCSvvyeXGVTqketQqsgQuXEkwB02ZEUxXlvIL91dAp2ewIgBw+/1xmna2FGrL9XzsYM5JBq9p7tbYdt0asi+Yf3PjE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjraYkACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqewA/9E8o0nT/X8kfW0vCh7gWsdoeKSo5LvJkP2J54yB8iHTJxmzTh\r\nymuc1UTeawktIXzNSJq5OgviUiFYFXI1Asgr/LoDXorwwIPNJSlsMHJ4wAh7\r\nRhEnp8TK3HjqFrKPdOSGYUvCQtnNcbgCw8P/4uVef5O7GCJw1b5WDB/m335w\r\nIw/0Yyk47GnuLCgAQvloyRFVXmgwM312X8uc6Jz82tDhNGTMiVzcBvE7302L\r\n/AeJtawnzsA1rZ9dPo0jUxz4YbK5wAjcPMm7hWSb1lKLxGfXWxjN0IIewMhX\r\nUXweeGh1Rn7Oth6eHVcPDXRrDIE4W2bNPFzFCjWByQdNf1Ptsi4MwqBx3+Kz\r\nsCLKAGU8qoFxp4JGxC2YOhWlvFI9AsoP+fYEq69n3VMFCaJBr9GtKKYpod1N\r\n4jV4or8MR8inXTcV9YzEm9/UCHNlakM4lAAK1tEpHGqoKCSarUBE0mtuM4BO\r\n9g/abucOHWrpMkFD+lChNYwdD4n6DrEYv94XqS57n+T+pEMZmlM7MoVH34Qr\r\nWyWxSJrMlOvNYZMxpVdxY+HhV2cJlgR1uZlCOkzfORdUFQ4ZRwg+twRbqbR0\r\nPN1bbHuAuSR70K3ZaZhGlSXRKbfI2Kw0+RDjLfogZeiY+Ck7Hajs9oNBmzrm\r\nybb4hdjfCvl4zI4EqACcdvZeeoKiUXMKfko=\r\n=NkmE\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221229143644-5491165.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/1ed2c9f8b85c2d5a915616c50dc8fce2/graphql-hive-client-0.22.0-alpha-20221229143644-5491165.tgz","_integrity":"sha512-ThOosxeEm3qR0yzli6GeYPiktCeApwL++9WkmFWIoSlb8NYZa07JYnwXXN0hoNBCE5jzUKO2eyQqziJ5p6KTcg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221229143644-5491165_1672324644534_0.44452622032625677","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221229143641-50b1161":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221229143641-50b1161","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221229143641-50b1161","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"14f13210a144af603c88a74de79ef4c5113603d3","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221229143641-50b1161.tgz","fileCount":60,"integrity":"sha512-jWudXplLKhIdNFs7RufsY/r7HT4XhD/eDM2k52MJ7dzOHBpLDQLuDb5HZhAGyhovcgYSODUejN5pvZaqPPNJqg==","signatures":[{"sig":"MEUCIFb6St/d3IYsRT66d3u1Co6IMsVZCaEwte9Y+IZDVXPIAiEAsNDkm+z2267dGxrRU0RyB2T50algBcaB187JommS22Y=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjraYpACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmojog//VDUYBeYTSTnFmECLnlI09RdAUlTYppuzHTl4VbgZqNoW5ywu\r\nw2kBE7zO6SQ7p5QsGnJpGncdf4HRGKGAti1rNE7OjxYpBrjba8k16/y28DRG\r\nuOiyvdpdZMZF/JXVBZ00qfQZln16w7QsyuIRLfZfWvhRPTRgNZTN24LS3UTq\r\n4XquBNbP1GHsqSPPMVN5saT50uMwn6V6rIDGfWA0GWQlH0AEOJujj/Xfa5qe\r\nizowqVSPKBqLi2f2xTH4nQvuKuRjqdIDSB91pnegmcDK2s+1hlaeZsiAPPgI\r\ngBz2u6fLKGQb5KtJwtsyUv9Or3FgnAYaC6SfvKTXCp3uYGQtmqaU039jxd1N\r\nphhstRKR/XqRxaQyydlCdYInV/2hwCOXqhCKpeCZuQxGfNYq5//kVxuKr+mG\r\nfaYf+HEe4Dal8+Es7r4Xuyf1uZi8a2UL26JIAHxGmnGkMw6ij72kLYLvSJmW\r\nmYyyNYeF6BtDcfDCZu8UL7D94F4ePtjOgE73QkM5ACncLLFrCv08WZ8zhJ7c\r\n0rITcJdjRNhmoZHUCthjxcsstBoUojW4xKaIcJK1lNW0S9oWY06Y7v84eqsU\r\nqvzFlShZB+lE5GxPbD7OI8Npi+bjizTKsjmpQ0Xxte8HJ9BsOX9sYKt1UQK/\r\nC9ciXzIA2CPxDIMElV4ZO7uhbotzd75PsPU=\r\n=oV5n\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221229143641-50b1161.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/97081264bd7a6d97a2a0376e8446d8d4/graphql-hive-client-0.22.0-alpha-20221229143641-50b1161.tgz","_integrity":"sha512-jWudXplLKhIdNFs7RufsY/r7HT4XhD/eDM2k52MJ7dzOHBpLDQLuDb5HZhAGyhovcgYSODUejN5pvZaqPPNJqg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221229143641-50b1161_1672324649756_0.03701175837590598","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221229151626-073c2e7":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221229151626-073c2e7","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221229151626-073c2e7","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"da1c1f23747735834264f209287d50f8fef151db","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221229151626-073c2e7.tgz","fileCount":60,"integrity":"sha512-k5gazxnbMybeqrlT7aFMW/S711YCeyCmXzAhSb9S7xBFhdv/N8gzN7ieTU7mkD2IMO/T7ooavyjkNbYyamYSvw==","signatures":[{"sig":"MEUCIQD9nsRsnEWbTw+G97PkfC4Pq+41o7+XbRGCDQBDakgKPQIgTNxBaaofMDE6j517TeZQHRISff/DXel4SPh8eXyHxzc=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjra9sACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqJcQ//QMCL/xIIqH7nrR1MbK8p/O0GzYoHUn6wh1+yzTALSABesy1f\r\n+7UPdARmcTWai/jilOLXW6PSCLLx6qeLLPf1AKZpJq0uqNkIvboqvFeGYr4J\r\nYCUHyEehT0BUsPI6jBsub3S953paa+4chIgsT1AsilxTmDJ8J+egwi9VH4Xl\r\nEDUU0mVhXZ3d/Q4EIZRD8Ck0PdsEDv/0Q8A/kgb1g/iWGS3e72nlkSgQB+SF\r\nHje/HIp959tshYxXoowNvh5P6WEVbwSQA+Bq77VIOs6TaEDRcaZ0Ay2rHbRJ\r\nsvNdF9zOkA94kh7e/Wf1kvp3B/9sOJTzlD1joVe87H5EKo/15CkJFOcE0FaR\r\nUAoKVnb64MaemJwoCRQLwaQlT4+gsAsIpGYGxyfWpYf0BngW1FeUckl3vbNh\r\nweQPl5cOWTizagt4p3i35b/sGOXavG18SPH6TQP8HrOIyuARqdX9tsUwW+Wy\r\njxR0Aosd/kS9bn20YfdrdFuectY/1nLv7oOokIXyreHauG83YjTjHp5v1R3f\r\nrdXMOmabNCh5BnBncq0PxJakqvHuYG5GsYpSv/gs2HxS4p664rYUPxoSwrAl\r\ndn6XYaFSqj+whh5j2FHjIQROsnNuC6NqLLFjZVhCyr4igyYTwVPQUth9musM\r\n1W40kw6AIJ1GuMttS4YzRcffXeagC8p2wCQ=\r\n=xc41\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221229151626-073c2e7.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/6208cd619b7a2de699e33d4cc4eba2ae/graphql-hive-client-0.22.0-alpha-20221229151626-073c2e7.tgz","_integrity":"sha512-k5gazxnbMybeqrlT7aFMW/S711YCeyCmXzAhSb9S7xBFhdv/N8gzN7ieTU7mkD2IMO/T7ooavyjkNbYyamYSvw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221229151626-073c2e7_1672327019856_0.40337572173259817","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221229151803-115b05a":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221229151803-115b05a","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221229151803-115b05a","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"aa44a0a0946cf8a07e86a1824b45db9334cb6104","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221229151803-115b05a.tgz","fileCount":60,"integrity":"sha512-tlBvd97o87xmGZ2aUJVpvbiUWPELmFdOUsGKkFQBMup8m9da8PGtyYNQmPxN86VWlVgCWKCdB9FnoigGdyLRPQ==","signatures":[{"sig":"MEUCIEYD9BrnGmwEQfq9jQLEfx1WiJNtwC6W7HSdUrP8RiNJAiEAyeDVY4JMSxqR+xQnqnZO9SGNDWlC6WqgYajwPIDDUSo=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjra/aACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqVnBAAj6v77L73efpCcOU5pGaBVw9zKyLTpGSW4IHO++C9ipM/MoGg\r\nMpcf1xEmlJOolKhrO5Xbmn6jrT+qkz8RSG6tWvXiMaPw6ylXi1wWcWGgp12Q\r\njQ30dlgc0e1z/YKBosAjq+UXTy5WAUI0rrELmnP+46NIcdKoUu1fBOvNYaVG\r\nrSkkERsw5sS4o1yFoGzaz7bmuSx4flImfscr5NzHW8ZvaD+xCd20+d8USY5I\r\nZvnAQx4HGOHB/B9tBHKME6xZB2j2GBCt8+8E9LN29rtnMNqRT9XNvAt+dkjO\r\nR2cEorlBI5ouOqw5uCvqDJuw/cx2anoeoQB/lZvDvlDXa6sWUqnhEiquGJwW\r\nVPgKLfWFptrKUrfCtuG97qOmEGZpJmFgAZje16iyZQDJIJAZGWIdG28/CESi\r\nJkMWe11gqSVwgU1QgnQACG7lf7s1pgpQVIQ1kvyD7U+0CcAs90oUROrhpBcz\r\nl0TW7T0wxn7RNK7J9of55t9sI+1utCgaN1jPb4FBkyqWkoS7aSL164AnyEZC\r\njwtY6Ufs66WJaQTHe5YA2BKWwzsMk/6ngVFyYHhfyjlu1iu+z6TXS2tl5K/U\r\nCi0Q7BofAqulym59vVsUAkkIrdYjyUA7XlvQm4MXaTM7Cotz0ancUshUlsLd\r\nmSvIChRpj7TJvQmDxbJMnVCkgEYFDexKfQ8=\r\n=qc1h\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221229151803-115b05a.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/7b837bfe330b60e2b1d7d5a06204d190/graphql-hive-client-0.22.0-alpha-20221229151803-115b05a.tgz","_integrity":"sha512-tlBvd97o87xmGZ2aUJVpvbiUWPELmFdOUsGKkFQBMup8m9da8PGtyYNQmPxN86VWlVgCWKCdB9FnoigGdyLRPQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221229151803-115b05a_1672327130702_0.042297756269193965","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221229151836-e148cca":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221229151836-e148cca","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221229151836-e148cca","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"aee7068aa8d63e89e63de93c5d22e64dee875383","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221229151836-e148cca.tgz","fileCount":60,"integrity":"sha512-cCvAKzdpwmAK8hX3WX8XUx7HhJ9x04uy3iYcCe+HBMnR9EjaJauR3ACXdn8ml/+V2wsxDHchxY4C5z36wWbUgA==","signatures":[{"sig":"MEUCIQDeqq/EzcK7izQ30HV3fH5h3H5MsFQ+WKU9LzieNyjH4QIgPgbnQeiAWNyFQlKTi8XqY3RppUiFTqGf8nL/QP2rivg=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjra/yACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr7RA//TG2cD7G8yHHmVrlbhabK1v+llc9BBe8ZnU0d5Abvs/2fCN54\r\nRiZary+sGIsjFLmfSwnhMQMlbJjpuh8Idod2xJxk3zANRzt9c1AvBvsTa1VT\r\n23UHm2GfFXuJ1eHDgMAH/XzxgfG2NisIG2VBpYTLo9XESU8QbK+tjGv8BZb2\r\nEZDJGb0fvUvk/HFG5cuKQKh/ClMa7Ao0FKpSdc6XwQ8Ihp+eUuyAZL+8yl7w\r\nfzkHP/Y7ndO+j4Oakn2uCFLVVlX82P240o79JAtOdl0rY2ez9a6VEt0D1dEc\r\nUAcJYqP6IQnWFVeP/PzHJlFlQIsV4GzOQxk+Iw5ZrrWJooEoyVegkDNhHYlt\r\n52Ebjp7Y1IS+KCTv9WgluYwyZ0bYwNVYtfHwsDU0FkP5YvedIUTtuEf17A42\r\nD2F7qZ7F/C3WtUF3T6zXmsKlN7mHedzMcApS15SUF35EYfQMkfhenjLsyMU3\r\nV8Rt7zI+b9HMYpQ+08V2MaKEQakRip/q9IfYJ37NF5oRmKdPeSd7fLcdKPOZ\r\n9hMGmhgBG37V5O7qSKmk5bq03WkcY6USO9AJevm26HxNL0bh0GUYrbPqK4nU\r\nE1v37jzrT1W9iaYr0hk58oX/XnFolBk0R5v171Ui5Nd5P2w7lUk9JwDeENWl\r\nRRzXBZ2fRLu/wPYcNOp5/W/VgdKNkFHr+Yc=\r\n=CbZS\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221229151836-e148cca.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/37348ad61abe4158637d932ad0f00c5c/graphql-hive-client-0.22.0-alpha-20221229151836-e148cca.tgz","_integrity":"sha512-cCvAKzdpwmAK8hX3WX8XUx7HhJ9x04uy3iYcCe+HBMnR9EjaJauR3ACXdn8ml/+V2wsxDHchxY4C5z36wWbUgA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221229151836-e148cca_1672327154427_0.33053783585881136","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221229154544-d900b42":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221229154544-d900b42","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221229154544-d900b42","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"c1d5d947b4414e8aa3de4eec7d867267eb5b07e4","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221229154544-d900b42.tgz","fileCount":60,"integrity":"sha512-MOpO5whF+evxqXBaXX7TKF6q9HD2Qz3Dju+P1hCQ6/K+/xocD55fkqXOfTLiiy52dhqh2ktxI4/iAIe+jE6pXA==","signatures":[{"sig":"MEQCIGd9azFeqwZWKRmcsbZmhpiCtPeVKAeZMD9CjdC6RQNdAiBeBhmTK/nkY5+XysaK2ritVfyJjbnO9AumjxcFRPyCzw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrbZOACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqOPA/7B6m5nVAt1MRYSBWWWFk1P55ZsGAyUjQJWoMdxTUPjZM8z4T+\r\nNzTKPeuOW0L64gd2MwWSYmcyrU0f/Y/F5HN9eL9t33Lnu/d2fQUbu5EcJYKo\r\nZGv9ucXc/UpN2eZU0CgTzH4ZwtI941nB5cUFv6SBJRLtkbSOPAd9lM95KmQG\r\nuO87Vm73B229LktC/Nry8pPKj/GDUNvUCd1wTb4AZmHkAl1CNy7GOB6gnQOh\r\nxBIgJX08ILo+3ctiOMFMxzBuxl/4wj6tjEO1HNLAcHXy/qnsiyyT7ii0wN7G\r\n/36wuggXhDpAJNl/c9bsEq3o8MWqOshzBknrtvCcsPL8z3S7BwGv++73RZx/\r\nhPAdkIFE5tiPqi2glJ5f8xr/+9K0dAvvhUISc+FFtOCRF/MVlHE+NIgKh5Z+\r\nKnoVsbRuGMharfGOvp4o3KN8R0WuPQLa9DPQ+963CkU6JW402N5QTeJOXi8h\r\nHqI2B9Au5jNgqG/5l43ayyWgQWTy3mSXy21q2G0rSIorthTVtaic6XJe2PZF\r\ng1sKEp/ZPoME20YvMfw2GRnXpPXiTZcZF/gkLbFcFlw2QVTupfF9R+Ta/oRD\r\nC1GroQZUYqjK69uO8w6AXuhcepTkYv5SuWOifZa3k3MAor+rfWlzFEVFjQP6\r\nqrvJ9vmbnNfXXw2tffziVymHSBoKutJk6OA=\r\n=g8N+\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221229154544-d900b42.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/da0a221b965c5158e2c4f02a06a9fee5/graphql-hive-client-0.22.0-alpha-20221229154544-d900b42.tgz","_integrity":"sha512-MOpO5whF+evxqXBaXX7TKF6q9HD2Qz3Dju+P1hCQ6/K+/xocD55fkqXOfTLiiy52dhqh2ktxI4/iAIe+jE6pXA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221229154544-d900b42_1672328782638_0.28033500306427706","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221229161508-76dc576":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221229161508-76dc576","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221229161508-76dc576","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"d8db0167bcc40d33862ac1067f5513c57f0d75e9","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221229161508-76dc576.tgz","fileCount":60,"integrity":"sha512-t/rkFpPtgWA/BxCThkHQWn91eAhhIMwBaemd02r5fktZ7DByw3wwW+XYEL/T5TBq7fDe43LAm+5MMcKkigBQqg==","signatures":[{"sig":"MEUCIADFkx5CFBLoVk7RxaKS0azKOeBhM6NDyDV3Lf2owNauAiEAkB7PWRPng/X52wL4YiBLeVSqvv9knHzD11R7lpTlU3Q=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrb0+ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp3PhAAhD7WB3SVHyMliweMXLJIP71mPhhlwEUwyfEs7yiW5xbaTaid\r\nzgxXJfRT/D6oaoWm5x3L0IyxmEx6K2R7n87CvXaOfMlWu9Xo8EfiuFa3TTYM\r\ni0WmmX77r4I2UDhyB58VR0/Ddumj+2Zexb5D9mfMa4mIRAFGCRQueiR1GyOc\r\nf8ji0+uHOgaxI4Yr3g0fSLwqFnooLV/asHcXRbF6c79ytq7F697SQCY8iBPm\r\nxuTzw+6nPSsGkfO46ve/zbc20qe52bl05hXzQCkbxWnkLTvhbEAZRlBg0Hwl\r\naKlZ+lw5tQSQdRTZmtMZgYQToNTu/9mwX2/3OKc+eoQqYHYmg6NxzNQcUzlw\r\nIwmfAwJAgIK8s6XFy68F6ayYoNLnnIU8WlT3sNzA1IlK5ERGMyXv2UN3Vd2S\r\nglgHeL+gq2/H1c4erAcyZ01FUDpbyoPDnmoaoIjrsq0jKlXv0nvTE3iV1Ijq\r\nsYELe3XngC+B7VPZJ2CoTIRw2ChBVWxVPyn8i3uO7b2wZLS1dnLGNRXO2Uf9\r\n33T+sXwY7QA78ZEj6B5ChEuscsIaaKHVl/oqMhOQKn4Fcbl5KEgpMU6A3hhB\r\n/jYRDQGlt90z/Y/XvkTItplh2GkD2lqPHvBBzc3Ytf0lTjlT1KGx/jjjN/yW\r\nM9A35E3Mu3tFOfgulX7wexGAboQZ9RXf4l8=\r\n=16U6\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221229161508-76dc576.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/df232c6598b19e57c2a56fc217a2a46b/graphql-hive-client-0.22.0-alpha-20221229161508-76dc576.tgz","_integrity":"sha512-t/rkFpPtgWA/BxCThkHQWn91eAhhIMwBaemd02r5fktZ7DByw3wwW+XYEL/T5TBq7fDe43LAm+5MMcKkigBQqg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221229161508-76dc576_1672330558035_0.4091879061964856","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221229164824-fe5724c":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221229164824-fe5724c","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221229164824-fe5724c","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"d24f9c273f7d94aebf4d021083e500fd3932ba0d","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221229164824-fe5724c.tgz","fileCount":60,"integrity":"sha512-xskEB04XAUL8q24Lc2Ankn6d6HOhb5Pvt6qr2lR9ecO7EJTdj3WqLmxn4RyaiE6l2R6SkyDEK0X2F/juc5Fz7Q==","signatures":[{"sig":"MEUCIQDvTfJAdQolLTC9cCffG5cFs0VjXUHxFSX2ydZlUYmCegIgK+QysjyLr2a2U2Cw3CPsM2WpDtXwBvEZlaJln4LCfCo=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrcUAACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmphrBAAjpgsZAagYTkpN3o8wFymI24yu5s6T8A7tlZsuMACppjNw1OE\r\nFY3bPLxcRnKhnkoeRa+IkjoOHKCpUEIAP5LWlwnHDToGG5WI5jMBKO4+RsFK\r\nNtqCbcgj1QNtKzPb007+ktMDgI4noYVv3HtabfaVvNwyxmE06vsUYuZ6L9km\r\nHKEQnWmnxrFPX+QH3vuLx6P9ntfaoZOPeMSGLjtccDlwho/fB3KSfNseeBwE\r\niUQJBvrmV4ceAGTKxPmyt8ANpi2Y9aNs+f2kI0I99N0zFgyrPfpmXYu61PPX\r\nmAMcDZnP2/Yj61H/WQhTJA575jieG1yn99sYOwYf4t0tk9ZKdb8+A6Iv8Pwb\r\nZrG8JN6ZbigpiCxxods4rC5EdevDdT0aZvax4tZrrpPNKNE2qaLZBJjJEFHI\r\ns2h9V6wn6YIBeg+37e1UvOUc8YCdz9YWBm40wEMgPJlceUNnHUjVZNWM7cWQ\r\nBy+JuuEJ0H8iNJp6MFN6+z/Opoj00vvuXse4RcTXkzhIdiffv/q1evc+84OC\r\nm9hNV4zpdXGS6YWVsbba9VMkkEMQ5o/+Ma+hROsJ2c8VKbEV0p1zgDFJQggD\r\ngG0FXK1Kn51me2xiCrnbfZHo0Gyjhu+UN95uapuAYRQ9pkpZF0kzHa68uAdC\r\nNuigBg9t4zUUtWtuVnp5WJG8xT9zvZXIVx8=\r\n=tBnL\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221229164824-fe5724c.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/438fb2184bea14787e7e73979ae26f5e/graphql-hive-client-0.22.0-alpha-20221229164824-fe5724c.tgz","_integrity":"sha512-xskEB04XAUL8q24Lc2Ankn6d6HOhb5Pvt6qr2lR9ecO7EJTdj3WqLmxn4RyaiE6l2R6SkyDEK0X2F/juc5Fz7Q==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221229164824-fe5724c_1672332544614_0.13647635197505337","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221229171316-4d8d936":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221229171316-4d8d936","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221229171316-4d8d936","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"d71b12f234ec85b574909bb61f96c4a8ae02bfd0","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221229171316-4d8d936.tgz","fileCount":60,"integrity":"sha512-JWsq8hqS4YV/HxmJCSJVylUjByS5FLM0yinfHSXYlvxcguw6z3B+fxH+/r9RwAYE9S8cSRIbG5LEnDPQvBxu/Q==","signatures":[{"sig":"MEYCIQC6P43Hs9O8eDFYBJkhSwxUK+dYv6UX5l/l73YGGdf/agIhAKekVOq//qMfvIU/sembkbK4JrNRzELk8qybG6EtL4Rc","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrcrOACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoXBA/9H/IuuByXqJOrpdJHVzjZNdhvJZk15MdxkVg2MH5NV1m61OOi\r\nH/6r7Wl8u6dIv/JhMbgzOyhUpeMpWWbUA00V6Xv4ruclrP37h5VkTNHiV5hN\r\nhamd/7H6Cdbatsa0wZmVYeRIqWlr3cYuQoLCO2zjSC+NOB6CQfCV0BzSJEok\r\nTkA4yn5zN5fH62DXnIKG4/40jKZEHOINC2ifwp5a+YjfJJMoFXsZ94NSIGa8\r\nxR3aMxSnt0NAdJZXRxGgMDXEDuiOOS3wVhup6sRoqn0EAL28oiaysLSC3VdX\r\nNkBGeNTyaNKyHl8jKFi5qR84/Fvm0+MUdyZBduaeZClU/idUsYcFJhL00SsD\r\nY3I3GI3cbKCJ2oU47sBCMwguXXBpEEkVjzVWyzIiEl7IeHJGngVgb5HJIZ3E\r\nwmIJpK28kOY7UcgpknfbZGEe/1gkUdWj1YWY8H4hVLgSuxLfYNk42j54YG4I\r\nbIQAWQbW5op4UHDkQuh+D4ErNBrbp59tkN3jB2qmmeNVbZrE1BnCCL5gR8lt\r\nWVGy2lYaz2DpKVmZqLjkwlbtat6svZYxBBQtamb66MS0cH3P7p5wAXQD4HjH\r\nttW+GDkwls2d5fePk1Rf88NLXFzzh4YwlYxW3FeUEoBFqy7Xv7WpRAI5XDta\r\nSQFtIPfe9F7Gvp+wEWKt/cfh69hGd/L9Jjw=\r\n=oKtn\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221229171316-4d8d936.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/93960bd8e7bcd56236a53b49e00ced59/graphql-hive-client-0.22.0-alpha-20221229171316-4d8d936.tgz","_integrity":"sha512-JWsq8hqS4YV/HxmJCSJVylUjByS5FLM0yinfHSXYlvxcguw6z3B+fxH+/r9RwAYE9S8cSRIbG5LEnDPQvBxu/Q==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221229171316-4d8d936_1672334030343_0.8998020266970732","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221229202944-cc0586b":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221229202944-cc0586b","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221229202944-cc0586b","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"1909efa9b31f9002efe92f168c310e9bfad0e7ca","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221229202944-cc0586b.tgz","fileCount":60,"integrity":"sha512-FKqKaNtOBLnqQ29bOz5Qbvrod+zWL6I06ICpn1wt2TqNq+SK9oic0lk53UEefdszJ1TeikH0xghiC30fizjkMg==","signatures":[{"sig":"MEUCIQCmlWIJnpw/d6S75R6uZ8AelFnDNg4vumBzJgQOYZiZ3wIgXRfsfUm15ymqJDxFO8IqpXVcFc8BVeUgqveb5qt/DXc=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrfjkACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoSbRAAgqwbCkP/Ib8mBosz4PE8PQglNzmdZVDYjPktCYMpOcLMXwcM\r\n470//u/xXlE4zdhvb7ETsqfnvwhyYCnomDfs8gxgQachp/Ik+2S68dsq8uil\r\npQJSI537myW9oCrJxgq+bVWxndsetceYlSBo6xhKx6gvEMeEIHr/G5P2DqEt\r\n21kgr25f0YBPmR6jCqaTzi5MdaDOJq7J99EZL3Lfmlcd0DrX7h6Fw8+/SP7I\r\nv+wUXvN/4hT0fbHqpGfu3MvHXzZl6phEDR1hMOPq7ehVcDQriTIDyg/4b9IQ\r\nE2t6MoO5BQiN2R60WkSDcz5IKKtq5MpvCjRK9nxwaUkwqQUuUUVvmH4IQm8B\r\n+GhuZ7rOB4QLMKgxmtTbO5aarxtPww1Ww/sgHIJyUhLI7WblLpxQGX1arILW\r\naxY36v//U8ubObLSeVDIpCVC5Oo4/Uv1jjqmoNkhIJZDckPrNvtLq9TWqS7c\r\n0OizAErhxcj24GGHvUN1BG6WvPXwRdBIa4gFnNWsE8QRGLMfcIpcP6mWUNvQ\r\nuV6jpkjoK4eI6y3lV7DNvmvoSjjEeoAKtGr85jogSJ4CQ3AM175KGUhQrnbG\r\n9Bv5ppHfdwLaOMKRBvaEU6sEYq3FnuKOZZuMfhTdRedQTHjaQ/swSTM6xGIX\r\n0Eq2YzFBVg22kET6rvxqyYNJRnVLk+OutEY=\r\n=T96f\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221229202944-cc0586b.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/d1be9b615b9634ca3005b5728cbf5d4a/graphql-hive-client-0.22.0-alpha-20221229202944-cc0586b.tgz","_integrity":"sha512-FKqKaNtOBLnqQ29bOz5Qbvrod+zWL6I06ICpn1wt2TqNq+SK9oic0lk53UEefdszJ1TeikH0xghiC30fizjkMg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221229202944-cc0586b_1672345828100_0.8506421940589368","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221230001643-bf6e50f":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221230001643-bf6e50f","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221230001643-bf6e50f","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"86c732033cff6db3c6aed91c305706448cc7c300","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221230001643-bf6e50f.tgz","fileCount":60,"integrity":"sha512-CMHZMCdh2RCmMkhXYUM7adrlmxSWiGP48Fagnqa+Uxak/Sw+x7H25UNa0bZWTO30gK2wkXBDUq1GY+8qspwIqw==","signatures":[{"sig":"MEUCIGNNELpRHSKf1kM/GFCU0yMNPfYvswMhL75X0ql1USolAiEA18hNBlpQM1bnBGY8NdB4U//YgSwrjzEiFGGZy45TNXw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjri4RACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmodLQ//WdLOrcgmtvhA0EXo7X/D5hDSgPhjMhLRHHX277UdAjdpE9zU\r\nkG0K6VG9X0BEG8/bOpWUANHBlJqA0KHavIUwBAGN2RY/E8vNOK3HO0qCDuBs\r\n82WqjIuretmBRDnsDMS7bZvfUoC5aFxtaI6aFHywQAqZN9h6EBc+bJTYqz3d\r\nMQVF3LCu3BkQzfmhm422EAt/s8UOG3R+s1SjdDNAUijK673Wo99Braquws0l\r\n2THKPUs3Y6TGpXzwRd2JlRKBYTEIIsBZ0N2ylvJyC145vvX5bEzc03929A2c\r\nf0zufLI9lQdZaLuPWkQULp7SFw25tZD64/qYSqaeiusxVGwWZNRVYtzoegMC\r\nX0SjZdPfNhoNBhVo/UDhuH9GyP/Sxuu28H8AKevMD/eRvYAiCNSZBt8yboDy\r\n4MvqSzi8gMyMcqKzZAqoHfEMruO8X9jwZLiYDplFf+AMqw6hMyJ89Y7vmfnw\r\nwpb+vKjjmNUVN28xcN9K5FZ9H5TQDFGs/W2huXhmGOYMp5p1sSYTDH6X6vwK\r\nukRjQt+OinpELfmPCM6eQuzSEOFldyhK+Ft7jlhULEnSsgMoY/3LZ3qO0K6/\r\nhzvDW1wq3lFmflH+bAMTYj0TvtjLoBPtFN6GKxXrUjqYea/1bt54NV5ceghr\r\nfJwn5ItmAO0pGG2HF1nDjS3nK35PtpSUSVg=\r\n=f3bj\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221230001643-bf6e50f.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/e4d1c673eeb4ad344bcea09e15a43f83/graphql-hive-client-0.22.0-alpha-20221230001643-bf6e50f.tgz","_integrity":"sha512-CMHZMCdh2RCmMkhXYUM7adrlmxSWiGP48Fagnqa+Uxak/Sw+x7H25UNa0bZWTO30gK2wkXBDUq1GY+8qspwIqw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221230001643-bf6e50f_1672359441134_0.3606733018319719","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221230002148-5da1b46":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221230002148-5da1b46","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221230002148-5da1b46","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"7f44e826153e3e799178c711d13c831a18884a5e","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221230002148-5da1b46.tgz","fileCount":60,"integrity":"sha512-cGFy3aTaTrypRzf3tVORcfJYilj8ZTJpOQNkZAqKyRdd1vcJx37HFD/6dKYjt5OVcVVxRwkrNRtANKYmH8FN7w==","signatures":[{"sig":"MEUCIQCkNbFgwB5UaqtdsN9sDQWzCxbvRWPCzkRzhxmh90+XUgIgZdoPDmqmF3cPw1GPqDvfOKzrYftd0dG/bEFhWcNF0p0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjri9HACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqrhQ//S8+q1oHl9NBtnYO7A4izJa7RTjZVL4nnGKItJABRXAwUgr+2\r\nn2Hv7WxZXWq62X8SWf0TF4BWHBtKtRCy7PjCQjxsXKtWgmjEVQnUi4xOlC+v\r\nYt9LDvwvl5hL/Ckv5+ZQAp2uCM/cfAgfdk7XJ6iCuSVpDfhvLOBeoQnuVUhn\r\nJ6uGj1R9WYwlbElQRPOoNct4fCad35Br1j0N36QmJF8+7nJBa2MLL+SFs5k3\r\nHcgxTISqUPVk4hFFf/K3zBe9/2o+9ncLRTzm8iironZ7FVFL5XsOw9sxssE3\r\nop5cl89lEnxCIkJHFfyAprT7X/rHJyBow6O+SbAJL7/1C3heN1rjZTw5rMrW\r\n+RqJ3z93Lp1RfoaMPYKvZAvNk7vV+PoUfezWQJLTN96bvse7YS105DDr+oPZ\r\nnlvxAB7aqRortLJk2Nk8oaLB0QhSrwbyiCwF6DLGQrp68myRUSA+dl6RWD12\r\n8eqXSgakBdsl93q0q7gwPkCt/zMq/4Tap3dlPj0wXa17dWal3jiUhhidtXhp\r\nq2qJ1eFXA92yHAaVD60FwFfYTZnBdmbP1RU3oz1hTTmFy4/3eIOJ54S4feu8\r\nmph4eLvybpzxvt9s6UiLy4ATFgJFUVQZY57MTNmDUulxyM5N9g3Dqzo90fmt\r\nuWWW3hatjgSuYc8UoXvpVJ8L8f8Xx0CShRQ=\r\n=ThM6\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221230002148-5da1b46.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/da93bbeac20d183a2ac04f9964886355/graphql-hive-client-0.22.0-alpha-20221230002148-5da1b46.tgz","_integrity":"sha512-cGFy3aTaTrypRzf3tVORcfJYilj8ZTJpOQNkZAqKyRdd1vcJx37HFD/6dKYjt5OVcVVxRwkrNRtANKYmH8FN7w==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221230002148-5da1b46_1672359751189_0.7342251729387952","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221230002540-da5d733":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221230002540-da5d733","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221230002540-da5d733","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"a2155b0d0d5cb57dda0a5e1817c917eb232c5db3","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221230002540-da5d733.tgz","fileCount":60,"integrity":"sha512-7552FzTrU7jP5vivl/13fd0kP3MGYRGh5NgdH3l51xiuQWFbDDxT7+qnZoQQ0p9stXvgfodIsp24x0+yyP81EQ==","signatures":[{"sig":"MEQCIH24HZKVvj+Qv3s0mfQZ/JNmE+bJJGQsdBZMKXZTPEoMAiA+EITfNiahf7cBDxnLevEb9ZEY/9wj34mXZq+2sTh1oQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrjAlACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmrp5w/8D2j3qqVFWBCRQaw3GlwD5Y/aZ3puUrNa3AS84hqd9MIgz0zF\r\nhyB7QCYp91FmqJBKq0MWPJ/GJi7CcVPQFtTR5W4dQ5bdZCs5uoZ9T09kgxJy\r\n5NNg3qSDIUv1tnACbpgOgX6qQtP/15dK/BZAEA7i59nTF0S8YNSfsCKnuDxW\r\ncdgV4ogFc4v/qMBg+DoCEX287dbNMuu2B+B8Je1RX8PV2wSOaNeb93zF7AaW\r\nrtZztm7uvDWMCfEFoCc3pM5FPpLU8xDnPuOuq4Q0S3ptgNNBBM0ensHGX1wl\r\nKsbYICojUj0SApGI1DtQOE2AY+i/V8/40puXaxePJMQL/JVcojPSSQq42j5D\r\njp6F3OGQ4G8GuBuyTDEVMaCCHEiqc3CG2X4r4nvCRoxK5vgmQAqpBpXxHVBX\r\nJRtno5y81ZtQTnB+aHkK2j6i4bs78dQ7huDw5wDk6XRSOAhBH5o2+cbwoQwx\r\nFg+B7ViairubSIfO+QxfnJ5Yg43WoVTcJFoOOmq1fmT/bDXOzocaVqwHNaxA\r\nHDhge+5EIkoESYeOerB/WMIqYElG2qsLWYmwF3P/N/RErm01HmK27vpKfhIC\r\nubz4pMxpeVhCKISaONMWYCi00cyG6kjqz8L+p2aqfFUMUfofHIcqJaxxD/PO\r\n9M6oLAVeINJPmGFHrFn/u5GjdNXCxGduBtM=\r\n=EoXL\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221230002540-da5d733.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/42a4c21e52a622d86effe478555d47e4/graphql-hive-client-0.22.0-alpha-20221230002540-da5d733.tgz","_integrity":"sha512-7552FzTrU7jP5vivl/13fd0kP3MGYRGh5NgdH3l51xiuQWFbDDxT7+qnZoQQ0p9stXvgfodIsp24x0+yyP81EQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221230002540-da5d733_1672359973477_0.5981845660753158","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221230024209-e422f89":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221230024209-e422f89","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221230024209-e422f89","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"a85eb0e551d28286e1bba065969c1ffa24a034b5","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221230024209-e422f89.tgz","fileCount":60,"integrity":"sha512-wEck/xtcs4+AiQ8HOe6lnGG8Al3slgG8Uv5oR8zKqkK46qYUBsa/PlMbj3cYrrODhcSzVrcLFZXuD/7IT3lXTw==","signatures":[{"sig":"MEYCIQDfklzr+2WXccrHz/4qBTfBzZyj2Xq8jEM2P70BYk7CqwIhAPHPI9rrKLzKOXZC4hqGgfYGnxy9wuSRrVjZt8eNrtTH","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrlAvACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrAgA/+PipXQCBlpZ8pYafFL8Xj2xVI4BjrSJD1AwpyQ5/SyTjh/4Vt\r\nZuU5U88E9psjyT+wEvjduEawjeZqi0n89fKNN7aaKtZtCF8/zAw5sXGLPnIl\r\nnJgvSl3uGiIRtEsZcNg+KF84ecNHxCopMVDgO09XgZVy1uqEj7tIZ3DJccuG\r\nPp6ZFMzoIIA4Jp8EM+6QP8KL9sr733Fqr+R2rObtYNDfEQwmisoWAoCubSMQ\r\n3eaVMldnsy5OSeemLSjYbyePNY61G+OYVgmOvgh/bRIDN57AjPH39sP45nmR\r\ncz2j429MjNtvwXh3IhlrvfguFV0L7RCqu+7di3X3Aj9pWJg8hNIQo9XLMHXE\r\nMCkaEqf3B0e2P7KgydrJYusX2YUpOIIIjyh8Gira7l9CKlfbeDRI61pa5cKc\r\nvDYT28VfzS2F4veGkhc+wguckvWBs4frZ0fOy/M7NNc7V7hy1xyF9forkGnh\r\np0Dq0xeWQkXol/xxxEqFdjCm2G/vaTn1WS0rknXVF79RIIMcom4uOIuuKx71\r\nQsAW6fnNOjXBM+7ORArTEpiwhvgMRCl5osHdTEm2UT7DJDhUTouACEjODWZm\r\nbXeXOX48+H6HIG08It3nNI9EJc4vRcx0Kt8Hn0UoskofhXooG0O4qftwZ6Am\r\nPPq/YIaPspa32i65hK7i+23o819oS6dFjDI=\r\n=WO1w\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221230024209-e422f89.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/9f5f5114f3a3147032cfaf910a887efe/graphql-hive-client-0.22.0-alpha-20221230024209-e422f89.tgz","_integrity":"sha512-wEck/xtcs4+AiQ8HOe6lnGG8Al3slgG8Uv5oR8zKqkK46qYUBsa/PlMbj3cYrrODhcSzVrcLFZXuD/7IT3lXTw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221230024209-e422f89_1672368174879_0.9767014015431597","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221230024623-6affc8e":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221230024623-6affc8e","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221230024623-6affc8e","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"a08102ae412fc37388da3d40d076d9944b0f5740","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221230024623-6affc8e.tgz","fileCount":60,"integrity":"sha512-NtG+AiVzy1VFJOomV0xp9995lEIXKtIFB/WnAZP2kdAzxrT8pSzlZlcVxs1zpdfIEuBiQJMQ4SqllJSayoKX7g==","signatures":[{"sig":"MEQCIBdENRYxJ+IV9CWx6mg5orGMN/l1HPDBTT3fqlwQYVDEAiAz2n2Viyng94uXcUZ6h7uscHO3BRMRQRvks/poy7qOBQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrlEiACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr2YA/+Jca+ZAWkgcgTZmAMi6coOgCNkYjRLk/bUGe5lEUa53rXDuJ5\r\n0V+N8m8vqOsyngQaPiTXS5Xt1SQkAFXkxIOQkwUM08Voom3h9USZ1XMoQY2F\r\n8+VNLH3YK5EkVXakp+qFEq/1I/s5Zhux03JSjUb1bEHcJawjzubuv6v4rDfZ\r\nIWUghJvxSdnn8u50fWYNf0YqEHM+z+IIPaojakRrs9aS9RystmDFb2+Sf3x4\r\nBUS0FPFNLV+7iro+BAfH5tYPISI6I12PRvIcR9A4Qu9Ko0zlpYUMXvCdBFPI\r\nRBHyMDYkPdGDwi5V+po2S3f1WO48UhCMA6/o4NJhesOAg7mioO+gcWqS7kke\r\nrwPlZiCrm7GyH9sk8+3Xj67cq3JFT2lH9WvuAWIVk0R33nAx3Cs0SU0KYEA1\r\nx12GgQDBIoehY2sS5l2uqjgDG9/DOeIN6JEfStghtNC9KL/mWqBC0V+aAvHM\r\n3yr7oRNI9wwWCfr67z0QzG/02xU0y9HtX8cps0N3gENfhfXXLMPoFfX14fWZ\r\n2Oieu51a+fxwbfeO2kXqPMscGOqNPfHsyzum0I/PKw4xBYnzEL3+EkRdOJAo\r\nghoHgHAjTO/FEzLcFwfSqUsxeMygdnYdkRVJ2p17n1L6UUUAY34Vtr/3aJe7\r\nU62HCFCkPIW3jVw1dZRoMYVC3YNBg1GBmJ0=\r\n=zBFi\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221230024623-6affc8e.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/81772ef336f1704cbacc9fe901a8fc15/graphql-hive-client-0.22.0-alpha-20221230024623-6affc8e.tgz","_integrity":"sha512-NtG+AiVzy1VFJOomV0xp9995lEIXKtIFB/WnAZP2kdAzxrT8pSzlZlcVxs1zpdfIEuBiQJMQ4SqllJSayoKX7g==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221230024623-6affc8e_1672368418172_0.8580924285698166","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221230111919-81c0a96":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221230111919-81c0a96","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221230111919-81c0a96","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"62b527a3b15a2f6ce2799cef6a353ef2cb018fad","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221230111919-81c0a96.tgz","fileCount":60,"integrity":"sha512-X7N9BIm8k6ETM6MMBaSzeSgCyBoO8R8frFFzeksn0JMVncAyKS2vPn53Xj2QbGMndBdKvbswrfmyRxOyu6INpg==","signatures":[{"sig":"MEUCIQCommtH8TtlERGvMKNFg4ZdZCyClBz8HCvyBGLawSm4EQIgTC0Ddxzh+v9l77RTXDkmlTW3A01U8gacEnmNxbMEJvs=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrsliACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoL1A//clIvtXRgpdzo/UoOcdJCGlOqgkLku5jIleSdb/uiL/bX8UGe\r\nSZVYC5/niQZa0EM+tEwckZ6ZbXs2vjPerwwkE2cO21eK0bjviYIC23MqWyp3\r\nZpbcHmKA+2n0rLKGWtuOhg2qcQyLFUd7zq0iGZ11ZgyICNjQtqzNGyz4XZ8D\r\nvA5VD2hYEKagGtNylRb1Q6WVb1wYFy44A3ji7eSkqMp9ijwX6/AZeNRswHcg\r\nF52p5wUvRx+vHaB04+D398ip6adX8MNqm0FybhUQwKMlRZBAvavBIEmT+O/g\r\n8nJO9AeSXrHwmwh9wE8WYjF4kIzTJ0k/dwRcY+wqV7c7ME79IbCXCvFfONk3\r\nlo/2YJitvxPGD6Goe/2o0P5oC3XCEPuH7+PXlrn7at80ARDOcY3KhpSfruvz\r\nBKiLb9GtfcELElaeLShnWhXeSZ0qe5fnSarHS6wuCV0+TIkMWehIJ5NpL/o4\r\nP07jaqhQJmoyCBomWTGtZqMa4uVfWNj3XlcYHigSK43jEIsOHOnxqfTslodj\r\nA2XlEWoZSj71oeb5pbBNCWaXsaRJtvVu/61O7p5MaA5AL8BDq4ePAQHtKDKP\r\n0GhjKUNsnekodUNS+gYtL6c69bs9ExzeYectY6/oR2By3kywmVp4NvbUpjG1\r\neZz4hTNdr1UGTadOrGJdCaL9kYV3ASUZ/Ag=\r\n=2PiI\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221230111919-81c0a96.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/0a6eda6dd6e2e347541bcedbc67fbf03/graphql-hive-client-0.22.0-alpha-20221230111919-81c0a96.tgz","_integrity":"sha512-X7N9BIm8k6ETM6MMBaSzeSgCyBoO8R8frFFzeksn0JMVncAyKS2vPn53Xj2QbGMndBdKvbswrfmyRxOyu6INpg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221230111919-81c0a96_1672399201723_0.35397140621382306","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221230112413-20aa0c8":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221230112413-20aa0c8","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221230112413-20aa0c8","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"1c7255567f82249622ae9e6bae4be3a593bd9225","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221230112413-20aa0c8.tgz","fileCount":60,"integrity":"sha512-KqeJCwI7zibk76yMBSGb3pUx0qQ+i3tnXRuoBZNasMJBfyQjlIp7x1PSOGRLHikkXjN3B3eo7Pppxb9zXxJ0sQ==","signatures":[{"sig":"MEUCIEmmkjcYHeW7qKIbny/FibotQsj94mht2QHmrEimlZtxAiEA9bc4Brke1OwLb+k2xei6l83hmLudMmrPAa2nFevoIgA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrsp/ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmobsBAAgLRTa/nVgfCrGGKxvtVSfw+6GL7s2F3nAcgmTK9KwfK2pTLr\r\nkSoeo7NPNwya8bDzsrRsY/IhjWbiri9gxLU0pnBrvNAYXA2UAYS5+eCgldbU\r\n5KNofBps5cxrkDdejIsMkmmOqEyS3wST8WPkVaiLN8zzVBv1udMVjnZ6RZzc\r\n1I8Bm29pzpBc+iJN8xAcwl+FS0hbfL/dKH2pqISyOXUl5hZzwefKg9MrTUfI\r\nyJ75ZzFhVW4SdlZUduxKhj8wi1BAOaZCQIPcXEclUEz9hGe8o9G4sclg6NXN\r\nbY/i4L4Prjs1tA9VBnOZ4vnz69cFGu5KFvL5nunKZtqVSJCEwLcjenTz4NWE\r\ns1YXJUyL5B5RmkffUbLwfe3hbEWs7l+IFiyx3PvFhaLlObnbOtwwmJUllEvz\r\nDCXR6XBMRoEQPVWyHeMoqjTx9+d4zC/4TGn03aoMGehP4+NBlzLbB1/l9jv2\r\nI3Q7n8DdTJtxyg0kPmGkorlQ5TjiA9/WflZkvlYPGZ+S3LinDu0sHBlzTANu\r\nOqPjqiqLu/RFMNJV1w/+3bT6ob/fRc4lQywjeuvpc5VgINqVfP6suyDhPCX4\r\n247XYoCsBIaoTGPoeAUh4ZBDKqdSVfFYvq9Ux8wn6XhLu1ER4NyucUvWD2r0\r\nqJPdSab9egZbkjf2N1H0Ak6ln2fRJnuDefc=\r\n=Svhy\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221230112413-20aa0c8.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/d4b9eefe14c32e645cd86a7ff015072b/graphql-hive-client-0.22.0-alpha-20221230112413-20aa0c8.tgz","_integrity":"sha512-KqeJCwI7zibk76yMBSGb3pUx0qQ+i3tnXRuoBZNasMJBfyQjlIp7x1PSOGRLHikkXjN3B3eo7Pppxb9zXxJ0sQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221230112413-20aa0c8_1672399486845_0.33396211549258004","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221230114725-049a139":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221230114725-049a139","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221230114725-049a139","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"1263940367340f1e1ce56fe5df094175c6a04311","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221230114725-049a139.tgz","fileCount":60,"integrity":"sha512-D77sJiOYlUgZ/yt7l68LK20dYmqOI0pPk1omIzlion5oZAzCdK4VWSrqSn3PlI0k94BzMZM6bIIw5+vPl3W1mw==","signatures":[{"sig":"MEYCIQDCDMcQuU3MsM4YrTPBeAuc1kYGBx1JKFQwvM//LAX4HAIhAPeJ3FgWm+ybQJnuITUX3n1HqFhA2FIt37e4ZyGU3wZj","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrs/xACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpSjBAAilmbvTYupaD6yevJjViiRbeUJ1EG4YTUEPgFFvZ3J9qnrJW1\r\nD9uJoBZmKVfJHIWVamTjDMFGehRfp2zmKLudsPw5UM0sQnHREjfusfvu8z/w\r\nvlqJa2Ao3sMsRQG2nyKu0t72tepMloUHkRYj7x2bT1irE75cTN5GXE0h3SND\r\nwJLgEN4VbA5LHZnrljmH8jbm8ZgZNi4CxsFlFDTNmMAS6wtAk76eomhs2pk+\r\nJazNTDo2upR/E6RgiADPkCmG9NPY465XGGwDUecicuoiMqBHjfBMkM76b3JX\r\nwoQzTjFWFeQ0vuEiu6Hxr8O+tIHcQoWA/PLk8wlhpdLJG1AJNQuYZKyrwmr4\r\n9YHYUHj8bJ2Yg/M0MK6sD6YKrIS0/h33XFUOiSv207I+myTaZ+yEshSm1mcC\r\nQqu49Ksp0ZxZuEFW3PgLgB/oH9iU3o+2vN99AC03ujb5kK/Q7xHQ7PvJS7AC\r\nwhhI3AYslr19/IFcbi1z34l6RbXlmA7W6rvrhHqVH8xo7e4n3VBH8rqeAz7S\r\nHR5CjuPpf+18oNouQ3J+jUlCM+eUrXatdKQyvvj7pPF1yL82xyXURFKQd1/G\r\nnP0Wzq+s8EU2c+FRbxFHeP6XGuMs7kpumf6Vy/H/K3W5tNR29/HywFtipOBR\r\nNfwkdIKlFbebyb624U92Ui7fT1aiAUlMUlw=\r\n=kdMr\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221230114725-049a139.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/8fc4f1a88c5a05877486d0cfe68bba01/graphql-hive-client-0.22.0-alpha-20221230114725-049a139.tgz","_integrity":"sha512-D77sJiOYlUgZ/yt7l68LK20dYmqOI0pPk1omIzlion5oZAzCdK4VWSrqSn3PlI0k94BzMZM6bIIw5+vPl3W1mw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221230114725-049a139_1672400881671_0.6756459578248659","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221230115033-08a94f5":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221230115033-08a94f5","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221230115033-08a94f5","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"9a4f9d86cf5252610cd428b0ab9f4cf8c46d0191","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221230115033-08a94f5.tgz","fileCount":60,"integrity":"sha512-3WjLC2ZV5JF4n+QTdcAJfj5k4ZdbNK4z/P5t8NzsRxSQjdqVGATq24/iJA8rxxyojCJaP0/Lb884oaAH2CgRug==","signatures":[{"sig":"MEYCIQDccK5Dhiuh/SpXZX8nA0ZsQjpp8KlOfwCQtowyy+iKPQIhAOxJBROyFDWrppnY72HzRWC4FCY1j9Fsre/0m1UPEfZ+","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrtCrACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrsYBAAhvwlNt6U/eTnZEdGVniVNYcZV3BU/9S8HVMj2BY8iklMC8gw\r\ntkIYKzTdqp8wEhc2AJTCdeyBroKhr9Oly0yBvwjii/fOxfj4TOZ/eBcAr7BX\r\nGhozsh35Kw+1WJRsqLMwuHteEpuMWgRLrr69sL1CBRoMkgF3OxltoyZXC1UQ\r\nsH6iKz7husqokRy2QPZt9QAyR02L8pHFq3lZk/id3kjKsOL37uNnYRNe+i4c\r\nI/OUDkomrjcwbuaVYGs78IOr5kAgfd3XczRjxoqrv4HxWbHMzFw7cxB2w9k4\r\nIAolItQ3Oa2wUC2UNGPz8Nx02cCVDj9Iir+Yg+5Ro/kVpn4hyoS8CPSh3O1m\r\nYaAyvm6MHmxIZhq617xmFD7C72iHr2Mf57uD0nezLi/4JOsES2Mhkl322N+k\r\nYIL4m4z/CmHDfw3Iw5mhQNypf0Y9T4QLv8gBXE9YP5J7twl3H3HhJwdH2GqK\r\nXNmtogRXyCD7zoP2bVilH7mDumkMzZlj/rE+Xu39irTm+uLXOElCsdfOWuUo\r\nXHeLHBYr8lO9XexPJM0wj7mRVmhEvgDqd5t7nORRTRU1VIZ3Yrq02h9y8hl7\r\nZhnnZiyEZzv95b5XtNCCe3ukBNmWPtODbHtP3J5+RgdsdSdINqaqx6uZggtJ\r\nAr5R1TKNYK/XW+hveOnxax7rMsVpxMFYizw=\r\n=1+r0\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221230115033-08a94f5.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/39b4dfca2200aa6c8431cfd26c14cfe4/graphql-hive-client-0.22.0-alpha-20221230115033-08a94f5.tgz","_integrity":"sha512-3WjLC2ZV5JF4n+QTdcAJfj5k4ZdbNK4z/P5t8NzsRxSQjdqVGATq24/iJA8rxxyojCJaP0/Lb884oaAH2CgRug==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221230115033-08a94f5_1672401066906_0.9588989672334551","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221230115516-6562f4b":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221230115516-6562f4b","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221230115516-6562f4b","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"8ec42fc29dc9f389528fec00b65a664435de1e40","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221230115516-6562f4b.tgz","fileCount":60,"integrity":"sha512-43GE30JQyCjKUksX6tUdwPjO/MEqLSuikFBloXoCFo6rn3893he64MS6UExGhjGZARD3pqzyVfzKesFMhWauXw==","signatures":[{"sig":"MEUCIH6ihnv3wVJA6aQEz/hNBpFeCuYBzzmuovq2WTFQbHrxAiEA3RJLmrXxLIxIU7XnWW6swBTPFBkwkWkyLBOa6WFpQTc=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrtHLACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpIQQ/9ECubD2zBDZVUP4YzjPOQ85a4nZITwbz/ETFkd24OILZfqUhu\r\nyO0PqoyT0YPrQ0LLkOcwwBzsUK4Rkv6tkpmJTWa2rwnjRi8lCAR3gYoRUrr6\r\n9U9sx67/4pfy/HI/EyWw45hyi2JWMGYx20Ebj9DpkV+OBcmPWweBlz9zzRn5\r\nIG8MkOO4SDlgGzIOSNn3R9A6s4E69hT1fKi0gCCBuDVRoQ9bJXHgc/eQxg8v\r\nN2miOaBkP/xT8LwlzLj0Drl90nZpUDfSOyIyH5TUQKYxrz/gmV2r7HsbZzDI\r\nQsmjBE+IAXVUY7Kb68RYdVeAThdLahtspHWikMUUl4IGLqjzDNLCTH0VUcXC\r\nAql3Ey1btxb7Qi6UNTZimyCG45vRmS9IXcCzKOmVp7VVH7Ys29PUUIu9fLYk\r\njJErO8aNqcVbljE3hGOhsxynfKQ7wZefUm+B3laIKacDZFLX+JbibwV7jwL6\r\nKZLWcE+9AkEVH4F8ozTcnSqD5O7wfsDSiVcNlvl3AEQcwxQtot1M0u+sQVqi\r\nkthIx0T0Al0Rza2DWAIzW/BsnECSTiNMRrW9HIBZPWlbMYugLMXDi23PDTey\r\nCzZ91WBkGDmjhtPFZnZKLjrOkB++0figMIbdhhjaoyer+NKwRpZ6qMK5nJhX\r\nkDrRw7DLsXUzb0TDqueiVBE+tKprIy+WtkA=\r\n=GmYu\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221230115516-6562f4b.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/638dfec620fed8c9c0dcd7f5f70e259f/graphql-hive-client-0.22.0-alpha-20221230115516-6562f4b.tgz","_integrity":"sha512-43GE30JQyCjKUksX6tUdwPjO/MEqLSuikFBloXoCFo6rn3893he64MS6UExGhjGZARD3pqzyVfzKesFMhWauXw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221230115516-6562f4b_1672401355409_0.9111624249437686","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221230120024-6780d0f":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221230120024-6780d0f","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221230120024-6780d0f","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"02dc0468dd686d5e71e2b5e824ba9a74fb0722f3","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221230120024-6780d0f.tgz","fileCount":60,"integrity":"sha512-VopRAxvH/sn7me0+d3Hgxc9sDrEnrK3J1dfCiktqncd3pYECVrS9M+TFmEBMujN5O2Ad22u8+COGgBk86gei9g==","signatures":[{"sig":"MEUCIQCXXFM6gF3rr232cFbMsH0Zz1EPJf8xR411asO0JuoK4AIgMhRSrWQMF6WCIcPr27CmOCu9GAECEZdQVIeL1J9+Hvk=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrtMFACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp1ZxAAgHiz+QWaalIoKvMp7qtrZQJv4+K0yI3oU6qqjgXC3yUnpZQ5\r\nwMtZ1iGtmbFzvKl+F7vXbNSIvgu4je6bty+A2liTqqFIKn6ogALVL9X9f/TC\r\n+vGyb4Ug44LjFly0SVXuuxa7EYtvm0/FXX4onjf2GEUEk0z8EC9xvPKhsetm\r\ny/0k50NV2V5u3GbzFGjdIeIQw/umNFgyKBAUq/eKS0S1WPtMwONB4V3A+BAz\r\nnMDBSZ0YCOu+6KwUBp6r8UN/vplXlbaQfZEaMx1jp1wIQcK3Oy+tw5FN8WF0\r\n1OIId5SP7gdszhGL2+itxNMD2gq47paNc8BaOpCuvEICUpWHuWOfvu96wtPC\r\nmxYUmBJnRwfZTBtVa+dKiB1hrgL11zke+EgWsnfiZv1+fEzCoEhKp81dxiuF\r\nd/M7FUaoBZyfe6ySXgLRyGY61GTAsrITR/JgPiPKCpcwU9isB/EqgKNqnEd0\r\nrbLB02T6QbVIEzS88FNeCvcWJzkIAOhtPiM74bwJWtl5W0SAOmzDcc0zKrFf\r\nl94iXOLuwDrYnvq2p+9uGh75EOGhchsLmkb3sjgfUaBRWxV6g1KilSo33SdB\r\npTB26nBgZ1hUW7xJQOMI3RFoLA8o/jVUqZFK1ecie1Ps+BB4FGxS9Ydre6yO\r\nH1oHy6zxVybtZDMKlwMkyF42wZF0E0HQZJc=\r\n=6nxu\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221230120024-6780d0f.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/38139a2d5cac244298523e498c63f662/graphql-hive-client-0.22.0-alpha-20221230120024-6780d0f.tgz","_integrity":"sha512-VopRAxvH/sn7me0+d3Hgxc9sDrEnrK3J1dfCiktqncd3pYECVrS9M+TFmEBMujN5O2Ad22u8+COGgBk86gei9g==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221230120024-6780d0f_1672401668844_0.14250175573179158","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221230120431-3cea474":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221230120431-3cea474","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221230120431-3cea474","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"30edc6061991cd8672c546907b028885756a185e","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221230120431-3cea474.tgz","fileCount":60,"integrity":"sha512-r53BwxjKW1dmCPZ59eBJMMLsXiV+gRpUMGa8MeTPb0jK/9LJPP2H4wWEAoD2IY8sufT2bn2R969Tty53XyWyrA==","signatures":[{"sig":"MEUCIQCCoRpXVY/x7q/2Fo54OWfJbmxR+0FAhfw4LC2OcmQ7zAIgHrx8AB4lMbn6uQwRKAd6aXTYyVTI84CMkFgJ7RWkDis=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrtPzACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo+RQ/9Ewk7GUfUO27U5vR8oQhzx4yBH1c/gVfccTIR71HagVyZEPFM\r\n6TPMXlxrYO3f6mreLXCgp1TxrMVIN7CfdT85zVobN9fRNH/clvHyMnMbo3ME\r\n4bfL+yz34frnCGHniBAaV8QIVuamoHuz9kzb8kajBxHzd+5r+aHGi2bLX8M3\r\npLTGmQcYhokw2028Ym3gc8WXOvZpPF1NoXmY0sUYQbs/h8mfGOghS3DFaxRJ\r\nGT8hNcmMZhERhQfNZxOJV4QBP8Nytm2ISfUy92QObutoUCVINJhCF0usiUml\r\nZlQQBzBb7D2f3uD9GK/8x0M1eao5Cq+4rTFfGFTNuX031vWo3mMmbIk0OBC4\r\np5o8YaioMPPUnCYGhdoiInysdTOKlLp/fL43hgh1Lgl88H0kMkxGP2tYZuHb\r\ny4KNcfyGmLWmtbI20GMwc6rmP0GiLjWGk9YGj6Ev6fQyLH78UgS+FnNTSBBH\r\nRt5QfHc1e9CSSDgYJQoI6J09YNGug66drzvMv20mhimo8ArgAl00hDtyydMl\r\n++lcWP8uCGB8ocZWJ5I91C40qF3hD5oy/h3GMdMTpASXAadJLd71E554UJaS\r\n7Bma37DZ01HWNvnDpHiYV675y/a46+9IfHZB/obkiDxdB7EAJd/uRaOJ9slN\r\nhstuZIbY+pOwtFkWoESg5IzirTGjFiRVs7k=\r\n=ue/Z\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221230120431-3cea474.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/6fb8cfbd2e481feeb2f4cb0818528075/graphql-hive-client-0.22.0-alpha-20221230120431-3cea474.tgz","_integrity":"sha512-r53BwxjKW1dmCPZ59eBJMMLsXiV+gRpUMGa8MeTPb0jK/9LJPP2H4wWEAoD2IY8sufT2bn2R969Tty53XyWyrA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221230120431-3cea474_1672401907042_0.9687887434635534","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221230121115-09c52e9":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221230121115-09c52e9","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221230121115-09c52e9","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"2cf0ff1b6854f9880a20568da6ba68477d2892c6","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221230121115-09c52e9.tgz","fileCount":60,"integrity":"sha512-QTIf07L+l0q8qdn3xbbok/c3hTmNAfVhN+O3MCGoscPSJjI5bHz3Nd3muDJWQRH1fyxZgQ0Wii6Gewg8ZhrbUA==","signatures":[{"sig":"MEQCIEGCyTTH7a6PfBT5nhebNiKAD/SzRiuzq66ndWr6DH1bAiBh0UCWWFHdXs4lAC97jHaOB6wRTreOcGXKpAzHpiyVgg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrtWQACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpxiQ//SBtiEuDjyYrFUS9Web98BAkurTrF759Hnd7n1HiBdrNkNVq1\r\nFh/jmWJtoHgqyv4yiQ2Grs16h5rVZqoEyX424mvNzmDWB/ksprYmK5vOX7SG\r\nDnsDKeWRDa1twt+LWipiZ22aODCkV0ZSPysAKJVuizm9WWbg8d+SVeVkiLfO\r\nS7661cuhiJx2iHEFy0iO1Pgq+uD9zjHC0MTqZmy1OueY09Ya78cAD/nuvPlC\r\nM7rhc2hf2lVI+j3sFm/Tr7AQeB8cSseg4tDiDdgIEWD6u85x+rkuFo2xo3Ri\r\nocGD2pl5ejtE87L3EfALfb9BsObYdfobMpADmOB6mm2WyqhtMhIMQMwHFlSV\r\nqdzvs2zp5XRLp0GI7a2vIeZU2plD9vZqw4zou08H1zSbIT2/GbESweTA+jxo\r\noCgDv0tVWmI5WE0xsz4wMEBRc7IesVDTwZiVmrtfYXB0KDEdraZXMu2Y9EWh\r\n86kxVkE/X2PzhKMIbV6t4MPrdnmC7dhBjwG3OgaUlVn+hjtVsv00dXUfrO/7\r\n2OwVcWlAyb13iX6VKlN7rOAI5USH0vJcR908w1xBoIFkTl4TkcI0gchDrXg3\r\n24myea2uO6uCfqxP1CcVfZh5IkIRYta24jBhDDT3PasrsQNbG4iM/jytVUrV\r\nZZgxoTLPeFb4MsTityOJU6z6ffaYWaWwLVg=\r\n=LHpt\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221230121115-09c52e9.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/f2f8103f6f1945b405e0507bfca6b796/graphql-hive-client-0.22.0-alpha-20221230121115-09c52e9.tgz","_integrity":"sha512-QTIf07L+l0q8qdn3xbbok/c3hTmNAfVhN+O3MCGoscPSJjI5bHz3Nd3muDJWQRH1fyxZgQ0Wii6Gewg8ZhrbUA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221230121115-09c52e9_1672402320526_0.7225407572255131","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221230122000-fdf1aee":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221230122000-fdf1aee","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221230122000-fdf1aee","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"a55e89ba1159efe674b76a13274849d46382c067","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221230122000-fdf1aee.tgz","fileCount":60,"integrity":"sha512-A9sghwZ1J4ZITZ0Lg6S/gRkrcanIp7DzuyH1MuYBNjMzzs2Px/hX99EMp2sN4oRPtM9rDxqNWZP97excvHA2yQ==","signatures":[{"sig":"MEUCIEy1xqXbTjjvya64Vzjk5WNprUn2fY9w0W7jhC/9yZrvAiEA92OwWzUoz5C4mv3y97YVDJv8AkZOwKlJ1/RsvZc0n5c=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrteSACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqanRAAnR6BBGrHIQgad8Vo0njCEHJByoq+AfEm1DG/s5LTFIDf4FsQ\r\ne6N1NKnMN2HyhGzpnXwkz3QtN75s0sIY3OhBZzCF3ReKt9k8SXz9XZIwk5gV\r\n/k8XSIBQhKDijOXmKM/0yq1LZrBjnD5ooaDXBQl20lJAIkSiSTPWXZoEh7A+\r\nKgxEShQOFpO2laQaNXHpaeL/FVoikmgJDfqQBXAE68ykmMjoFsjcdhSBDaMs\r\nNHL5/HW1N2fMDGVHkCDu2+1uSvcuMqj3vsYPzYswuBSrImN4jkDn0E6OEf7c\r\nFoF9amiI5q4BR4uT5czXHxHLSU8jadLGfXFxAbqvQGDU6PQRS+vQFenykNcV\r\nxNQKN5yrc0XVU9KRKH5JA7QyVPf6JY+4DyBETIWz/7SA7jJ37f43c1o4MJkT\r\nDeyZaUSzumdu1C1Z+MS35t+0faWMCr1V/UUWlbcj/l4/6MovvHO5zYfLPznn\r\nm/vsRlGjiRFqia4M4IBZENJbFh2Gya5sVlC0od2YroIJl83nArPYGZtrtS+u\r\nLUAjSWP7+QhJhG4PkgjgjRS+eCnkXvatTdhdhHjF6HpD71ne5emaiOcAF0Nz\r\nV/IIxYy+TbqwRtyTruD3seSz97inajQ/hW2z9NDmurs4UZCfvVNS9sK8180b\r\ndc8OEr0QgrXBepG1tTrgs2PHlR2jsyFb3Ro=\r\n=l+Sm\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221230122000-fdf1aee.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/f66900c47f6eaf3b0f6e7bdbe61761fc/graphql-hive-client-0.22.0-alpha-20221230122000-fdf1aee.tgz","_integrity":"sha512-A9sghwZ1J4ZITZ0Lg6S/gRkrcanIp7DzuyH1MuYBNjMzzs2Px/hX99EMp2sN4oRPtM9rDxqNWZP97excvHA2yQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221230122000-fdf1aee_1672402834592_0.7041310595133863","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221230122009-7dc0e5b":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221230122009-7dc0e5b","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221230122009-7dc0e5b","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"fbb32e735eb3c58a4e63175743338994bdb2a3f3","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221230122009-7dc0e5b.tgz","fileCount":60,"integrity":"sha512-o+lcWQ7MgQchO1Gcr/xWDnu0DblxbsN3FyZ0fC6sMDUskmvdr9p6NzMJN0EViWh2np91mvyh5SM9DnxvKLvVWw==","signatures":[{"sig":"MEYCIQDtQ1fn2TMgoFmqFwnTy7QV2Dv82I/Wj8MLI658WzN+lAIhAKLw5PQbOebAjaXdbUGVpZmG+nPXWt6R97SOwA24kCPU","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrteiACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmriow//WwwGrJenPbyx37w0YY02zgD4XUZePLUMgSm+pRjE8IoDe5+I\r\nCUDcZSnJ6OowHDiq6KEpDMBpy83OTQLNcutyW1TSP/oI3vUKIDxYieuk98zg\r\ns5ITRRL6UKcQE2WeMU/QVVv9XMyWIxCgY9ktVxvLjsFRZaFSHdCWPMLf28eN\r\n8cvI4Nkg0yLRuw5NkPfZnO9m3v+3zQtvoMykpdX7z0e/7zMhD2ZKFY6RQPWp\r\nT4XGS25+X4e37GsR10PXveMkvRlfpSA2eUhF2SoL/pQ2teVBFpcWo/ny/MgF\r\niKiq/3WGoEnayBSV5hCQgced9AYcDBB4aSsjEzG0vdHUZE+u/qOjxIrkthF6\r\nyhKeGPnFeCylF5F2TKB2xDthejuwPEyUk7co29R5ymvoPfYboVm17CbT5Qd8\r\n0+gywhdtRseNQF3GEAH7rxoFtU+AUpti6lc4CSxd+cusNu1nVQiB/pde/6Ob\r\nFdNnRi19uW2Upsa21HKEXffQgVOeyMtk4HHEpdgcSZEkFz7xbKOLSZuid4B/\r\n1FH9fcjqVMgC5IvxV0jbowKpNXEZwkU5SXDlMQqCB1BOX+raD2wWBE96rs+w\r\n8O+WhvcGEPOA/Ipv9LYJh0q0AqO+FhMX+HcXqwykvH8TwOiZtXqgRj8etAUF\r\nbQqEWUDnVJBwbpkub6Kq/OAM0Zqq/Ksx7LA=\r\n=v0Mz\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221230122009-7dc0e5b.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/0e6c0217d145669260e8cc88479b7c87/graphql-hive-client-0.22.0-alpha-20221230122009-7dc0e5b.tgz","_integrity":"sha512-o+lcWQ7MgQchO1Gcr/xWDnu0DblxbsN3FyZ0fC6sMDUskmvdr9p6NzMJN0EViWh2np91mvyh5SM9DnxvKLvVWw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221230122009-7dc0e5b_1672402849741_0.3256819619318292","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221230122330-2569107":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221230122330-2569107","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221230122330-2569107","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"01d902122f3e5a06e2299eab86eb047b1b151832","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221230122330-2569107.tgz","fileCount":60,"integrity":"sha512-M7/rGIIKDvyEdeY9GDzu33uIiR59OJRBMsfzlayLGLY8gNa6DRorRFhv186It+wdrUttXzUuef7JZcO4anhkDg==","signatures":[{"sig":"MEUCIQC/0RcVlACQSHTiNU2yGlV9oHJN6yZ+SLDuuGYpZ1KAjgIgYXx26UGf1ONxDyv7dYHwSy73sdAkthKmkKJgIB3oR+w=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrthpACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp/Tg//XRBxeOHwu31Kb89Vmnz7u521etBC4VGM1N7sVw3/GYHtpQ8Q\r\najYPshwj/qtBJmvTeaKY/VFlSLDr0/uKS0u3X2Nk3keASX/6UhEixoAz7qiA\r\nVApG2RVuRW4R0kJ0gs1/dhMkwZHjSHPV+i2qjMlBYpLjsHpf77cgfuq3pKuE\r\n74dl7lhl4fVq/g5GWuMsnOb5Y2csD8LfQrKVSgwgWDx3RlIQG8A+FP5ttina\r\n5Ok/aGhxLIBr1OOcoIgRhFYIDIJ3IzfoVTBV6hxKo1zv6FfRPWteVsDPSjGy\r\ny7zW53G2bUP3sFiyqExghDhT0GB0vi1dLqg7uluDA3+Y8vQ+gUo2Iwg2JVQ3\r\nrXp6bMZO+sb6CeuzwI410XwGcrTSCni6olQkJT4fqdOVDz0RaNCNWFCekZMY\r\nY6FK3y8ZaRbStSmmzTK/FJhNnu93Qc5RUcKj4+fz/XTwYkuEx12TbZ5dbPyc\r\nJ6VAimXVuvN7Z9JhMgmOqe73N7EF3jprb2wnv0NvkJg9mHDar3BG94S1WlDP\r\nyg8CEclG1y7QGE3z5YW2jddy85uPi2c28k2UD46nfuudWcgAMFdhWM+JtJqH\r\nT3RAOwE2YwkOMjZAAoQH9m63TyOT6dWqLTaK2Y6hkGTXyZxjHP7PiJetn431\r\nPj4baAzcReK0CTkwxfkcEeRpn/WwYJhQU74=\r\n=TS+j\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221230122330-2569107.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/46421c47a6801a680eed49f7491de32a/graphql-hive-client-0.22.0-alpha-20221230122330-2569107.tgz","_integrity":"sha512-M7/rGIIKDvyEdeY9GDzu33uIiR59OJRBMsfzlayLGLY8gNa6DRorRFhv186It+wdrUttXzUuef7JZcO4anhkDg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221230122330-2569107_1672403049301_0.6421425126440343","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221230122453-83224c3":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221230122453-83224c3","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221230122453-83224c3","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"95944ca9d5ffe86d2c72f6da183211fe4e628ceb","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221230122453-83224c3.tgz","fileCount":60,"integrity":"sha512-G/y/ekjgzSqbNkjr3UgyyfB8XTITZPHUSs9bJKneuiq5nZpXoknJDW3p5JBEjZKOfwg4ykKWtp0S1SwzTYhO/g==","signatures":[{"sig":"MEUCIQDNv7tLUecZsj2xWwrus2c1/jX6AGcHH7WfXFioXH4EtAIgEAnWYzvloQ+4hREqibNYOhon2mTfN8OZ0Vi0++VqSE4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrti/ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpqQw/9EMfU/fta51S99GD6IUXt9zN2BM+GEZxgDCcrLTYa8+2coilw\r\nkVGT20Gv+nK75nXCh2QjZpMBICinlxhBaMDEiglJ7vKAO7dVdKg0v4UlBdrx\r\net4MKPALyEzO80QvEhu99QK2MufV0EwTS5sO4/aR5ZUCdoYdAbjJbry6SQX1\r\nioqClzlxqNAnzD4jT88r5Qpu/qjwYc149kwPKhKcmSibD1vUyPMyJz150JHy\r\nY/Nn9rVj+F8r12p5sFNfj+ThH4UJMTxdS1cTPIVtrSN4BCjubT/Nz2UKheZ9\r\nOBfR4qurGBU2UM1Po4U6Z5v3Qj68dQPjLQFnc4kaLLlX8EF93oNWbK4oWFP4\r\nO5OqbRX03uMHI5/RqjKp73Ww8SFhE4GE1oCJH2IxLh9PNbtkbJo+8SAO3Eic\r\n5Jrnp7AvfVg2heguwAA7ThdcFGg2ZHMhwTBJtdBeeCFjfsAYkZ+MvFx1TiFg\r\ngRLKtfamLI8IrSalesL2h1OuM5o3kkOJfXtFRCEd4Ob4xqzmx8EDuaH7vtBa\r\nwwQo7MLk+gU7OOYvA/+yITcsYKfcTdSU0bUfsQHClvytVw6dPywxrLoiBr4+\r\nh0iIvZ10vvTjEfnt6+4nQK2Dht1PwxJ7GtXbdFQ6hQ5HwdApa/pxYBavZswE\r\n4CKfC+m+gG7nMKCXQ3kpTiXzxrUFbq2qNXA=\r\n=TKzf\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221230122453-83224c3.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/8fcebe44c3ab9cb9f55cb63addfcc899/graphql-hive-client-0.22.0-alpha-20221230122453-83224c3.tgz","_integrity":"sha512-G/y/ekjgzSqbNkjr3UgyyfB8XTITZPHUSs9bJKneuiq5nZpXoknJDW3p5JBEjZKOfwg4ykKWtp0S1SwzTYhO/g==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221230122453-83224c3_1672403135431_0.8565428853268204","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221230122941-036ef7a":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221230122941-036ef7a","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221230122941-036ef7a","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"b32fb3136700fb5bd1f57f53fbf8f53f84126f01","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221230122941-036ef7a.tgz","fileCount":60,"integrity":"sha512-isC/Ve1Kb+TTedBOtMALORhaxNKigqnSDzHXNdFlarQxOqmr0STDkRgjvSlYE7zcCeZI79NF8axauX/o7d3DVA==","signatures":[{"sig":"MEUCIHSDZbJxb/hEdW4jbIS5hdP8uiuwmf04BgOvVDR98KvJAiEAo5rjGmoiYMyP6fv9OmjJEQHoys+iUkJeiRWSPt+90RQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165581,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrtnXACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmodsA//Zg+e0B7rgRmQ7pe4eCZQqnpcyyasGw6CXtrGz/JWGpONmvh8\r\n27vXjY7jo/mp92tnwOJx53zWlr1ZCurU6W6nIup291FFIXCaM/neGPwP2HuP\r\nEtleIgFOEJOUPJNh3gISbcR1DkEDHJp5Iw/NaItRtH4oOOsYi+ziEfvI5NDU\r\n+nmJA1i635Lyt60jTKhI6+mOJ4NVSukajZ8/KmjZiptDfyd/aiMAe0KZEhBo\r\nzpSEdOSAPo3oFN2ihTRV8+ghyMoXGfxWbrx6EkGBiY0aGNBXNHo6h/2WMBJm\r\n5LKUp2bKjAdslItD5KLj8yTIiXL3iXxnWKLAqDtz0eMA/4siATq/cN3Mh6eY\r\nforzeKaTDY33sBlBTDcAWBFHFx/+8vxaHaqJsqRzOwqN6XppCRgzXuiVj1bJ\r\nQe9EksOpfd9qa5M2OGZ61tnLCTIdHvtFgoinv9gSglzQInAXR8O2ha3vMDt2\r\n7jM5aw+axXV5/XMDYU22Dya8XeCDUo87x5D9fUiT5qB+bJJHuR8ImQXjzcDb\r\nQan0r8YTfce7HhazuNxyEJXgUCA2slNoqu11sea96bHlra/R0VyUdl8e5q0L\r\nfw9G6XRP20RhylfDDKo+nZZu5u6GbxSqm/eShwOtV4kYlBrhTxCtj0X7QWoQ\r\ngPHarU7UkCuvfxRXCaaH7UXND7+xVS8Xbdo=\r\n=LTJY\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221230122941-036ef7a.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/5654ccc288c1323e6a40a4037df35ee3/graphql-hive-client-0.22.0-alpha-20221230122941-036ef7a.tgz","_integrity":"sha512-isC/Ve1Kb+TTedBOtMALORhaxNKigqnSDzHXNdFlarQxOqmr0STDkRgjvSlYE7zcCeZI79NF8axauX/o7d3DVA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^9.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221230122941-036ef7a_1672403414883_0.9021306862093361","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221230130350-ce45990":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221230130350-ce45990","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221230130350-ce45990","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"74cf2a4c63fe956e88279a7ac7db0dbcb8c799df","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221230130350-ce45990.tgz","fileCount":60,"integrity":"sha512-pbUg/mek8VukOg0YI++HF384m+kzTopQA8Nf7+jh7F2h6ZeZkW/F1r+t4jpRaZNZ/Vvn6Yxw4w1WzgFxzBfRSw==","signatures":[{"sig":"MEUCIQDOGEzmsoguZEAXcWBvVXQK8wgE44JfUm7o/GYS16/WowIgP+v1Ce/ma5G3rItgw1sNfv8Ymz5G3H15VkCI/rF6NFI=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjruHkACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqC9w//ULLUiPNulDjLHaA9RDHHC/YW6hHHJ5KrcAh8wj5QbLKQ+mAB\r\n6XiX4KxvYDa+/U28Lm7kYdz0vZfLxXzncftXhGGDc+7LeK9aMqyT54JF8YRE\r\nLBfx23dLUeCWD28nSLEjOWNbwLCndxgYfdEvJyzQsSmFchqKV+0961JdrigH\r\nyx2ttnNITUofPf1vTmcXAaYlo3WZfzVgKr0PeiaRZz5p/PgbdyjtvO7TZPVG\r\neio1jcB+V6yKxG1fffbSBetPCcOlbg5SrBwC9Hu3ZiARjR7kSuhI+GCzT9e4\r\ngFwvEY0DkEk9A807ds5Wr/Ca3UCF3POxsrmYDdUG7WVwboITP7EkQVTkhV1B\r\n79CmkTjUiwJLXHt1mDOlBKUkGpgcnGKmxIP7f2S8CokYdzAI3isXHrcs0CRG\r\nLqTSUqkZacnvvIL/qLVlMDfvDHBygLuTuE7FCChFL/fwzoT34V0bb52t1J9+\r\nHh7Wf62X80bwHuA4ABc9pp6yFb5w/9FPZkrCRkQog8AaV6N4Duz4xQsVJYPO\r\nnW9MJmqmticZbUNHB6co9Zym8gqTlaOygPyP+915Z/sozc94nRxW00x88AK0\r\ngmbB8X77Eut9blnGIwc1Z3Z7vmrRT0RFfl/KVG4I1Aq72kFgapT/JO1QG4Vv\r\nhkdjXpi848lqysV6X7YgW5qD8lWUPYKFvng=\r\n=MDgi\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221230130350-ce45990.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/64caac527ed0467ce9da8a854faf9a3c/graphql-hive-client-0.22.0-alpha-20221230130350-ce45990.tgz","_integrity":"sha512-pbUg/mek8VukOg0YI++HF384m+kzTopQA8Nf7+jh7F2h6ZeZkW/F1r+t4jpRaZNZ/Vvn6Yxw4w1WzgFxzBfRSw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221230130350-ce45990_1672405476114_0.5409393157054494","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221230143215-80815f0":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221230143215-80815f0","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221230143215-80815f0","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"7b9d37a3dfa42a02f93af9992fa7c7fb6b5261c6","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221230143215-80815f0.tgz","fileCount":60,"integrity":"sha512-XR1uxOTTEKMgfQfxpq0p5qC17Fuq77I4LFpnsPu4n88ETao29tDVe+vGbvhMHSmvj6hEXXc/TUakvCY0pUKvIQ==","signatures":[{"sig":"MEUCIQCLB0zqRe3Pmf2JkAZ+bTFgSUYfqPexj5rO+kxmb1U0WwIgCk+UaZ/0G8mzOUg5/etM2SmXBnAdRlpXBG4L1mZmfC8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrvaTACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmqw8RAAkTYQ9WOetSS7ID3Fq3S2LKOtK8ptHYMBTD+C4CS1Gtc+E7p9\r\niuJ8mmP9p0kLrji+KuXSBdQr90ZFBFvuthXBKUVna6IDpGKKab1wURiV0dcy\r\n8ow5KcUhAC77JfF2m4ndIHwWwQpYUWbt1IgeUQId9aTtAVg7gis+Tq31HN1u\r\nZj0bCc+lbj+39fko06t0qxOtF0umQgIsR6EU+9Yvp1K2s7yXmjrKx4hpQwWD\r\n2qWLdjCK/CQxjGj+klSLSIUrlTaeegKmx6X4btwKAiJAdjB9tudHrPXdEnPK\r\n/DFY6sOYAt5gyMuQBXtsjC729fxn+0ibJkYOqWC5htymrN/1cQvQ4IWW0chP\r\nGnZ84Jzmjqs++eau7s5iT1MA2Ipqr7Hth4oZoPuBoZkHbGK7tdCgz8VFfxp+\r\ny2w39RmdotCyHiq/pU6aEN5Ktn004qyFgtcyw7te2JK7msZ85YuRRkqGqfGN\r\n61KUiQ/fij+OUqQJfceScEsDc06tDrd2x+AqSrntiv7IfzDDjc4VtcbNoLTr\r\nv26ok6hUFqtUXnZbq75p5XNChe1RHCLYjo0ldPtn/baD4rnrT2NjEOBRruhP\r\nqqn/RM4Qu0C7LiaDdqEmvq/2kNSeoMdup6xkLXjud82a96ayd/tAJgO7Rv/5\r\nTx/dNZXWtH0ET/jVmISUQKmeiWPyEHoaUKs=\r\n=aWgU\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221230143215-80815f0.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/2d245f2339be7cc97c042427d6539e6c/graphql-hive-client-0.22.0-alpha-20221230143215-80815f0.tgz","_integrity":"sha512-XR1uxOTTEKMgfQfxpq0p5qC17Fuq77I4LFpnsPu4n88ETao29tDVe+vGbvhMHSmvj6hEXXc/TUakvCY0pUKvIQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221230143215-80815f0_1672410771693_0.33058261385901","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221230143420-f84dccd":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221230143420-f84dccd","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221230143420-f84dccd","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"78c333da34941609d716650a48f06fdee83ace40","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221230143420-f84dccd.tgz","fileCount":60,"integrity":"sha512-UqhfwnnoZFkNtOYTfAsE0pOHPX4A6KDb5vpHw4JiXbuumonjyLVwShhjt8igSBavhQHx/OXolPxnHrN2uti8aQ==","signatures":[{"sig":"MEUCID3A0rzG+I6fPY05NjVJfKB03Rw1wvaN1Rxi2p/rzrTVAiEAsSQK9vsXB8veY/ubCrY4KbCE1G0VaSFP86TtGD/h0d0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrvcQACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmoe+A//Qz9asfA84G+G2bdI5hvQ4sEwG5f3Jv+3yVrzXOmaqqOMjO+I\r\nx/x0intN53d0z7CKha7CRh/xpubMvaQbmK/kpNB9FQAhoGtnwoqeDvqRBSLG\r\nzulI3LNnEeXGwOQNkHE7NcfPSSIXEvuzs4LX1SlW3JkKQz3b9Lspkn/EAsKo\r\nvwyqHFvDuLMHjXGNVvr5ZK9gh5f6ymzL7J2Za6QfO4J0ea/QAvLJYI1wmR1w\r\nMR20Y5pOeFHBTK9hvKea/ukj6VrwfEp8yKWrXziaQdYfWCltCKU9IdMPFCJy\r\nBOhrddJKfLlDUd19MtnwQ13Up+D2V7Gy3I0OZA01D8n1QOYa0lYYJwCc1OOX\r\n7TSdhLsoK51ytKe2wVEh90fTnd9PqWJkoGbDw/DMBd69R7sccE86rwXrMbye\r\nTSDIyI5usNSBuV3i4UmlVJ183RN0Fg9+udQWioHzIARohsmtqYKjgJVBzkQo\r\njpn10hwkUfBK9lsoE/BOck0KE2eu2vM/dw55a12gmlXeKCi0eiaTrtpC9Qde\r\nfRg1yG2W3ZZxj2esXsKB2HCZDEqer2mTw3xOqUTxcudbDI3IWUhLIQOvPG08\r\nTNkr7q3wPtDiAEa4KY/l6rjX+nBjBYgYQwgsTe4EF9yJ6fP5zlEPJZVVXhfY\r\nEDdV2vgtt+sDmtAtW65zZA+Dn2G2XeR/6a8=\r\n=+OLy\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221230143420-f84dccd.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/afe45d65f6a385dffd3571b305723565/graphql-hive-client-0.22.0-alpha-20221230143420-f84dccd.tgz","_integrity":"sha512-UqhfwnnoZFkNtOYTfAsE0pOHPX4A6KDb5vpHw4JiXbuumonjyLVwShhjt8igSBavhQHx/OXolPxnHrN2uti8aQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221230143420-f84dccd_1672410895808_0.5371198412454328","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221230143738-0f7ca79":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221230143738-0f7ca79","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221230143738-0f7ca79","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"0ff6d687f2e079bc9623e1d5882a1fdb5170981a","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221230143738-0f7ca79.tgz","fileCount":60,"integrity":"sha512-7Cc+CblMHpaWOHpb54BYtQSeXS3Q3dp6hUAWBpiqSP4gBQdFXzedOuUrF6jMslf3mWK6HVyzMs93YD29rTyQCQ==","signatures":[{"sig":"MEUCIHqRaiw4Hs2kpkhEAH0QIZqZCv1A3gNTGVfHG7bhlqjFAiEAjgNlBoFvSEORoRZeIlVl0S9hO2PzwnB3CcL1Qt0q3MM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrvfbACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqiJQ//YFgwk/TnG7JMfhfcgJoKNCvan5S40wBfPF/a4OWNpKMRHNyF\r\nHXxq5p4gCHknbDdi1F0K2QTVXku6rVJ25kL4oa+k1o0OY/uI/mWjX5SlZh7t\r\nzaR4rOWKVVJoz4Ag+1wzL/zVI9Sp1gv4gO9JvCE8527hYHegJSnS7QKVIzxd\r\n/eItYaC4xuxay17yeXMr2XFsjAo2OLzXKMx2BoitKIapCqtnVK1Yz0enRX+B\r\nOltLxTbxcbzcPI3A9J1GLMyrqU4jsao0A+59soJ39bS+vmFQsaTnmpu5dJNq\r\nBymZN4q0UKWkH31P3v9rj/vTf3CX44LNnKNh3QKnT5NjAQmHTBx0Bd9qv8cL\r\nlDa6h/1563RLe4tUrmDx3plQKqPMYCqHZnCcxhxLAZgiEIrQHeVeMrKqItuc\r\nBatu/sJ6yRI6Lv358GVLHulIp2yaE8OrVQ9XLa5gXjBxTpwzDpnjT9CfngVE\r\nJVPEnkQR/1L30O6RvCsBUkREBB8jnfFmW5j07H6mH0pRstMfnenT0mMAFWzB\r\nV/56T6gvki6KP+4fitM16GKO7gZCs7ZNY76qpX5ekVCIRicqZDYfp8rJ3I3E\r\n7wzDqIXDWK1w8fzA/vqRroliAa70J4eCasRnUVrcOae//Xa9STbfDGWTDdgM\r\n+GP+a++fktiLsQj1D/TaW/FE8KuAzPLYZZ4=\r\n=MsYV\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221230143738-0f7ca79.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/1eda683213c1444a38f3f86b067ebe86/graphql-hive-client-0.22.0-alpha-20221230143738-0f7ca79.tgz","_integrity":"sha512-7Cc+CblMHpaWOHpb54BYtQSeXS3Q3dp6hUAWBpiqSP4gBQdFXzedOuUrF6jMslf3mWK6HVyzMs93YD29rTyQCQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221230143738-0f7ca79_1672411099185_0.044178778049221545","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221230144225-40c2202":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221230144225-40c2202","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221230144225-40c2202","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"0861384797281debc3497cfb244d400ff971f32c","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221230144225-40c2202.tgz","fileCount":60,"integrity":"sha512-PWlNM64vN/UQBXCDr1WkFkEXviFDB2QelSmsFImiMrbRHeGImDpFjgAL2sJAfgPzKMMZwIZsgJtPydhUKOd6xg==","signatures":[{"sig":"MEQCIH5wm5B+NarG1iI562Dnc4yOsmlpmTOWZuMXXpMEyRZMAiBlssDX/qeKSod5z2Fs4IOoStV7Wdu32yj4aPFLuioB/Q==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrvj1ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpYLQ/8DXYOlgCtWMwrEYSLM8fTXeK+WqhBU/ZpGmw2NIC+atNWKRP0\r\nzOVOUxOT4hI2oFhLpy45gAOWrC/xdaHhqliRPV8+n8l+TdWUIZz8Bb16mbhX\r\nojTcVDvwDgDq1uW6pcEfIiyHPtvlQguc4hlDUpVcjgiCaoX5XUOtcTrFTQZU\r\nPYU69F49a3IIIPtA3xsT3wfJU8cLqRBvHUZRVItcdYfAbHh8UFoFyrRo2BTg\r\nkQu6yA7/ptyYOsnjUYDDn7jOc2Di5zMkVAd5dQYw4Ch7lkNYFc7J4VI/pJOf\r\n5nTVkplJYF+IIu2GwRS8pQdT9gwH/61CYH+ASvslWFXMYcDctyJEIHgGTKba\r\ncbozBfRZwI7L22FG3Lq7QGXGU+U5QkI67PQPEkUynaGFdUeBoZqiPnhh3ko8\r\n5iugzcnZiQPxlfVUgKGG4MHP6T+QY3UyvnaPREx5BYgthgWRHEZkb/UCMPsF\r\nx+9ZVpR4LIJX7DQSwozpsOfTVI/8ypjoumOFYcjigC1OD4Eg8edeEosz7Mxw\r\nQ8+B5JnD0cXK+WsZ9crvvAD8wUaUIShxZv0Mm5LY96IjFRtJmun5iyYMYkPR\r\nKnRkoL6cM8+ddyetFTKws9MsQzNBvI632jCGHqekO1FK+bIQvRyDKMVi5P20\r\nJ2Wh5SspVoGZiI0SCWcz/przq97a3GI3JOI=\r\n=g6r+\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221230144225-40c2202.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/0e2256f83a2f863c46bfa4e969bf3ae3/graphql-hive-client-0.22.0-alpha-20221230144225-40c2202.tgz","_integrity":"sha512-PWlNM64vN/UQBXCDr1WkFkEXviFDB2QelSmsFImiMrbRHeGImDpFjgAL2sJAfgPzKMMZwIZsgJtPydhUKOd6xg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221230144225-40c2202_1672411381284_0.9819763338747529","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221230144746-95baa5f":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221230144746-95baa5f","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221230144746-95baa5f","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"760ceb29d3d45d3e5fa68e6d87b2d516e0e42bdc","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221230144746-95baa5f.tgz","fileCount":60,"integrity":"sha512-K4KXvZhYVofaCOFYB9171ifNrRHFNK7AHzn3ovamXeWYVmbvJ4JxTK0cRebvbb+gchpKdVe0Gdolgb0FLHphDA==","signatures":[{"sig":"MEUCIQC8obARZikcFCay8xVX25lsMGff6WYDDZbkgMeIYA2b4gIgZEhYikcb8G7cmRjdsf7Nb3pE5PjomM8RtTzJCZr5isQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrvo2ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmoj0xAAmeqBBaPGvREODxNN19H0SudWo8AtnajocGieErkzCmWyu1IE\r\n2Dw1PTThOkO1NEvv8rjWzJmoX0pkK22d2ic1KKZfN6a59VgYFqFCBqMn1ezs\r\nXm2U23i1dqzSvjNHUBs5Td/0HRAd0jkNa/X64UbhmK+1dcHBo6mInfAtG5N2\r\n5Cgf0BMc+HxHH3503BULOE7ON2HX3ggJVnglsgqbngTlQM54gcJzqZ9vzE0L\r\nGRq8WJCyqkMfxT2Obi2zZWUWfv2qFE2+f0Z8/G92rDHb507brlMXAflHhnz3\r\nb/xN5F7PAXdVqmtDDUVT8P854sITE7O9VnrKqz+HWQ1YzGyr6MdFgNdNLHV/\r\n7faYLJIO0hKr7vDWWKZ6QR79LAmICpNSy/RjWK9GLzZVidYsB1GkXha0CpIR\r\nornclpPRqlAAD/gr+7IH8hnnBAdsf6qCp5O65LB2wPViGEdizRkiX+F5MQpO\r\nZh/i1oqNKXLrk39xrZVgu/bsFw7w0SYzayt3i6dOzOIcOv6wOXz4iJllXS9i\r\nvLcEWMyL2Oh0m3JZ9cT92Z7sGk/BvOx51wASsll9DPvvFfohT3A9rC1+4XiG\r\nyikBi0uGJ+kQWtRnpK1ajyE9tUKanDsN4LcshN4IgF7yoXb6aVBawvD3lxh8\r\nRvZur5L6jyw6hQqz+bgxxvDxEboZaifqDKE=\r\n=9LJ2\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221230144746-95baa5f.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/3dcef07d582a1c1c566e857a4ba335af/graphql-hive-client-0.22.0-alpha-20221230144746-95baa5f.tgz","_integrity":"sha512-K4KXvZhYVofaCOFYB9171ifNrRHFNK7AHzn3ovamXeWYVmbvJ4JxTK0cRebvbb+gchpKdVe0Gdolgb0FLHphDA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221230144746-95baa5f_1672411702353_0.987451168600421","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221230145301-a585dad":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221230145301-a585dad","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221230145301-a585dad","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"0695ccbcce3c983b1455df9e8dd906c57ccb35a8","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221230145301-a585dad.tgz","fileCount":60,"integrity":"sha512-AB0dCNP8c1ljDDoY4nuAd0wWl2CJJJ0qu32wmK0GtzYs4jO8ykuGiCsm5/zs6FLq9MVfF1ZdrS1p/Yjkdmws4A==","signatures":[{"sig":"MEUCIQCz2Ppk+SRyXRtwZHI7HCUUKs0E4Ilj5Uqg2JYY2m/NpQIgZsr34FGER+gZ8nwmzkvbR0IKZPg53LKWjm5QFV+pDok=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrvt5ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp/UQ/+O6gHFCIQ3evTjNSm+/XVIyV8EJK/G/cttH8lICAdt3tjvbf/\r\n/eZYjTgunNz0l+b3q8mPncXpGLvDP7fVhT/VaFgh7DVq3S6D9IJCBtsRkka0\r\nSUl3DdACQjPCuVoGUtdpQo21KHsrQSYimyFglVusEfmQVACR9aIhYIGsCMfJ\r\nfuMrAEeEPh7iaGGvVOPo36k+rn4egMcgLysdYqyddQ1TNA3EI2sgkpFBXne/\r\n+MaSY5QqqCVRkcswsFSgvkvJUqh8d3FRvH3wHsgj2rYjbXkO+AXcZa//Y7Wf\r\nZCHrMp2JG3qemWeUTDOOu+Kt3m/vcNP/k9RXaHEXDVSZLooZvmrfQSRSslTt\r\ngBd4yt0LWCZdYSQVcGZpakJ5uEWGwMEcWHwTWAxdIH04OhNM/oQZEnkABsDx\r\nFTb7KBBiHH2xa67m9dwu6h6ppo3GTUitHyvzQA8s1Y3CMuvqG/R6HC1TiQBL\r\n10w3IavVeJ0LtwWNolHKHMX1xD02XVQE5oN/uMWC4AVdXmK5FGj9Gl9bXcB3\r\nqcI5WzsalCMUGKy7pPlNbxYPH0p6HWquN2LSHnHjQOpiahwczYHEVZeMoJOq\r\nBqQcTpidyybe3T2UFAIl/93TovwP/Gq+NqdDUftAfxdTiE0PzQ8EGjf20EWf\r\nmItHkc6jGAopFXG0mrbuBLR9WXg3e55qfiw=\r\n=lM8o\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221230145301-a585dad.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/29230395fc3e7ece1a95cfa089b45c0c/graphql-hive-client-0.22.0-alpha-20221230145301-a585dad.tgz","_integrity":"sha512-AB0dCNP8c1ljDDoY4nuAd0wWl2CJJJ0qu32wmK0GtzYs4jO8ykuGiCsm5/zs6FLq9MVfF1ZdrS1p/Yjkdmws4A==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221230145301-a585dad_1672412025293_0.9636000919715078","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221230150248-0279109":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221230150248-0279109","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221230150248-0279109","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"ecfee345940f9d98aae01a6715b5b9f7131c1b21","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221230150248-0279109.tgz","fileCount":60,"integrity":"sha512-xHwDuvUXRupmh+RKjeTI1uiSij+0t97BseTN3SNRE86dQTNm6X68v9pRIAGaNpdU1wxLp5JQiTalW3J/8gmyNA==","signatures":[{"sig":"MEYCIQCZD27huDgQwrwXr/xNZPE+l5kQllN2f7VGeJ0fBtBZdAIhAKs4s6rqesYffoJM/HkIRTBIQKOWERsVyx2f/FUVggDp","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrv3FACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpDvQ/+PtwHIvLw6rvQlMgbmjV+/rPxQqTct3TDASIOnW7v7fPMTv6u\r\nXe5GfKu2RdYmJXW1uV6eKR6g6wZ6o7j9KWQgOHEH/Oq3FWjF+TRG1EuKkRaM\r\nvssE+kvbDss8pcQa4O1elEZxmKQvPL+S3cgx1MzMjZYRfBTmEAdJn7/08Fkd\r\nyUoo+Iay5Fupm1Uysjrq7ih4KLR4NNUZpZ39gKZuMX+D3Kps/2gZdhmvfm4C\r\ntApyTHx+dM0QeXwTMMDVbtbVyLLZ5K/tqAsgwfWv5D3qECx1/XjW4T6RAM8o\r\ngtld8ZnvRbb41Ud60BNi3Nfc7d7t/HENXXxtWCqTUhKt91SGUoRuzmwy84q3\r\nr0Qpoa8NhrsDj9ftSCrdA1iuhGdE3eALu+fXv6t1lgv+36YeuzjRz040QiCa\r\nN3ki5xqYeJqe+IM1009i62xpS5duZd9PTPZcxlF0dREUgBG8nMFwNmcV4RH4\r\nN68iLYmgb4ByKzjCs58k4JAN5tDZiYEWMWDgou5vs7VQiiCCVh+0WyBh1WIn\r\nFTUunWqB/lH+/OD2Zf6yYBaWJjRBGWw1dITVtGbwyQVGR2prkU1Np/svGfPS\r\nUmdnttESF1N6iQZemKhwBJr6qbcJEd8FP/BYLyGCkDFAzFGMIwD5x22cWP2n\r\nrUVoxmL1AmEzlEMdGLT/f13XAggHfXhSOfE=\r\n=leMC\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221230150248-0279109.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/1fb44b1bef3c7fb8db6de794f729ef52/graphql-hive-client-0.22.0-alpha-20221230150248-0279109.tgz","_integrity":"sha512-xHwDuvUXRupmh+RKjeTI1uiSij+0t97BseTN3SNRE86dQTNm6X68v9pRIAGaNpdU1wxLp5JQiTalW3J/8gmyNA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221230150248-0279109_1672412613098_0.7079490116029721","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221230150656-a107156":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221230150656-a107156","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221230150656-a107156","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"46dbbd2a780269f0ed4587a9f73e371577423263","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221230150656-a107156.tgz","fileCount":60,"integrity":"sha512-eROOYycE1usoN/C6utRYBwibNdbrrudFxEirqKO107nxNG3ExT03jQVybWyeBrmp5SiGLGZAgP2HqkCLjzyiaA==","signatures":[{"sig":"MEUCIQDuOIIWaeAer4YkpCqny/nixK3FZBybnWdvNSWOA1CdVAIgGPq71vC7NpqHK0q/Pg4UHZWdpWafTMVzQBZUTo7bgqo=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrv6zACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqDLQ//dYyUB6hkU+kyBDY8vfBtS2Siu/R6jYoZQkAUWJjq5BbVkBTr\r\nNpfdTfs5CsIi17LhDwi549Rjy9psRc0/GDtehSAqC2YXLJy+7yCNrePlZ08L\r\n650+G0xrhD8G9cQ43RDg+euWqquXDS/scS5+IZZvW+zXN/OM31G/0J8nEWO9\r\nSEz8Fgb+ghowtOs1X2Fqhrjg1o5YUJTo8utUr+js8nYr49vzqOH/lbNwK0Zo\r\nVPaxAWA3lfM+zaZ+mD/qNZmuCYxRTpap2y3u7W5d9V/91wuo5h7DnTh3OFnE\r\ngzWjipie6LgSDnwqy9PjzTEWuQkNCcUYrFgeSnlvhLz4mcKondjfdi5sXil1\r\nI1P4Swmj5EpaxPPb/S7JuHQaje+GVM24R6Fvts+bgkeLDYsn8NCigOzjMAwy\r\nIl0G6pIT63DUPltE702OoY6zx/NCgNO+cPUHQaZTOozU71JGFB3byLumOn5p\r\naZ55buyF8HhSpf73zrVLyuS0sCMUc17/vwMSq2Igt58dGPm8a9BqoyUuDmOq\r\nvzTwAMka8uhGMBJg9ghAZZt3xnu94oGQIlRg9TH6nDoA8vdOYaijZISAfB54\r\nJjzEs21dGsH+mOg5/OmSmY2bBWfPP0ybxsbWgS0gLr1v6wa/jPj/1bGaIoOw\r\nzzv2tyRTDFhwPKr3KTsjs4kIEBNKJxYFi9E=\r\n=kjYK\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221230150656-a107156.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/cd3730f65849c57662597ab540bf87cf/graphql-hive-client-0.22.0-alpha-20221230150656-a107156.tgz","_integrity":"sha512-eROOYycE1usoN/C6utRYBwibNdbrrudFxEirqKO107nxNG3ExT03jQVybWyeBrmp5SiGLGZAgP2HqkCLjzyiaA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221230150656-a107156_1672412850880_0.6645569640307374","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221230151552-dbd76bc":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221230151552-dbd76bc","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221230151552-dbd76bc","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"722c9866258cf3f973cf8f60567a69bd8880776f","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221230151552-dbd76bc.tgz","fileCount":60,"integrity":"sha512-kQ0CeTH51/emdeC7qEi5st+Y3pqpWnmmcHKq7HZaWpmOGdWYQWkLK1yW7TTDLxpbfmqt+8kKKpnLVvM6kt6l8g==","signatures":[{"sig":"MEUCIQCnUL3Rhr3aVh7/zDG0pYG8eSi1Ddosve081+4QHub2OgIgFg6jV1SeNVKwkNDz/y/e0RmDetYvEe9Z9My4nWresY0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrwDLACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmohwQ//YDtEwrulh5EpzlyLF/X6QTUGCuqL3O5ZHk3vsKPLIY4b3XVo\r\nGWs8a3ftCisB9/Z61E+xC+DLhavkb+ef1s2vOMM7Jw1p2L33O8JEC6f4UitS\r\nEcYvyLcm0qxIpdA9T3+JNL6Hj+/7lDMnl3v0axbH2XMh9jxeh6PCpK/el6g5\r\n8j+ail7bvQN+Mh3l25cC8pYWswhrHvEO5NM5y39X60WWHIM5fxQ8l5UbHPbR\r\np6EfM0IZ9IxAIpnpMaGR7DR1lJ61Teh4xVZIC73KzhRI06k5MGpH/to8t1PG\r\nxdd1G5IWsWzazWv4pZvl2xNLWiM4khAF0WlPH5hs5OMh5DJbX4Kzef3e/hN1\r\n+snQNwoYoNch5riVpGtNEMtdmIb9u4PU3LgGPn0CZqK/ZCpykzBcXXl2MsAs\r\nfw9cff3siuWNOScKZuWdNupG1bFdOdyWZasTrZA0NmoF87aHlT1JFCtFnniW\r\nb8voQ/VzDxpgfh50kVn2+tqASQQe+P/scyIBKZnFmyonsHB5tcgqmYUuZcSK\r\nxcuH4K2engDuXhz2nIWp3PYG0xsJ2+EC81xe49lZMYPtZwb++Cx8SegRz4Tg\r\n9GL9/FklOxfoZfRcsPxuQmNrjVyzv6vjl+pY8tlgV7XElCpZBEJGlXxQhRAZ\r\ntWiyTXxb3doCTX72+bxfUqSkRv+FdySFPLI=\r\n=A3y1\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221230151552-dbd76bc.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/ee0a6c3d9338d46acc05a00066b3fb9e/graphql-hive-client-0.22.0-alpha-20221230151552-dbd76bc.tgz","_integrity":"sha512-kQ0CeTH51/emdeC7qEi5st+Y3pqpWnmmcHKq7HZaWpmOGdWYQWkLK1yW7TTDLxpbfmqt+8kKKpnLVvM6kt6l8g==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221230151552-dbd76bc_1672413386803_0.9471160664002465","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221230152024-351024b":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221230152024-351024b","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221230152024-351024b","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"8bf403903cd1717e4eb538da7a5a23245a2c3116","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221230152024-351024b.tgz","fileCount":60,"integrity":"sha512-nGLozv2qn3IErLqpm8IEJIoowMpYW7CzjSEmuyHyQ9sTU3fjFxTBKQ4Ndpiy3HVsfZ3NOoR4KrcZ0AyBMueFJw==","signatures":[{"sig":"MEUCIBJCqSlkQMZ0hxmPmX7jPm/ItIMYbqtSYFgWVQ29ba8bAiEAuYhSO5QesBvHco4e9fwPIS2n14X0hMbreWSjhNjIawM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166427,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrwHcACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrXIA//ei6aliCajRkEUmlZdZzGazaeQ2IhKCgyCxCIJ3PfIqELxuZT\r\nVOxKWyZEo/yzjipok3EuR5WOLL5BZ86MnS+MVUre39omowDzhIKFlHe1O9xh\r\nTIp6iGXo0JfcAq4ncyiAOEQtwPYJHm5P6V0W2n5bV7SeGGwBNZDO6xqDl+65\r\neyvF2kyUivThWzPklKYGS4cVlPc6+SA4MWHSbzHCL8VAupyZLJFJPDL8uNvf\r\nm7Q7Zf+KnCGZ1wY7MMacd3zKuHsak2kioxC7e58EQuE9+/zD9Xcbkjp2n8mf\r\n1KGYRSY94Qr6m8BkGbzAYz9xD6/JVTf8Dv1JG5IX73Ds8N94qY/ZnH39r1iB\r\nEe/582YoSwf0hnQwSdrNcMDB4QVddJKryEphmoY6IoGdpUM5j5P6NUocZRjS\r\n33WhXUkFXdOQVLchDAAG3+4w/UtpFbELrE4Dh7zIm5K/kAEbKjoa25GkAvL3\r\nY+58xp/zOdSt5UfyZUeA+KirK16VDI+1HO1HSHSfYe3bA+DmVQIc1lpbBZlk\r\nAR96Dg782Ekvb25gprldSGmSuvwZWqDcEI6rBLQXaNkYynmHrhmbA0xkt1tF\r\nn1wmS41UaRmpA9YroOC68Im7Sfc/30sqVQot9AiKsXxtGDDBOORDksffVnQf\r\n0kK3jwmEsCOS0YpXDs7lIGsumYritGD3o4k=\r\n=kATd\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221230152024-351024b.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/6841575494fea297079b3062227333df/graphql-hive-client-0.22.0-alpha-20221230152024-351024b.tgz","_integrity":"sha512-nGLozv2qn3IErLqpm8IEJIoowMpYW7CzjSEmuyHyQ9sTU3fjFxTBKQ4Ndpiy3HVsfZ3NOoR4KrcZ0AyBMueFJw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221230152024-351024b_1672413659797_0.10409059934260956","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221230152124-a6b44d6":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221230152124-a6b44d6","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221230152124-a6b44d6","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"b543b3969d3c1e1afe9e50eac3d8bd0abd12b8eb","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221230152124-a6b44d6.tgz","fileCount":60,"integrity":"sha512-Eet6s4UJwwwZD2k+c0ZidR4qQ8kCCnHVhuAFjrnXwKeCvKX5uXioJeJ8MVaHL7TgsMggvZkdqiFduNHUaCcQpg==","signatures":[{"sig":"MEUCIFmpKBZikU3c7i9aEL0pIWv+P+QzsnyxqduDU9Knzdk7AiEAuRPWYJqboBqtLGk4AvtTa+o4d54eotDgvJRJK/THDNA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrwIYACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoDkg//au/K9aVS3fNPe4LnY8hzpc4BoJs27C0YwNnWF0eqz5l3F7Qr\r\nm2W2Qo2Dq8BH47lkXEXdF6tAVWKOVwz0q1tEHlazNcB9n6JxTGaFKoy42Dd7\r\n+L0dp4Rzg8bFCodf89ahg4aO9vgPcjhXfP5auNftER/bqEtL2KDgFDDGPURj\r\n9D4gjxD0vtgwIUtM4zJrqiPVRA98l6g+hJ895ojFAw3AsfaLOFOVyPVrPdvh\r\nSTWkl4lL9p0bZaAweouu/oNCtojnw7xCLAhu8AHGD0OaRLt3IdXENLcwwXji\r\nycc7abk0S4DTUMXjuI9ftlZcO38wHGn/a/syBNuL8swpGYgZPDK6cfaMZJO2\r\nljktpVoiusPSJFnY8af7qjFlZLlh0TgT6B2TUTyG1st0efgel9mEaBBlyvla\r\n66DFaWEddBUx+dnB8in05Z5lspSs5VkbFPaOu7x/a4zwo1WW9w11Kd2JPEQ9\r\n3C3ApDzcLFYnEqp43FzkYVAGn6MNZ2RWE+ZeT10tf8gXR/HHBtRaA+l8UXVU\r\nRgxuZ6fiyk2zkSfkCNFwUsIl5Sl4P4KeOqCb68Uj90FJZmoCu2EHurlMOR9M\r\nnlrCFg2fuNEZLgrJczSweci2SseoFHILAntA7L7WQgGegTlCk1UDs7Ovoblf\r\n8whLV+LdTzBhMPe0MfjaRl+BVkJ9hkbQpMc=\r\n=4dJJ\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221230152124-a6b44d6.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/90a7e0a23136a20e488622acaec5ec49/graphql-hive-client-0.22.0-alpha-20221230152124-a6b44d6.tgz","_integrity":"sha512-Eet6s4UJwwwZD2k+c0ZidR4qQ8kCCnHVhuAFjrnXwKeCvKX5uXioJeJ8MVaHL7TgsMggvZkdqiFduNHUaCcQpg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221230152124-a6b44d6_1672413720194_0.8834559180978643","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221230152704-649466f":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221230152704-649466f","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221230152704-649466f","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"eebdac7be44855cca8aff6815acb8b038f913593","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221230152704-649466f.tgz","fileCount":60,"integrity":"sha512-ueRJvRnEhX1pQWrs3/4dn7JH6bAjFd1KzFaLM1Bti0AvoJBh6iDasOUMkdzUCLQQ29w0AHt29RtNAvhMwm0Yuw==","signatures":[{"sig":"MEYCIQCPood8fr/OsTxds8TQ2gC0AOnGmbEhhs0lNPK6OACrQQIhAPRjkHF7+X9G/matdQZ3qNxl+VXXEXwgNUhLddHvhkJf","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrwNwACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoEqQ/7BLZm0aG2KTdFcte32quqBzjWH4f1K74XOiIWIxN7m6UNUnoX\r\nyTwKYiXqEzD+CiGKeAoBZsM6QinmB0AhFNe+x3NIsoI+fTW6PkEVFmFS6KCh\r\nyOcn2cERn5EMAtVqm4I3OS0Iz490KSki7462pdl7nHErfhjQm0SU2RQkfS6p\r\nJVe8ACq3dPkWoWkHm7jOhW+Nu/gRk5aNNaoWro3tLMCOEkH+TBBkgTzKemBo\r\noYy1iCxG+Lykl3301zNn21PTMTVYWMiGgkLNkD9Tbrx+7W2yJXy/rk6G7Wnx\r\n7ZNb2rzwh9+QvRasISohNSpqxAARsZks8+AXVvTRt0f1Zf1NP9S7HXa2sAcs\r\nStU0EFpFmG2SWyQs7NDE8MIfXfe58XOCJtnrw3jC7Q+2FcoJKLJf+yupFjL9\r\nKdwSt6khBT9BOH9hqLTIqgvVSMc/q8zdaAKiX8LZEpqMP6hlfte/8VXknBMR\r\nLagbWHyxGRKqwCaMXQ1jB9IQ5clc0Ptk0x1PyT8qSY/84/Gwvm2USNdRV5S/\r\nX18heEhYUyVUkN0w0ZkZXx3G7R1LxMmHM7j2B22LU6DegVz3e/ImJfn/gWsb\r\ncqr197l1mk55Vhc4dIS074ixG1Jg5LfWey2SUS5FI6FVwRZnCpmgWiNlEUJ3\r\n7Cjv7msjsOrN316GRTk0AISfP24f7W8FPJY=\r\n=KpKP\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221230152704-649466f.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/f380174f3e0fd7c44067b3656e7e0e23/graphql-hive-client-0.22.0-alpha-20221230152704-649466f.tgz","_integrity":"sha512-ueRJvRnEhX1pQWrs3/4dn7JH6bAjFd1KzFaLM1Bti0AvoJBh6iDasOUMkdzUCLQQ29w0AHt29RtNAvhMwm0Yuw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221230152704-649466f_1672414064616_0.12243002026546668","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221230153241-34a1c54":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221230153241-34a1c54","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221230153241-34a1c54","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"88d70d60d2be390149fa34eab522ad8172a72017","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221230153241-34a1c54.tgz","fileCount":60,"integrity":"sha512-QfrkqR9VT4XmLHQQWvJKlLwurD8dJB2EBE9SE2XmsFB+jNmNl91hK8mk1H4+l8Sne2VLrVOy3QXBfxS14iLPFQ==","signatures":[{"sig":"MEUCIQCcBaA9FWLsN0K0oJIBaoFh0XICOMlqastroAFpBWUoowIgOiUr3IFVU8GAfKF8WU9kO5MG78aloUSviJ86diHK5qY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrwS9ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr/bA/+OA+o2wrC/Pb5rAg6LLJMLrUb9UiB+O/g9/H8w8f87wTAWgvq\r\niJ7JZTUz3TJZLAtoR9bvZCOKHkX5QeSG8pOOvI+dNy+Sh+eefTi3VTGTXfiK\r\nBr42hBtbi4baV0D5BARqHLrsIQHZMVWvBMS39C2Eh0FNockizRrrhNMl11Xj\r\nOeerQUSkJT+JSUgXQR0qAHscxZe/qxvyhQfvUQACXR1sXOvCan8KEhOeXQ8x\r\ntzoe1GfLc6DqtDhHPSj0ry/LZbYEAztL3+SETRJI4egqDVEfqawWGgJyXQXn\r\nrCtt2/rl7rGQNSA6Jo5Qzugx2hiwO1ekyoQvGZ1F58YlFZmSvgI+Y4oNkw3u\r\nvXoti2D2mwyppANvL6OhKt1xFO9ElFnJPcjbw+9Sah918grkDG1NoWfyVg2A\r\nVs+180nK2ld1+YvQTnw24d1T72iwacFigqiywb0UBR+T/7OtzK7vu1T83Bm5\r\ncg3ORn9gp+r0yyUqRpUlcE5b5nbCl0LcdHF3y+rMhFfhgAybhNstdVzfZLqY\r\n5/Vkvn2AOkJRhInPXKUOKx5SXyR9DUnEmLoFU34ETVGOypxgcrxEg0YTxDTk\r\niB2ow0fvKIPfJ0Aw3xmrQZ4Ba6vKhEaLK47B80fuEXimmboITdihpu9iEGDr\r\nS09S7blMNU5EStU0PUyMwGWFl3Yj/u6iN40=\r\n=1m8/\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221230153241-34a1c54.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/c59551fdd3fe8c3f2cfea607d5524119/graphql-hive-client-0.22.0-alpha-20221230153241-34a1c54.tgz","_integrity":"sha512-QfrkqR9VT4XmLHQQWvJKlLwurD8dJB2EBE9SE2XmsFB+jNmNl91hK8mk1H4+l8Sne2VLrVOy3QXBfxS14iLPFQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221230153241-34a1c54_1672414396872_0.951697903683455","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221230154013-312d8ec":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221230154013-312d8ec","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221230154013-312d8ec","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"19729a1b6d8496806f346693820880997ce8cf8a","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221230154013-312d8ec.tgz","fileCount":60,"integrity":"sha512-AMRb0/p7Cy/b9u53AhnayOqXwDlal9qOfJ72dzU1qYjd+FnOA+suSUHh9m4uyd0njxmJop4ZQmZ3xipANKEVfg==","signatures":[{"sig":"MEQCIDQcxGR87ISumtq9m2vqu05xoHOHaDNC90t2iRzHN80XAiBAuj5jKVVVTsn742LrQlgwjPlMvFj4MUmopK6ATb6Phw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrwaFACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpSCg//Ua1BYbm6hOAxlER9l9odD7wEluqFKvnl45mPTsUaktT0H0zH\r\nptlmJrHK0K8+2MUCLemV5vg8tV1sBJ4IzqZ0hs8BIgruQBm/mUnF4JNrteFD\r\nC9CsMRmuceg7pWUS6aVeIpafTZe+WEINfeqLbewVPEU5heuzbz90+63aSgWE\r\nESzCsWOqNFS2BAOhy0GR2HjZIZ/1eDnS48ZEr8BX5CwRYEq3gX6prMmVmDzv\r\nyBHA2zfkXBMtlwclqRXThtcxxamyyJ9AYWvgNqLLZ3o/H/lDm2M5SeIgpL34\r\nF3qYacccKbX51px4Bl7yjZZFIj/T8wVw5900GRjtpWNg6jL9sx0VvWh9jXyZ\r\nEnEJgLhIijrjZX0LmK9V7+IvETpg/qnGHKbRwAe8phxxDdLmn3u/KGx1MEst\r\ndmTzg/wAAGOi43gB1E8AxWjdXJZg6y/pBO0Ed+RF/jNfAc5T9HjloWMLI5db\r\nAzaHsSxUuCg8aRPMMKDysFq2W2stigvdQm8ghoSyjk8kUyNwe6llMivonmdZ\r\nDDINGiu6h+acOUpMF+s9nHFTFdsRYdG8oJL8R8iVijbfLjcrifU3LjqoF6fA\r\naQegDYowINc6C0icV453SDWHOCoHRAb+UGp//7rwSHIyVPKwrmWLA3ezjczx\r\nghbA/g08lU3+w2YvxuUOvzhBZftKdfkElO4=\r\n=nYTL\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221230154013-312d8ec.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/6c48ea5c9c205a4c630204e9af7309ba/graphql-hive-client-0.22.0-alpha-20221230154013-312d8ec.tgz","_integrity":"sha512-AMRb0/p7Cy/b9u53AhnayOqXwDlal9qOfJ72dzU1qYjd+FnOA+suSUHh9m4uyd0njxmJop4ZQmZ3xipANKEVfg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221230154013-312d8ec_1672414853178_0.3459329133982352","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221230155053-c3b3a08":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221230155053-c3b3a08","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221230155053-c3b3a08","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"d7c2d200673fe6eb17c3076c8f192823a6e5909a","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221230155053-c3b3a08.tgz","fileCount":60,"integrity":"sha512-I0lTlMRO9zms2mK777k3QYZuxhovF1Ujt/AwRImpqpwMV59wz0EcVAVTmV0cuKcbDia3JWVlb/TRyUy1159SxA==","signatures":[{"sig":"MEUCIGUSTx3RQJqhpOD+wq+FCNLsGARs5GFosxGHWJaLd9ozAiEA6RP/ofSDlG93vDjP1DiHm3a27vLkcYZPkI2cDY4rd7I=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrwkAACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrJohAAkVWe0IWz5oBE3rINHJxXaeV+SBWPL13jA5lzlqohh3NYK58s\r\nxakOQPdifoTOQPL387QW3bfaUYK159gvpn6czsLvPPrM1YMTWEC7gL0DRaN8\r\nrA6yUE5IF8V36FW3wrMsZi+nz2IrMjpPfnUl9t5SlXPtMYbgHYCrubzagiKR\r\nDWH1/uFliU4VgndhN5lfSZIDeUPSZpeyqW8G44Np8wC+ZK+7LjeFkypGdf1b\r\newAeqGuLv3KcL+JHQx6O84xRfHPacDcIujeyWP3+SV4n8rLMbgvoNqRdEYR9\r\nd81mcuEFQYPEX/2eE6bhHGDNyKD74hCKMdDaHWU3KLY9JeAa23cGG9f3Uc0H\r\nMtUzWmtPEEZyIdeO0cT3Kw38Ma5icq1sLfdzewK5bLiWVKDuUNCDDEe+ereB\r\n3MDjLWij+Bs6nQYTxK4gTEWTnQMf87ckBaoesE+wRkiGeBU4Rsf0IenSKoJ4\r\nbCeH8iVg9tFxIoA2xj9OwypGrSEvMPjb51+yLFgLXcNwx3CB6U/GN0seEAMi\r\nhEEO5wTVR1MFvlUb6t/hjfv0Zt5t05e+nYBi1OkJ3Zdc99j+AiyHCzdtR8qX\r\nbXcNhd70yr5oOElwarjt3pJPdQ2cv5qVQDEOV0lYsL4tN/9mo0MUibvp17bn\r\ntG/8IK0H6t/jkCdCFO5p0z09+tr6zHP/JvU=\r\n=SJy+\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221230155053-c3b3a08.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/9c824caa0d1565b3589c9b7603089283/graphql-hive-client-0.22.0-alpha-20221230155053-c3b3a08.tgz","_integrity":"sha512-I0lTlMRO9zms2mK777k3QYZuxhovF1Ujt/AwRImpqpwMV59wz0EcVAVTmV0cuKcbDia3JWVlb/TRyUy1159SxA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221230155053-c3b3a08_1672415488773_0.7754799504497831","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221230155632-b6461b6":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221230155632-b6461b6","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221230155632-b6461b6","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"7d29c09b924586ca52f16f2e7527ae118bd0ae5b","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221230155632-b6461b6.tgz","fileCount":60,"integrity":"sha512-YSdBXLS7fuxjqwv2o0/fZgDuF0MIQEjryUBDGKpBe9sIAE435FXgSHsYTYRDW3BZCVh7KO7+tWP+1jPWkgxaBQ==","signatures":[{"sig":"MEUCIGJQLM7CqEQv+U13CnTN3JVkIvnIeoR671X0wEic6L8vAiEAqC5af3IjlHNzebMykfbpBikGyJgCiUX3R55ACJaNBLQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrwpRACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmqb/A//UzlGGakaF6xlXepJybMOJZcLiuREMUvnrYmU7rM2pLgy0uQX\r\nf/hK/gm5o9GvKrRzXvm10YX0nLi/N+46iVjZenNOS+AGeUzLrnSvpQNL482F\r\nKKTarsXCtgrwjNLauQnOj8OkJT+V4Uejjj7JKX3TRi873BZm0s2ImAhPcsQZ\r\nyxIu0CWsyc5rkALRMYT49QFeYawFiPF0VR9pqfryEQLvjr3qMe2h+G+Le0a4\r\nAk7v4Zvyt5UPVq4tmy11sSQkc2szHGJo4TPh+tnNTgCRDPWa5CoVh85Q9rDW\r\nas7G3AKg7kZpACyeble0nQoq4VUl40Mf1XeIs4jqfnL5cjcXFQ/xGWBBUfLA\r\nQu6yizt3WsBCJjspnUC/TCrgRyy7MPZnTL7D3wa1XlBgR5KWBfbXiivPkZwX\r\nDNKGMbxiep5ExM+1RNgI21TSSh8xBOa+zLG/eG38dW4JV1Gf+/PI+aLb7miE\r\nMtIsIfAzzFZJ/n1byfLy/B7Y36kNX63gDcRMUuoC3Q0gV3uhW1CJcwd3CQkH\r\nK/Ua0JuQoWPmfAdrvG+hdsxKYHcTdT6qf5g/1KKujOx1MrtQ82j2DqE5Icjc\r\n3fx3nMw0FWdpyJaH9EBYuTQUMQD8n8NNXBsGUexPEf9oOoko+eanVtEtJzIB\r\n3uxT7JyYoilUeC1vwJwcQFcXQoP30OKBVjc=\r\n=o+d4\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221230155632-b6461b6.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/58cabea1007e4ff47837126ea3679cbd/graphql-hive-client-0.22.0-alpha-20221230155632-b6461b6.tgz","_integrity":"sha512-YSdBXLS7fuxjqwv2o0/fZgDuF0MIQEjryUBDGKpBe9sIAE435FXgSHsYTYRDW3BZCVh7KO7+tWP+1jPWkgxaBQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221230155632-b6461b6_1672415825306_0.7530024127385706","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221230160153-4771d7d":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221230160153-4771d7d","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221230160153-4771d7d","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"f5cf92002b15675606a4fe5e239183da867e7efd","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221230160153-4771d7d.tgz","fileCount":60,"integrity":"sha512-M+bbxHZZmult5xt+IK8wTSfyhEVunU867cxx1TGm15S/zcRT5bJHK19GuYbdwbnnnAXsDqCH/sH2TuKPZCipog==","signatures":[{"sig":"MEQCIDpBnRsRot2CFGauDAa86zDeu2p8zz0v3l6UOBZZv9nAAiBqz3dPZRyni9znYKbfmTUiBem2U71xiTFVTAZAG92jZw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165581,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrwuTACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo9RxAAjJggC8RiF3JuGB66JRNK2GDUC2b/6qMle+eSx0mqEPZccxED\r\nkq2mkhhfLHlfrMZCgWKTlIicfs0uMXPhJ6DVnmdlrZIQ8FiJYnJj9A6Fcjc+\r\nviBV+4PrveDIYKeiUFv67Rkvktcf5hoXUUK2wL7XrUc+/ayZavdbhGFG9/Sv\r\nVud+tH8iFj2UbN0zmSvbhrefm5qNk27xviEM7HLIOWh0QnOnBJtpm/X7OQN3\r\nBnP+ulB6HHL+ivVxkZjK3o6R2LrQNChXgLE/pZxjB4vGKC9Z5LbpPNAkSvQV\r\nUEqcvyFymTFQ0V3mKEI9h8DcuqKjXkPqo3/w/FvFzuT+UAoDSjF20eVyNY2n\r\nItpj/jCzm7FZsQ4oIfxYBQPEQ4kRGN5YPDhundsqrSpvJ2zCp7lHo+A2lS6V\r\nSV+5Z9K0pCMB1bbUcgxxsGM23hSNtUdjfxlc6QIqu1/giqrddoWjMnrDnwof\r\nIXMfP15XHiey/rEmDy7L6sNOZ0CNWzZ0R6uV5Ja6AyyRCJXN1geZyy+toP47\r\nz4Y/fMoVWrocrVVUelfyS7R09A1OwS//Cfk31x638d8u40jDuaW70M+flY8e\r\nJXOVYKE8W2MJ2sLS0GNVDu3+ZVXrW/l97kW20BytnyLis/EgVWymePadwTBs\r\n8RWozkkkl9NuZi6DmAiGCohnB7zgW/hTS0k=\r\n=GFvn\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221230160153-4771d7d.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/4b17b9ede18e3a88a90be5c02660d9ab/graphql-hive-client-0.22.0-alpha-20221230160153-4771d7d.tgz","_integrity":"sha512-M+bbxHZZmult5xt+IK8wTSfyhEVunU867cxx1TGm15S/zcRT5bJHK19GuYbdwbnnnAXsDqCH/sH2TuKPZCipog==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^9.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221230160153-4771d7d_1672416147767_0.8007604226605625","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221230163743-3864507":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221230163743-3864507","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221230163743-3864507","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"c33ec8ba7eee965c1b7e215ef28dd0933a800fd3","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221230163743-3864507.tgz","fileCount":60,"integrity":"sha512-JxnRBquKU/a9dwSbwDGqr74SA6sJQ45FYp7bJ/jGr9ijsFZGKJYMPT6kmE4Cte+JGT0oVkvsjLr1bK4KKAL9xw==","signatures":[{"sig":"MEYCIQCxddHkRVFbOhbXGyUJ7OrSu7Kcb49Kbh2hYPl/yg1X0gIhAIPEd9EACG6f3/NpRzhDW5izW3EaOqzH7F3eABWzWGqM","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166427,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrxP4ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpchQ/+Mdt9y/QbMtAqbbP0ds68SKOgTNWEDo2BnyMOe6CEjKbXoxBO\r\nTy4ylEeqtFswhv7cnQgpdr61+b3nfEjlEA6TE5aL2bBfVx5lWYgyr08IiiPJ\r\nwXrVLCuuzZgdeBg2KmEtmx5xunTCMYl8gGjT6p28aABGQ4Ex9wiqhMtgg04M\r\nPJrnUa6qSz7aXaQMJTKg7kzWVPQd90iTul3V1bEIY4UWnnas/G00cnhiYIJI\r\nTPdXImj3pFNZd+I6a7XOMwoIrGqVCh/uQL2jnYP4sJ8o1JZL2d62wWkclW00\r\nmzFMGdhnubsuev74PB/D84Zq2U3RMDpbp1VPz631n+pynrBpiHViouJ+z3sW\r\nYgqTs6GkSBmr5qCaLTNgKSo2t9bqARPwPjXL+TcGUNG8Yq9aEUx4tgFwUs/r\r\n1/cvWVvTpXvdDwp1S1OnsRZacNgbeZTJZdJ9Woedbn1zIZitpbWK6Q0edN9Q\r\nV2QaYkjNDHbiVJzuRfZIzRR/t3g6acchiFo/LTJA8hVYUUSHbi8+kHfvxi4l\r\nO8UibRYZK6NeLZU/kUDEUF9JHyFibx/tiYxTJ5Ys6UBg1K3hKJQH4Ux4HuaG\r\nm1HvZCy9oGXjxfKJpknBL18+3/qxhR44HQRqizvzvEa5OlcomZ/3abW+Yt8d\r\ny/yptKqllJS+bESyYD2HJggepobr/gr8Oq0=\r\n=xDrc\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221230163743-3864507.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/e166ea8f4bb55b24fbc9617333397204/graphql-hive-client-0.22.0-alpha-20221230163743-3864507.tgz","_integrity":"sha512-JxnRBquKU/a9dwSbwDGqr74SA6sJQ45FYp7bJ/jGr9ijsFZGKJYMPT6kmE4Cte+JGT0oVkvsjLr1bK4KKAL9xw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221230163743-3864507_1672418296353_0.39561933332123833","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221230173903-9a143ca":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221230173903-9a143ca","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221230173903-9a143ca","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"16c4c729cce986b936a418c237eccac12345c95f","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221230173903-9a143ca.tgz","fileCount":60,"integrity":"sha512-amV6Uw4PvDlAZHqeb/fkmBnmdnY3eVMY5rFoR4SMSCd06nZrq4lKLMd0WEcpZ4+QnIT/lg+c8gZT60PvmIkS4w==","signatures":[{"sig":"MEUCIDKCgS1OZ1O1NjjOiRoVSMLCTIm1MPwA6rpYyr7G5KtYAiEAzRot1Z3wb4DbqFJVQWzBsYMrJvP+LjIn9vE2IoRi7e8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjryJcACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrtIA/9Hx2YZGt0Zl1sQzgVozgUAPch+POCuenny5J8F0QPXGQjyhKk\r\nQIAX/z3XAnlVzwXDU+x1GNEEn0BRytkTZs/OYsFldDHYG2xqjt5/7YdbsMLy\r\nZf07EkvNy77ENBC0aPwmLC9oAV7Ypt2EtHaQ9p0RwmkxycsBmr1PQ5UWTcXq\r\nhTlX8zDi02yY+uHAWEWtkRTFRx23wzQ0PaWKJDQhcAiCADt0Edlr0H6vzN52\r\nOyABq9/engFb1lrbugEU+wp6jYszti6b6HUN9ysHhQ5Fe35YZR0d05lz4Wax\r\ntr5M4jOFAqy8lULxCn85We9CFgqPbmHOBr1u+3Sjb+urB6TFeTR51Sload5p\r\ncr3Y7Zn0iIuSVSEcTRoT3o+y9NrmJNTZyX3US8ltZ5caCCGkVNCo7Zlkf0ra\r\npmoqoflzfdoSFF6FKzkwp9BFM5syZloLvMy0BbTfodTMqIXo/nTf9+gvOuOJ\r\nnCX09ZR8hpwKu9C8WE6jynDf7B5PiIDperJNha2jhNTOE1XeWdkV8RFD4VRE\r\nF21GW1i7knRQCJXcrHSQRWBo/xfFFIJg+NNQZR6eYr6u1i4I3T/8WVOBPSZB\r\nPQvHiYaEoqWl1kEiNvUnV8iyDEaygkPEKh5hWJZPrNZWMrn90U1kG2XOBFS0\r\nGvWtCHqKubPa2A8V7UeoV3w/cp40kHaVknk=\r\n=5ggI\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221230173903-9a143ca.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/a6a58a0888d3b54cd4478f137bd3465e/graphql-hive-client-0.22.0-alpha-20221230173903-9a143ca.tgz","_integrity":"sha512-amV6Uw4PvDlAZHqeb/fkmBnmdnY3eVMY5rFoR4SMSCd06nZrq4lKLMd0WEcpZ4+QnIT/lg+c8gZT60PvmIkS4w==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221230173903-9a143ca_1672421980072_0.23570596697115143","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221230174420-fe7ac15":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221230174420-fe7ac15","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221230174420-fe7ac15","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"0667e5496db2f72ec2e9e4e6f922803ec9148b87","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221230174420-fe7ac15.tgz","fileCount":60,"integrity":"sha512-LTkH14QsFK8ry9IUy1V5ljeUMpBy06V1vAtjE7BH++TqyvGx30hXIc/W1dt9Bfg6xMK3E8TLv+E7aKLyF5yppw==","signatures":[{"sig":"MEQCIAkArczPYJH4gwvvHnXW+Ab/YlxFv4YlIMkYHZCdKbyHAiAz6UZUqA2CVaxvNCmcAXxs2y45HvtOsciCKkr3a5sylA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjryOcACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoeBA/9F90F4wtjNLtIFM3hEJUfiHhC0ouwtHcNZfdsmlQ8oVZPHPHv\r\nhPwa82zs9ZSIv4yurwy0IwMAfyxCCYsfThI6ACGZmWwtTSG/VGUqKtr9DsSB\r\nIEy4NhxS/YK9vG7BDCzSx5tvIE8I6pEk+UMU4WvTXJjt6aVJY/s6V1JUPiFI\r\ndwuTcUR1I35Fr9V30hFbMcSAmxmFK65n5YbhJIMJZEvWJfz/rm/Ut5bYE2r2\r\nA+fweDQ0qJl35WkRekTxbDjmqSex936/iyxQFEIljyldkH2y7OWi1f7YzKvz\r\nVCwByM5Edc05ev59ignK32ACLGyeQFjQrNAaiobz5EFdcWD759rSA+Ho7oNm\r\noZc9NHl4RwVIAykvMhCMhqFFVSbYYvOJRALav3jn0eYcX59KzpJd0Gdcw5Zw\r\nREXoWaxz83qnTJVLq7xNnTaFTojaWoG9H29FIduo7SwFJwi77PVnkXpmdEGC\r\ndfgX3jmEyQylbaB5cA4B26f/5iISaRcsBuJ8upH+pkLc6tXkETnvIBYTKExd\r\nsHOprecasIqxPwHUfl23oGh/hxdnGwcqUNZEFMvzGOzOn8mzEWu1AP60LMCw\r\nRTCyqMYFMnUijkCQVVvASE48tksZv2vXqEwsMhOTXgNi6flRK6P7HrGXOugl\r\nCMCJFyqr2xv0E4fZLpqDr27+rELQ6L2+25U=\r\n=t3No\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221230174420-fe7ac15.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/9a16f3813bbe317b6925a6208fb352d1/graphql-hive-client-0.22.0-alpha-20221230174420-fe7ac15.tgz","_integrity":"sha512-LTkH14QsFK8ry9IUy1V5ljeUMpBy06V1vAtjE7BH++TqyvGx30hXIc/W1dt9Bfg6xMK3E8TLv+E7aKLyF5yppw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221230174420-fe7ac15_1672422300236_0.966571167952879","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221230174901-e335a73":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221230174901-e335a73","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221230174901-e335a73","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"78b2d7a91af6451d7555b44ac82ba804260a1c6c","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221230174901-e335a73.tgz","fileCount":60,"integrity":"sha512-gc4yh8dpKJ75z7qGHp9ZF+bHWv1B2flNgaNmIHcEQh6km1bGARZ0Cb5QQTP1Cmz/AkwHX0C5zpOYlEFekSe+/A==","signatures":[{"sig":"MEYCIQCwSqkZBG+P/CLpJ5XR0/W5VLlmQFbH+3ZvCU13VfzN8AIhAL7wbXHlvCySJYeIfTs541Hffa7OZs3lwrtkFabSTBrW","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrySvACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpmnRAAmPBTbOfM/YGFJfiKJEUYIXdgsWDdQ6mz3gFFwqoKaBfXDhp9\r\nImKZW2HO+/H5KEtY08DIr88IlgB/kQCAnwDsqI7fjcEAP3O5LsBzI4NnjdkJ\r\ne3StvwotCWArrt+Up/rzqy2llwB/o+26pAMJA3TxMy2uex5ivYm/nsOw8WY3\r\n9VXzdQLFoVXJhoeOHTYwCSh9tgpDD/OrmxbnshiXrRuedr3frDaGv6zX7bCN\r\nFT706e6hqNO2gNUOv+nOFwldbU3m9xkDbH0f5SF2N9uVWn3BzntJvKf8oTzW\r\nbmlKTy7slJMFefUO9/wQWjIdZAjoSvyybBeeyGfPtCmy6LXUvo0Gqs3Jectu\r\nTfyn8p2uFI27Vs/IzC0cTIjEMSQcNJtTES6Es4MRw+VuaQVtw67G6ggYKrhT\r\n6ddtOlZ7ZQIsoqLggPykKpEwQcVZ7pZrC8ZJmG06FPIXn3hJW5v5qNi61BlX\r\nHvQPMfmedrjIAA5RGzUd72QQbXsJ8UKu43cAQYoAGzpTCFFMmR/OXFnmSDp4\r\nmqX/qZGesDYSyZZj0n0Qz0/sywrvZatUGkvoAr9+3LzO0fBLmWGWxfsLEcXw\r\nu9UDYiwNHsR6x2fQzNN0LXmXLT35nhSTv6SqIcvKhs2qRBwDMsXFX1bP5dBC\r\n7DFPgzpM+FvVf5KvR2SBeLkngswGub1Jdq8=\r\n=Yq71\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221230174901-e335a73.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/537fa6b9234157148712622d8964fcbb/graphql-hive-client-0.22.0-alpha-20221230174901-e335a73.tgz","_integrity":"sha512-gc4yh8dpKJ75z7qGHp9ZF+bHWv1B2flNgaNmIHcEQh6km1bGARZ0Cb5QQTP1Cmz/AkwHX0C5zpOYlEFekSe+/A==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221230174901-e335a73_1672422575291_0.972626569421756","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221230175359-67e9abf":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221230175359-67e9abf","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221230175359-67e9abf","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"58cf41ea65b5163e234ae09c8cd6cfee06625f48","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221230175359-67e9abf.tgz","fileCount":60,"integrity":"sha512-unwlnbjKGLVpZU2OIA/WBa9lCoG8AreQIOst10YwsRjlYlSSturHf6GGIfAra0vcCF4IoL5IIFxBPFTQsXAeOA==","signatures":[{"sig":"MEQCICSwJbiyGREjkiatOYfVJCwL7jud+htzdsoKh+Qk2nGsAiAFs9oYgXzNZD3U0rPydpnKJBrRUP4YOZAYYCSHHeHU7A==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjryXZACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpXdg/5AKQYjy61DuDgfwNhzyKOM/W4z9KKrV4Q1hWK71L7IIH+hgT7\r\nF+xCPyFf0JqfL9CqYmQrhvscaMJmaiHNnZPIeShavLSMYYViMmG86dsRdP5M\r\nRNltRhZf2/tyx7xieTGxjYrJRtFUvob707zmiOFGWqSRMdJjFkxxECtVvOaQ\r\nGbUYsdNFSJbP8KDW1zQMsx/EmDX4Rf5y7xqMaY++hSlGwW0CIDMUx+u+4ALv\r\nsnKPmASywIUxuWJWvFW0wCdky4VPDHZ82dkXV2GnPi7PNY8W981+Z+qEv4EG\r\nHMwzJDNECVUDwwVnVugndNcZibEgWtdD9NKwP6BI5UdE4njSreIkAJx+Z1ZX\r\n7LlwhB6/VuEgHjf7H01v42gHxF6WsYCJRRgjBMvo9qrrsDxSAcZIuHVylq6r\r\nYkXAKHDkejonfeEF5Aiv/UJOx5ADL9HqqJean6u8Jjt4eLjgMYeP9F1PRpss\r\nAOVR99hVtNoBaQEbzVkFkEbHhpj27qP8L2vldT/ZBvwqSHrIlVZxw1CZYpb9\r\nXjhlQf+D6fJWxQN7Kb4NBi9NHsFYZ236bkd8SMyRzu2ygJ+PRyiG2hI948WW\r\nja7MGLn+FsU8Hm32T7ZBl126VhB/YFyR1dCXm6ewcot6EEGXJJAmWDbRvzwm\r\n1DcgfhDlLwvLJbEcCC/JovoIk5/6OYebFnw=\r\n=xLQv\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221230175359-67e9abf.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/adf96ca47510bfd6c0e4f0c2edd24988/graphql-hive-client-0.22.0-alpha-20221230175359-67e9abf.tgz","_integrity":"sha512-unwlnbjKGLVpZU2OIA/WBa9lCoG8AreQIOst10YwsRjlYlSSturHf6GGIfAra0vcCF4IoL5IIFxBPFTQsXAeOA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221230175359-67e9abf_1672422873610_0.10269674633509296","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221230175921-83ef110":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221230175921-83ef110","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221230175921-83ef110","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"2f8061e2323637458b043fa5f4c61e875b5a321f","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221230175921-83ef110.tgz","fileCount":60,"integrity":"sha512-WkfdLaZPit+8fkVt4hOmqwgMx3Uh843JtFwh7RxGQaMO0Q1HSFJUC1O7s/8mghFgn3Kc+Ww4/NhWCzoKlO7ORA==","signatures":[{"sig":"MEUCIQCZP6Ckfw/iTpNTny2V3wGbkwq1HvuE1WOlegFcHLB4JwIgeU6C2OnO6CCvFkLgzQCMYOzwlsdVzwDrw8fGuWZGYUw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjryclACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoZkA//cJhZ04AFym5SH8KXCmngk6cOByaPBWVHEzPH5wgZfrHPC/Yp\r\nnHc5rb2L7hJC/b35vsvQBwaZIkCW9DQp31G1yity0/b43TSe6kvfHUK2AHUn\r\n4o8mgy+BaZ0/pk2Bvh2h/XPwh+RBxUEdCmBHST4CeLZFcj+DuKSqLWnW4SiJ\r\n/12EmGRl85VMqoWBCeGrbUKs+Vpfq3TlK4DglJxY24PuMKdgHs++lHUkgvLf\r\nINw8C8exKsUBYaV00T4rPYT+cz5DvOxvkQzSgne/Tn8GlWygTQ7Dszl8mBSV\r\nNE8FWROQRrLbPjLobC60Xxio/PIb4H+y5rw9ayXdtHJKn7Zf/poWCO5vnAWz\r\nKpH81R/n2J8KpVR7Q6YZ7V2pNmBDNd+tH63QlB7+jhBsJi01w/k60+9VUlZ/\r\nyk+1PjClbnCy4d6V3mlY8g0614kqyaDXXSJyUErK/laXn+TfH/FMp23Bxdq2\r\nlpLP6t12Aayy7YzBy0UaJF/HuIYRR/p3Ud94liRdWdXf8buheAEeLZITPHT4\r\n+bsC+hHtB6WWk7ht0FYBRa7NQTrj7rQbMdY3Ts9DoAAWDYu3wJsBrSKfz5l+\r\nrmRVpvaNp24t0K7HO6FQ619F/mUV0gQCBi6JUCAi3hJU3K2QnHvZQp7XO5My\r\n74J6ZFjbAZzkknBQbAaw7r6O+TU0ku0Emd0=\r\n=0xun\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221230175921-83ef110.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/6b87ad49f99ce28a6f52ef4a19d7cddc/graphql-hive-client-0.22.0-alpha-20221230175921-83ef110.tgz","_integrity":"sha512-WkfdLaZPit+8fkVt4hOmqwgMx3Uh843JtFwh7RxGQaMO0Q1HSFJUC1O7s/8mghFgn3Kc+Ww4/NhWCzoKlO7ORA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221230175921-83ef110_1672423205281_0.7042189238875642","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221230180753-7a677c3":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221230180753-7a677c3","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221230180753-7a677c3","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"19b754ea05a4c11d6007398f132295574383fea8","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221230180753-7a677c3.tgz","fileCount":60,"integrity":"sha512-821EwyPZe9kJfBGx9NdQsWeQ9uN/JfNMYXbbyvA3r0aSS6Ht9H1OQBIQ/PxcVC8o8EV6VSdvfcjEd3vq4iDGkA==","signatures":[{"sig":"MEQCIHLZBxiVYSjM71HZCXtBZ3kfhKWeZnznwhoOyWuDV8SlAiAq6eWZMYW2NNBSyWc+DNM0gbYORAPxfeKzBdp6Q1UM8g==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrykoACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr1pA/5ASfGH6Jl5OLKKDwRe/Ydo2rwpvOpE4g6rcVb48gGP6gx2u+n\r\niWrD1PjqBFlZWRpQ9E7xCd8/8+NzHhJxLsdBk4tJjOwePU8DS+mKZN+BA/uW\r\nx3M5wcvGdw4G9+w6w2RtHFOkgBCtK226i42blfshaVmA0sm/vKROZKGDiBE3\r\n2I+N+dDOk9D4Nw4SgGit4RmP0PVpJxtSAAxXTO6BDTJDelbKgBfeZVQXD7yU\r\nVJf7S/JNJYFtLh8I7VEN7DC2xmsBNiwdYDEPfFd02cFywPe7CnEZe+RPAqPC\r\ngtzd8RI8Y//J/9lzGOH53HRAzSO6sRTzwn28YebqECgrOi+INH56LcZ3WGu9\r\n5m+hwWw54FS4RyEUAIFvKEGL01/u85PRSf03xEsZonrOp8Fku+wi25g1cX5p\r\nAvj8/3fgWpCnh+LCioxP+wz5v6A2Ebcudnf7mmxKb1EJjE9zhSLLoA8TAcmq\r\nXTEh/Wjf11aN4eef3ovbtDtyn2OQCNidHW8w/i9cQqicuUx6dA/+eXLxsv8Y\r\nVoEENKzLL2uHGNi95ELfOsCFpzwqGaYqiNX3HUtBoi/mE+r/SZoMHyftGEdi\r\n9+WKTBCrSXaHYq9WfNlUaCp047z6VrlzvzNEEj8kzSRFjn2cLcJkIq+2vKGA\r\nJK6QZAiNfxTM4iftIIR2GTpYpFOJixMVCCI=\r\n=90MU\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221230180753-7a677c3.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/da2c2734119ecf974eadf9adba161fdd/graphql-hive-client-0.22.0-alpha-20221230180753-7a677c3.tgz","_integrity":"sha512-821EwyPZe9kJfBGx9NdQsWeQ9uN/JfNMYXbbyvA3r0aSS6Ht9H1OQBIQ/PxcVC8o8EV6VSdvfcjEd3vq4iDGkA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221230180753-7a677c3_1672423720440_0.15819977833780685","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221230181305-bccaf17":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221230181305-bccaf17","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221230181305-bccaf17","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"72b73aefb6896767368f14898b969bc53662fef8","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221230181305-bccaf17.tgz","fileCount":60,"integrity":"sha512-FOjHgU24xBm+PVrDROLsWcmzmU+r21UKTWqV7VdrijZo/1KCh8MZO1mOtztYL9DM5sK331CdPSrI7EAYSC3Upg==","signatures":[{"sig":"MEUCIETf6xGWNAagNlPkc895KbK06sk+nBix7913QAvXc/q8AiEAigLwoNczaK+wtKwwTEl0WA3QBqcS3o6JETonL1PxH/w=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrypTACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrU0Q/+KXU7stcMuKHDfQE1gRUibC//GOcRvBU8HwNqVIkhgpOi3S/X\r\nEeCUTRpLcmlm0CLJ2sOjZTqG3HwrAiZCSnE/vgfVpAgvqL+kaC2npb401MdV\r\nXXzg13EoKFZUt2aR4+lRKCWno7MpslCcZYOZxk8gIyY/gV8OyTf34ON4gO5G\r\niOzqoRsoqyJ5NaU4HBmhpx+6YPrG76PjtfJ38Kj4KRbFYd8I8/rpWPVs33rO\r\nsn5CdsbECKfwq66nRAm1mcpBiqnCi8GXtouvppmXr+3IeeSrFf36B8kwVaGJ\r\ng9R6u4DXPoZ0F98LBAGxbfnaxYS6qo9+Ng8f9SUtka1Ggyya6oL0l/k8adXi\r\nkWUx+fj8HIVVjww00kYC1skBHWxQRA+p1Bj6ZySPY4wJFvmx0yfYc9y0phJ7\r\nNxuZnKrkmqWmKmJaD6owH+pnh4Aj7t3VAP7KO4kznqizHqADlQzQJAjDWC3a\r\nXxxDqh8cGkaVuuilZkBJQlcCny+Yb60xafPqfajyggwYQ75GkTrZhkcKONVL\r\nCNwa/6IehO0p7O7XLr8de0ZA68Y2ufPun0AelaykSsXwoWdbHG658pBKh30m\r\nz/Jmo6mT+1/5AiC6TBqPtSN2XHXvALrmb6k06qM7C5f43T+xUssNVogiTP1X\r\n4zMLzHhIha8zqjaEM3b9k6i/SVtn2uKN5fU=\r\n=7OEw\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221230181305-bccaf17.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/c0271e2e8df334f07634c0062c08c483/graphql-hive-client-0.22.0-alpha-20221230181305-bccaf17.tgz","_integrity":"sha512-FOjHgU24xBm+PVrDROLsWcmzmU+r21UKTWqV7VdrijZo/1KCh8MZO1mOtztYL9DM5sK331CdPSrI7EAYSC3Upg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221230181305-bccaf17_1672424018812_0.6570844415851604","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221230183659-917b514":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221230183659-917b514","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221230183659-917b514","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"d34a14007b0ebac1edeac57a777c34cf59316881","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221230183659-917b514.tgz","fileCount":60,"integrity":"sha512-DXEMesqrby93pqfLn/sz92URsGIk6SfaN7gsrJYfNcAoDHtWuAVrgp6EpiOnd//I4gSYdgA9EDgD4mydeu5e8Q==","signatures":[{"sig":"MEYCIQCm/lq9TeevOAskDqM+ONCufbQKO03inNBZkZGn5BWtyQIhAInQ32J7lqLbKE7/9cp+uFnC7EX7eCz+zWkhU64z5KCI","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166427,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjry/tACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmoe7g//XE8Ch0+QuL6Upb+aVVEFt7wrE4UgyCFBED0uTj8CS0/zP2a+\r\nERkaacu8MrTqISo7Oa6Ef7kIlRdQkUVatEi2ZpCRB0xNsV1vhneUsuH3g44/\r\nAC5sAuiJLGqvAe84Xj1RugqHUKCx3ATg632LyeUVSnhrMQorikP897QB22u9\r\nV40Ln6+3Qmov+w4wq3U6VgmKmlE2ypdkoQiXkU4mgb/W9T1PA0V32ccgh3zz\r\nUyJ6nOrjfXCCSMBEat5jYmIFI3uNAtv9WTyb8odxPzqTs4z8I6YfyYpdJDmL\r\ne8wgUk3whc3ybHcHe9eeBrW0G+SfyNd6m8r8Id91h+rdB142HNP/YZBQI49B\r\ngWzq1++DKEJpBsfzacinc+wEvheQJVPWT1vL9NnhfIzdtFPIFxRbX6V4okeO\r\nOXWktgf5Ia+R91CmG8Jvhl1U4BA6UDhdJzZwtEA+lg9ldUAmUtNQDd8WLVJ1\r\nW7k/HQ0hf8deXyNuZgn8PGzabJW1vZkw96EKFw/RqPubck3fRcPFbKx+Km1c\r\nypD++gD5E0Kv7zLh1BuZpmbKI6CjPD+GOyNxamimJ5ms39+WTfOH5M+EAV35\r\nWPdlsFNewVd5/AX+vI/3pii0wiocjmSzUsvLimSoCvHenjGEAOguqsRarQvw\r\nRw1hgyIHdu0KjcLwQZbNFaQG6B6T9Qbe7vE=\r\n=OmMn\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221230183659-917b514.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/564178f80c145d7f062589fdff4638a2/graphql-hive-client-0.22.0-alpha-20221230183659-917b514.tgz","_integrity":"sha512-DXEMesqrby93pqfLn/sz92URsGIk6SfaN7gsrJYfNcAoDHtWuAVrgp6EpiOnd//I4gSYdgA9EDgD4mydeu5e8Q==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221230183659-917b514_1672425453081_0.5260307429770437","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221230185802-26f7328":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221230185802-26f7328","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221230185802-26f7328","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"aa15b79c62d74ba5344bd58556295a5421741bb5","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221230185802-26f7328.tgz","fileCount":60,"integrity":"sha512-hsfyhYwW9a68NqSUDjqiTuHZz7M3pqN46n77Z90l7rHt/AbLLEvx7EFiNbFZTO+bcS6H4ZQxveBxzA2APxelHQ==","signatures":[{"sig":"MEUCIQD1eabjKJjCVBNsgXF8wMzDPiep2rhNSJPK3QGub+1U9gIgF0/l46B01ZIUXONuyi1IbPfGb47hZQYzKbxLqIW6QCQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166427,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrzTdACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpISA/+JO4et2ctIQzZxzh+Bb3O1MqZ6knMBTLPF7yXvnilbPoztLOL\r\nMcJYLCU3XhB8jPaCyRdwDsMsWXrxZKcj3YBFuTLCzLARLOWZkzMJ8yIO9uik\r\nqPlYVV5t9Ir1ytIdXpWaPKV0wd1T3+wfl32QoyB0KAVz4m3QGx4FsakELSWd\r\nvEXOutYdM+e+GZbgdxbIJ1/4PYBUgC7rwMyMEtzwR0dhZZggaoiNuOO33hrJ\r\nNbQOmjI8Aor2J1qxRPPdNJbdEMpio3PgJJYzao46rp+psHGN2ZVaWokxbLjg\r\nsjRFB3A96UaXs5VrmiuSnK3mTMyLeXWBZbcc0QudUjzo6abfoTlcXO6gl53n\r\nNB8vsWtCes7E1qDYqHPV9Iv/P+/es+qOj8TQVjkhbXYGQrZzxzNKsuQu8whx\r\nkwzgNTQ3qdEM2mTKUvZjqrd61yRnnzPXp7bBjkCNzhKZE1KupqDMohAuZ7SO\r\nYUXtl6tSwvFxn8aB5s+3bWjqFQD2VSiVu3Z5SqndVmQEmqLWloCB3ODj9GIi\r\n13TARwvU7dFfviY4xRKq80KdvOa5BSZNQqr59V5HSg053N/Tvx3p0Ojd38+V\r\n1J+FGIuQLNJvL/hIQd5rKsrf+A6S5SQKtAnr4OdZ9JjYi0LWeBmEilP1AdnX\r\neZMruC+JGm90+vjKlqD4MneHO6A6iD2c+vA=\r\n=/mtS\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221230185802-26f7328.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/73ea79bd52c46b32012ab23b4ebe49f3/graphql-hive-client-0.22.0-alpha-20221230185802-26f7328.tgz","_integrity":"sha512-hsfyhYwW9a68NqSUDjqiTuHZz7M3pqN46n77Z90l7rHt/AbLLEvx7EFiNbFZTO+bcS6H4ZQxveBxzA2APxelHQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221230185802-26f7328_1672426717028_0.30460364063828815","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20221231180006-e46d2b3":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20221231180006-e46d2b3","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20221231180006-e46d2b3","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"7dee563025bfdc8b08b9c3c45451e17e241d58ee","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20221231180006-e46d2b3.tgz","fileCount":60,"integrity":"sha512-Go0z6ibU2AY2aS5Maxzvd6VMI33Ezuk5IpBX7ZTbVjNkDzo3tlzzR+OJWdpHpEDHc9AL6qG5TL0W8n+9lnlCuw==","signatures":[{"sig":"MEQCIE1TxEtjz7ivsj5h6R8JvRkTMwr2Yle48QO2dN04q0stAiAkwfJfFoT7wT8FxmtbZjYKr9KfP5BkozkTvwn7tkGU6Q==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjsHjIACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmprdA/+IY1xiANo4b/uzClnrHZlkMy3SaIgQRFjBJcfv32HqXjV2mka\r\nc/Y367t0fn5tgCSS9/shqOvFwW5v6gOZvO/kjIpI5tVLbSaP+2J/5Yjm2Fe6\r\nzRVxcSV4+VciohVbxvlxSsWywQPtw+eVvwzmjLBRsmZL1COPvNJK1P5EZzAj\r\n2NhBNLVlynq/ZKwqO52E+WLAT8dJirhuw0Fo00UJBMva0Xv3h/d7QJsRGSk0\r\nW5qtXt6j6IX7CBippqNF3gtOY6YlatOTBAdWtu8So3zWVZ6DxFuM4spXdEfL\r\nglvLitAfV8Mb4ORklqgUQlf+6MaUbsquGxJn0sMjeUvf/u2bzhqWzg5YvSO4\r\nHh6Z78yeTR4b/w5RNwycsmRGWCJ04G4exZXbPKDUyffao7K+RJToGvSyYNOc\r\nu7bSDRsA+dNgRbyJ+YyaYjDXAzzaftPDlZ0ynIkZCKgjILWGtVNWdkSiANq4\r\nEI6Ix0E/63ka2ymSrq/+6DGJjPwC/kcEPSE/2SrXn+OQuO2Nvq/BRb5yF7ML\r\nOlkTEhoJfkZoZt690wKlTYLcaYyEolTKP3vdPDfpaeSfU7l3A2hrinOF5L5E\r\n7rPwTUaab9HB4TalL+xRbtXdVXJBFzZueiMexQ/vnJZ7ubJdURTSZZGdsuXH\r\nm3XBfetx6GDK43kNrfnB0eeX7oWOAW2KpJ0=\r\n=/p4K\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20221231180006-e46d2b3.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/63e8fbfff51ae24753d4e6b108a1edd6/graphql-hive-client-0.22.0-alpha-20221231180006-e46d2b3.tgz","_integrity":"sha512-Go0z6ibU2AY2aS5Maxzvd6VMI33Ezuk5IpBX7ZTbVjNkDzo3tlzzR+OJWdpHpEDHc9AL6qG5TL0W8n+9lnlCuw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20221231180006-e46d2b3_1672509640307_0.8868471047326092","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230102080025-e60757c":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230102080025-e60757c","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230102080025-e60757c","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"3c70b419f44f6e304190509ca50c739e7d03f922","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230102080025-e60757c.tgz","fileCount":60,"integrity":"sha512-nD/U4aJRpEhnnqDXl9gca2eiz41towcGMQt/iU+jzYxOoAoHueV1Sn9RkN7E31aPCPKO8vpQsyS/zp36GXXkig==","signatures":[{"sig":"MEUCIA+klD54WYWrlavpWkPtD7DeZy65JoTsqOx7ll+PaToGAiEA38pl7RwFIoKt6oqaCZ3CemQ6xYcfqCKb8LyG6SfYt5g=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjso88ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo4uQ/+INCrW/L+BoUfBsYZ4V9w1he/uXHzyhQmaS4ttkgh8rXIWskg\r\nrhvsouEIVNqZ0mY6YH6KM463wn5c9m0D4O2gXo5mmeVB9ExvamLA8iv0/5aE\r\n8TBxkGP0mGw6tPvLPyN74h5aRo6zAww/TuBVb/YjOv17vRZqwUq+YDKpkD5r\r\n7Er3axxPNE/OWH6BQiKiDDzLT6EBSB6RsfGq2A10pWb2Nd2zbVgID6SG27pF\r\nX1/JjoiFyMvIZnD6vuBUfJA065tXYYvGdSJVsTUzsez83Zdzl2adBK9GyB99\r\n5uKW2a3TrqvA/TUDwHGSZmcY8lF+2W02IBTAQxJUGnLzR6qOF14KLg121hhZ\r\nER8PdZZ1XkOuunpvxDZFUAtAIn6IJnlj/dfa1g5aXfbG5giPvt56ROf6kVtB\r\nL40DJBoL2gIUbmue+jp9QiD34JSr1QDR3U78YjLoFC6LUstvuqkRWacZG4Ee\r\nBeEBbBaI+YHtYaDFbyAuRE6uLDTVcpIpql1HK47Z2ejZunQ42Pdhy4yw+R8b\r\nmH5/30I40vj3Silpvzl6cI+vF5m5VFWXHZEExdb/S6jul67G1YRqceu/w4Vk\r\nCgPiW9zdhLjBuwEnO25UY7ikf0LZEWlbF0uHJBbbSKtvP9XIUTzGNWN/kfPc\r\nJ386CdyWGhbmUkKA+Zoe4QrKZqW8pndgn2Y=\r\n=CNCn\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230102080025-e60757c.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/7bdeac7e9077c19734044f4e152c932b/graphql-hive-client-0.22.0-alpha-20230102080025-e60757c.tgz","_integrity":"sha512-nD/U4aJRpEhnnqDXl9gca2eiz41towcGMQt/iU+jzYxOoAoHueV1Sn9RkN7E31aPCPKO8vpQsyS/zp36GXXkig==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230102080025-e60757c_1672646459813_0.6927420394255535","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230102080909-671200a":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230102080909-671200a","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230102080909-671200a","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"fa1f5c0b1fb983059d73af517f62aaabddd75cc8","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230102080909-671200a.tgz","fileCount":60,"integrity":"sha512-ITYYwwrYycFlVPeny5kF61QZEGFk2hp7JJ4q5asRqijA6+qcktm44+1AweANWMmRPMl4z0A511RSH1CbsTB58Q==","signatures":[{"sig":"MEUCIQDO4aJ0y/NeRLvmxekeRzKbr4Dc8up/F6QXZNnve94hQgIgPAjzIF/OFDvLzAwuWLJk+9jNI6fMestC2BHDKbAQI14=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjspFIACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmoh/xAAlhQVAqvqrKLFy7Ya8evLyORsdmrjLv/1i8WJcT6g0A+y1+ot\r\nXcoh15G/JbfPNX/WPj/jxQe5pyvUFbjBUEdLvzW7HvaTWAfXmgvL+9Dh3uvM\r\nWQ7+Zu63vXTjZfeyHUX34qVDWjomPVOhsfNvqALqONLRchJkgcRyOFU2zcRP\r\n4J6WdRiUpH7ysflPfEtnC3lNQE6LEhfnloNtwNcGoku1Cq5SCA6uQcLUQE/x\r\n2fKMEYT6llFlkS9XuxGMV+KV69XmgAVG76ALTw62Vlj0aaayXGlVruyrqtcE\r\n8lO6Smckf3jok1OyxCmDp3ZOMNDbeYVikPPH388m820vLvr0/fS8GF3llG8M\r\nMQLatOCE0a3FQD9Mq1QJjOSkgYXA3SNzd9Zg/1cp/RQdUunWxT3Z9bOJ9Clk\r\nk+2p7sS5m348r3ccaojg4ao1pNYTHMXwKiZnMABw2X+G8SFoAuYV6BuRH3f5\r\nol0eR8j4oNUW49R7eFwVr0Dp1/1RnQcCwPzo/WQKasPdfXyxpS0RM81YcqjZ\r\ne+Pu6tQLQ+dHazBa1t3zGXQhMtS9zqaEdVvr8hSM540wrmwJt6LVfp6DKpqA\r\nT94H9Pn2uOv9uIZf6JSDOHWo5Q9jCfCg97KBtUWwzmN3ePeDlPhZzfbx2A0A\r\nvSPOB1SWCLB4PpykkHRV8sUHgmFVEkhvjGs=\r\n=romV\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230102080909-671200a.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/3a2a43329224845f075ae5aa353fbb63/graphql-hive-client-0.22.0-alpha-20230102080909-671200a.tgz","_integrity":"sha512-ITYYwwrYycFlVPeny5kF61QZEGFk2hp7JJ4q5asRqijA6+qcktm44+1AweANWMmRPMl4z0A511RSH1CbsTB58Q==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230102080909-671200a_1672646984448_0.01069310993371686","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230102090112-1935b71":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230102090112-1935b71","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230102090112-1935b71","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"3c9d7eeabf3303cd874c282ffc910a1f412f4b57","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230102090112-1935b71.tgz","fileCount":60,"integrity":"sha512-e94uAjGij0oEiXA4C5PCGP87Xm1ijwPs48t7yGmNOc5tVIHzbU1LrsY8lGaVQkjhskuwoXFqGqVJrscCIjBnWQ==","signatures":[{"sig":"MEQCIAD1rs6A1Y8rlJwsH7+iPgmqNJfeRgmIN/vFVsNVh8O6AiB5EC22Xid8ua7NNG9ihPRxuTjqR9qLR4Dm6yAHj0oFuA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjsp16ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmq0eRAAlCfmoclMdUJBfl2lFUgAZIng9KuTGu1MP7BPvwyC2bpoPvI6\r\n82udPBMkfqvMEDPvmDdOHDtlXHrL6e8NC3G9IOjxMG67KziYWZEW23veCBOk\r\nUZTdp9RqJwY4cKKdDJOzkWjq2s+X7m2HnkfdC9Bwj2edChpKbAn6MDkzL32O\r\ntbYrQDN52lLPjfSOx8QhyWAEkrLpsAN28vXsMu7A6I6FDPgn6n4jVBjgCpIq\r\nG3S/knOH6dPWQmaeeq2eb8mn61fo3zKfkg6bQv/JOEINqCDVbmHItgknMMlQ\r\n/dZ3sBceBqgZ1D4o9tgI0NQVn4XCzJvE5QxwNRyUcx51G6eSw8JSngCsODS7\r\nnO2aN2btlI2PlPGym5ATBz5aY++mXGpDMNav/Nb7++HX5OAs6VTPlIi6t0iI\r\nUfuMRRAYH/Mz/MKf4zh8vRVQAZCKF/13LOL/Xo8rS9vx2riVKvFB3is2hqCS\r\nFXRyR5gZvS5iUCMjjQnSjEaFHAvB303S8C+1g6YNY+oE1mxoj5S356zlTRlV\r\nmVSq5DL/SpLq2ONaZW2r6zWPEBGgwQ4/OAhXajZHZROVeh9NNSo+BmqdYA3S\r\nxUPxUgtgwLMyBSHJYB+DDpoHlBJnohmFPM9OBVNO+GjctEbFEak/ZVaJHci6\r\nGdp3VjT1DMduUBkq7OBlj/g2nd18rwpEseU=\r\n=eH43\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230102090112-1935b71.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/5b8a6be78a9a055446175c63bc8b9e08/graphql-hive-client-0.22.0-alpha-20230102090112-1935b71.tgz","_integrity":"sha512-e94uAjGij0oEiXA4C5PCGP87Xm1ijwPs48t7yGmNOc5tVIHzbU1LrsY8lGaVQkjhskuwoXFqGqVJrscCIjBnWQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230102090112-1935b71_1672650106155_0.6309031272081129","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230102092908-fc1ebb2":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230102092908-fc1ebb2","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230102092908-fc1ebb2","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"eb43a8793e233fd53217ef47f29c8174b98b007a","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230102092908-fc1ebb2.tgz","fileCount":60,"integrity":"sha512-yloFMd/AYf2QKu2HZWxN/R8ZRDM1dbZqbJUaP0SqwGneX0zortjSz5xYCHhyVZQlXkIcRTP9oCrsdTfJYtnheg==","signatures":[{"sig":"MEYCIQCgxnnM5lpPCjNFJfpdCbQ0ptQ+8tFUfDltWnUA2T8CiQIhAKd3S5faCVwVuiG8/uwbU/hQMpPNYR5zDpoT8mW4HnlL","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166427,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjsqQLACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqDCxAAj7zE7D3FE3hYyd8nM47UKQfRmeZWmxYI6doJNOej+oqS7Wat\r\nwqKePK2JROXrwfB4tECkwXY22fDaWKa0y13O0t6Rt0cQSXgxA+SRUFplZK4z\r\ncY+N60kEZzAJ7QTo7QqTuV+dNqeBk/HskOa/My5XGjlvjeON8ajSDZr3t6BT\r\nrMfqqivI8FooIMCZyKFjK/TUBWbY0bmaClcNMOFPyARec76rlz2voc0LLQvh\r\nX0Ejugh6aQg+D/2fyHDVvBu81KOalBsuxZaymsjB9cY6iq8QsFHarvZJMv3k\r\neaWXwhlkROtbYflONxaFMoXVFUYMJ3wMoqEmzLEJ5J0zUic7UjEwWXa/9LMa\r\njTA9L3t01UfH3XdYVg7dK2/CBuKA2XQej8iDbcHkprB4Sg39uth8LaItL+vb\r\n/gCjRCSdPQskvNjPllmsJxX+g0BrX4pRGJSwIdtTIyT+rlP0WXXO+LA38t1i\r\nSfK4vJOVI2mvKId5/oNV6VPV1xe/eKtzvQLbuEbIMJCnArpaQxTHHrFk9TEY\r\nnRwS+uA7gUqdT39AuFulwb34FPFQgOyGkAU5DoL/tdpinX73VmdCNIawt1op\r\nx3/1MRPTB2WEBLqkVrcwUqTe9Cp/EIBSqXSSXCyFWTQLCOSB0QxnjMJ1BMms\r\nfFr4IfWcxvRME3TsXfXqonPNgqNb/hh7a8I=\r\n=bas3\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230102092908-fc1ebb2.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/f4dcf6f4fc7ff2ed7e864f2497a0cc5c/graphql-hive-client-0.22.0-alpha-20230102092908-fc1ebb2.tgz","_integrity":"sha512-yloFMd/AYf2QKu2HZWxN/R8ZRDM1dbZqbJUaP0SqwGneX0zortjSz5xYCHhyVZQlXkIcRTP9oCrsdTfJYtnheg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230102092908-fc1ebb2_1672651786852_0.9525267439552696","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230102093030-e5a8731":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230102093030-e5a8731","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230102093030-e5a8731","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"8cd762f3976eb2ce614d2451e9ad0ae5df15dfc8","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230102093030-e5a8731.tgz","fileCount":60,"integrity":"sha512-CVDbyRE5BWqejyFSs3FoHe+K1qr8ByeWApXkj/9v8UPJ6E5UjLkeeAjKChLRLsj+NlyW7OMwVXiu5MSTPn6ajg==","signatures":[{"sig":"MEQCIDl4Mj67CEwGkhW0004nSlwmd9e2pAywS1VAsQh+wHVrAiAkgJuYC1bMAab+yXxN6paDfUEwVrUAEqeCcCcj5UfmPw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166427,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjsqRjACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmozkQ//VzayCxXWK6Jtpya6mzdKw3ztmKkRPrScJBZHGdqW0zxKWdzV\r\nnGJpqNr1mQHcfLfTuT0Y2KR2MhTBFv70ff2u8Xb5Tw8GZTiOoduYN8lldZpS\r\n9ozOwJMiyYFq8Bfqr6UA8et2jOsHlufALywGcVo+GP7dIpm8IB+Sd8OkbyIN\r\ng8y9bxf2HzjtKl3BXfWET+TYqBcs0xNFpqP6mxk2jKW76XoI6aV37wKNg8EQ\r\nsTnu4rFbCzxNw6pZzjpo/g92CzPikSsrFhudcALkOkxQkSu0GGoeJhuY1Q2j\r\nUtHtmRS6TPAbnsftAXffUZEVci/EDwCfWRCS5gtgDzzZ8GCd7N0gRon2ujIZ\r\nHphw92u5tPxCldg73Y7965if0O/B9Jy6Ghu2KbNi8HlVHJF8oPQBftrl8wiG\r\n11VbEq85/gYskoJJmlMErwWku5YGwsZU2kj1NhjN0du8g97VGHix75jzwnVh\r\nWntV/JSilRdbiS59I2KCraJXvYI8YkvfNroacUQx9AQ66Z1gF5ZBMTtexE8C\r\nx7qcp5s4FMXcKjqFLgwqP9Syo3NGXtvv/3q/lKaAjuqF9I89HRJgLRqXh7sN\r\n2Qy8Cob/9A7UToAv7SGWbBhpeGtcs53OvjofrGKTQTzlONezPS7HS42PqsWJ\r\neo/MMkE/pm70cjBUHzX79Kdl0Bv6Wn4NbTI=\r\n=chwX\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230102093030-e5a8731.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/05f72be135e4a88c64f9d2cd9755202a/graphql-hive-client-0.22.0-alpha-20230102093030-e5a8731.tgz","_integrity":"sha512-CVDbyRE5BWqejyFSs3FoHe+K1qr8ByeWApXkj/9v8UPJ6E5UjLkeeAjKChLRLsj+NlyW7OMwVXiu5MSTPn6ajg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230102093030-e5a8731_1672651875726_0.8298656870586829","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230102094209-936432d":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230102094209-936432d","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230102094209-936432d","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"5e20e0fae0b3961509ac89b359a01e318c6b6618","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230102094209-936432d.tgz","fileCount":60,"integrity":"sha512-rEJyYSi/sLu72WHCb8e1opEBcpfTSwTZrSsvDuOIhJsthyUt3utW8/nC83tJ6LyFqAyRfZfD0AG33umsxHFwmg==","signatures":[{"sig":"MEUCIQD+Cdzq3InZ5BFbb22pw34g08SMQT26Z9kNwJcVml9ZVAIgB7u+1DjF478nba49eztt/mVFTKK8s48LvRP6KDE/Nck=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166427,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjsqcaACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoqbhAAoJ/xO/HVyrQm/o74WN42qXTeyyp8tOuI2/JfhX81dtgWkxDa\r\n5HIIKfduV+SVHtdg2N8qFGdm/TFsY3+C1g1FTALt/CrTHJiuGZEqvYcvMo0L\r\n5ujcgJF2LZcVqjMaRvfis/GB4a5IAmO1pJBNFtx3qUA0E9K3vgzQYHJSSDOM\r\nSWKUE7ZGHG9m+a96ihn3ttrLJycL/DUmQCKHurl6qJlCq8Uip56obxYQb8IC\r\nyGJpPH0JZdz6QZAKxSLtx5p0fDjNsnWUgbOOeZMDIovRJUQFa/IPAQ/OzI+s\r\ngcPQ1GuwZzctRDQot1VakemP0VeKOkrr7GPFqfHSYATFzazApBAdF82ZrIEy\r\nSrrCt0O3Syy1/fYhum6WJFSw7w9J+cHCE+ueV6Nk5h/40ldWG/JMq/wKQfB6\r\nfILYohKE/hd87BjpH/CKfVfBB22mMhiZEgBCGBtHu8OnmKS+i46bL8eRQmYc\r\na5i8IQboc+8iJKUdVnhkDzUvWTnOracZJJXJbc9DKb5w0OlJt7XoxHWQfhjb\r\nswFGr24z2dixfxm8Ve5axj2mPVStSBa141dFSYC8zz1XGL/U7VLtP0/R/934\r\nOR4mFh/jmi59nH2CxJA05EE7/p9rF2N/u1wnY/2uWbcP/CpRWEPkCfy4HJAv\r\nfmoPrPv4y+1es6yg14XiLdF3OnAbw8+6NR0=\r\n=utz/\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230102094209-936432d.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/61f7a8960560187416b4e901b101da99/graphql-hive-client-0.22.0-alpha-20230102094209-936432d.tgz","_integrity":"sha512-rEJyYSi/sLu72WHCb8e1opEBcpfTSwTZrSsvDuOIhJsthyUt3utW8/nC83tJ6LyFqAyRfZfD0AG33umsxHFwmg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230102094209-936432d_1672652570387_0.8969351062937791","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230102094238-7ef22cc":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230102094238-7ef22cc","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230102094238-7ef22cc","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"69f9e2b60f359457311032e6a6e86676e704d8f5","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230102094238-7ef22cc.tgz","fileCount":60,"integrity":"sha512-eAaUAZItMPcFHnOEEY5kZD/QJY87EGF3GgNB8QddloPB0cCY9s1FhF4DlUowm9eRIdqCK+G7d217Dv40F2l6AQ==","signatures":[{"sig":"MEYCIQCWErxKRn9cnBhWneFXvwsTrnGvxTZD+X4eBziLxGlcggIhAIhuIoRjgA0DJM0nT+e+PtNcWDMpHcg4J5kJE46ChfZn","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166427,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjsqczACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqZ2g/+Kvi2aloLfY3lUMvOSqo9MLznouH1ewNIaRBjobz5XKAQDb3o\r\njbXrhS5/3yce5CqRSLbikokd2hgHGNzMXWho0hlwpN1uaxvICkyqYnVVlIQJ\r\nlPvVakzWVtGQVRV4Xz80pjxfja58uudndobp0qkx8nOGKl+HFf1JNCnZLEnt\r\nVM6pQllb1/q5LKWRNRR97QUN070qTBvR5ZS4xEm8BaSrsXlY1oe9b+rWcLys\r\ngx+6BOQj/1lcaCUqWiXvKJvO0XTi92pYd3DFPq9Cq5RbdeDqR7M7Ek2Sq1FT\r\nPHOZcKf6+bGpKMcClcdnP4umCK9G5MN2wWWFXpXQrGo5gODK+VPjLMMhFs3y\r\nl05DjPJWp0mQsYkyZvMqsy8eJkV4NnV6SZOmanP1IpbTLpj/wga5FSOfz4TS\r\nC/qNb+o9F5xv4loWpYvdX/PVRSKaHP1jkRawZ0dSXZcOe5QDxe0Y1iBtxg0R\r\n4Em/QB/ebxzcTUab0hf/z4tJLDtCexBINvBAt5k2XeGRBebIocttQFc7UoYj\r\nkOxxLL3pkDcPPH7WLwZHCFfl0h22SonshPBHg4jW/uTcSdLCXBT+9AKJEsZ3\r\n8Cw0IaxQnxHzii3cTGARBDiU6owLnPOZA3ZJvSKScsNish7Lk6nOdh2zvk4b\r\nhCRIHeuk7lHc8rb/bnbv2nCP9YsBkUgfNCQ=\r\n=iHNP\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230102094238-7ef22cc.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/33cf02dc3b7ab88e9d7a0ad14c3d7e76/graphql-hive-client-0.22.0-alpha-20230102094238-7ef22cc.tgz","_integrity":"sha512-eAaUAZItMPcFHnOEEY5kZD/QJY87EGF3GgNB8QddloPB0cCY9s1FhF4DlUowm9eRIdqCK+G7d217Dv40F2l6AQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230102094238-7ef22cc_1672652595468_0.22782189978739598","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230102095001-a0d6b4a":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230102095001-a0d6b4a","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230102095001-a0d6b4a","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"e19ab2a81a6c6b16104c1880359b83047cc25880","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230102095001-a0d6b4a.tgz","fileCount":60,"integrity":"sha512-iW2Hm2ZfA2t5pxfOGPb91p2JUlkopAvTL26dLhmqKnVpuKIr3DT4kfrhkWkqpJ8wUQ8zaU3wgc/dvSNTBHyDBw==","signatures":[{"sig":"MEQCIBtu0at9/i5EjYjfK1xUjHezruTmGET/T5/w+B0K3whrAiARYNFLQNgCL2CuZLWo8NL5iIFQaDrfShaN0oEDM5tgtw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjsqjpACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrOnw//ahCdSBisfEHGL/ZqpwlmBuw+rPIeH3pBmgR6oVbq/H7Jo6gm\r\nJstyZcP39SqnVzG0hzdVS982kqsGCS19d6oFpZdH9Yqh08tSR4+bu4WvNkDs\r\nkDQ0jQmWxc/eiYZxx+gGXpbmFBNEX471mX+LIS7YYp3NOo26e6JsPortJFrf\r\n1kTw6zjrEuy6HjiPX3wTSHQUaM9SqLjVUtWThX/ba/mykZrMikzedo3OJZ6X\r\nNBg869/jKHEvwdSzqj23TVILyuFuXsWf/1KEvCgAriTyiP9j5s8Pq+5fKoM6\r\nD6KQYgzaSqKTNJbpGT16O0Sb/DHyDJmQGiaFw3kOJbbuVDXWsJrQgDhHvmN8\r\nldFe41snLWrIb/F81xzpRyW9jX8BQ0iRAnHJc5Q/KPVcEyyiXMoYU6of8Id+\r\nHAcOd22hkoevVjX2B1cHnMZmiP2ns49vjAmVG5X4IFP79htpLnlsbs2CA/DN\r\n/Th5G4hCcE+2D1UfjYSqwrCBBL7/WRGMP1QpE7FTIHUWGpf38c2I3F98d318\r\n4YzIPjLY4t1ECWzOj8ST+7beNRof/hDev7/AjO/AIdI1+jbObgdnxXwwQeJf\r\nRSRXIciOAE1tIz6FqvIyhLDHtCPRe7DCA6adykcWdeMjC7O373JcDGPrUQI3\r\nu4D77g0Kul7vfl7RvXwuSAS341O3OXUPRuM=\r\n=Il9w\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230102095001-a0d6b4a.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/ff62e45ae8774db157e22f159d971df5/graphql-hive-client-0.22.0-alpha-20230102095001-a0d6b4a.tgz","_integrity":"sha512-iW2Hm2ZfA2t5pxfOGPb91p2JUlkopAvTL26dLhmqKnVpuKIr3DT4kfrhkWkqpJ8wUQ8zaU3wgc/dvSNTBHyDBw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230102095001-a0d6b4a_1672653033589_0.46593917875005464","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230102100534-95f4c3b":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230102100534-95f4c3b","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230102100534-95f4c3b","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"1cdf97c46e76baa9b0b85427fb1d54d77897fcad","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230102100534-95f4c3b.tgz","fileCount":60,"integrity":"sha512-J/mRL4clq0CoC0cJw1zgMGOyD23Dw316cLbZuqCPFcS3Rhhh/NwkmobHI0MGIyTlMBec7c4BE7VwaoGmD4/SVQ==","signatures":[{"sig":"MEUCIQCYUeUnB7CO9IVOvK4qjWnGeCbFVs4ZJBgup/ahrsZhGQIgYGBRxHUfq1xoRqIh/KqM9G5TqweyAaLD6ayY3XUR/m0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjsqybACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqpHg/8DMk0y9Yd4OAuECW+GLDdZgPn9CTUzS5D2BBu2I8goWq6xQGd\r\nVV07SF2sJtc8PlRPwpaYkQa/S/braDp1Gg0anXSsmALrQN3yCMsNC2Uxj2EH\r\nLBwfTFRm36MeGbc1PxekdosXhqLJWS2js2apPsjpttl72BdiKWVT+BnvDPqZ\r\n6XdbldYTj3ele8qwKs/5diXD89+2g9x0O2BUswhX1ghfuD+sakik6ZmzOOeV\r\n9mHmDedJy+IZG3xtlXwuJOHfnZIyo0R7gXlgnHfA7s9him9EqPfoUxyFcoXt\r\nNYN0f+Or7222xqn0WDA/ThxJNnCT8pIgWuDKuYHBVrR5ENX5xpyEQ2T9t7qy\r\n7CCpPQ5EjEuuyDJr2dkaeVntcuZ3MuSVZa264eaAZgtqPBIZjyzXHjsl717A\r\nvVUjUDMAs5D5+urMi4Co4GW0Oib1NVDypNnngkQ9/GAu3wbosPFApZl0fM2s\r\nKADegKOik0szkDhHj1+KtC7YcPyyh9MNr6hBgIM60CfYyGPkivTbIzYMpNQ0\r\n/Bi0ycruor1QB0FwVWTHCASfbiuiotVzpi60MRjSgTS0JvEdIOfIqNxOL4yS\r\nXCGqReWg2ntW8CCzzmhsOaAZFIfKJ/RrWhJGweaP+fZkHmCdBx0UAl7DUPAr\r\niyGvH/GkgaguC9Yz/k1mw6En+rSKJKcyRRQ=\r\n=Xj78\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230102100534-95f4c3b.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/a2d303ac68bc7fb77dba6240143e0baa/graphql-hive-client-0.22.0-alpha-20230102100534-95f4c3b.tgz","_integrity":"sha512-J/mRL4clq0CoC0cJw1zgMGOyD23Dw316cLbZuqCPFcS3Rhhh/NwkmobHI0MGIyTlMBec7c4BE7VwaoGmD4/SVQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230102100534-95f4c3b_1672653979014_0.6316989444265961","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230102101001-c97910e":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230102101001-c97910e","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230102101001-c97910e","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"5c1f67de941f6bcf135e085317ddd1fb3c655ade","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230102101001-c97910e.tgz","fileCount":60,"integrity":"sha512-aU+CZFxMbAUJ/PQjOYFegJLjQW9zMeMl4hQCAZ3eZX1+aBpW8NFv7xlLdQ3ugEceBP4cslCbZx5yctqfQNCd/g==","signatures":[{"sig":"MEUCIQCLZqyKgbdBEIdNMMEW76eaHiGSfKe15CJj0tXosUa7TAIgC/bQ742g3fcg3+gkBHwYjYr/HOpD+W2J/nN9JLegP20=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjsq2fACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqJYxAAmP5Hn3nkr6gJvWnXhbXldHkBGoSg7JdMtrdb9Xa84NkfZyn5\r\nM895Ee4zHqfn3WsFiAd/+k+g26CHBUrf4BkOStgxOspnLjCv0SMHgXBJMUtr\r\n4g3/lw0WiqQb+X5TtZ+PI3zT1CpKH4L2Av0HiY1tYMzhZUtREEzN+WTyYItg\r\ne8anpjcvnnta4x3i4S4VLAwvDpjDCHFIVwOd+KZBUOmMvaFHyzf1wFLs3/X3\r\nm+OSFpvA6nR3olu/vqSsF5PPuTK5JoeAlGUoYcAtWjIfuUxNL1C1pXL0b7HO\r\nsW+khb4lJ5tjLCBoFIFXVkv5shzMxSeIJPl4fD3rd4i0rdXPrQyRhQy11Ajs\r\nSY+d10R+q/DqGo/MoqjjM449wHKyODQp/VTVaWuvyTjkCghljV+exNSAoatA\r\n9i4EpEsrc7yvNj7Vf2YeBiVHB/B1XFsnrRqjkrRCiP6WUa6rZznNJhJUGjHe\r\nngJt5BEFG2HF3DoeaDUNi5ettKZpdTWWBGCK/J3/EFJjUakkazF8eZa6Tx4q\r\n0xWXyW2a48aIw0xv/lp1c4aYXY9p9gg0eFC7I5R8aRtYcbL0yukyaIzIDrtG\r\nZrs/Rt27/n06w8kV+1IhpjPFB2BeUTaI+L9v+e91dyspnlLvSIwhV0pnkXXj\r\ncfLzK2Wz4ASFgrZnwQl2NX+5RNhmhF0/CQ0=\r\n=tvl1\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230102101001-c97910e.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/847fe67eafa8549499439cf56810b360/graphql-hive-client-0.22.0-alpha-20230102101001-c97910e.tgz","_integrity":"sha512-aU+CZFxMbAUJ/PQjOYFegJLjQW9zMeMl4hQCAZ3eZX1+aBpW8NFv7xlLdQ3ugEceBP4cslCbZx5yctqfQNCd/g==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230102101001-c97910e_1672654239078_0.7457500416779688","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230102101825-7fd1786":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230102101825-7fd1786","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230102101825-7fd1786","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"7bee31e8e46e3ae0cc76b3b6b2d9b1584c6af123","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230102101825-7fd1786.tgz","fileCount":60,"integrity":"sha512-AoRRbNaYxiujXvTH9TvoHjPdt+NY9+XGjL801hFQnSWVV+cW8z+6T/vZmya62mER9X/2pLY++u5jEj40921niw==","signatures":[{"sig":"MEUCIBXUoT+VxdTH6pAKWGxRux2NHD6CRY8iHcjYVfhOtkGOAiEA88uUWpTllKne0N28Zr4jy31kbCdOWLYpZFC+PD4Yj3M=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166427,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjsq+SACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrjYg//dGtro4eVuTf92XqG3ZzeDlCZotc6Ghdhs3g/MBZvLqRRoC+d\r\nSEG5zgNlsPI7dEII/HFRzNi5Z6qdmIqOteVYT16usMeGpQEfwQctDoDFSZvL\r\nHMnTT8FI2KISYh/e9ZkGzYE1d99teqhpTb6lGiS2i2EBsbFMuceBgnH1BcoQ\r\nB9IXZ8G6jjfZ7Yaipig4sJPBO6zAVk5QOg6nuHTbW7RrGnzcUwfF1HoMAbsF\r\nrRAb0BBOoe9XuKwrTuL+THexVagkcdyhrLJ3gNnsQA3iiLT1OQsHfZh27tjy\r\nDnRqYm27lkCYu2VMs8DC2l+BCxMKqme0gl18N+MDYhTrnTOv3aHDANaLwYzK\r\ngKkVA4j/MqK1FPuLL35rS8k6g14qezJjMoiAqXEXXcRm9/4Z6rQPOLDNlNk8\r\nz6Q/GYU49ZbJFfnQHymFT6JsMJd5hMeAzNzAe7ast330q91sjKKWISzZcTGu\r\n8Xmo0vj0KPAj3bh6RHcWdoW9Fk6s5ZICYWq3Ks6r4jEnxri8DzQyJ+tJHH1D\r\nq7kFNc0tojX3kumd4BZrN0Bdii2avlet7A9U9jLZzsidOLxAJox0keP+QVrX\r\nXuXFMOq5zmshb0uKwfY0TZbyo8S0R+1dOcSukbNERmUDiFUCMbjSp0npZs6+\r\nj8bXccB06OjnWEJCPeZeuaqzOjblx0+fp1A=\r\n=kVg0\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230102101825-7fd1786.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/281ba634d8aba6a4adfc0609e08df4ec/graphql-hive-client-0.22.0-alpha-20230102101825-7fd1786.tgz","_integrity":"sha512-AoRRbNaYxiujXvTH9TvoHjPdt+NY9+XGjL801hFQnSWVV+cW8z+6T/vZmya62mER9X/2pLY++u5jEj40921niw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230102101825-7fd1786_1672654738555_0.6551450118047617","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230102102048-9d87db0":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230102102048-9d87db0","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230102102048-9d87db0","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"42e811073e1e23ebacf4359b551e73842bf9d2f1","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230102102048-9d87db0.tgz","fileCount":60,"integrity":"sha512-Vz8vmmz3WUdUJZL2QgjipZfTcVXaSlSA9Y2IRkDqn0WX+p1K8nQV12ZaZocJZMLpNKTqdIXY5GIaQP2/G8Cq0g==","signatures":[{"sig":"MEQCIES1PtEy3ZTaCQdF1kuYrpKKyTC/FAYFTnoybaW5E8VAAiAxlGGNNgn2rxkfTvjVt2kiHbP6J50gvNXy+/uivmipBg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjsrApACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoB9A/7B5w/evxICDA8+qMT2HIF0B5iM0v4/b9Zv3ihZMoTkaVYbhb9\r\nQ0lRmTicTFerT0DAj6LB67Eyj8pYNDxhhl0LH26V+QNB4L71ZNpu9tBeG0gP\r\nzYcPo88y7MvToy8dxRj60jLSljOD9ldynwmWmGR8a0hNZ60+jOdtTRa2IEMR\r\nTtKC6CAFSIducdXqhNB1sDJ1XfEzI6BxQ+aLMSRFhLirPpqiN5yh4Q4NgacZ\r\nY97pLrXiWbXDN+1WrE1SrOZLUQiEeHVh5OtOOKdl3EuPs4OpCniySFgLVeJy\r\nJL8wANF9vzWRh8c0fi5um6r4vlzVbNgVxiMbA/svZz13yjES/pH834oDsmQy\r\nMboIMxiexlektakB4Sapr1+TC6vOQm0TZd3ubnG5NeVXHAHBcOtGkuQ1pqrU\r\nC7+JmyoF+XVyYj6UISWIbmONtrV9OqfaWSIMWMfa7wXPK8NIKQGNCFJkweu2\r\n1tS89sVlpkFPHvp76/liaffZp2zkCerAtq4MY9FAxYE/cZrJR98Rj9XePm6k\r\n6qCBKJ+T1LDtiihxuxeG0iVWi0t8LC9UJPQ2WOyXrdz/sPPjodSxocwdGIuN\r\nRiYD/X32YammumYTfyA8FAW5qdS8sP1wCLl8RrAzblHmprzSMLOto4pSYcfZ\r\n0WFGcYcN+rmQYqSHn1HdsLkcOueifxd9BhU=\r\n=kiYa\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230102102048-9d87db0.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/b734b0e0cc6e0b09defa5b3d651d25fd/graphql-hive-client-0.22.0-alpha-20230102102048-9d87db0.tgz","_integrity":"sha512-Vz8vmmz3WUdUJZL2QgjipZfTcVXaSlSA9Y2IRkDqn0WX+p1K8nQV12ZaZocJZMLpNKTqdIXY5GIaQP2/G8Cq0g==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230102102048-9d87db0_1672654889440_0.11481044608345581","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230102104847-7c3da7c":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230102104847-7c3da7c","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230102104847-7c3da7c","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"24a1b5dacdd980f9a42fb76ff9b937c8fa850613","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230102104847-7c3da7c.tgz","fileCount":60,"integrity":"sha512-kPSN9kvZN5PkOGu78vySALcN4JHXpES9Xw8ohIE4sJ3NrwN+m1NzpMrF9Mf0zJBOYd2exYxc/+mq0pQWXBu55Q==","signatures":[{"sig":"MEQCIF+1+x/CCJ9vGxALI5D6mfKpXRR00BGXbPXj9mIVQu6HAiAn9T+p6qHncTsEp2IJxiX/RbDf2+Ek5D08gyBGwrTgZw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166427,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjsraxACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoYHg//UEdZ1ZPyvQvPtMEE1l27qo2i67+dTDS3IR/Q0iusZE1J+3sd\r\nFrirtZT7KAm43/iH8vnBJ176NrXIePV4eK93ob9y+Vb/hcL6XNqLgpGuGtSt\r\n807DbwBnZE60X5A0Wph+dTv25Geg8gS8QyNGIGVTN3NLYOLTbzwsgfC1Mpmz\r\nc+E+C3i0PbI79HIzszYmVHk25e9jNe+TrUyx0AXGz9+oMrxaJ+DHq4Glixca\r\nDCCT3HLvGkkEQl7G+UVddB5I0a710wj0KaOK5Wyk1eJZTpGUMrYoYf9IBrWR\r\nxxPjWiXDzXdvaQgq67agp8x/n5+I254DkzMoZXrpMRt44LL+YCTNJ6jNsVrG\r\nmZK1HRqLbIuDb19VzpwHGW5cZTg2rfidkoBOcpWILhot9mBSLrPx1lb76fJi\r\nB8+9wgJ9/MK4U3vhdOB1BSQTTBNuvDRi0gBU304EQfPTeDBLZYD5DJdqRuMl\r\nRJTa5yz4bY/1e9/otF5jWlYFD+3YY1fFq8SImtJeyGqx7dsQ7UAq7+r7SLTT\r\ntkacPS7uG8X9366Fs+iQJgJEYyhlD316eIZD3R8i780ggHgH2C3svix5sog2\r\nlNEgbk2nszJ1jzZgO2Bz6mpNWnL7aySWOv0eE2hxvwsYXenyR4uZEwxWOtOI\r\nUWOFqxy+s9Fh+QjCHQ7C6320CwvDOm24g+4=\r\n=9A9g\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230102104847-7c3da7c.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/a3489223b7958904d0647a4ea2eb14a5/graphql-hive-client-0.22.0-alpha-20230102104847-7c3da7c.tgz","_integrity":"sha512-kPSN9kvZN5PkOGu78vySALcN4JHXpES9Xw8ohIE4sJ3NrwN+m1NzpMrF9Mf0zJBOYd2exYxc/+mq0pQWXBu55Q==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230102104847-7c3da7c_1672656561775_0.7532030563282575","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230102111547-39df89f":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230102111547-39df89f","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230102111547-39df89f","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"0d2f2cf48a875802eeb7c73fb9d07d360fa540af","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230102111547-39df89f.tgz","fileCount":60,"integrity":"sha512-HuhZfTPpqMjKvKtpxpY+0+chQ3e1Y+c7Mo4/d+aWS0qlvk2mtuoUkGGvqJ/YW9kb6+7AlTe1+TrsW3uJoUEdvA==","signatures":[{"sig":"MEYCIQCUubSmCfAOtcaPG66bVj1afknZzKD5O1I0jkYHrvxoqwIhAItRyvD+GYEWpLTq2gY6LxxrH/ooUD3RTSgAtm/OUTJS","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjsr0QACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmruLg/9FXnJrh1MnIb4q3QZ4gZhEt9AxXd273ZzqtRsr9rbmHrNyeWt\r\nJ/9KyR9ZVAzF/uUzsU3eRWkkeHphQm92unDi6DdYUJhrpuB6q9x0OCveLSpE\r\n1lYOPp2QGDaEnIyF3KhI3FExIkwtJjvl7o6y748XZhJZJnLh0LV1p2jd59Ur\r\nlsmb89JVcKtHxXxTH7zqtjdK4YkILdVIHPpVpXrCliDIOkLZpldqWeiLhMZJ\r\n816qtvx46h8PQ3z4FwHJke8XeNwWBb1VV8YVDCkhhlL+VVLiqABEynnw7D6Z\r\n+33INVKw/0KbYkPSCCNC/hCELkdE8JKr+TtAEepn/JSqhZL+sou+yzfr6zyo\r\noNxA9itg7PbynoCf5aZh4uwH3bTljjkt0kjuEUNtxZ/p9nZRI8o2ysTiM/A7\r\n93VuoA6f226aDJzRvtXkQusxwq3+4kbqdhvCskhDzdM3xbLnKKhNYLFL+1NX\r\n6VMZUcrOOoTu7OdbFjLLXX2zOgqosFoV0nzPOkJwuFLWDUMsKHAGppqQI5iY\r\nah1yHnQ1pS4jBx9zTa8fuuTEmcbfVM7n9N79W006Z+3h61WlUOazxkHXs42m\r\n+8a9Q1V2DMVgWRYpYxow8hYVd0zJL+6y2q/XUelCVSGq2BaE+YIWRVBW//ys\r\nFDSMZskZW0R5ed9WbGuA25C16/kF4hbOnEs=\r\n=vqy0\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230102111547-39df89f.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/6abc490316c60e5ea538756c2bd290d1/graphql-hive-client-0.22.0-alpha-20230102111547-39df89f.tgz","_integrity":"sha512-HuhZfTPpqMjKvKtpxpY+0+chQ3e1Y+c7Mo4/d+aWS0qlvk2mtuoUkGGvqJ/YW9kb6+7AlTe1+TrsW3uJoUEdvA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230102111547-39df89f_1672658191861_0.029729744667946756","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230102111709-d06d910":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230102111709-d06d910","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230102111709-d06d910","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"611933d5ef354a5abde72922b019a93cdec747f3","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230102111709-d06d910.tgz","fileCount":60,"integrity":"sha512-D8HcDqEKal/cuUaQbX0vgsxTdoGkjVCUuuR13XLKlODrjChNO5nzsomSoiii7137sXwwZO4r43+SG+SUc4Y5cQ==","signatures":[{"sig":"MEUCIBfPXICt9/pBAPt1B0X6AHGoj4cr+cK51bEjuqdwj820AiEA1n+OW8SKA1FQV0HBwOihSFHhdoJ+q5hpuDyVmlOekSY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjsr1XACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp5Iw//QdcuZx/MuMmVlzz9+3wUfwpqqR+6yzRIMMtX862QJ+busXRj\r\nDsP83X/XHOoSzSUGL08G4+/3x/1zYSSRPEKPj2vZqV4Jl+BoF+/7bQ9JlRmj\r\nuqcSdT8vHNbyMg2g8dM3uyMkIzvTtrXl9H8W+lUsM7g7dy9jxX5yszOCfIP7\r\nR3S8JQD1Hbz8zyFvl53/so+mdtF+BSiK+UzVwhj9ZkQ7hcErE4mJCFpGw/yZ\r\n7tZagzbFHiUDyDI7mMaMjoP7AdP7pjFTujGBJWrWpA7EwgT1yZZoBXPIWZnZ\r\nW2/DgKELpQhDZAqGldSibA83HGft3Q83GurKjzDsf9h4q1i/r6m9eP9T6HTP\r\nqHBGAEs9wL7DcFZ0pkSNsRxQFd00pDa8CU6nM9M2KOyD8tvPFvZ3n5DJPtev\r\nTDKobp0QkQCI1/V8HJSO9aOVfDkvxxAllD/sPOjxTV502zu5ZXo9tH80WiTr\r\n0FkLXS2+BQdg/u1CU9ZxvKY5hhXsYh9PEh3W08FwtIBo1OpkNFR/++ZBLosZ\r\nx7KujOCg+K4GTwKjHOls4vra+VO8oHnAX4YnjpQP0TwCUDtKVeLTSFfFetUX\r\nMp8Q8/1T9/4i7ZMCv2dEGl7dy67TJ/GiYJb+3d3EWFAuvlGg0VvhR6DJHdDD\r\nauiVxOv2gEnapag3ST+VRNsh0D2O8S1Cqew=\r\n=rJvj\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230102111709-d06d910.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/5df1173afff8f7b8730421b321d142b9/graphql-hive-client-0.22.0-alpha-20230102111709-d06d910.tgz","_integrity":"sha512-D8HcDqEKal/cuUaQbX0vgsxTdoGkjVCUuuR13XLKlODrjChNO5nzsomSoiii7137sXwwZO4r43+SG+SUc4Y5cQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230102111709-d06d910_1672658263790_0.7556556754632657","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230102111821-b53bfd0":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230102111821-b53bfd0","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230102111821-b53bfd0","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"fae3e539d062df2160a8838874590b5d0d74d876","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230102111821-b53bfd0.tgz","fileCount":60,"integrity":"sha512-XrgkMuKXWsI7mXmCpNdvt2M/ZX1plslvm0QWUbtVNqWZawFqRuHhJihs5Uu2LomcRCSnpDseQ3KWim1ZsZvISQ==","signatures":[{"sig":"MEUCIQDvIQE0HAz+Ub5C4ainkKR08awke/Oad2zf2Hy708raVQIgXH812DNXzukPXSkAH2n5vxXdwsOK/XsFvzPqysVX1gY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166427,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjsr2pACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpqLxAAnQTMvnJi6TSN1EEhiPk1jy0u6FLUeuK6k6r9xDo2tjljETPp\r\nJU+OIilE+KG9VDn5MJ1FNoofCXCrhSfJArcjEQMpx7XWfYsYdXHAKqphK6zk\r\nSFZJvwfI2DtDTqE/kV1GruOe/+FxM2Hj6JHUn+iSDcsgghJOv+uFNqUKsz/7\r\n4Q/mPbliKPvWma5qmE3D7j2JFiKA+a+N0WXKIdZZ5FlbbuF8o151/nHVxzWT\r\nI/lFNC2INtbqYpJFIg27psbqOpeO/hOa07vyURd1leI5EqSbqKpMP7YcVnfv\r\n2sfc+O0kcmhL98e4XJJCl1mnLjV7wubAqJ4XQmsM/l8rG1O/rY6YnQC4tTRV\r\nH/CJKLh+ia9cmn7a3p+ZrheWS2eABtzwRE5angS61CZB+7e5+vPQx9Lm32VS\r\nMeWsB3gzbuH/bsp4J1zZ75rIpg6Lz09GoQJNMUDDpI5usVLc8tbo4mlViZgh\r\ncIDW3Xc+y9w7dxdRdoMo3l67/w13i3UxCuyZLQj61d8HMtrTp8kzLZwZEatR\r\nF0t9e4jEWnv4PEpKtwjzmwBzr09h/uD1UlMO/XYft4j8/Z5cyBZzGOLmj7rx\r\nR7tOndO7G/ZIersnU40rtcCVtvkLw9MrDIyXBvR9J9lbfvhRqJJcilGN7AtZ\r\nF2h4MiwtUcxjZFxbNnYTHVsk4eZKAIgZIUI=\r\n=S4/y\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230102111821-b53bfd0.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/1395ec01cc0ad4018c8ceed9cd81d833/graphql-hive-client-0.22.0-alpha-20230102111821-b53bfd0.tgz","_integrity":"sha512-XrgkMuKXWsI7mXmCpNdvt2M/ZX1plslvm0QWUbtVNqWZawFqRuHhJihs5Uu2LomcRCSnpDseQ3KWim1ZsZvISQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230102111821-b53bfd0_1672658345245_0.17107278540356918","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230102112223-0171a82":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230102112223-0171a82","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230102112223-0171a82","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"7947bc61c8771506622378765fd5215f18f32766","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230102112223-0171a82.tgz","fileCount":60,"integrity":"sha512-n3eHHcQ93x8rT9qgK56PR2ALBWo8P3ZDbABmstpOpO+tBD16jSDi5qGF395+HnPTkyzJxcsZBrvsO8TOnR13vw==","signatures":[{"sig":"MEQCIGhTevjoZktOeOY+kdA39rRg0uHIP3uIzP3/hUcG4qw/AiBwRoXCU1+ALpbiWxeXX/I4mNmWu9BjMmGomuw5p/7ZIA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjsr6RACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr9zg//Y8igNprP/kRnui5eppBW8Mu29e4S70CG8H3H0AxEZATk3wbu\r\nNVQ2aBncWXMLrnkj3/gst6KW8mM40sAQeE28ET0WECjsrjXcMoKFR0rNDZH6\r\nVQNXuQgzyeyXF6Jisis7dm/hb2DHzRgchBFH+yfsU2WZDQIWapswyrc2CkrM\r\nkJPIO6vCqUipd+58EdOPoA4+UFOK0c6lIEjheGTMfw+6tS612gBIJGl9HSiS\r\nRLyauPby053z9m+J4kwFH6F6YgirNrq3OqrEsFO4nZC4AZ20bTZxsW/NSbTX\r\nGg9aQRG0rsie4bZoSWwcuDbG+Zuyh/JoN/xnX6U3uYdpuoSyN6SPY1SHuDUr\r\nWdB8YR2JCEYznJADmQpSm1/rp5mt/qQq6wPm4QrX8+vKXlJmWQp1HZWKts8Z\r\nxND6pFGv9v7yCoFjS/5qeROPh4jAK/mUuwN8mQvK0YrIa4i8126iYVsHJmnr\r\nrZJcttm0fKaMPq8lsU56h9+nFAyqpB/q7JqRVJDPBmb6X5vlr/U/kgChbnEE\r\ntrhoongszIoiSg7Sy32H2z2pBc3TVMppjGb/MpAq9xZ2vqaer4dxS9wmrtKt\r\nM/SJ6FJMkBWgFY5Pu0NR/uXF5Q4dUKyu/JEWWwuGiRN3FvSjIwU8z2CV9QhD\r\nXWUDCQzoX19dkAASLdSzSV4jQRpzXAWz2ig=\r\n=owCW\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230102112223-0171a82.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/2f4eadfc63e4259c0d1bded9b4340f10/graphql-hive-client-0.22.0-alpha-20230102112223-0171a82.tgz","_integrity":"sha512-n3eHHcQ93x8rT9qgK56PR2ALBWo8P3ZDbABmstpOpO+tBD16jSDi5qGF395+HnPTkyzJxcsZBrvsO8TOnR13vw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230102112223-0171a82_1672658577308_0.23944987233940407","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230102112251-516090f":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230102112251-516090f","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230102112251-516090f","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"1bd95b392b5be31becb40d0fbd5f8869159804e4","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230102112251-516090f.tgz","fileCount":60,"integrity":"sha512-sCsRauBWy4zOw3kXXF/m/U0O+54t2R0JG+Mqs+SmPU1M64AV/0ySvh1Oj9YLqVV0OB1bLJg+SCLx3OsMcYY/yg==","signatures":[{"sig":"MEQCICtQCbuVMbUq7H+6aImQ4/VqdiLt5RPzlwaDQ/+84PCiAiAGwH9C7MDquQhHWIirDPuHEJ596rwsJFOMy/tAyY/vxg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjsr6uACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqbeQ//ZN+EXaKJnCvkX6c1WnJkcql6VO9LtQgqnVmJumFktuTfk+rR\r\nkUmyXz2qFRrz4VF/2zRXx5/cjMLk5V9JsYrcaEfbXOZIQNNFliem52TTWaAM\r\nHpAlz6zfZlpmrcqxkPKTZOdYfWtdKMCIbQ/DVLmsu1npZRVE0pA9JLdhGYS+\r\ncGqSNfowz5t6ficsTZJ6lR0K45Gq9jZVC7ZEnYvvABBrnZsSSX7Kox0RIFLW\r\nz6YdwKTdRlFJ0HO/uOzsGsI/7LyFIeoWeQhWugl7IAnbqz5uY24+ttIA2VBN\r\ndTDbaYB/AIa/XFKBBJa6Qgwd1PCLS3BUjphxMpvnZd67OjKY3zznWiMJDBxU\r\nAJlytR0ki7k7XY+B4C/L5yg5eIYCS59PqClIYfzlzSugRHw4kVd017UJAMN+\r\nLeGOYb4cpQfRQb3myTj+K/v8IY3COv83rP2LFtSpX2e55jZN/UNcKePCHxag\r\n5U8vnIVzl12LEQ0vSwePvGafyQcUQpCtnLQPx0nOJUpW73C7aqk/twJRwumB\r\nd70FjXGznl/BW4838R+K8XLkgSkmvkRVSVwRPl6AHSInFxfk1DKgGWr2Ct99\r\nZ5Nz7/JZ4OvG9XhNhrKYuSSsqKx9XwVvSvNiSXo3Z8W9SMLBh5UZd1cFWnmo\r\nfwhDCmwXgG9Pwkxdp5TrEb8KhA6HVrrzuoY=\r\n=Hwh3\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230102112251-516090f.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/21a0c51307918047f2b1fa716822ba45/graphql-hive-client-0.22.0-alpha-20230102112251-516090f.tgz","_integrity":"sha512-sCsRauBWy4zOw3kXXF/m/U0O+54t2R0JG+Mqs+SmPU1M64AV/0ySvh1Oj9YLqVV0OB1bLJg+SCLx3OsMcYY/yg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230102112251-516090f_1672658605803_0.30744764683785064","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230102112729-a6262bd":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230102112729-a6262bd","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230102112729-a6262bd","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"73bdf5abd3526d3742c569ca72e45c7e6b3fc446","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230102112729-a6262bd.tgz","fileCount":60,"integrity":"sha512-m2M8G7U5jbztYmFXKn1BhshNE5eqSewbridGs11RfbbSrph26li6WdzER9g7OOKE3w8E9fad6wFTworHdFZ6FA==","signatures":[{"sig":"MEUCIDn9mhdKlFyJHR5KpvIja4qIawofe0dEZKujpISzTpCJAiEA6tgh8qb7wNygIuA/eY7lOLTu/+vphWadYaFpXrKvp4E=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjsr/FACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoFCA/8CEqC4cULUvM485g+wzl3OgzKSk5OYJTWAvmLH/6RYVLTNR1h\r\nEgpzJIhn4VJMCWMAQ5Fset/AdrEAjy9fQbyZtu/J7pfAEB4YHe/6Bw7PTi8C\r\n8TijnGv/OMYIrnAjvOl99TYlVN1xpJRs7Xq7vYLzDQeyrgcgcvN49s3rcw79\r\nrEl5xfVITMRCQsEafOtYgwxp01G7m3UqB1v+TfgmBT6nj9ze29hiGbfUXL5g\r\n57El8quDgmn4pzZGG3FqGpJuLDV0vb3Tgym7v/qU8pmZTrDz19tCa+aSWPwn\r\nDDQr4ena93dHP5AsxqyNMSTJBYS8VUN1u2SNATuy9GHnn4i7qLhJfUaJqJ8N\r\nqWy9Y/jPHoOunZEIqSYbI5s5BAt0sB7S6FyBE7Ri+QnSAwJF2bOAr/eDe70u\r\nVnnNj/n6XZ0qJfQwxeWbUuRbG3ciKZT0ChYt+vT50mlKsT/F+0gyNUUgiEbn\r\ntQpGnFuy9YsTPPCG34bIrXMnOV6ZMzP23y3XQGgwIJShu18hjIB7HzVkMoO/\r\n7uuHBGwOJcxrcjPYtLituLMWbtMg31qnJisEQm8d1Xh/iC7x3kf4iqiwXvXy\r\nRREOJNc0/MmWC8ZNB4WkC8p/My5uNIW8Pm4qCByQ5zKSlykkjdDxuNvxcvcR\r\nvR6FloYb3adIapt4b1rlD8Lnzr89FLDUxpc=\r\n=0Or7\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230102112729-a6262bd.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/7b86bae5af94c9456debc0d1592e8e71/graphql-hive-client-0.22.0-alpha-20230102112729-a6262bd.tgz","_integrity":"sha512-m2M8G7U5jbztYmFXKn1BhshNE5eqSewbridGs11RfbbSrph26li6WdzER9g7OOKE3w8E9fad6wFTworHdFZ6FA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230102112729-a6262bd_1672658885109_0.5440879500136713","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230102113257-fb7391b":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230102113257-fb7391b","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230102113257-fb7391b","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"b7bdeeb6bfc310877034ab4ee45c6cce11debb0f","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230102113257-fb7391b.tgz","fileCount":60,"integrity":"sha512-JhWFXwwyTCXULkP8biafCSIl/g5C4kB8hYUADRYpWnaxg0RyCa73jMSiG+Lh49rs/s8N4eCnGtYmGLJ7CuqF7w==","signatures":[{"sig":"MEYCIQC+CtrhpqHW3rYUp1ZqVKKznYt5FxoDNNBYBkRaiphhgQIhANz4xttqihPc7Ez60FFMjwBlnywQRyhu9v+CGxxfGDAm","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjssEMACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrQJg/+N1rpMXnVh8EIcbW+4Y4yjuApydXXeOKjn7yVJNHKGwefvTPr\r\nwxXeonon/z934Cp6++ZNP6vasDD/pDqiJ0moZjy1hMGaaiD9nwgnt4bkGKFS\r\nHeRR2T46w7lu6jBxDBLhh0kFSkiDpUfLys4fkCupYlY0SbcQQUIQ0qOCmm2Z\r\nM/ixn6Xlvhdflg1Mosf+fH+tQtSVdSFUuJeq3ddjxYrTMaA9CVkwDvZPqWcY\r\nw6vQEgNt/aMC2h0Aj+AGIJfA6EBXBUNYcRjxdGpHhvtUD46+J/KE08eIn0G5\r\nnNm4DVX1OMmeqDo8yYHoazCBKgwpEk5rKfcUey7mnTZDKbpqO5M+wETNZwPZ\r\ntfDQlp8F+k4Zo0mxJyo12fVvzZ9xW/sprwo9SxGtistITADvFnrUm6FyhNlM\r\nvUkeg9q7QK9cluCi5Q+/4QRKz+8/16MlreXNLjybs1Kj/ClZwp5CZ9zX+XHA\r\nMCE1qrVSVrn1HcQFKE0yYTMtDh5WktHKq7Z8jp4gMogvu53QlaZQBAY3iQT4\r\nHI6mb8Iv4dCN/yMEOUfWpGJkjsOI3KHA4BSnwCL7NLkdbI5Tjmc/omYJZ1WG\r\ngvQ9NBrFRISMr5McAya2EbH9oN5Va5lqUx1GK+uOncUuITxKGVtiiFg/MbqW\r\nIE9GA+wsd0tsbDjGx5exzOwAKrV0UoVBa6M=\r\n=HRI5\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230102113257-fb7391b.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/613856b30a34b556d52fb7a338364285/graphql-hive-client-0.22.0-alpha-20230102113257-fb7391b.tgz","_integrity":"sha512-JhWFXwwyTCXULkP8biafCSIl/g5C4kB8hYUADRYpWnaxg0RyCa73jMSiG+Lh49rs/s8N4eCnGtYmGLJ7CuqF7w==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230102113257-fb7391b_1672659212049_0.7593110651962114","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230102114252-f4fb2a8":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230102114252-f4fb2a8","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230102114252-f4fb2a8","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"bcad56e4285555ae0bd36dbbeebcefe4925181eb","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230102114252-f4fb2a8.tgz","fileCount":60,"integrity":"sha512-IPecDZPKHAe0eCktlnj8vCwllxafX0elpfUIlm6sqmUPKBV1g/2W9X9QoufiJumdmvTrBy3oEGJo+gV46utEYA==","signatures":[{"sig":"MEUCIQDjr4l/H4GUopXUODYPL88q+915WRnzrO1E3bgSwp+XggIgbegQCV3EifDXXpQvQSNjB2jd7+RNOFpp5g6XTbxMi5A=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjssNfACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqJMA/6Aj+zYxKNvquPVIBulp5n/TCa2SVVSmnj7kLEt3ADc7gn7E2F\r\nb/OdwAxx6eMAQGpeva17MrK63YN5WWC7RB1oSKK5fRkWSfr6ISIUXL8UMwQ/\r\n4K4B4cKjxkZKh8V+khPnlXX7/SNzcm+IbOXvCiv/V2G4axGZ1l6bYCWJbYAc\r\nEAcP0A3iP0QMlLuqoufE9h4nm38brMlCZjnvBF0msGANTzh2p3l3Po3CjZgG\r\n4ny4vURAgi9VoFiAiddAWjP/StlSFoGtw332I+LjGXchAHi6bUq/uadnwWUq\r\nSntT91mCPTN4ReqOF3lwIJrwaOtaVwpSTN1BlyQI7XBkr2dVm05sdShvSg7x\r\nnHX5GOApWMa711SOteecOl5CKpxmgf6+Tb/9c0xB9HAfD0cMVPljAsugElUP\r\nSqhXv+KW2O9/OJOX212Wd31V17bpOJiGsawtWSVadUQm+YKNHb3cpXEHHRTc\r\nl8Qtt4hcPYEOc+EcDvHLY0yEKKG3NRq3wEGMsN4rbiQnpmIeV2ww9y8RcWKq\r\nYbXhn7w0oX/CQihW5AIcx/6tRZ0dp6/KvwP1U3M/96NSssGJNqiu/L1HTfIj\r\ndnwnjyIV1pgKflIeoNe+7xorGWlhmJ+Kc0owir2o070WZFKZ9XjNjllNyDpw\r\n2SM66ily9ryujoXKCndI/WevkWRlnAjlu9U=\r\n=atuQ\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230102114252-f4fb2a8.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/c08c6e7819c2b77f6e84a17f7a86eb36/graphql-hive-client-0.22.0-alpha-20230102114252-f4fb2a8.tgz","_integrity":"sha512-IPecDZPKHAe0eCktlnj8vCwllxafX0elpfUIlm6sqmUPKBV1g/2W9X9QoufiJumdmvTrBy3oEGJo+gV46utEYA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230102114252-f4fb2a8_1672659807750_0.20190721083709917","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230102114309-71f09ac":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230102114309-71f09ac","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230102114309-71f09ac","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"29dec0856b2e44de00e3e4ee2a275e15ce3b33f6","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230102114309-71f09ac.tgz","fileCount":60,"integrity":"sha512-QCmekcqk+EGryQGylDBePifwYXGaSOi7ZLUCDC4i4857G2PcR868e8ahc/jgFpSa//IwNwk5FGJeBddwxtZScw==","signatures":[{"sig":"MEYCIQCPJVLY9DotHZEl4p0zOjGnlCFWOh9IxvqgSA9Ml6uVtgIhAJWIhjWByO7iqu41IJI0/Nq5bPmVuPvpDmU7BXjYUb7Z","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjssNzACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqDEg/+OQGqx8Qnoaj8Nfph50PaQLwrKLd25XPPctftlhdy7zf0zjLW\r\nvdDZnx2Ni2X86QMEGiYxjFnTyEpMuXGKXVGSBzTAOVrlBU1LCks+YwDQ6wTv\r\nszxEpb6sm65S3BIfeiJnYVrOHxHzYYviE/X0/vrtaeMhxr8GZoU6W8bMdjoF\r\nBPSf9rXvYQIAgVm9ifASNVFfkKVB/efmhPQ4BoNjMFDRhffYQE5DrPNk9XBb\r\n+NnHFVoFAJ3vBhHd9YilnXXvcxKp23vq7+DIJwRs89efMHmJboOQbjXJ0vqf\r\njk7JPPf3TlUyTYQFBPx/LL6kamepXWqKift47gT/0O4VgKqe4ZpKJpi5fxa2\r\nGcmodEusJEmG7yhB/1e/8YRc2bOI9pt/KArQo1qE6xDuOVJYTWPZ4LVfef+V\r\nRGex3xnXvxQRs0CINrKvqlKKYilH6TIni5XPmpEmWaYC7SG7UzPsrywP2L5K\r\nfDs8TdqEo+EvxewlYlhrQ1WHYhnmjEKLb2qTnlUS6cf5mDAhXRodKj4H88g8\r\n1j9Bmi8FbpBFEc08k1R3FzMKJ9ZWvjpeotTdpF56uQJgZ7zGJD+6UFhIWCrs\r\nN+649yKwfHOIK3xmYAsnkOt/cLh/bJ3LFEHuqNQ5ETiKRR6uhy5rQtbJME+L\r\ngEdnmYnNQyjtz75f6uRDhTfb9XVjpW2dASY=\r\n=eXxI\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230102114309-71f09ac.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/b30c93afc8eb88338a214ee050922204/graphql-hive-client-0.22.0-alpha-20230102114309-71f09ac.tgz","_integrity":"sha512-QCmekcqk+EGryQGylDBePifwYXGaSOi7ZLUCDC4i4857G2PcR868e8ahc/jgFpSa//IwNwk5FGJeBddwxtZScw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230102114309-71f09ac_1672659827081_0.5818384356732698","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230102114905-e7a9148":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230102114905-e7a9148","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230102114905-e7a9148","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"bc3446885c5c757158f035c933e384147923fa16","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230102114905-e7a9148.tgz","fileCount":60,"integrity":"sha512-tD9Zb6wFuP+IEoyhsbnfYhjkOW/TLHD1no0/jgziMy6SRNur/ZySylGzM1TMyV6nVDAqbKCRg6HxBUCDE2j3tA==","signatures":[{"sig":"MEYCIQD4hW+CGPZePAs+vMeLF1lRmaiNeVVfLkIJFkE5bFoe6wIhALlVNi5NavYkekUUKYs/IUEIkm3Drdy0yZUKyZe39qtG","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjssTaACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrirA/+Npvsui/GQuHlf1fn4jVpIeWhbtDtjGmukQsJLuN79yUKuq7d\r\nLMaJqDDStXxtWxuRswlb6ZIw7/idATyJ8UoN493T0pu/jUqMdJp4HCtonReu\r\nIlVjl6TDbLlaMx9oYaNsWwrK+lt/o4pzSxUENch/xXoPrOvjW/5wlVRaRCRG\r\nP+qoHt+FU5/cgsbkRibvg5E/BWMCUOTwfG3cGElDNfFOjtgjSAKQcyeSf4PK\r\n3rh2xkSnti1zjAOcjk+ROUladaa8XUsTg6t7qN96mBreAg4P/2Gt07wITKPy\r\nLwIMaBdtOvYjcyjY0Fek4USmI1+t9Qu1qrCfieBNKmZzoYfEnej+XbglxJaQ\r\nlo1+W25AMe7qn+8w8pg8CFc++tJXfGwFC8IshrR2uNTogoz1fivPtikyotI2\r\nZmJZpzLcW3TWJBbZlzaHUvisG4iM+xm6DOOU68S5lLbDYNLeE37tcYvoFDdZ\r\ni54JaCZMKC76rttPvv/+W/A9aahUvFJEjFMZ4ZDdzXilWSfCK9UIbmge0w6H\r\nVB4OiGQiPo45EBGd2gkBBW4mGDNAPiXB+0IGp99TZHVhg6Ppt1MRaeVTbgeq\r\n6sJL7J/5tHSelRrPa27PZOvpD00Fgu5uJKNlJ77/FaJaVSTsYb7Z2nBJb284\r\nm8YDctGfzJkOioToKrNjX1r6qa/EqQo68Fk=\r\n=RNhM\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230102114905-e7a9148.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/c6baa747bf7a3fb1d44a3a35535b133f/graphql-hive-client-0.22.0-alpha-20230102114905-e7a9148.tgz","_integrity":"sha512-tD9Zb6wFuP+IEoyhsbnfYhjkOW/TLHD1no0/jgziMy6SRNur/ZySylGzM1TMyV6nVDAqbKCRg6HxBUCDE2j3tA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230102114905-e7a9148_1672660185939_0.6765780597624405","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230102115436-4ad26f4":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230102115436-4ad26f4","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230102115436-4ad26f4","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"15b2b239e05c6f71154ac8e89c14dde1b16cca0e","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230102115436-4ad26f4.tgz","fileCount":60,"integrity":"sha512-v0DlSyfJilkoakyFL8hD6XbmWGifF/JmwT6L8MloDdjNbaZvevURZSaZrA/zt6z7mEkf7dWwW/8oF0g4DuIHjA==","signatures":[{"sig":"MEQCIGKZixnHg9N0glAkyWm2bgpheMNCFATIV8OzEHDtvRHRAiBFTG3wFxoKXjoGbl5z4UZUgc+Rs7uSMqGnyDMsL7HVjQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165581,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjssYmACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmogXg/9EsLrk96hUhqP03+4ZdfWq1JVs8q7D6FUkuU78UWuKKD6B/Yu\r\nvPYxiZ5UtW/0znKz1sfOMIOzc3rfqQjRsb6kheTF1J9mSGZ0tqC2ikCaY3HR\r\nvIr3bSH5QPIq6jM7HCO8vWfBpiLbCor3NTaUDS4EESRbqOOCmyUmp5NGj3zd\r\nox/wzfACPpzJ87ZcPWlrXIPl0gLfLDMg+x6rxpX0jAKA/6y+hrBKNoNAL2g1\r\nAS56g+VWExkRQDiCU8l+3dEBJFSP/USZmy8PuRg2oEZDCRZh9shfJgSP8Zrj\r\nXYpxafn+VAe0grJTAe7OP9m/j6ko7L9RSECT8HZw/UbZFg3jES0ffXYjYEAy\r\n32NevzTgAP/BCFvIVyUfmf0zLDGQvJeSGqix0S1w+ZT8s9sZ3AN5+XVeU/qI\r\nIR8X7+PGxsc9eeTBFBt9ojAM3psMd6Zyy6++kiSyw/VW/MXG4mxv/F5Y+2aJ\r\nelnSxJf9N/qafPqTyct+ahE2zekH5V0uR/qwVq3hoMlW/MiqWxRCbRx59gQg\r\nbYNmGu0X0/ghV0NNXQoPs/X8HiSGpAyXo7a8xgU+aTTrUSmLgl9iGEO7Gwqy\r\nG+5yCPeGq733SQGRhucwqoWTDSs9aOVbizyAcFjYKr/Kab5lD9XzsN3vP7Iy\r\naQ07zpSKIap/1Rwo3V51goLSPwsoVpDKHOY=\r\n=v2U5\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230102115436-4ad26f4.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/9523e09a77a81e43e36c92604e632725/graphql-hive-client-0.22.0-alpha-20230102115436-4ad26f4.tgz","_integrity":"sha512-v0DlSyfJilkoakyFL8hD6XbmWGifF/JmwT6L8MloDdjNbaZvevURZSaZrA/zt6z7mEkf7dWwW/8oF0g4DuIHjA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^9.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230102115436-4ad26f4_1672660518262_0.004888001335253467","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230102115836-70d492d":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230102115836-70d492d","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230102115836-70d492d","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"b14ddd62e5a850e9dee33bf2c8f20f12c10d4a5f","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230102115836-70d492d.tgz","fileCount":60,"integrity":"sha512-HCkPHHp78UpoHn4xCOrnM75wXQxlc6zuyH+OFyZy+kQtYDLaWMOLhIaqkZfchLurP5xtvbQv92F41oD9nh/cOw==","signatures":[{"sig":"MEQCIHTs9a4NUy3lvQgTeIjBV6kHNQS2n1ntNlOrd7NbldEXAiBGA2bPAidUUsAkoTMPcO8fc2VVhy9Veeo7uXDbEkOHxQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjsscOACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrnohAAiUXMhknMGs+zBSL+ARa/4gS32QGBc/4RATNKIorhc3OIdiA5\r\nApw1VvFe7HM4uwAa2c6rcBLjEtaF0kzVuo+Mm/KXXPbUDnj9oefe0CI0ZqkH\r\nPGvPkVKq9OuALE/AaSCvwuedmYbs7j8ssbfi5oG74pVsrU7M9BQ5iumzJvM6\r\nXOd2SAJpFVOIG5iXHKqETZpGJTIeUfQMng0SmRLhrrIP1ko0TnbdsgNWTEpQ\r\nXOrIMDPKkP0STPMC0kJ80qEF7eYsivkjlyN7TapBMe6de910/6FzSgpBsOo9\r\n01nbghGUadKASShZztetgitOC0F0r0gZK1PpcWLHeFMjXKk7UYe5HTBUJU6O\r\nLz3gKCnE3OqEccgtskifmvRZuwC2dphHNh3nUOlXkx2M84+itqF5cTxhDBr5\r\nxKgq4bAaoyIRBgEO10hiqyXPIgWXOSIq/8ESk3dawgc5/GKw7GcOUS+i3U90\r\nYTmhmKigK9qVNMjN8LdrXFKaXcmBPGp/xO5TDWIS3apnwzts7YQoimogGZIa\r\nIHeAZdOsh3/pDhpMHp+ynifbCxmSaPIKeZ52zBAc8AhbUokhcwGBUmuV6Lkw\r\nWbGWhpesm+t5dlHO9hDy27ln733Z+1f6FHw95MdccRwj3Z3YvdItIN2oHATo\r\nfPe299NW4hxnvjvPYdsXnOK58K3C8p/d5KA=\r\n=eCgE\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230102115836-70d492d.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/afd6eb6fa8a7587054da15e7c84698e0/graphql-hive-client-0.22.0-alpha-20230102115836-70d492d.tgz","_integrity":"sha512-HCkPHHp78UpoHn4xCOrnM75wXQxlc6zuyH+OFyZy+kQtYDLaWMOLhIaqkZfchLurP5xtvbQv92F41oD9nh/cOw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230102115836-70d492d_1672660749937_0.6235283968802203","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230102120525-858b52c":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230102120525-858b52c","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230102120525-858b52c","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"5987d56477cbb3fd7bac30c76717995ef4d8b7ba","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230102120525-858b52c.tgz","fileCount":60,"integrity":"sha512-GEDB4KPG7gEoEA9bXkagXzd0MZxelBf0EmmfLRiZZoP0CUNoBn7xJb6vuU2beoYdt4GxlUEyZAhtC8qMngoZ9w==","signatures":[{"sig":"MEYCIQDxid/hTE7+wxdU9SIGY5YiXiNzPZ2wEkPfvZBFZ7HZRwIhANykc1QBGso8MMQ91jfuiSkxIbRttbSsaKoZydXyOQ1z","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166719,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjssi2ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoY+g/9FpmvZnlgeGBH/AYv9yDw7ilIYmHw+SeeP+Ourhnw4vKjNkVD\r\nnWD4dLiy5DmjqRIKDaaW1nMOarsrMmfBomc9B2x9HTL0uh7Wfg3Lq50m+hm+\r\nAKwuq3KvztLzOaqvr3rEJGXZb3VrhLYQlrNKQ2kxJOHgQLpVoPjoMc1kU1z0\r\nV6M/l9PvqHcMBvWAhLeL9DXQvl8vFAn9wnbCdkhgI3yBgkqfE715CUYcmerT\r\n943gf+5mkcEqZyJ6ObpJ5Gdutelhr0aAvakQeTkaHWmvQW9LThmDfExbPXJy\r\nNgDZeAcScRuzQTYIdtOIqeyYyj3ku6O6C3rHAquN/IesVMI/Xibvvdfn5Hw5\r\naKAwHZpAZ5Xgvj1CH9cze6EKy/cZEOHT2gpxGfmmkH1EC1OtMcDybV9M8ig7\r\nv0bm/Ber9oGzu/1EY5t2ORg+AmWDVgXw5vLkNJ+68Uu2hUxInJCPfOZ63VTD\r\nwlF2BlLriNMdhwvHjMxHmqiyvOBcCU3NDpEcZjseQqVhEEAh/noc/MGef1hS\r\n5DZpsCbTD8EmNn9YO2Q5VkFCZewOG4QBPvPYGyseEU9pB+0POg/AuoMkYIoS\r\nFLu0x7eeG9+X+cQ4cL0xWC4yPQgTGImcAHZLNquq4pIhP7/E+haqw49gYKiW\r\ntoRr/6MP+jsih4PCDEOVW8hcpTJ/WD77uWY=\r\n=w9pv\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230102120525-858b52c.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/54e15a11f5c8386fcc7e5b28c6042cc4/graphql-hive-client-0.22.0-alpha-20230102120525-858b52c.tgz","_integrity":"sha512-GEDB4KPG7gEoEA9bXkagXzd0MZxelBf0EmmfLRiZZoP0CUNoBn7xJb6vuU2beoYdt4GxlUEyZAhtC8qMngoZ9w==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230102120525-858b52c_1672661174769_0.7409309287122354","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230102120605-f5901c0":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230102120605-f5901c0","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230102120605-f5901c0","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"d791f563fa560c73246b3bd01427f957fd9b5401","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230102120605-f5901c0.tgz","fileCount":60,"integrity":"sha512-nMNejr+M9H/sD7Ym8DHQvIQG7OBppGykIWsN3K1aPhNezDrZuNvws8lhKlJR6OdeQAUtVS9MeGuQg/0G/DviyA==","signatures":[{"sig":"MEYCIQDInwQHkOE70SkRc+rb8TBTjGrONFVa51lV2jN171SwBwIhAPddrFBrlNEiJxFNU8F4KNsK5sVB3YOTwoej5VyKY8ol","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjssjPACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmoe0Q//U3SQa6sj8QNvfbbYC99StEp3CzTvvQIgDBwWd+mMPBrE4Gx3\r\ncGiRgWto5/iYGkP4CkZoyTGtYOUj8cqmYYaLqOmQ88ZiTIE/ClOqKZ0o7txv\r\nWOR8oQ8oKbF8Iy2Cqn8DG8T1S1zil6wVgIPo03t5+NTKfpNXoypaMM1l7kmj\r\nIUKzTk71ontJBRZAO2AEUmqZcn3oJVWPsWYl+MVr8q1nHDYI12L8aYzDGs4D\r\nP5xKe/06X253AgPi7cj1I4w6ucmf9Q4reJildFg48T/8UoJd84L5aFZxAg0p\r\n6KeSfBaAtLmuoTu+6ydmcHRlhGabf7NqwdWt0nIqeUs/2xG8qq1lu92FB6iS\r\nT1jJJrxiojqwapgPhdv5gUlxvW/Z185lsBQiyN4riXfNyQlY7dlP77o82t9S\r\n5/MxBiFMFK/DpuPxdExUTB+fEAv6EMncO4jcmQP2N7vNVT9X5ZHRPlq5mI+z\r\nipq0fGpgO8rSmdrQKp9ZSZ0DG3qgozWSpz9BfXJLg/qwGpsDZUHc1mTkLtEQ\r\ncoWAAW2oAlL99a87Qpf53WpUsinevc1ZwHSFUKH/C49s2pZm8i4S433iiiAY\r\nMQ6259eWVK9ofyJIIp9jldgHmrtVjoDPhn/EhcaIR5Rz52XlOYmCihcY+yVO\r\nJxeGvLBh6rYbJbbknIKJMEBYLyBrUKdbyMQ=\r\n=wzpr\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230102120605-f5901c0.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/4df712881de225745a5c25deeb9bcd56/graphql-hive-client-0.22.0-alpha-20230102120605-f5901c0.tgz","_integrity":"sha512-nMNejr+M9H/sD7Ym8DHQvIQG7OBppGykIWsN3K1aPhNezDrZuNvws8lhKlJR6OdeQAUtVS9MeGuQg/0G/DviyA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230102120605-f5901c0_1672661198965_0.7302165520243404","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230102121136-45b8eee":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230102121136-45b8eee","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230102121136-45b8eee","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"b7a7d82a9d172c5e61fe76d7b1980bde8d717f76","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230102121136-45b8eee.tgz","fileCount":60,"integrity":"sha512-M+p+OUo4WsCDlV2gKtTfUz57jeBv1FKXlXNBiXdBBRPIFaMY5HEAT62B2Le6FWAlJXXmQXc2f0pfv1ukz1SOrw==","signatures":[{"sig":"MEYCIQCQ1mQWH4cGbcu3uLpTjZ+JVHIfotXJLVP+d0ZH+SrJMAIhAMmuwyrUwXedcopoMdBtO+x0Dt7a3LuxJrmx3jB6fUd3","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjssocACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmocYw//f9YvHS2HkINyTt2kbhHRId04qRxCSX8eAZiwhI7SmnS+uCdN\r\nPGwzj7K+5/Y1JeOguMeycC1lqHLyxJVa4NXIP/G/ZRd2OR4tmAcXgsh+pl1D\r\n04ZJef9PBzHYwaifY3kWkGWF9Zcp8DpU6GCAjsMAuivZn3K4e3ytwJkHE2Pt\r\npqaQWlMEy4yz2de5bW62L/0tJJtFpJdEj1WtKEFSR0Knw/Fs3NjNeqhCjn99\r\nkWXw8l2+6uzhB1hoc/MvG+a0cJKj+LFgM5POUxy2YD9WfxCTgEC06Mphsrqv\r\nDZ2BD2tHR59ZZipEEI90d2JcrA/5JHVkONBAV4drCAZQFN6ZRd6gDG1i8aOn\r\nG3tWJ1LT3LVXx/HmMWYkcTpbwBxh4DlG5GJWyCQoC2ny7nmVki7elx07KdUJ\r\nogMXJ45V8ASpZBrfziutSJEXNX5pKxULoy/NcgC3M59BkJCFm6ZnHnADUmDK\r\ngZBDRqMznZlzFzL+hFMw/cn5GQE86lLckrhsdJCv5hg/twpYfKn2UWOFKn2O\r\nphDwIxNxDrYdg6I2/TAbB+EwSO+R/to8WLdp5BFkOoeAPtvoUUliWskegpio\r\nCjgRtNidmFlqZLPuDXRFZRRAUy2nh9aYLRG61HhoUXXIDg4R9XqRGDp36fgq\r\n/lLrHIyv1Gsnl9t2OSSiwaTFNhLoylm4B3c=\r\n=qxuV\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230102121136-45b8eee.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/aa07537966b457485d30f5df17c99415/graphql-hive-client-0.22.0-alpha-20230102121136-45b8eee.tgz","_integrity":"sha512-M+p+OUo4WsCDlV2gKtTfUz57jeBv1FKXlXNBiXdBBRPIFaMY5HEAT62B2Le6FWAlJXXmQXc2f0pfv1ukz1SOrw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230102121136-45b8eee_1672661532437_0.5368100003297123","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230102121640-b0639c5":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230102121640-b0639c5","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230102121640-b0639c5","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"52447eab7b453499d81666fe68031da45304daa2","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230102121640-b0639c5.tgz","fileCount":60,"integrity":"sha512-1mXbmy2iGDTw7dTikz4/Zjs3VSVl1UAdyq413gWZEzC4nDwwNuScny5Bwv6wKa1gBjHZ1IrEm0uL+YV+L5QfuQ==","signatures":[{"sig":"MEYCIQDoLiV4LoWxxKCSg/oVzDQwaMKUKR61jRWOtUvLaKReGQIhAPLrlOUIMskKksluAsY+PXt88/X1lrV9jtlJTqt6N066","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjsstOACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo3xA/9Hvve81NQD47uWtk+CZCg7R0LY1oVcrq0KmyNB91df7eJzYRv\r\n9PBrUrfTdIdrkRzrLU0jj8Ue9Si7eGxHJxUiqmUzXRo+lmH99aGNZdhUmIs8\r\n8FH4eCEgYEut+xXe6XVOL0QfxiLO0pFtbZSgBTrSkqrT2lBDjS92ZCI262ys\r\nYdfavDL7uFWpUbzhPdU0ZE/zkQPdTege8hrzoK2/JWOIWcSE55Jwp+CPBrvm\r\nRZHIdHe57kPY6XdxRMjNo8eSLQIZpVMHTv7btmk1YV0MqFghkTS60lHQqRB+\r\nLtv8VfmUz5CZrTPGtFzv4nx0wTfyUD7u36/PmdzQleTuN8CmxVDa5g2MZLiU\r\n6uCsOw4sxn2AtVzXWlY2GA6K7D5wNGdwFerKjDOjQuDredEkAFhbPz2JH3zo\r\nsA0zow/aB4Vz/nFOZalOZIqq+55HsdKB6oYhaiJLzqQhnK2rSiIZNAYPPpNj\r\nl8X1tfBbE0Hm3V3dl0s9oxgeqblGk3ZNjBVIdTIHBAi3kAs1/uTdibAL5UQU\r\n2ZYILUj+MPAL4RQSZy3mW7utBKpOLA39xjMIQaeGx9NZEf/3G1ZWWcdsFwge\r\noVrCKyFdUTGldjV0u6k1aVodIR5rfQcz0zst0WEdbIgVAjRyu+mrr61rEfqo\r\nMfJfXD8ihhUj2YLr+suLRq1+j9fg3KS0bcU=\r\n=A73Q\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230102121640-b0639c5.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/b0204ab392eb52d0a46f2642a1602c5b/graphql-hive-client-0.22.0-alpha-20230102121640-b0639c5.tgz","_integrity":"sha512-1mXbmy2iGDTw7dTikz4/Zjs3VSVl1UAdyq413gWZEzC4nDwwNuScny5Bwv6wKa1gBjHZ1IrEm0uL+YV+L5QfuQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230102121640-b0639c5_1672661838492_0.19226789052767934","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230102122133-dac5b2e":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230102122133-dac5b2e","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230102122133-dac5b2e","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"08a44e3310c6ae8ed454c0b16ad59c2eb67f3ce3","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230102122133-dac5b2e.tgz","fileCount":60,"integrity":"sha512-KDEbgDvY+N/R4mgwwvg5ZQWct+1QJe5J9lPFtpaplS7lxiwhRkMI+92gdmBuUNpnrQv+2jeGwesxqHxzMxmD0w==","signatures":[{"sig":"MEQCIDUnyBhrkTFMxvsoSbQHhsbHLpp3KUdkRYkbwKA4a/IwAiAWKdTwQY/fv47lkm7Kfu/bCjtZGE4CAM+PPjBF61E+SQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjssxwACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoOJxAAkNNWxTxeCOMI3O3TY/9vZP/PZvyaUJWCqr95eC2kjh1fRgMR\r\nX76TpNfZlbPKnYW5UBrZXKrt25tmOiK/+9bIZi/2KLoRnJ7/dZOJgN9k+9RV\r\n6bE7wmcBgp4rnmoARRRLTVsexWQgn3OvnSck8Rv0ZO6fwhpuIjzApTxQ7WwY\r\n/GiZ/sZkhtaTZazKNJagPOmw71mD7ElWooQg+ifBuzI5VlIjoY+OePPFaEeX\r\njJiFwDuWOTiThbyG3aaVzuYcjmf8oE11ncEgzPzGIYEQVs/ImAg3+Zcjv/Rd\r\nAMA8mtYbLjCfTMon5yCeU3IQVlHhvV/f81qnXw8Ug+DlX2cY/1R+w+T3O2Ih\r\n8fl6ziWTv0alTYJtuRKtNaM/IZEOPgDNcribKJg2oHBZIA5ZUJZpREoNkffB\r\nHbHXDxL30cLBnrNLLlpFG+5EBeA+YN1BoHZLWiTk6pRzVV4wYKMwOC7pyhqE\r\n7wxm4qqDrs/V3SeqM5ClXwK/BQt2senWOZh5d9kXsm08wKChPs+/hMnc6K9W\r\nqX0XWPCipET1LB3JdzONys2lEsx/Rt9zUAK5o9HvFs6HLLT36DCG88DSA3Jm\r\ncnpRt7VJKGn0maoQ9v7OYa/gAxygG3POaRRkM9iN1jJW4S8pEFY6RPYZ3KHo\r\n1sN7aO2HQWRjRMAgaCDq1iykzPzLzcKmPAU=\r\n=mqnY\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230102122133-dac5b2e.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/18a7fd7cf190291f935de385f52774f4/graphql-hive-client-0.22.0-alpha-20230102122133-dac5b2e.tgz","_integrity":"sha512-KDEbgDvY+N/R4mgwwvg5ZQWct+1QJe5J9lPFtpaplS7lxiwhRkMI+92gdmBuUNpnrQv+2jeGwesxqHxzMxmD0w==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230102122133-dac5b2e_1672662127982_0.8483347778344328","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230102122436-f238eb0":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230102122436-f238eb0","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230102122436-f238eb0","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"9b144af1054f893160363cec35d94a01db50270f","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230102122436-f238eb0.tgz","fileCount":60,"integrity":"sha512-0rc3+hc2tg4ADgDm5QVm2WkZuLxivKTdnaifMlRW/i8bo3ug0nensbTHqM0da/ZT1bF44N3jN2HJcRY01uXXew==","signatures":[{"sig":"MEQCIHns5VIPgby3RcQ1qB6+T1EF7Vi3VSr5OjbGGwFc9kgfAiB7RSGqMU6GkL7Owec3UdrJgsynATOo8Tw547xGrNfaQw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166719,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjss0nACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmoj6A//bbyQzyMWQCoygeFf4EaWHLkmFMMl8a0PuJjqH7YesYWEwGZh\r\ndjxRvMI14/dca/2WGT81XhVs7VrpIaElHWCayd6DNu52DWc15z1XZD3E5i15\r\nohgmDkBFOSPZtCC73I9LJ4iAFuc9FPrMwYtoXBcuT63lZ3Rur9wQRcr8W1gb\r\nLcIKynCxgERTJy1VNk1c0rJV11WLR1Dz37BNYDDwWrAcx9e6BPXNp8vjRKfh\r\nMNQ/YZVASbzmLyEpG0S+iUOpYPYCNS1wcsis6cUQQBo8UH0lqWbBi++iry39\r\n/jYbWwW5KO2XDrDPKCwoLJnDaoABmHt38ZA+YSr+GPj+R4jta6xmot5tVD+g\r\neY4BFkLY1xsA0Pz/Vt1wQoGhV2njqRPfqFQpvfLB3su/q0D0e09XXNXsQ4Un\r\nwmJYZfhctAQuegPt2+X4nA8qtaYuIIGiygNrabUw99BjXsL8IClZGRD0FjHO\r\nT48SqIorNedaO44Dficssr143fmTf3gOEmhheQEhbHQlfhm5SHQq7d/7wnPH\r\nG+upeyCV61V109JBAoeTqKOPL1b3Yd6Gq1ue6zcvyXX7JTFtkKjY83m8bgcU\r\nnjW9OeuddbJvoyQuvjf7xn6SaECKsqsDg3yBN6vNVu8sRIPVDMdryzuNMpSJ\r\nNYgz3Bh4UMi8lPZFv5CRgyY/vPn84JH5E1g=\r\n=BWWW\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230102122436-f238eb0.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/ec34399a8ab951eefa16981fc5dd9310/graphql-hive-client-0.22.0-alpha-20230102122436-f238eb0.tgz","_integrity":"sha512-0rc3+hc2tg4ADgDm5QVm2WkZuLxivKTdnaifMlRW/i8bo3ug0nensbTHqM0da/ZT1bF44N3jN2HJcRY01uXXew==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230102122436-f238eb0_1672662311480_0.6694496621966997","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230102122642-9ed233e":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230102122642-9ed233e","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230102122642-9ed233e","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"63616861646543fd8d474f0fd6cfe872c56516d3","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230102122642-9ed233e.tgz","fileCount":60,"integrity":"sha512-erZIGfu28JtTRvN1898gXxmXCdduK3MTf2ZZeMwG1f4xjouzJU5vLaHyQHukMuknkeDkFXLS4eAg7SmdCAntWw==","signatures":[{"sig":"MEUCIGYZK+m7/ZSv9IxBMwKiANQ4UST7tLoj4W6G17qeSVynAiEAxzDnziACOAPkxraAt5SYZnDekVl9ERNt5rFFofjx99E=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjss2mACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrN8w/9H8BQLlFzlPzUTMSKCtENaCP+Wuq4iCaAJYUgZ6fzbx0MODSe\r\nR0QWYsodFpZCy5cgcaFa3QyQIJKHEJsxTYV020yyywo6vn1ZvHQrNUjNCHsC\r\njehdvJ6saKZjjuLwnPYIlwpM/ADqYgxhVDBUuT1smiMLq0RkzAm+dM9mWuKl\r\nls5y4A5xI6OeHjt2W7ckgugQs3OLf7RsQE0ItutJgOOWRe57pPZXPDIyjEeq\r\n5Xj7n4Ued2E06Gs+UgvVMKgsDF+LR/KuqDi9iwkd92LYeEcZrn3uG6iVx8De\r\ngtwf2MqIoUAjHotAy3IOOlJwksMy8pPMLypUbNqaIxb61nurDY23brX1JuaQ\r\nyRGhXqIMzqEQ4sGQYNmHJe0nmZmQcX5xW2Wyyq0ENeosCyNOcRFnE1bRzE03\r\nM8KhVIB5edKWaX1Pit2WKxxKzaYhm5ZHI9TrDEXK4d5ZgKthcL33MPMuN6jo\r\nIyOluB1p3N5QtCi4m3YC5UFffPYab7fwGNXcMCMzFXjDGPKBcdRyR9Yo7O0P\r\nvqkc8ofKrftIEctknL8n8aLkmWdB0Qn7dtUqtrNO7wrTLn7P9c2ia7cTh2Gt\r\nvWp+mEHHju81Qp9EmwlLEGz1fxbYPdSClxVVw6+9PyrPBedIlBi3R1HSltn4\r\nz8DW9Z7thlIsq0uZPtkPmnA/n9BfNTBrzd4=\r\n=0+0L\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230102122642-9ed233e.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/6af757167043b6df1b2f645ae83541ba/graphql-hive-client-0.22.0-alpha-20230102122642-9ed233e.tgz","_integrity":"sha512-erZIGfu28JtTRvN1898gXxmXCdduK3MTf2ZZeMwG1f4xjouzJU5vLaHyQHukMuknkeDkFXLS4eAg7SmdCAntWw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230102122642-9ed233e_1672662438477_0.8394516997686974","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230102123205-a9287f6":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230102123205-a9287f6","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230102123205-a9287f6","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"00ae881f7481720cff7bf90b5d59796ad9640d69","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230102123205-a9287f6.tgz","fileCount":60,"integrity":"sha512-PollOzT38Ks8QeXG8ahisBzm28E+om4mbGluH+S9bVb3qaz0K7uBZYlpuyf9sae12PYOON5e8J9q85XuUKoy2g==","signatures":[{"sig":"MEQCIBTCE/LdUIMsoK6jBMIm1cGCiC71a1ipUSm+A9a5GRLFAiAgBtSeNPgAL5lKd+ZGTYmrD9Q43XR4jtNZBjs1Vw7j6w==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjss7tACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr6whAAgtRCgRDWjbT50qCivpucovW/Eppc/z2R5lSS6XhUu2YmelVj\r\nSiGP4AAVfuhEE+lkvmor44yTGT4KcwSxMSXHc0+9chc/uvJzyt4JfH5YjBTH\r\nmCHqrWjIH5hXU5pwf4L2ME3JH5WK1TgKGI//WT7bX8KT30w8hQlfK5MO/y7B\r\nwVjRvB/dYj/Qwn7h3VCfsOMIEDLum488w+GVXWAho9d1ACPhdpKKB6s8EUej\r\ns/unbOi3Torfth5tsQXY9gFPia65NlfiQWGmEtzVO+mM8nwxi2+5tpTXFIc/\r\ne77WGuP6dq71628qDYC00MAx+22GGV2pnXGrJ1xPimWMxuZXwqKcNzBuDVqY\r\nahaq3pD51ABonCKYb4W1faoU3f9AXjKYeVzhYpCHZV6s9KoPmNWMdO9A3II6\r\nBxrbXtovadRE6afVgPzmFljxVzO5olVdSrdwglugsGZm+aBoy1ZHyz+wDdte\r\nqigiXFVLDV8k1mTrSr7SWrOzn4tUDWbgohw8plXxY9No33rzAtKTiWRdvhP+\r\nUDiswAHuUn8GAa6tvWqw4FOFgYP5mNhRzuTx8/pVix9uvcUH4kQjHn4No03N\r\nR+CD3I0wx7ohJ1IWFMsT0lO58F4pOP1bEGdoceWckZDjufbYmKG96LD8TrUU\r\no5uHByxBNIfPDf411UyM6DPlU3JSc3qCPqg=\r\n=jFcl\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230102123205-a9287f6.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/7fac8f887f550948cd8d4dc245e23701/graphql-hive-client-0.22.0-alpha-20230102123205-a9287f6.tgz","_integrity":"sha512-PollOzT38Ks8QeXG8ahisBzm28E+om4mbGluH+S9bVb3qaz0K7uBZYlpuyf9sae12PYOON5e8J9q85XuUKoy2g==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230102123205-a9287f6_1672662765145_0.2465212727748478","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230102123729-932bd4d":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230102123729-932bd4d","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230102123729-932bd4d","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"e5021f662272c319382871bde382c734e2a78918","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230102123729-932bd4d.tgz","fileCount":60,"integrity":"sha512-8DnHNbC9Z90sngaEyrHKpBc9SRA3ifphlGdQEdouzpLeIe6HQNWk4REuNTry46ln4Zjtq+sURDVhNdB1vfgbsg==","signatures":[{"sig":"MEQCIBUayiwnXS+E5A/ZOK3wx+kUTyGnKJA2WHAZE+kViJwfAiA6LG3PbMj8FAeWvRHnbY5+uSws66vmrsMLiK1zkQg88w==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjstAzACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmqlpw/+IsuffOMN3IUtC3KJ9QG3pj/nFI1mEyb/O+ONMrvz//NtQGvT\r\nlttUxljiBGKQWB5Knu6ByCqpeUf4iyW4K3y+2AGQGTbkxcB1fvlSorOGdJYw\r\nMJcBE6dYpJthXOJnh/8qa3jK/eB4pOWBYdEHV24Tte2uszFVh3HbF5/PYvan\r\n3epbOnJBwhuXVfk3D03N7JmYq4y7umKiG7eoMVrH5GE3r/Xi6/bqMGN37Mi/\r\nglDyVXwnQAcB9Ozwp8CXopYnf2Tvmzhe+asDU89x+grg/Aceopz8X8wgs/jB\r\n6Ufo2d8cYRICutes4NVmnSjcXfaPeQbILlEmaOGtUc+ww7Tbsx93rKukp37w\r\nkvUVSqXrvVhNW82NK+i068CmaNac+BaeskhXNcaR4ttZ6eUNdBbCGXq9IIJJ\r\nnmRIYUG/ScY7nmJzRDuk8hJdSoAobmye96PLPPkgqQdn5RXm0EKd+8DcmejS\r\nOQCeO/uLHCgnjYy13NzzMfaqt0qGySRnun95X+PRyK/+5skyKERCURgmt+2N\r\n0qqCUlBofF82CBUvT3eQtTJQeeQcLSS1Z9eQjHr9vqg3jU/pb29rQBLf5BCA\r\nzzOnZh0oQ0souxKj+Zap3lBl5Sm1naoHkeVDmJc4VD7o3VVzHzkdh6EvotZv\r\nq4g/8ofqqNe0i5cbI4auEgZRNPtB2INxP0M=\r\n=phPT\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230102123729-932bd4d.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/0635ec7f50c0144469e9b816989f10e5/graphql-hive-client-0.22.0-alpha-20230102123729-932bd4d.tgz","_integrity":"sha512-8DnHNbC9Z90sngaEyrHKpBc9SRA3ifphlGdQEdouzpLeIe6HQNWk4REuNTry46ln4Zjtq+sURDVhNdB1vfgbsg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230102123729-932bd4d_1672663091091_0.6034213508207358","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230102124205-f3f12d9":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230102124205-f3f12d9","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230102124205-f3f12d9","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"613289983d9af727b8a02873d83a814af4990c5d","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230102124205-f3f12d9.tgz","fileCount":60,"integrity":"sha512-rk9w0eCKfwLryCC5GkNXKF/L/eG/dTU4nIEju55EvT/EuQYvGo/iUA1t/HMWenuUTpB8y0+bjnQOpdiQCT4CsQ==","signatures":[{"sig":"MEUCIQCw3bN5WnJ68gBDOnvTvVAgKbi1zQmSVKeb1npjj8L2GAIgB9z1qj1dzMGlg6jMRV/FaqkeZSYFug5L+Wsy4O8K1+A=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjstFAACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqZNQ/9GiZz7Ub+iwOdq23fAWkHFbC7lj380Dtb1IOaHdexyvFDMDFu\r\nhhxxJGShxSJ9988LfycvH45OAJxNgjoASaDbO/G0tR0xK1MaiEBvWWW/Pn1u\r\nbB2gFNEdkEoacRkdaES+39BcgQaW0JFv6gvQ4DKsY44n21wDabhpSQV0jdns\r\nDZOmdpt3a3WJUTplz6J3vALR9a2+DgdIil9hdNzAO6hENfCJ8KUCDuki0tKv\r\n2BE48Y5k53GLM5+d+sjl+jBV89X4c5tPWWq8/fQgDcx7THezvK1hBRS1SuWe\r\nFeqpesoB8MTAMmi2Z+beSulvn9Q3Ptu/wVmgPzrz9xoYdNaOba41S2QxYcoD\r\nBDfaIXzuUVpPCDdvV6ovndPxXEQVtcLHG+6pP2/ct3qRfUoHutpAEzZRZ9Ap\r\nh6oQvw/knDCwwUSe8qIE4D/WnXnlDTnRYIMkFAzTHt6wJW1uhrS0pdcdFZ8S\r\n2mypGAW35IqAR7sNAxL8lAt18RF1Osj83TL5msjXaNgAtTzhDDiLTw5VUtCD\r\n0GQ6kVHjAadabYQGe3WOMK3oQYDUfrMflTz/suB25TIGrpQFPSxO3mcOrNLy\r\nm1B/z8OLhSswAExFvKugqwDBhOMRgdEYlAgaaNqK+BnKFONIEmDNk1f9I23T\r\nqyUYCkjMYiEdoXfPOZEN0yhyRPCdaCTAoTM=\r\n=hs4d\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230102124205-f3f12d9.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/0e32672ab735825af8f6e6916b1013ac/graphql-hive-client-0.22.0-alpha-20230102124205-f3f12d9.tgz","_integrity":"sha512-rk9w0eCKfwLryCC5GkNXKF/L/eG/dTU4nIEju55EvT/EuQYvGo/iUA1t/HMWenuUTpB8y0+bjnQOpdiQCT4CsQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230102124205-f3f12d9_1672663360405_0.5842222165346267","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230102132358-0d4276a":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230102132358-0d4276a","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230102132358-0d4276a","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"72a9eee9aacffa0c54139c96530881d8e2b246d2","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230102132358-0d4276a.tgz","fileCount":60,"integrity":"sha512-iqcQuKwsyTLuiNoycvos2Vh2u6oXzeNpoP6BSEmDD7BTZrDlHBZ6W/HYXdKjKYviAAllD853FRnyJ389Y64vCA==","signatures":[{"sig":"MEUCIDlM0c0fj39y8A8Y0GnQIemo9wFYLVjWU77K7PZHAm1IAiEAqGtJt2+NFb3uGoYwcRG+t1Q3fHn0pTKhS1lkh3fLoCY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjstsRACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmquehAAilbbtnGPFpiVjwLqzsCFfZpmAo09TUvmEsaFIWQ7dDAY6ZiV\r\nBB+YkDl+HSmOrmaDipKKXM10pBNq5Yn58iCno3g7OweUSKs5jJMpP0lVAad2\r\neYDf6JYFvDajo2Fvompr8aXMOPCX/XhzOAP8Dl+yxgKrGEQD+gyt3MA++tqn\r\n0UWa36yuSpYiTH4PKF65mGCUzd/cPqea50GNm4sqVrJ+utMKXzdS3I47cmEw\r\nWzg4qCQyj1wnjJg1nxdBtRIv1lOg6zGdhhgg+KKI8Y77d1tcQ0kPySSu6A9B\r\nu9D1Apj6q6XoyPqyU2j74DO+1r/Y+9QOWTt+l9JzRaqWCYDAwjRRJnzpT5cH\r\nJFHoNCXC3ZM/3RB1xRbpiao3JB7132Cu9xefnrOqEOnZUclNbZNC7a4g6NwO\r\nFQebqhsTUEsHBjH0ncLkl74Q4Er/GTy7v5hRMQRp6Ha1DZiodORn09gHPo6u\r\n68WGxWcHMFkHTVFi872ksFs/efE2UB80dPg3qwFudXsy6KqsY4qWnpQTQT6n\r\nZZDFzAAuIACWEsboDSvSgT/RRYRyhUm54yuZ09+g4qamlenYFc5D78q+3TYB\r\nDx1BbEdj4/pb6kaR+x0dCgxD1InFpjAH9qCniCK2TxTiBx8kF6OQHmL3wOY5\r\nkPyOPrgjM9kn7vU9E3aijvJeJZr5FZufzFI=\r\n=RYTi\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230102132358-0d4276a.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/b7d896daa924c230c18a2994768a7b59/graphql-hive-client-0.22.0-alpha-20230102132358-0d4276a.tgz","_integrity":"sha512-iqcQuKwsyTLuiNoycvos2Vh2u6oXzeNpoP6BSEmDD7BTZrDlHBZ6W/HYXdKjKYviAAllD853FRnyJ389Y64vCA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230102132358-0d4276a_1672665873339_0.4973104765674061","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230102132520-77388bb":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230102132520-77388bb","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230102132520-77388bb","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"c3240618cd4fa55bc17dee75879c0b66781e0244","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230102132520-77388bb.tgz","fileCount":60,"integrity":"sha512-Y/iwQEJWyJ27uL80tI3+gezxFNygNld9W8eNktmRAPfvpSb5O0sA/psVWBv9bjeq41JoJGRj6tlQ/hBoOu+G1Q==","signatures":[{"sig":"MEYCIQC/Y74J0GwSwBbVas6BPsQ4QtfMX4c7mvTAdXDMtBvnDgIhAKs0QbZnNlfWXzizq7poc1cP1BcbzkK8vabHbiKauivI","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166467,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjsttjACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoBHg/+LIYNyAK851ZcFRu6Oz8SWt217Ka9rJhr1S4HctqR8gs7w2i1\r\n1a03iLtbdbTBljvCH4np56dwBlI2kNyndQgtBMAL2OugDxx5Yh7mpWzbhM27\r\nzYG2hQmBtyXXW7tZVWCaXEwSoxClmqWjNK/cKVB0gx9ZqZ9YKGjC6oK2VoC0\r\nlnJcIfGauUXRtIEbKJ9QbGSRbIvSyyTjHHjgwz1pbdX+VJY4ErTFNAxkN1TJ\r\nVfrRT9dPjpgDwv8y186nRd/CLAPGIYlk1ir/jl+cHV/mPE6P21L5ZaerfufW\r\nEWxnznj23PvmfOJdaS3r0MrDtehP6gT3Kl0FOpPxrwpeRqxQEKzgfg85uGQ8\r\nDc4Uc6wNK78EGhytPQ75zt9cymkFuFJ6axvGUzSBAFkG23XuOkMPk8i2UOoV\r\nbJqtgx5ZD8kJIPYOufkIu2ncDlJocUy5OcKIrvCTjpywNkV/Yb1Y73SIfzzI\r\nObxbT0DefrRMJhp8KQYTXkdq9YvDAdYLn4GSxjeTP3c3yzaKZMMq6Cu9ueDR\r\noKtVdlu1pqZVh5PGhWooqafx/4FaIcrH652QyhssBKOxhdThL73sedxNmohE\r\nRQLtixkVXvEPlXmd5FK59HBPX3H/2DtYyyW1VKmm6zOGDOTsztEunXVn/Zev\r\n0Dbn4eNBJEX1rCGa0erUWR5uoCL739HhYdI=\r\n=VCQI\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230102132520-77388bb.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/3a8742907ea1fed742d935566a5c6a04/graphql-hive-client-0.22.0-alpha-20230102132520-77388bb.tgz","_integrity":"sha512-Y/iwQEJWyJ27uL80tI3+gezxFNygNld9W8eNktmRAPfvpSb5O0sA/psVWBv9bjeq41JoJGRj6tlQ/hBoOu+G1Q==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230102132520-77388bb_1672665955471_0.9371584229858336","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230102140938-5c4e325":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230102140938-5c4e325","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230102140938-5c4e325","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"2cb583c40820b3d490a7e8e82439f3b7b215ccb9","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230102140938-5c4e325.tgz","fileCount":60,"integrity":"sha512-KeGi+VaTd5EW3jUo/14ty6GZ8F674Rk9RmoGNdl+CJrbjUQKkJctZ2AP6y5T33tr7Bnu53D9B4hWk2fyeJvtwA==","signatures":[{"sig":"MEUCIQDo4AaX1LYJV3Bemw+KLzoVRDz2JW35w/rgXW3lAoyg3gIgCdhr1UOwytcUoTt+yPOVg6zItMyDsMjErb6MwyN2VPA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166467,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjsuXFACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmov1A/+L+Vyubri0D4Vw+/G3YCLCa5WqNrlArDnp9sIYq1QwZOOWcW5\r\n5h16GPsTjN3UW3RpXLzd6mdtn9x/zCkpUbW0oXR/BKNXkffK4mwyPzz0jp2r\r\nT/aZdLr5tFz7+KfXjTwOCs1Y5coGpEHjJraot+CztHxQ8IfMr1DPw0KukYBg\r\njD2k6aOGMxFM8e7/ULuW/OAwGJuXqGGNIdNuijUAdMHCInNH5nKVwAwHQsTp\r\n/FFs7IVIXubkYXQhtbev9G2N1dDNj1BdzcqUf/lwH5YqDWxgFjalvDBTv5ny\r\nDizhMpbrNX9E9oR5cXHgUJ29EMnohdKOgSmMPNFsV94iO/gjBLqPVpuOSo2Z\r\nhiRVVYzLEQXgoH17D3G4anjOHkVCqy9JRg/9RSLUc3vm0UTS4QZuFjPxSjoJ\r\nr99t5F+eYJFlv8oYXMxdG8frP7/oAMH8fA9UWrvm87n6GQPHjF4T60oRhWHB\r\nyMHzKd7YRfi38bOZJuq0kKUhn7UvIc4w0F01QRQpldLJa8P+WbzgxQ4Ufn+/\r\nBsoUEi7gQDohlsVDBptg8d0ftaqx7G1OD2cOa/rUjPgUJ71E+yqWW9Nzi0+Z\r\n61BewVFn3i/ZgLPjrAOfM3f1lX87FW6aSetlSVRdO9QXvuCH7ua6cFHj01c+\r\ntG5UoOn1grKl7UXw+n6G03zOmuPa+tdF3Zw=\r\n=SrL0\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230102140938-5c4e325.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/1e58cc674be7d195fdd6191248112c14/graphql-hive-client-0.22.0-alpha-20230102140938-5c4e325.tgz","_integrity":"sha512-KeGi+VaTd5EW3jUo/14ty6GZ8F674Rk9RmoGNdl+CJrbjUQKkJctZ2AP6y5T33tr7Bnu53D9B4hWk2fyeJvtwA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230102140938-5c4e325_1672668613268_0.8936973263616323","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230102142304-951bc25":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230102142304-951bc25","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230102142304-951bc25","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"2167e5f2534357dae537b2afa5f657625ea34e0e","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230102142304-951bc25.tgz","fileCount":60,"integrity":"sha512-F9hz3Ar8d97XTGMsFG9If/KlxAtDWNoxGcJsXmYVoydUP4FT0ELfbIrZTTtBe5RISOaEpD8/ITRFGsdPMKYp9g==","signatures":[{"sig":"MEUCIQCa+N84uNVPZbaTP2ywyeJDxIkXK2V4v4Q9DLidVLZL1gIgK7CWFHJ8tGqGsomvuMaT0tl4J7meiI3fib0a0C1n7FU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166467,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjsuj1ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrqIw//R1T92Bp+dK4pTwNMD1bISXkkHo+DYjUcJ3r17/4bWmdok+tk\r\nlS033A2iAr/g7gjk/A5hmh9CIHs5qPgoOi34ELA/c4q+lMZklC9ZkTekPAFS\r\n7xBrlEOhDIrqMR1PtZxwDPdZ9BGpR6zghkkPEzb76p7IYjIbDBfslVGVmPC0\r\nQRSvKEwSsxZN4eARyWPg8kMSTbsxSRhJAakzNmOuBMflKZ+TJauhWAEfYgXG\r\nFhbnqb4GvOhP1Ud4kKBc3YWT2CDxKMsG2v5CMhkoOWGfMddpvMWcjuKYXJB+\r\nmlqjF8UH3h7DUcBuHEX4qacYaO/YAW34gEiMUJAYNPZcojIIuN4X22GMJe/C\r\nxGEF2h+R/VjVlTmRy2a3ShuTr3BprF3VpLVh9ugwAqjbxZa3msk0WUblhk4Y\r\ndKa6ZZ9AVRn7DmpMsM2p3CY2OLixcb5w/Q8nccfr7mYLGsTCgH0KB/Egy7fH\r\n5x45CIzwsV2rTEW7y5RTEWJyzbU367m2upDuZGeoKag1hOkT0sFReL5+ANRa\r\n/X+Z/jNxLTsOGDmcdrp/Fj7dKvEsuWtEJlP8O2M+rUeyVEnz6FEf1xB668kb\r\nPZOsnqm436oAF47zoUWDiRSTlPI1Pzkb9OydmFcJlFHOiwFx22B9YC0pNw4e\r\nDCqtphGP4qMvPPREqyTH4A1IaxF8NtcaBK4=\r\n=dDz2\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230102142304-951bc25.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/b2e72f8600568e0171cafc5033442d5c/graphql-hive-client-0.22.0-alpha-20230102142304-951bc25.tgz","_integrity":"sha512-F9hz3Ar8d97XTGMsFG9If/KlxAtDWNoxGcJsXmYVoydUP4FT0ELfbIrZTTtBe5RISOaEpD8/ITRFGsdPMKYp9g==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230102142304-951bc25_1672669429378_0.35941817411807575","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230102143822-8bb2085":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230102143822-8bb2085","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230102143822-8bb2085","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"4ea060964f5c9056b26b09edd61c34d248c06722","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230102143822-8bb2085.tgz","fileCount":60,"integrity":"sha512-TeWept/J/HpcfRGqrXd+YqQD9KYzc+omZ4JGtGIEN3lqdI+QomujLnaur87l9qIXBTS6e6Yh//Og89KX3vh1ew==","signatures":[{"sig":"MEQCIEui8Ry8mV6/yLYFMvI9CFcSLmTJD9eREo8TwBsmlCE1AiBSPCEA36aDBw9ZawyB0A5NTtAhzfqL03Rc3pDieOixEQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166467,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjsuyMACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqBqA/7Bgz+j5QyXrvO5t5HULwPOnokAXiCobxNax3PHphf3NEMI9w3\r\n8GJY/NdrYkAdQwDtFWrSIJgnUNniaG+ei6VGAOVV2eHevxjjYbgOXY7nsV3p\r\n7r1AkD4pyxo9F3+0VeKQhQ849fDWNUK2v93H4GEJVKmA9lkxDLBORP0RextS\r\nXLUJUycb8Z2srhwB7VtWJ+QgnM2IvNi7IoYoYexcmXUDlSK4EO/AIZUf+1Ga\r\nBRwyaG+SCh8u0joqMGuO9VTf6eNF97MV9+viij+3+s+eYsC/K+OQoynoMwsV\r\nRfIYZB4VyR22UDM9M3JprYgylA2Jum3WKIw1MNAU8xWwlvcXyLUq39ahxgrR\r\nDXLgijfeLrhkzs8oa8QnWbP36oGLiT7vZJEaxr57I0oN1qgHty5M96zvfMxH\r\nrgzOWfTNznlc+a/01KjiaI5r0Dfvq9TmVa+irfiRr6qDPbgdz+rl0pLkIu3W\r\nh7lSrGMdECGDoELJwamnsppnQ0PFDewlyi+x4kJ5jZMDzQagZWYRtMk47Q2m\r\nlVY1h/8U4o2/UixzwaZ3H95XzosVFN9carYz9vVxLG1ZLwCMm6k9z8/MS1AR\r\n0nYmnVTeJohuGlF7gn88+eRApKQTcupcK28SHMoZSsTCY81T7CdDfRDMhj9K\r\nV/giElrG28+C3eYB8TkzBWwNorVp0mvqt6A=\r\n=f7ZM\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230102143822-8bb2085.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/374fd7ea232e34af4ca83f06f18b74df/graphql-hive-client-0.22.0-alpha-20230102143822-8bb2085.tgz","_integrity":"sha512-TeWept/J/HpcfRGqrXd+YqQD9KYzc+omZ4JGtGIEN3lqdI+QomujLnaur87l9qIXBTS6e6Yh//Og89KX3vh1ew==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230102143822-8bb2085_1672670347825_0.5527120122734683","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230102151804-09d4659":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230102151804-09d4659","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230102151804-09d4659","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"cc1c9ee16c91171398c2697cf42ddc8a690a5f5e","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230102151804-09d4659.tgz","fileCount":60,"integrity":"sha512-zg7Gu4+kO3hXGyuMsHFKwYmIZfkEDTdtuvsLjoJjzghxjbrGxzrvdnyKfj/WeUmQw9emM866MBk66isuHRN1wA==","signatures":[{"sig":"MEUCIQDTuGzl8BPDEpGxr8fbifvy5awhY2coJHUpiz9qvhjAjwIgAY1cWGhQ2IOKiZt+KU7fq7hE1f5zW58YwUqUF00MEZE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166467,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjsvXOACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqVkQ/9Fn+ZQDRAT25TO1wE5VEKd87aFx58bAhJarWhXJznk5Ymk7KT\r\nCizIUzFsYpXuQBfMUuZXIBZFtIcpJfV8MrltWvNINQ+MkKZYmNX40KQI0Vxh\r\niM/wOb0vP4RFQdLWFb/qKGyNqkNnjPcad82DwM+akMTy/rMdBBviqiZEWxWS\r\nz5X2i++5rBR0o/ak5VUyEjG/fhtTAu9PGBXfWoVin0j8CbqsHhbjO6uyGdBx\r\nxGSaFrgCK28sDrN/pVhtLGNrVEKq/Fy0u14WUHm059NB5igQ6ODYDjvtD4fo\r\n/T4lRdepIOjNprzPAO8DybzUlU8h3YAEKCd+4tjNdF+gpyIfeDrm5y9W2O6f\r\nDxn47GDBKkUT0hk9kTx6Bo1iBRQg/mXSZ5xZ315rblFIS42YThodaufwEG64\r\n2tEqITaWxlZ3XMImeFKXutnafGMn7fTJaRWtw3AwNrjPquIpKzFba3nN0RSZ\r\nWvrdj9QgFqrwK1vzrMKWVR4eiopQ6A0K1uWE3pQHkUHGm456SxXDlXTMFjnB\r\nHIShSzLZ3oRAP+1Z7R4K+jYDq+IC9p4r9N+RbGUP3y1yxxC6mCAylDfPiQXG\r\n++NnOuaT19NagnwYEZr+bXa7jYu8OsxnsbH0EyECQaulo4Kk0Wf78F4Mvkp8\r\nXa4RwfI38Fg/abheldqHQ4Cf3H3bDkB+M+w=\r\n=uIwi\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230102151804-09d4659.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/5b2d36b4be2f988b1a418d90839bd76a/graphql-hive-client-0.22.0-alpha-20230102151804-09d4659.tgz","_integrity":"sha512-zg7Gu4+kO3hXGyuMsHFKwYmIZfkEDTdtuvsLjoJjzghxjbrGxzrvdnyKfj/WeUmQw9emM866MBk66isuHRN1wA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230102151804-09d4659_1672672717946_0.2624736696814114","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230102151837-c32bd31":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230102151837-c32bd31","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230102151837-c32bd31","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"9dd55f52b306faed8c5c197adc82816d9e2943c1","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230102151837-c32bd31.tgz","fileCount":60,"integrity":"sha512-vfLr28vMYJjXgZMbQZb/bV8OgKYcCJtW6AzVyffxqBosy8WdHQfCg9wy+4phoCtS2X1Ak8VjaJykbp+qVgATBw==","signatures":[{"sig":"MEQCIC61PFvAhzxOhOgJDnaIY8JySv4WO4NhKVcMd/oCl3ZzAiBtP/Pqcy+4RySMIX8O4Mzpj2sTb6CzLkCbFDrNoQnDzQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166467,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjsvXxACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp5kg//TXW40+86Tc7Y2QeyXz9rK6/pP7tAF+/unZTV+eFn0txWCuxO\r\n291qThibvMHJGzlPY4z8SyDypOL810fCRoa7siOJUPJUl9tq62bLyp9wRk4X\r\nGAoFdrqwZTWSuoJ345UYT2GlNMxzgfqhHwhbEaplWBd/um4TX7rpB01mr2/A\r\nNTVKjQXqWCrIMVCUznAqlVnAD3LIYxZxkBI4B28JRiQeDuG4iEFMmmfHoirR\r\n4Luf8yvvSAImdpfDJKMn2TdgGTgPxJyz7E1UkgJ4WjRPREtFxl8akJD93ihl\r\nyTmzisziBUZK5VTdsB4+vJW17D3Vq85QGQVf8gcjS0nzPFFLjWubQt2tktdT\r\nZk6OTs5z+68EhDLjjz/Mj0GvpZeZrFE5SHSFqkr5/of2Jh8ioG+eKc/ex+yk\r\nKUYEayVjJMa/9r8NIMCEdJ9yMLHX9n9e5eP/FfmGn+RqTKBbRAUubk3vFRAe\r\nc9fLVnF/+GIB9OPKmkPQU4fd21fAlnTfSFp1/q5uIw5M5VFr31o+8bf0ZRCB\r\nuWumHZg1lkY2xehIPgJeaTS2nYIa7IhtJCfhnUeBiEpvRUca+d/e8QL2wDtq\r\nRotUuH90TqGGFg0DePV+3WMpzVUjyGkdQCKxDX51bcB3tIh8ksCJ0KtQsdxf\r\n6PAJjJMAqNgdNPVPIF+mIsGCqeMW5JiUv6A=\r\n=s1Rk\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230102151837-c32bd31.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/a9a564eb8da026c780f863ebaf53ceb2/graphql-hive-client-0.22.0-alpha-20230102151837-c32bd31.tgz","_integrity":"sha512-vfLr28vMYJjXgZMbQZb/bV8OgKYcCJtW6AzVyffxqBosy8WdHQfCg9wy+4phoCtS2X1Ak8VjaJykbp+qVgATBw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230102151837-c32bd31_1672672753653_0.1866154650154921","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230102152456-ca0b426":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230102152456-ca0b426","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230102152456-ca0b426","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"ac2505905681cdb18e63d9d204ca13e0ab9b3a14","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230102152456-ca0b426.tgz","fileCount":60,"integrity":"sha512-cc1Q88KhC5Cv2PTrAc8qeexerVTK+u982fLw5YdtEncGnY0M7eikSYXGYiaSp9uf6YxB1ZAAtGtApkENCTx/vQ==","signatures":[{"sig":"MEUCIQD73EEGznMd/HHqDHSr32iYacxLKIDVj5M29yOPQrG0wgIgXTK4Em8tZdgRH82xQjITlYmMtAjF8A2S64ZMIxAkNoE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjsvd3ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrsiA//RGSlDdcEQHT3Y5VTUzyStzML5HiFct2fhv6h4dHBnWQP6yDx\r\nvmBGHuoRzCKqSt/9NAKCyZjKjwp4lJy0YDHhxF3WPuV5IRWWILOzWFbVK+ha\r\nBLR566zJQ0l1BHskNMY9dHh33p0HfMhJiMOOajdhln51ffKJdrhP1WBWLNXm\r\nVzpZuZr4mdGM4UaYkgdtI+v4/qHF2K0OmQ3kc5c5HDAB8WCqZjF3zLiwGZc6\r\n0Vy6Ode83ekEtsxs06LaC1JAq5oOOxaerzInSmeIYrotxhnp+b+Jqz+Nk+So\r\noN4eLCWOd4XnQHA4LQMZfuUgruDztvKfv6eQSB4/pvGcCKc/TRyzrVDzXfsb\r\nNxG2XtZvqojlFoJr3anZOaDgq1PFY9/yQpslcQcOaYivWjDbil7fICV5duK9\r\nwHWuZgi1c4zc+Niixgb6vwWZJ+uFcM7/tR9nQv+kE4GirGJV7/h9YR7ZD/M3\r\nUfkNM2mud6mYSXHxB8Aw3c+KsOUEk54EXf+hslxduTPG6UJG4eFLyJXoQfdc\r\nMep5hIdu6U7TjcdiH+LRBRu0EvTD1/5hWli2hkJGM4UuMSNGHOtODdYzbMBl\r\nq8M7f9e35XDTEIG8UsnK8jH0zJeK1r3ftP7KgdDnmNE4n4PnYp+6xVskI66U\r\nVgVsG3xX0viL5NV+FuBrUzQlRg4Wob3APJY=\r\n=+aKZ\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230102152456-ca0b426.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/00d2719901583bdf68406f1df6430141/graphql-hive-client-0.22.0-alpha-20230102152456-ca0b426.tgz","_integrity":"sha512-cc1Q88KhC5Cv2PTrAc8qeexerVTK+u982fLw5YdtEncGnY0M7eikSYXGYiaSp9uf6YxB1ZAAtGtApkENCTx/vQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230102152456-ca0b426_1672673142762_0.03419017173117056","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230102152635-c3b9307":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230102152635-c3b9307","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230102152635-c3b9307","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"ead0a417b59781c790952e33d277e6c638061eff","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230102152635-c3b9307.tgz","fileCount":60,"integrity":"sha512-lOdUyUy2BOvL/5OohCvZo6UVG3lhV16UBL/SsGQaV0Kby/BwrsYbI+lJXQ6xx4sxVxGGxmxipWJUHVZkYX1gwQ==","signatures":[{"sig":"MEUCICLpLEDLLcY1dCeZ0ldeW2sHYi3luo+aol+iPmU+Txx7AiEApwQ9MEYEBmEp5xW7C8QRO2/FjomNHJ0JYprn3E2NDww=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjsvfNACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqT9Q/+OEeSRcPAfSstGohyJKy5O93VhXIjrOy1EbhNMBX9a3AOOLao\r\nDSMLoCjS9zHbLz4nKAiS0ducdoI3vgXvHZsvMskikYL+JiYKl4BoQDNpaB7S\r\nTSN4F5pAVboOhhUcNlKSsXLmSqN0EvAy7H+NqtQHS/4dt6hXdlhSVBKwZ5iF\r\nMXwE4roeVei/EBH609BM9dMwYkjeFgUMWSoPeP9RLVL2klrR6gp83ZGglN0o\r\nd57m9ex97GIBPYtUcEjHq7M7Y+uWTYPob0YwrUqN0pimfR8A6IFcp6svRZHB\r\nxzMmkSM6FtLmR3PYuhTy+gEkzG69XoQUr2QftRgmKbtZCZRcq+chVUv9Cm4s\r\nl3IYMh+MMLgxxOwabUpLvZ+FT2cq6mTJwDwVL3HQ/R+xLLEVK3svXRCSxOo8\r\nSdr5AakAUL62T/Tpy0JuB+uSTWBkgXUnI1vWpuf5mtsd4ZhaxBbtG3JHR4eU\r\nURfAxTqeMluMB0mImRhJBfkSronIGgHKSg9mIv/78D3Fr0+i7pwHqIHuLVWl\r\n9nUvL071TSIyQNmDl2woOXfJlMB5xZ6vyCE9D9FT3fp8qqsDedjuTWKgFgmA\r\nipGke3CzJ1vl2dJKPkV8STR9cqQRt5nSlK7nyRifvl38vIG+4ZEIwPZzmsgx\r\nQP6NepGW1e1XU3UHY1W0m8A8JPZJdQzJqyM=\r\n=JfH0\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230102152635-c3b9307.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/7d7b6e94fc4c290be4903fa1f5d6b409/graphql-hive-client-0.22.0-alpha-20230102152635-c3b9307.tgz","_integrity":"sha512-lOdUyUy2BOvL/5OohCvZo6UVG3lhV16UBL/SsGQaV0Kby/BwrsYbI+lJXQ6xx4sxVxGGxmxipWJUHVZkYX1gwQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230102152635-c3b9307_1672673229757_0.17904840627742824","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230102153119-c458f2b":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230102153119-c458f2b","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230102153119-c458f2b","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"12db83f92f622eccfc0d1a434d819cd8905db7f0","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230102153119-c458f2b.tgz","fileCount":60,"integrity":"sha512-NSemClgfVQcQjDGPnlaOodEWarGn2TlLuSE93z6N4SLDQfLesWITHVjBHAIp12A37zW5gWoy93DHTc2OhDZ0kg==","signatures":[{"sig":"MEUCIBSegVR+Ubk3bOIVt55yfac6mdPkAh4Z5lpjAwGI5blmAiEAptSw+9gURUTnxsu6WPTuj12zfY1X1cSAmYAk297PGok=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjsvjqACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrxUw//QrvIrvtmRiCOPvRpq4i+SIVPN9XHUJUaVtaAUUfRC5YaVBZa\r\nK7ZSTKqdNZ0+rVa0lkhR43hStPIHUVVFsnfFLyflDnI5zuHIzJ2dVKaRGDUL\r\nLVMi5MthErdj87+drVNLQPnNKsRNypWZZ4wirCHDrRDYUM+RRh8q2fS5kLVj\r\nBgeEvSNj+60ewPCDM3CaMnefIkBf6MYQnnhwtwb5qiLUXhkw2APDIH5Fk47K\r\nu5I0uXtJn43oRMjcxlZ64WC61b4mn/lijSqC+s0hUHeyEbbUdfJjUxA7Crz+\r\n4bXil4jyKI2nmPu4boRj6qyq+J+aa8CzKwQBI0jNA/q04VjmGkZbLrzyFCPR\r\nRPFDjRQ8OZ1VGqiMcwifwAyMkbysDUfc+U4681AbQw18Rl4vu6URsPdoXWu+\r\nWHSa6120Ql+zqD9DpQgtqmwF21PMSnA6ZuZ/0I8C0DIK3kXFqQoLYRP5LbCJ\r\neF5Y6hvHVcqQGINTjn6X8lVElv1vMW61s4T577JmXuHO0UslkOQ0tyAKKk1W\r\nGdepxyTvUamshiVl1yYGIWIZZvmHh+r/E7+5zYp4FxXTZvFyC5xf00h7QQXW\r\nqJfrUvw6PSXUKnu2XeG94NGPwkVRJfhHlJJ/lE1YaaVu49iLsUc06+1nZAVf\r\nsd3dhbYKpo0WLnVtApdrrM1aVrJrIdohaPs=\r\n=COwf\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230102153119-c458f2b.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/7913a537cd8e35f83ba915f885354f0d/graphql-hive-client-0.22.0-alpha-20230102153119-c458f2b.tgz","_integrity":"sha512-NSemClgfVQcQjDGPnlaOodEWarGn2TlLuSE93z6N4SLDQfLesWITHVjBHAIp12A37zW5gWoy93DHTc2OhDZ0kg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230102153119-c458f2b_1672673513800_0.7838225635938145","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230102153621-eb87554":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230102153621-eb87554","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230102153621-eb87554","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"7da0245ddecd3240512927623d4db4a3aa778e81","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230102153621-eb87554.tgz","fileCount":60,"integrity":"sha512-bBSoImTwZxphfrMUhZiODPvFKqIhQgMIYZ1K6ObvvFAO9JSgRy9Enmwwr3KWABFcE/S3NpQyaQTgQHqRcCRofQ==","signatures":[{"sig":"MEYCIQCJBGWDAczJw1VZCeIhADphjjBj1FiBGLCQ7X17pWKhhwIhANrmo0Y9DZhB/kU8VPYqFrHns2M1WH2HI04F+yl3y7jy","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjsvoXACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmowOA/9EnzgaeIC0KYrRgbvfU8X13OhjwSTDDhj8TTCKwapGzgozQvH\r\n659eI4Rmvm+SfxNvkJoEq5+Q/hBZQzmRb0LsmMZ2CKwpDPy3js8m7kCSyXnr\r\nOBUXYsniUcgXWIF9WoBPxKAG552qhoaeE+JbpxMP9bCxNHbr3HIZGsTMuDd+\r\n/mQBa/1nMNmZN7ow9gIOt4lA9lXwsO5oPtb2Ktic1E9zSOodArTArJefYYH0\r\n197407/5SdusJ5kKWsNCMHjUkmKYvi8g2xmq2vvk8GK9X1DLliiB1ht9qku5\r\nbYaHXOGllUqoJ7+Crlcr2oUAyjHELcPDJVOs6hRsKYxRamXRzQaG1FBB82zY\r\nAQFFQ7kL2kxYPrULlxCG3HRjqVU1fJQVnImszbYhLRKzfSdp7J23vQYqzaIy\r\nFm20qg+koZ+bN20k8SSYaAJgeJpbJHKmFyujotAX41XzLCI/SlZYMudWnjL8\r\np221TQleZyVe9k4tFEHjTMIW3HWOxBQz5p/vrkIONGm8JtTmlK+GjkfRJfCL\r\nDLfmJ7fsAAi0I6J13svRGOhrKw52OMXj1tfj/F28luEiZ+8PGCnlMQs5OAYg\r\nMRYDLsZohJY+zRhypClEYYK2BNRPEsReEbjNoNGkHcQArlwVF14zBNHFtofo\r\ni+idV7pbYTXHpIQPGFPS1+Qgh6Www7Fh2/w=\r\n=rJTq\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230102153621-eb87554.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/e2cb9a32bc535e6934ebab4083cc105e/graphql-hive-client-0.22.0-alpha-20230102153621-eb87554.tgz","_integrity":"sha512-bBSoImTwZxphfrMUhZiODPvFKqIhQgMIYZ1K6ObvvFAO9JSgRy9Enmwwr3KWABFcE/S3NpQyaQTgQHqRcCRofQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230102153621-eb87554_1672673814974_0.2902579668245233","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230102154125-afb7f0f":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230102154125-afb7f0f","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230102154125-afb7f0f","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"3907e40c4eeb0a9c66a965b6d7064bb8d88b2a36","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230102154125-afb7f0f.tgz","fileCount":60,"integrity":"sha512-p0RBwZ25pxjIBV1HeCNn73vJFShh/n2ihWRxCZroYKo5+WH80ZlHt8fLf60mmuXFzgUBSblnAy6FaTZw6LfWRw==","signatures":[{"sig":"MEUCIEKaijf38AJlSqVkFCAnWvvCoFIofKM9fuaMt67OxNbrAiEAlujrMtHkrpsCC3ngELB3iem8+LXPGfr0t+N4iRD0xxg=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjsvtIACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrMqw//YF9MemPKLNlMXU3P8zIPiuK3JaEUUPtTmPnA/ANEWImlpckM\r\n7pYWnnIcn8V5UyXf/irep/Cr0KCkj+03nwomm4QSQLURHP0D+J7gjhGmlanh\r\nK1yPmNAI+OeRLXDjag3TyDqXQPx94Lms29uiKbV5ncCZysj4NM9NONA7T6P0\r\n6lyxbd9vieN8PPch5DNzBy4B1bAwB+atQDwZQff7b4GU00vn7KSfWYYmSSZW\r\nDuFnkA+jddKAPMOUWSIXKnEb38jD9ExUiiVL6hUCOXWtvkb7TMsDkBTmCCa5\r\ntrFKY1/GJuyeQKmxfOHR8EKq1C23Dbau2al+Be2RXKK/4C/6dwRmdOR6Rx3q\r\nZFEPypusnGDIH/uQyKyYs5g9LIob9yWRhRi/Hz7iGh7FlWDt4mlVlNDY3zIF\r\n814H1T3lXHjIGMFpF53fem6oJaYlFpGaJEyrqg+ZoPGpuNHvoKQzwL3HKnQe\r\nE94RyyHHWHw+8Wtz5CeqO1oXH2TXUkF+fcYt2JERGh5usdUQsQJCITj5je6H\r\nBcnx7PRjCf2DbHhTydj0O94+sERJ33W/drecdOQ+43AZ9wbYmzv4IVnGPK6v\r\n3DISKTvgw56yf9I3CfbC9Ya9JayvfgAMaZbvhQFhK3GIvhMoPzZGNk6FwHIM\r\nqGe60Lr3JXC0U1MlOqsc1jUZLd5sQ1x+SIU=\r\n=NRkE\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230102154125-afb7f0f.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/3ea3a487f4417bb3015fbf4fd43104e7/graphql-hive-client-0.22.0-alpha-20230102154125-afb7f0f.tgz","_integrity":"sha512-p0RBwZ25pxjIBV1HeCNn73vJFShh/n2ihWRxCZroYKo5+WH80ZlHt8fLf60mmuXFzgUBSblnAy6FaTZw6LfWRw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230102154125-afb7f0f_1672674120000_0.1073242414609139","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230102154619-6d6735d":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230102154619-6d6735d","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230102154619-6d6735d","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"65419619c523f2d4b901af532582ad7438888e70","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230102154619-6d6735d.tgz","fileCount":60,"integrity":"sha512-10EvQpTkoisIYvSmP4k3v+MpX/+FekouAI8XWBtltNZWFSs8BZP7OJEVuusks4ilEp7W/Tz3r3FlV35lewP/MQ==","signatures":[{"sig":"MEUCIQDD8sK3OYYBin/4kEItObdL4PITv+MsBYENgcfvOzelPAIgc+91bgN0isWAiRAcyALtNlsjFgWawqvDsojE5w9nAKI=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjsvxuACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrryA/+Pj1vi1q4tN/79/11bngvdW9SucAy9FGRpMSHcI2CpUrATvYj\r\nEK0CjCR4PBkN0FTzYMpnk89pfcdKOS1eM+Pg0cytcTtOGKxYWhMTdgnek1Iu\r\n4wHU8n1RBIFSNLJTDTyrF8K7dWU4JKhVVl46ybIk1srrczcpUksVzrqSM+jE\r\nrvh0EAzp+z0c1rdFE8zOn7Xtzc6RBwaziX0uDTkLcOt8oHi0a6pY3LFSKB+W\r\nXaMMy0oxaQ6JRoTlYOVuW+OtII3Hpp4cp5iB/m9swnS4xRvu0k+sieG+CEiF\r\nJCFIkVMTgVVZfDt2Aj+rRCrUHjuf2Ve1ea/XLKui2FsdrFWD4SH/fCWxVXac\r\nh4c0nLxI5KnYxwNbyYCjLHzh0Is22PJ9c3KVaQgpQ3ZyLcg/jKwbmmaujz6d\r\n+eCQ9xUV53LNaW7Zkw/VV3uOTGYXXMon4k5DZwKS6ul/BwOe9FEU95y9egXG\r\nKEiPHkT2zMK6b8IAs7B5dsYWYP5j2tFhLNev6USDtLQ+Z8ZjYajD1kZ1Lt6K\r\ngTWsxwzeyFrRSxQATxrsjISYHsFf9Cj4RJPi429vDj8uMEQ+O5d+NYy2QH0x\r\ndpWsY0f9bCH1g/nGN8wjAIUumOw+dAXyO1ZVhq9w/hsdSi9AJe0APhXG1a5c\r\n0tNS6/rHtM1lSw+I5r89qT0w29G29bYA8Ww=\r\n=DD0J\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230102154619-6d6735d.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/edd77f774e780b4b559b12821bd6dae5/graphql-hive-client-0.22.0-alpha-20230102154619-6d6735d.tgz","_integrity":"sha512-10EvQpTkoisIYvSmP4k3v+MpX/+FekouAI8XWBtltNZWFSs8BZP7OJEVuusks4ilEp7W/Tz3r3FlV35lewP/MQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230102154619-6d6735d_1672674414702_0.6826610766219285","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230102155135-bc791e5":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230102155135-bc791e5","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230102155135-bc791e5","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"5e7fe9eb57c073aef8ab6bcc33af2ebb86a5958e","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230102155135-bc791e5.tgz","fileCount":60,"integrity":"sha512-Uh/5QjAhYB9/O+w9EhNfHYlkq7HOhKF1IBcsub2x0veOuguUC8Jm5I0rYhLoc7+gC2dC4HMyTI3AZQtNJfEpEw==","signatures":[{"sig":"MEUCIExLZRM6HqmaMbKQ98TZ+AWkOvXYMSkOWC19OVVthsMVAiEAs+VYN0yPZZkIT5k0YjGopEglDYLIudLfW8oTGLcovTM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjsv2oACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr0eQ//bwwIp5RRdw3o8TJVKOT5NU5cLCMDI8cNLT7aoRvCFZEGdT/S\r\nn62mZsMfv/4zyNU5c1MqvWB62n3rWmWm4zXHslNbQMp5oelg+m2iw51PMPtZ\r\nDMQbInSgVdWIlrPBKM47VfLzJi+9gydzD0rSDV9eZIl3hD+oGhVAj+qvqsOe\r\na7xCBRdY7vW+30jB5Kghv6i7mrYreFUWOliPBVWgJ0Na4zxsE01yPHpVJkru\r\nbPqT/PY8qG1VWTkKAURc+mYLbL4j55GL7sx1aLi/544NyzU5ZX7lh1WA37ye\r\nn14HKYGhW3HhUIG+q5orrdJRyxlpJL3L/Y94W9ddCceyesQYv+qwmuOUAzPH\r\nhQ+S7ZIyfAFM57AH0DNKSRvffLQYBcjaFI6t96gSik0B+XbzwVDUBjCsQPbf\r\nd2dYNpfdW/TaCt+YQM9fiKpxe8jDXPPW9GKoKtC8znOrV248YJ2/z4pcpP63\r\nVdyudWRwz2OrKC9H+i5x244R7BOujgRns44WY3SMSf5NkUVDcW9+yBYpzlLy\r\n/CRSDEyq8NCVFwVRiYjzOAx8OyURvz5fpr6FOi9KsL3thcp8TaIwCHQ24aK+\r\nk0/88AHeVZH4seLEFO9NXM9xRaJS00y8/2JKgFSisWyHFgECk6LZ64Oo+5hv\r\nK2rv01BqnCqyk1a4qWczWWqwnTSaD0ouIcA=\r\n=Xy5F\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230102155135-bc791e5.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/3dd95d098edcf6e7509710cffdec9a11/graphql-hive-client-0.22.0-alpha-20230102155135-bc791e5.tgz","_integrity":"sha512-Uh/5QjAhYB9/O+w9EhNfHYlkq7HOhKF1IBcsub2x0veOuguUC8Jm5I0rYhLoc7+gC2dC4HMyTI3AZQtNJfEpEw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230102155135-bc791e5_1672674728649_0.2632907348162927","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230102155809-e53e940":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230102155809-e53e940","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230102155809-e53e940","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"8c2c77c841cdc67251213cad932d898d0d6b2094","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230102155809-e53e940.tgz","fileCount":60,"integrity":"sha512-7tHxQQX9Ru5lUPoeDexdMLN8Frh5bdKcmeCVOxyZJhSBbRAAyv8N3BjUrad+LKUiJVKHko4MaHH0j4h5LNVh1A==","signatures":[{"sig":"MEUCIFZlj4zFmrh9hiH/7rMwrI214eNNmJh0SQPkONMQeigNAiEAwgnY5CO+Q2hn5S2yiOG7i40zy5H4zBluSQeuR42d9zo=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165581,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjsv9BACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmozYw//R/8WtyAjYU87VKEAg88HHyHfHGlnpTXp81DmsWPdIYI8+vTX\r\nS2qdCWEDAep4ZEHgEBGlB41ca1L5OzOb/aAYoMcceAVv19xrPDarl4BnMaTU\r\nCiyIxQEF/4InnjUwKd5S+8b4X1oep9+D2Yr+zx61RnM+eT2De8nqyMmLUQvn\r\nx7pYMeQCMZL0id4y0Z5QkeM/UR1YenBK5GW1f+Vf1arRzLCOOY7+T8h96n3R\r\n+Mcf/vKHQOLZ+OGQ0vlMh0aYbz8xhbGvPPDk7En8qKBAMPJZIJgBSDIsZpav\r\nxgp7SvRpWEZk721u9h/5GBOiTDCRAopa/a7lOFeCMuBGvDMv0Zhh1fUZ9P1X\r\n9LvxpauBp8dtdhgAtOgZtNeDHYNG0mcCT4V+/4rRuxffV4EcDrBtfp/Yr3cV\r\nWNlEQp3nxFDC8uhrTUMTpvig5KZyvvC4Hjn1gu1PaHXEIEyWBFam6lNYZNvE\r\nNJ20qdvtsrbHDEjdv3ZDLPUUM+4u43o9ObV5QyrnYHJqOG7cPxnIuHflCUbE\r\nkfyZaaaW8O0C5J910V3wMTG+/XmJ9jPasdzpr06r7O3ahpuW/0zHzgzBi6uZ\r\n/zfzezd9y/+OJKjbrApqJ3mciyJtD/8AXrhSFIavyfw1KyYgmF7YorRF6VkA\r\nD0XGZReEnWXDD1LrCLL5J2k65Co6MNn8pgo=\r\n=i4q/\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230102155809-e53e940.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/b32705afd4eb7e8ef2b16aaf38bcaf0d/graphql-hive-client-0.22.0-alpha-20230102155809-e53e940.tgz","_integrity":"sha512-7tHxQQX9Ru5lUPoeDexdMLN8Frh5bdKcmeCVOxyZJhSBbRAAyv8N3BjUrad+LKUiJVKHko4MaHH0j4h5LNVh1A==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^9.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230102155809-e53e940_1672675137352_0.12090014687133133","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230102160207-ba651ec":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230102160207-ba651ec","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230102160207-ba651ec","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"b643b0cee51589882313efb4b415e0756b0e3b13","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230102160207-ba651ec.tgz","fileCount":60,"integrity":"sha512-gKYD8PoHv5KmZhCikm1wX2uDfvo6hpb5lxnIBAMZVvDTrEqq1nLEoWZ6P9IfIOSCIksMsVVRwA3VoOrQDB/0LA==","signatures":[{"sig":"MEUCIQCitXx2EEN7JTMwegmxOHwZQRamhtj4H+zoxpNaben/OgIgDWqpR0/9ot4aOfDlA5aXBQsQ4e64hONHF8fovtGz+bE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjswAhACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmqf8w//YMkPAuxXGiyXozx0QlTmTjg20VrDW9H0dXvVJaf1Ho+vj7Zm\r\n1qbQWfT0Og2Z4sorIJykfiyTwjy333nad7hHeAFjrly5mRYoHKD9hfCjchmC\r\nBD6hHdQ1UnEX7GPEBMoAaHkI3iSyiPSLy5Y3fZl+bm7aPer3i8F+dUIM499C\r\nDcRw1lafLPWsZfyLIY69lbLKNT0DhhesJ3nx77oKfALsyCbpgb1njkfx8Co6\r\nbq9XSz1Jqdll2flcgXNqlMvXyIXC9/Z/foUBxT1NZV2QYy3reijcJKi1I9B+\r\nhKgKw7kLgfU1iIaqJe++Ol8df207GJyRxVT2FWrBBv0M8Gnvhjl6Nwv7mIon\r\nZlaJPdbzr/cZpyHibs/yotrB++4FGhrXsq7ugRjuNYFh4r0bTrNXNOlh3Pl/\r\ncu64NyiZ/leihGoOaXiIVLMtAqlihtnJ1sKm7harW7SOFvwdNw/JGFS9YH3r\r\nNEMt3aFEsPa0yFPevlT6boMFLPhWAGxlUWmN7RmO4vMS2PdQ5LQ3uNv87Kby\r\nzp/TShXdtTvduc0qi89P0ynKZYHdGFldk+A3QpFKWK2oBmNGgNULS/2/8t5H\r\nI1Whdl+xpqR4wXjR7j6v9kfjvuCTS2NvN8mZNgFZyQ/vqY1QfQJSeLGHuxPT\r\nX3TF4StTGLCnzpTaVTslhk+0QLN6q4UfiM4=\r\n=o5tj\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230102160207-ba651ec.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/2180500d3ad4963bb947d4829751cd0c/graphql-hive-client-0.22.0-alpha-20230102160207-ba651ec.tgz","_integrity":"sha512-gKYD8PoHv5KmZhCikm1wX2uDfvo6hpb5lxnIBAMZVvDTrEqq1nLEoWZ6P9IfIOSCIksMsVVRwA3VoOrQDB/0LA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230102160207-ba651ec_1672675361537_0.9486522032040574","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230102160824-12562f9":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230102160824-12562f9","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230102160824-12562f9","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"3c5970684a0a3b4662c8274273a2ca03fe503ea9","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230102160824-12562f9.tgz","fileCount":60,"integrity":"sha512-a8AZufXSvR8BgCWhvI/e+AVOkhTQ1pFE+sA/eMl7Bp2SzmLwEy5z5MtEnh6of/INLTGhoF6sANdHCLny27cLMA==","signatures":[{"sig":"MEYCIQC7KddxBsew3ODHK2Vs9utWWlDMSwrqDrAlwoXToHPciwIhAJnhCLwFPXkmyZrg6G0QwkMuuEEJzecWkxKvM7a5j4xn","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjswGrACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmrpcg//UcfiUb2g5Mvf/W6toRsuDlTdRuGJgb3G0PyiSTyGnbfgDRtw\r\npVdE1utaMSuLxVRBrcwlUcA+8kBHbWwyNxQuq849ge6Xhf2WYMPaP2VX3NJq\r\nNZEctp9Rq6Uw1LS841VtgSqylzd4/jgAkmvdWyT+H05MhsWj1WCIoy/p4f3u\r\nuKTps0m5Fe6rGvuDlNNqIuUJE9fGba14Chy9YnU9xhqanqEviLat7uXqbYp5\r\nUVh3PkvpkIoSJdAl+kGEWtq6G9F6Jm1PV2lJrjFEbKJmlck9OAh4o4mLvanT\r\n9+i82O8dQeGw3thT5dCq/gDPBi1QFycn8KJLYnCvVIVTjtWYrvEtzzvrJYwB\r\nQmM9tO7AmNUy+9gqxZBx89PsIniFcWArIVs1VywnVhaAgtiAkn57hCLFzZdH\r\n8veVfwJRIJmChzMkj/SuieG315poaoh5bPjR1nks8JmjPBSmloLKx+jgrjUp\r\nN4xnqhjZqcMaOO+iATSL31+vRSBxlA7NsvVTjh4/Ml+lc8CBLj6DoyTjjHek\r\nqsrmNBt/cj9CZ+q9+RW8GDFRDFr7nXh3PVFWy0CZXwSSjc8t+UWYIw5UnuPX\r\njis4iZmXdljx1jbuMYUF18tn/YCPmvq9E+c3iLRRkW5N6UIKTT1KliTzoHnr\r\nRO8MX/ipIFbbDk20qQOCLLHsNPMc5Kkk8dc=\r\n=v5uW\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230102160824-12562f9.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/accb272fe8946b311216c29b423f58dd/graphql-hive-client-0.22.0-alpha-20230102160824-12562f9.tgz","_integrity":"sha512-a8AZufXSvR8BgCWhvI/e+AVOkhTQ1pFE+sA/eMl7Bp2SzmLwEy5z5MtEnh6of/INLTGhoF6sANdHCLny27cLMA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230102160824-12562f9_1672675755779_0.01697090325111117","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230102161221-ab7c20b":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230102161221-ab7c20b","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230102161221-ab7c20b","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"be659ec71d34587cc245f3f632204dfc642bb49a","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230102161221-ab7c20b.tgz","fileCount":60,"integrity":"sha512-xbCpIhK3Hi2Q/WxSPcIBUtQVzDV2ydiS8h6WeZ/bo+6yGUajNX2MBlkHGWgwTJcgXYxwJRDTF99YIpxYamYjJw==","signatures":[{"sig":"MEUCID5GzJ+jFxBK93BAyQfPszBm7hjUKcBAB4WnOAv3EX2RAiEA7ERipwBZ801CHUw1SmZJtm36F9gOORQFeneImeu0Dgs=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjswKQACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrpCg//W0bBIpK+cT7uIQACQEtd97QAiUuLL0gp815bafy1vwbk2GiO\r\nhainOvZhM+xbJOuW1dv9oAQpd0nwab1bq0MyvRiWFAMkExvhrL2GPNEXwmzV\r\nH0NM94q73wxVNJGVAMddZI/Bx3daqDXKKRgwLf+YKkMbd7PR/stevHfC2uHo\r\n9YOt2KuRFLSVix1Iu7EZxJtxtUble9h+WnFlNdjQaGqg3CUc5yDGZUNRayMQ\r\niwOLWWmp0uqmgc+rR7q7lhB0KPlU41xuZcBHNmJ2n9945sp8FYBE07Wz8iOU\r\nY6lHFCM9A/44FyWGuU5OuhL0QnCfPvHBewhAwlSM20ul3MQb13OlL8K9aYSc\r\nQfZKSi2JUm8ot8Dt05J0CNIAhH2AV5X1B0WfK7PsX4vmSv5cKnXsLi8CiWxf\r\nCO9vFtYz7A0RWurJL2eWfcDzbRSDZRBYG3MBmACJ890NwhmehsWbLThOHmwl\r\niMXGURR5fDw77TEsYdOIZp+FkBsUkL2D2CAaGPPspkntmOgQEdLbJnG8Wytt\r\nCAAUKI8SFTwx/aVRVME0CCGRhVgLdl4VN3W8lDhPymdinTNaeslKGQfVuTbD\r\niEvwa2kKdEWvSQ2ewj3hnUwxPea52UtJwS1Qd2J6bBH2NkFECtpiQ2JmuQzQ\r\nK2j+DvbZlX7w1Xs7DKG8NT5zLOuxG8abyMY=\r\n=hv48\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230102161221-ab7c20b.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/ee3ac40755db7a14a4b1be717d1a6fb5/graphql-hive-client-0.22.0-alpha-20230102161221-ab7c20b.tgz","_integrity":"sha512-xbCpIhK3Hi2Q/WxSPcIBUtQVzDV2ydiS8h6WeZ/bo+6yGUajNX2MBlkHGWgwTJcgXYxwJRDTF99YIpxYamYjJw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230102161221-ab7c20b_1672675984436_0.9231344473820959","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230102161610-09ea4a8":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230102161610-09ea4a8","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230102161610-09ea4a8","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"c6ea803146e0007aded1dbba8b9800a87d0439b0","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230102161610-09ea4a8.tgz","fileCount":60,"integrity":"sha512-sCodOUTfqYKJjs9IGmkQD3AmfznXJZv2YaOUEyc9iR6OuDTGRyaiNGSyYYwyj/IXn7fKdLrQz4RLhZbe6DU2+Q==","signatures":[{"sig":"MEQCIE4JhiNbG6VwlVZ8a46xzzSppvnx3ApXnDPkvuBfEP6vAiAsNj2YQVXM8rQMZKoXZCwuQTshbCFuuXJ8vpothSGbmQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjswN3ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmog1w//ZVPO3tkUXNa2JPmS2qOvvvGiHFnhHX+BGTfa4veOdcs/oBDf\r\ne/RpipZNjYkVMrdQFcjeCLozNQueJGDFZQpTOMpB5j5TF7yXRrgKdZ3Lcd4b\r\n4UfSgQZ87w0ATIPBPyJYrJAivHFBV4fsaNqBoiUzNiEIKO3ZyVu7ZP4xqIyr\r\nS6DKZDy8ZXmQhDesjQMcibsRGltQX2//HbR3oGjnnzT4vanvIj/0RuOy1o2s\r\n0BXxY5jQwEOdK9O33vhwz+vP5dM40YPV9+3v+JoNY+pFt6lqN6RdJP0P87lr\r\nZxuQCPynX/9nUSv4DQ4m+oXMF4dcIpHzO8OatiSGiDBtUMGqJtm/cIVQ9LTG\r\nwEa7F/X+AsLOojpfX9zyXrUE7AzviYegeorilCXwxCpLOqdEvNEHuEuQImBP\r\nopzTvTW7I8wAiVCfr5wn01Dfy17aB+tSDAbto5V6/qB1NhxvIZCd5+xWESGa\r\n43XfAqv5gSJ+dgnh5P6JpWpuqa6ZMCQIf75yrJnTdvrR2+YNDLM5qk9RP0uO\r\naMFzjC07tWw10qyJrrmduVZfnbwQRUFsfJpSZlwLzGLBH310d77PdnOA+zcB\r\nUiO7RpMSakINBGNvXHxhtVmCd8jmdQWD7iKzjqQP33Xc+alzXQdnNo5GqlXD\r\nnq2Qc7cxMIcoWJ/4jTlHOa6b3eG5hyss3Zk=\r\n=844w\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230102161610-09ea4a8.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/0b92c65f69e57533f391cd7b93ce2674/graphql-hive-client-0.22.0-alpha-20230102161610-09ea4a8.tgz","_integrity":"sha512-sCodOUTfqYKJjs9IGmkQD3AmfznXJZv2YaOUEyc9iR6OuDTGRyaiNGSyYYwyj/IXn7fKdLrQz4RLhZbe6DU2+Q==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230102161610-09ea4a8_1672676215257_0.6681806422265208","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230102161713-d715617":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230102161713-d715617","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230102161713-d715617","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"6784fe5a7b41de45c7f94b1927e089a4c776ab81","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230102161713-d715617.tgz","fileCount":60,"integrity":"sha512-F4lBDu3dsq4pFJfnbiADzsh7aWog7tZ71BANMsW3NLS1wHrYdP42fxxQ1voR/F20AJkA6xAVuIECveCK2z1gRA==","signatures":[{"sig":"MEUCIQDB65wJE+vkLrn9k3CakrpQlztbTqucpGaZqLhcu+xn4AIgWrIbOrwWmOCnzgLjdoLQtzsTdA9a2SJhnBXAx1qeKzc=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjswOuACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqlWRAAhMjp8xfl7Oj5tDcyX9SVdoUXuDKW90JIzLoGTpbqkOSubV6i\r\nmJaC5XE2n6s+lH+bQ1Lq05JUFSBk4dGpOzsVFrzuxazhpHEp2Hxkw2ifSOk+\r\nekNIU0ucBlyuT10h3tbC1mr+L8AJiYoZyn89VyXRjAlMlVNe9c3lhO/tDILj\r\nbH3pDsTeYF5cnVKtjQH6hHLNeY8Z28IWSZI6dvGw2b0RWmZ6N76gMNLcD6f2\r\nuwP3BG7Zeh+s0KgBitNhihuCD/KwTwH8hVTb+/6Z9be6yhjpFjco7iFNbNdh\r\nt9oDe7jEnSCiaMQlF2Xb9WTJ0t6eCVv6+TMy+bNzzopyYmjeTOD5INXDAj8G\r\nOn6yVeT5qUty37QJg0hN7mrIghU6cPgAeTBO7R8AX5qqHoOXTI64YQFyhG7e\r\ntVaFaI80vwUlr0RJ6i+qfI9u/kDvEnZjJeu6clMw7Hy3KjpRocNzHr5ntIfL\r\n8EL/aYMcaSNql7i2R9g6EWn2TCo0PQMy4+46bz0vHIiUpTWfWp+nvZFQdi7V\r\nwCAUwHehLdFbloASrsZpWBMJH9gkhykvcii37cuyTyeoSrMeuGHSN77ylUkc\r\nMySFSuQBE/Ghlq7vHuIcX/8U1VvWujaQduKBrdYm+2J18tKO1guoYrYXdyhg\r\nYHKJTKBxF+GgRfWdAxRaSgX1mXHjqSsfQdc=\r\n=h3aU\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230102161713-d715617.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/be81e0c6879d1c4098a8314e4529074b/graphql-hive-client-0.22.0-alpha-20230102161713-d715617.tgz","_integrity":"sha512-F4lBDu3dsq4pFJfnbiADzsh7aWog7tZ71BANMsW3NLS1wHrYdP42fxxQ1voR/F20AJkA6xAVuIECveCK2z1gRA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230102161713-d715617_1672676269791_0.9393290427603467","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230102162205-4ffd53a":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230102162205-4ffd53a","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230102162205-4ffd53a","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"c57a954e6680673b6b2abc0a3fe53c644688b47f","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230102162205-4ffd53a.tgz","fileCount":60,"integrity":"sha512-rAdQ5iVP0Vp8GgyCQHQF96dNtSwzuBK2hBmEauASBHV8qMqtXBD2msatj2W759XGch6E66BjOADxeI0vMJj/2A==","signatures":[{"sig":"MEUCIAed0YDnd+KnMIFEYnu6zSJAHAArlKFunvz6N4pfZm1CAiEA/SjZVoqeJLkwnGG0rSBV2PsHBlcPz4XfaYlwo7z4H0I=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjswTVACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpqChAAiWgdScQS9UmeH2fHHS5nv2lCxuwVTGHvhRTBbAFqxitYy9iA\r\niUcpsQ9qsRQFbwJpQafPRiIcTdXi5RDWVjnqF9X5howZAjUU9f/f4VHqmfOF\r\nS+GfzZQ32M5qAuJpYjTjkmyekn/2tlg6YYCfXUaNgDlAkM82E2840m5s8Fo4\r\n0jluPoy6O0by6QvxNPzBvotpKhqIWiTB74JcfAO1tS3Wo6im0HNkhK/14PwU\r\nORZO+UufKU96/5nGwf5ZN/kih3evsREBgSlGrCycOTkg1LFk4eriohiF4VKW\r\nFXVv9OO9Qgpp7GHYQBkck45BF3zfdxKblqEosbF3iJ7qfb+0RGPOc/nChXIs\r\nhffERwwcURV1veTNtIfz0/bPEKIH7zGZzLOpEzTAExWmh6JwzLw4bqb3qii/\r\nVbfzJ+CS3DLoAqyGw0fo9yAnHIv6JA5fR8JtOTN64Nh5cwni9WLt1PFluKdm\r\n8tTG6FW8pc3vkMx9OkwTlSAnB/pdeqqVpZazNrkN7S34KsQ65uicTFwVUWXF\r\nTrI//61+iLaGwjCwHCklcd+GPq66e/LZJNS469V5U9vzZU1Lm/rpQJ4zVL80\r\nJmZdEz8HMrnKca+U3evqklkLFkmQ0s3TNV/LZwWBXafm5964d7+eaPfzf1CX\r\nz0nScDyWZfgDvOyLN0Qo6MJ0t84wSNCyrNM=\r\n=w03i\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230102162205-4ffd53a.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/25644ce69cd7e51895bec748c51a7e8c/graphql-hive-client-0.22.0-alpha-20230102162205-4ffd53a.tgz","_integrity":"sha512-rAdQ5iVP0Vp8GgyCQHQF96dNtSwzuBK2hBmEauASBHV8qMqtXBD2msatj2W759XGch6E66BjOADxeI0vMJj/2A==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230102162205-4ffd53a_1672676565137_0.8427529921913539","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230102162616-404b23b":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230102162616-404b23b","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230102162616-404b23b","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"1a964cf61abf94b2135a42e15974ac8cef56feb5","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230102162616-404b23b.tgz","fileCount":60,"integrity":"sha512-RLVrozTmWadeFPB9Ey1isZIUqw8dEmrLUW45MTSpx4qux1nPKugv97yjb/mdF6ujLsE9mYBWXb5NcsJQtDfe3g==","signatures":[{"sig":"MEYCIQCrW3Es0ucgA3K7d3zC5hNS0SYVT4kFCD9ZIWM87AbHPwIhAMapqrxDpiG9YJq/wR1dzg/fYANqMIi/ukiNvQINRkBb","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjswXLACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpMqhAAl3dmsXwjAH7XVWgaq21jlLUCYs4ZTQcpZf0a9GVjrmc6btsa\r\nTuee/o3wE37MBcy0mFkUayZs1NNxkX574YTWNWPHeYsBPF0/cXYiMTxtvVy7\r\ndTVxbL4DDZOWZ8vaMrBdQFRD5U74758zzVSxf0Bz5qjsdzpQJc3nscdZElXP\r\nUVaxgMxNqJ9uJ0rcjUmoY07uAC+YfMLryCWox1zvFFPxHxW83xE6tGWJhwqA\r\n6cBDCp01J4GfNUrxfNDyFrU15kHuosFvYpjHnyG95ALmW6wnzyHoe9Pk12TY\r\ncPFv4xbUolP8MAOuD2oKvG+iv5iFi2+vzNpK3eHOLIyZ2l4cEHdHiSgpWnRb\r\nBqOjaR1Ak/Jjckt7g9CGUV2uyQq4JWi3JvDFNrpPNkUvNmCZHCFa6nbX4Iiq\r\n/Xg1HbW+wAkXq1wwFu3TXLcgYT/f3uB89vAWRQReV2qhEs/UfEflZOFDQ+Uk\r\nnqEB4lhsxluTO0Q4415SIAcwpnch8ZtmKuEtdCOjf57pndWyfpH+bGtEkmhV\r\niAgZ6ufFjEzu92y0Wmp3UpVKAaGEUmGeLg6B/RxbfbWch6aYHNW0WC2yG4Uc\r\nGdphNx9QkllQd3ZyHc7cfRlg5ZV1De+f16x7Z7MyKKYGRfHGjxcBE8fy4NFA\r\nog/EuV/E3kvWE/slgfMUOImQV+csefOLq9g=\r\n=5iks\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230102162616-404b23b.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/f06a471e4c58a8dbac4605158fbd6abe/graphql-hive-client-0.22.0-alpha-20230102162616-404b23b.tgz","_integrity":"sha512-RLVrozTmWadeFPB9Ey1isZIUqw8dEmrLUW45MTSpx4qux1nPKugv97yjb/mdF6ujLsE9mYBWXb5NcsJQtDfe3g==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230102162616-404b23b_1672676811572_0.2229287717532693","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230102163106-e6e9a8d":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230102163106-e6e9a8d","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230102163106-e6e9a8d","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"ce5864f3d6f1b4c8954269488c0e88fc99fdd97a","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230102163106-e6e9a8d.tgz","fileCount":60,"integrity":"sha512-KJl/sIlus+ovc0SGEYChs+01iv0Ffz2KaQbsoI8urx204F4cPxigEyPgChbTc5ZB8uCVD/X0ChZXwtkdIyMhsg==","signatures":[{"sig":"MEYCIQD0ibhiwilAYnD/zO53ZE5vjfsrpS4Hd88qA3ikYvB6hwIhAPXZH/NNtwdPcT/zfn07An8wFK0DKAeLN1qACJ00ICPx","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjswbtACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrE3A//fuZsbNXkpgLqV3U4IE7fFXO5rvNZmrOBxbzjfMxE1+z21T7B\r\n9T8/ZdI2oRlTJpINRAuw2+uvc3umX2yDZg2ECjZImIKebxGS7I3llDswBt+i\r\nYC4Tj5qajo6oQDzuvgbHiUREiNu98drI0iTAsKT93bw6vbMWwjHxwzZeaEdz\r\n6mkBcCBTS+XPYn86zX4mG0queL6b7SB7h0t93eQhvPznzIXtS3KBMq7w3nCe\r\nrY0VhwyIMhRUVuPEdvLsrcmm2GDDUSA8vr0cK13oPa877YMgbJemIRiyvTEm\r\np3cxJChNIjyEhhe2u3g+JQEZDqQAAZb8KBTJ0Z/9QLL8wQyzIftvfP40EPG0\r\n/UYBSU+YzABpqWVDA9NqcuYq5icpnbOUl8Hfpw83O0VNf7M3tm1Wpg97EAt7\r\nYwF9EVDNLxqDcU+q8moRvbAAzPbAUgvoV8kJ0gmwafToLYp3ZK4m/YSPn2gh\r\nrSIFOMV0mYjIFKs1kwjoQnx7fMvVfFB4KMz47LXKdSFfg5PTrGrtT0+D7zLl\r\n017XdtmifTPLM//tWQ6PSduVNS7lBaY4HJwG8hkypfBbGzt7RvNlIqUE+l/N\r\neJniV+wM+rJ7fY5UayFTIJxuBa4pO5vypdiS6Lbk22q/gaIq+I2rdX5gxmcQ\r\nP47cMBHwZqNWojLoNeKw0g7y/xKjRGr9wzs=\r\n=ZP5O\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230102163106-e6e9a8d.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/06dbbfcbc0e5009c369b1b1c90d40652/graphql-hive-client-0.22.0-alpha-20230102163106-e6e9a8d.tgz","_integrity":"sha512-KJl/sIlus+ovc0SGEYChs+01iv0Ffz2KaQbsoI8urx204F4cPxigEyPgChbTc5ZB8uCVD/X0ChZXwtkdIyMhsg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230102163106-e6e9a8d_1672677100927_0.4253527152844756","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230102163117-361d054":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230102163117-361d054","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230102163117-361d054","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"04f70b1abce7c8bd7f688d5ace9be923894cc876","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230102163117-361d054.tgz","fileCount":60,"integrity":"sha512-yzO2SfRKtBVCgvSYEXJH+OpRCldsUsuNvigHdNfxnWumEZFJUAaocjg8e513BbHEVevrYXnKsbHKdWREDp7Law==","signatures":[{"sig":"MEUCIQCqMBnXzxeWFwh2BUrRYKhDbr7EGI6mfDlDdXY1zD2AcgIgOlwmYU+BGLkBG42Fg3DnLRmq7kBCFGPdHkWMul7omC8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjswb5ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp/+Q/9GUWh2FoQo5xAnLvRQL4cADkX7MzdFbjRUF3WXACefkwkfPoC\r\nQkaI4lIT5PIcCs2uYCp9nwfAYw2CfwONffu0Dvx1Qkc5PRc3xMvnD2Uavnmw\r\nV01xWM02e4ZLG0Xm5Wgs+oN5B1DVdqy9yoImlWzKwX1qufkjB/BuYoEDF0eZ\r\n1fj5DeCsaXGRCFAtiWd/5Exkf68ynPzoduNny/GPwu/5Fg8BhMeG2ttg6iym\r\nFBtH/AKsarWDSYQ3hmRxcUHMrJpeVs2hVwRBE752fcBQHh0RkeJBNIJW0VKm\r\nZbruAFVY1et6TWGb5BnkO7DY6PNncm5ziKTeBV+I47nmQ1cT06iN9+qV4RMj\r\nuiM7tp508wVd1F5N7rtwqUjJvfr6pZBXOpwE5FESr5vvaXwFQ3oa89TZJbol\r\nuDqTzr2S8Iub5rqWKGQ7/ZyQCzq8SdDczhIa/Vff/Ic+wC6mwnRalSwLiX5d\r\nXcXDL3aHwS/ZNFkbfdtWkw8AUi2hKTIFjlE3VI/MGUPTveg18m61cyKrgano\r\nsxWE8XqjyQ6aAGZWhOQ4IISy+MkhCU8pH1hJFl9FdGAjSRQj84cbYhHpp6uX\r\n4MVDc1QN7a2CYAY5cYT9Q4T9FlpyNUDd5bAwotNGUZrIIhVN6XmRiW4bRNYr\r\nHcbLmxzGI9IKuXFdQxncv8/ne5e1VI/eY0w=\r\n=06Dc\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230102163117-361d054.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/b040a788521a98d0bfe7ca8843dc26b6/graphql-hive-client-0.22.0-alpha-20230102163117-361d054.tgz","_integrity":"sha512-yzO2SfRKtBVCgvSYEXJH+OpRCldsUsuNvigHdNfxnWumEZFJUAaocjg8e513BbHEVevrYXnKsbHKdWREDp7Law==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230102163117-361d054_1672677113135_0.2174571573191968","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230102163636-45ee8eb":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230102163636-45ee8eb","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230102163636-45ee8eb","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"488980ce1931587f9e51e0f6f058a6e457c5d70b","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230102163636-45ee8eb.tgz","fileCount":60,"integrity":"sha512-NPs+WNkPuIVohtCB++5vPGw/WkWW3zBFiNl/YEUhIWBnvXkCj0iummzyKSSh/jQ3P4PbwNecM0ibZvI6jmVeng==","signatures":[{"sig":"MEUCIHRIkHdrLgim6nQkmY/9J1d8PjWLqGt7I367E69MeBmuAiEA185i+o+uIja8MFpcoKQ6P0AU15zndlWD2R+oiM+mldY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjswhAACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrWzQ//acg+89nbe2N9BJKlL+7HpQZmpWGgJEXAtdHFHcDF4R4+n6af\r\nmadx8s6NZGevtbbXwVx1tbPM16Qx9Xq2M5xoaaNqH9aoBPzcucQfjuvjcZ50\r\nk+0JFiurajwfNGlQjPT0uyOBEvDv4MDeBF68dVEXvGxRTiohjzymZLbgL9yX\r\nXMVq0e26wdxO2A0Jva/tYy0S4MhEjjoBFSyyjilDFuDeU3BjKLMmmwX08jYb\r\n6TmExSHT1DAzFkYpeJol/WESPH16BXfmR3YMBRupgudH6lCmMe/lFwDePK7K\r\nen1agUr0YEvV6dIGXDsQQw40O6kv9eUDp90kkoGW/GWejBbWYimq+qxl6uQE\r\nBinZODvHVWhB74GZqLuFxUJ976xFaSeiRwhslK5MOpcWvQ2BI5QCLpklGB67\r\nWu0M0qkBnhLgBgMUL7baq94nHx4Vi8WtDWunTrxCrJf0DWmrKnDZfA5zIT9m\r\nE60WvO3vb8B/X17eswD0fDguPGjwZk3TtcLJzhtnQ3Z4RkR6hAmvVAyrfg/0\r\nGU6riKlfm0XVoxBJCVEoTpUwCZ2pC4sA1X01eXLxyDihZemXhtIEGchuT/rx\r\nUhtfZsiiT7tnW/bwnHieznMkzw+mwRvCxUI9BzT7hoUcjxgEtMGUJ621Ae08\r\nFyELPQH4YZZWZwxKhkznttCFlyXZal/G8EU=\r\n=gdto\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230102163636-45ee8eb.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/d57437851655e143d36f5cf1d851e32e/graphql-hive-client-0.22.0-alpha-20230102163636-45ee8eb.tgz","_integrity":"sha512-NPs+WNkPuIVohtCB++5vPGw/WkWW3zBFiNl/YEUhIWBnvXkCj0iummzyKSSh/jQ3P4PbwNecM0ibZvI6jmVeng==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230102163636-45ee8eb_1672677440629_0.5117776385663706","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230102164010-1d88d39":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230102164010-1d88d39","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230102164010-1d88d39","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"527c5745a983d225743fb1c57890bafa32de98f9","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230102164010-1d88d39.tgz","fileCount":60,"integrity":"sha512-+q49taO9J6+0MnD2D5cntxooOmhw/5AEe5/vJW6TTOaFomprrXT2iFpIRBGyHda0CdTngOPSz48v8sWlQ3VBSw==","signatures":[{"sig":"MEQCIDq43Q0bzzU+Buh3RqKAo0SnfYc0X1HdJn0TExOvHe1JAiAF+Dyf0Ku8CAm4cX7gkqQekUWUIcvGVl0b/tn3TjfUKQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165581,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjswkTACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo7xg/7BUbDILgFpWWI73eRVntFYCEoBW5dWGSrtbaCAZvWMnQKRct1\r\neGV0kA1wqtkBr2v5Y+7jrlNSJL1kjr0recQAayh9Rvn9jc+Ugux2HDWvpvB8\r\nWiJPE55jBEIRq6G1qZH5Nh9S9Q1z6RxXjVG9vUFEIyVhG6LpZPJuxnaJpqjV\r\n7I1UOeXQD8JWD80WwCBQ1lwudxwd8ln/LqfAEuqmfIwxlyVAPBp3X3mcLPxX\r\nYNbMvWxclST9b/HAkUQfSu87bTrz/AaWLG2e6pnslmhKM9Mn40ANR+E7qlOz\r\n5+D/mkmMKpo/legD/qmyG2PFj3tdXCFE+3WuNxgJFufxQvE3QFuVUDvvwL9t\r\n5a02h5x7P0Lxaxw+tBidZ1onlY/64kgZ/ZS1Kyv/r1daK8swFWaJo8paqGsB\r\nefAYbJDS9+oQAusaZa7N3GY8IgYfmJtYItqgNiiKm8qxgQgKepx64nUg21Co\r\nNHH3IX2MjsbQJi4ZsquxRtIboRZQ24Hre3ZDg+1ME41otG1r1F+rzqSWchJN\r\nteA5fnnXnpdOCJv9tUANFkC0sMRP5D7/VDjpc0sSOhXtPTOBL1aTValdGH7v\r\nQx/6RLi380poE7VLQnM6+nIFaVkE7rs+fozjpkQiDNiGlLWnLCbh4EXdRti6\r\nA7sXUKPTI2HUQ2hzMuqAQL1nCPrumq8Yf9U=\r\n=9mGO\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230102164010-1d88d39.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/aa93d58fcacf7cf1cc1707e0c3d5a2dd/graphql-hive-client-0.22.0-alpha-20230102164010-1d88d39.tgz","_integrity":"sha512-+q49taO9J6+0MnD2D5cntxooOmhw/5AEe5/vJW6TTOaFomprrXT2iFpIRBGyHda0CdTngOPSz48v8sWlQ3VBSw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^9.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230102164010-1d88d39_1672677650901_0.06618261423426675","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230102164524-00bc528":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230102164524-00bc528","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230102164524-00bc528","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"9a40a26058c971fa3882f4d9d25074f54095053e","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230102164524-00bc528.tgz","fileCount":60,"integrity":"sha512-tXG9H+NgUNuBWqx19/deTmjlsKIdfULi4iwE5GtoCCjW9jO6nlRR4IyqL48ZVHw+k0NJTQJdHj0+kbbR1q/eGg==","signatures":[{"sig":"MEUCIDP21xURC7hdsaFcnDx3WvQHoPae0v4+rH2rKFGDapIBAiEA6X6fXvZk6OiJHkOr/acpukWd4wE3v+uW8sc/HM22cl8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjswpIACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpUIQ/5AOd4p3evZH57DHZTk9Ph4eYXijEogVP6sOU5k7QMFOzZdrBI\r\nmJvnhjE8CC6mTK6sDDuQiAfhrkOw8KUktCIAobzh7HkNobasDyY+/9dvU0C6\r\neQSrDd2fgJ7RTuHnP3dJDVp5ERPk/7HqixXW5d9YTbns27G+271fzeggiKnT\r\nVrP/pV4sr/FVvvJ9X/0zNzvVg2+Hu0310IT2v5kkyVaGAYl6pxP00YbYCm+E\r\nNTUuXlko119BevOnh/H5+1/Nc57pG5V7IOKfBi/sGjhueY7/by0sWPE5cWT9\r\nuSselzPPZomw/Yq7fo2ZFUPQGMRBTxpnrL5heY8ipDoGKldRbHDFEjiiiutT\r\nM2jAXdswdYoS99BgvS85M74/bada2AB280xKbx3ZC9gDpxRUM1lbnRK8iRyA\r\npwGL9Nukz9NWI2uJT33bd0wx2Fqb0CguJGf+jSc6+cjFIWIY6pLEcQAYW+M+\r\nHXzlqw/9wFCfD+1XkNU3x8ucKpZ3wDutU+CMaHDJZuLeeOo+RxECBvNnIlLO\r\nWJO4BgQuXjWQQ5eDaouGxNX9WLsX7s53L1cW2Yds69nl6Gnq9q6suG9nEEux\r\npSgC1on8OO/sM4QissZwWXq7JVv8Ov5hYFfH1prETWwTtjc5/JV9WyxS/UBi\r\nPzLi0rEEeHQ4+MhGrcbon/NSXt9tHY2QCiQ=\r\n=Q35U\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230102164524-00bc528.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/f70b836d1c6ce6fa237fa89a988eabb0/graphql-hive-client-0.22.0-alpha-20230102164524-00bc528.tgz","_integrity":"sha512-tXG9H+NgUNuBWqx19/deTmjlsKIdfULi4iwE5GtoCCjW9jO6nlRR4IyqL48ZVHw+k0NJTQJdHj0+kbbR1q/eGg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230102164524-00bc528_1672677960049_0.5257463932943474","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230102164857-a90f5ba":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230102164857-a90f5ba","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230102164857-a90f5ba","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"4fef51dfcb9c0820ad27873f5cd4be12ed0b94a4","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230102164857-a90f5ba.tgz","fileCount":60,"integrity":"sha512-7sL8DnmteIcw4TfmEB8Q2F7QxxNsxephkN0Q2LMST1voh9NVjaagEOpuMH4cq/jtuE16Zjw6GtKwrCM4iyfRsA==","signatures":[{"sig":"MEQCIEKGNpBVWdwfRgHbwPc8HKFH5v/U6RLTh8vVUUEHy9xCAiBTsiDWyg994l+0RfWMJThDqdxXfkJXKGKTKtl0np7Quw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjswsdACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpN7Q//VkzbIXaJnKwvHMMmdruMhJ2eodQ5+mdhY4ecVzNK3NWIt1s8\r\nUbaA+qn40Pynd7CG8ZXRXavNIrfOQSUC11KwigfXCKn2HO8FqUvO1HDoOp9p\r\ne0eSc4qWol3Cci2knIWeJeACDJ42UhLWFxyXH74jGL575/phZLpiN59d4h7R\r\n8AXvE29BYsZJnh8cfHJBr/5D0tmsXc6uHbcndnbmoTpvazr5WUlSGIjIyCkx\r\n81I1nqProusWXDAhFHVUPUZ0RrjMoym/UQDkxEf3NWxvCT/3R+OpmGTeddGA\r\nZ5h2VI9yEI7eD0v1m8UepSHUROCB+uQoS0icE5S/IJ6bNa085DkDU+zkyCe0\r\nO9SvvZAV0SI06jfrIBp3zlAdhJ5v4nsP2GVGdpEaMc3LG0ZXtCU98crZuEtf\r\njMH6xjOW3IuqkwJzKZCe5cLDALzKiVDR900nPL0YE/68G/F9jesuNGQID0dG\r\nwgZsc9BqhRNKeSiBfWHAHTYqw0BsPYMApMbcYjwF4iSwZpDR0NuohIMlTGE5\r\n95nMPZOwbuEwsUhN+FDIHX1abSiafFxtDrHDmuQLnPsb8QlRVODxIM9pt+Q9\r\nYz/8IgMplN7RE8L1NpdTcW6Yxmtl0AvBdStybmvJClZaGGABUIcsRPLiZ/FK\r\nZecEwQIwpMvHeBDJix1QsnsHvfmcEWmpLAE=\r\n=EJ62\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230102164857-a90f5ba.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/d510bbdb410bdc15be74d6f3bf35d760/graphql-hive-client-0.22.0-alpha-20230102164857-a90f5ba.tgz","_integrity":"sha512-7sL8DnmteIcw4TfmEB8Q2F7QxxNsxephkN0Q2LMST1voh9NVjaagEOpuMH4cq/jtuE16Zjw6GtKwrCM4iyfRsA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230102164857-a90f5ba_1672678173199_0.3201375424470476","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230102165342-453cfa5":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230102165342-453cfa5","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230102165342-453cfa5","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"aa544af8487ac7e2892f2a0bf8ff0af0c88d5dd3","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230102165342-453cfa5.tgz","fileCount":60,"integrity":"sha512-DE3wHt2qypPIkqnlkLF2Xu+AeHzQOCXSINaTvj3Y/k06GqnsjOGBsKGFObnLzYfmiZ4kPysVXLvVthopF5VHIQ==","signatures":[{"sig":"MEYCIQCh//a/eOn8iREWRlGGOQRh9N7fAW2Ey3iHKIA2yW5CRgIhAMs36Nfvko4eEH/maUf01zEVnCEf9MyemSDPNbrujqLd","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjswxAACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmq7ZhAAhljLSJ4kaHw1w7jw1Q1IndWOq9KOioprq6AYgZuRZ4Fi+WPd\r\n5QZd9aGG66XXQNnFsVALs8a/zBaX8PKkZc5nWI+LbkWjQWamCV5I1+baKtrQ\r\nOF/p96NynoKRv2j8qYE8b9UCLKk2GHQZjtt8E45eED/a6AD5zyphpeQ8hNxr\r\nSzwHcpNcT3wvGcyMjstOtGN9+FlNLdzlBj/3wF7qp+ryjoSBZXgQtWKRy2ib\r\nB9pIJ3JQUOxBYRUXoRUWYX868MkmTfgrhyW0a6sKEXgbWVL/yYPL+HhOX7t0\r\n2USxDU77BscCp84eRzntafihE6Roi+lW+7wIhwMUJ/CMRg6ZiVIXjrXJsrzS\r\n7yhiJdD0eNjnlMKBm2YwG02LkVYGsFFcsdKsxJdaKm5lPvWbVwWWDgYrDmAb\r\n30zTr9jYbLERmXdpIanyJAX3gCBAJhuaUefDumwzkItxjlXpHbpg0n8+Ct6R\r\nSvWmRo2L9Mrvk6y7jzF2ACISuN6T8hP1a8ZMPgltOxRlE6sj+IhAbk1Fr2GJ\r\n16ScVuwb3rrCQ4dY3z107VL341cCI7+hxTxlefhKwp/WG36lYIrXIv5ozPoP\r\nFo7Fj9BClvFlRvpqbz0wHrNyayRnLdF7s2lQny/r3zvT9UayjmU1foLWNgeY\r\nngpDRHdb/BYJLKgtNhTNURX6pfwH3vvfNyQ=\r\n=pqJp\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230102165342-453cfa5.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/f87cab4b316bb379df45b3410f7a9766/graphql-hive-client-0.22.0-alpha-20230102165342-453cfa5.tgz","_integrity":"sha512-DE3wHt2qypPIkqnlkLF2Xu+AeHzQOCXSINaTvj3Y/k06GqnsjOGBsKGFObnLzYfmiZ4kPysVXLvVthopF5VHIQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230102165342-453cfa5_1672678464496_0.5352579544548419","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230102165855-2782fd2":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230102165855-2782fd2","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230102165855-2782fd2","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"174d345147fbfc0461f040c37c81b339e92448af","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230102165855-2782fd2.tgz","fileCount":60,"integrity":"sha512-5F8DXGsqYKgkUHC61b4KX2UdU/J9omd1gfuraMptLD2YiXEVODuQBdGbcJUtq3P/W1SuUXvXE35RhYrKgnVBDQ==","signatures":[{"sig":"MEUCIQC7zQ1yk2x4XIHNMlkCbSa58AlWLwnCesDnP/gPffhrJAIgOQQVnCjYaNZgS36iLLiRClySYotwqdkGUF/md1Dsy3I=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjsw1wACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqMQg//Y+mUfCzWd4tYlf9dyhjmKJWv85LftZklZVqHvmzjnJ0wUJPr\r\nrrIl+qqU3MYnLZXg9lDDrm0Oa+3hZoAtkgu5PaZLK9PD0rRWuT95PgYaK0Rh\r\nBppZ+bAhMF2KiqJTYvSVKyEfaKrkAYuvaFwaOJGF9HvFzBPD2KfdDba5LAgG\r\nqzDlVFmW8sZyq88atI5GFFFxYmVZcGjeLse4qhCILxglmdqnMn2lM+o5Nxxz\r\nrg1FiGRVkpUw8ZemmbZlOh+hkKWguZxv70CACQKSxfMK3Nru1fl775Wr673E\r\n1uHQ/Z93kdcLAsOHoX3jZgq5ArNWKn0IBaBLKSS7uTKTGtuOvjLkqke8TVNN\r\ns3hxxv0qKSA+AN3TLK+Hwagr4kYsGmWmxQNReI7O6Qf1asTd3uRY40Drai4R\r\nIBO2OQOENUMehZd/bdrRbvpIuTcgaVjoSWnzbloo+2rGJ9cOq9jckGXpsW7T\r\neucxHaa++Nb8gydhdmZrp7yDny6fSMntfNd1kfMB/2UG2Y6HRVAlxLrz+/6w\r\n1wHO8BkDGJRuuUafzkeb2qYCyDDbqstjQcG2cGNATPgtN3SvFn5mRJe4t46F\r\nJ2ItiYD0gFU2HP1BgHR8zHIZure//0qRaZ2wqqQCjtoOKVrtUhzCPpd91ZC4\r\ntGbp85bnajP9cwS9+whtWPcUFARsB2xkcYA=\r\n=YcMJ\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230102165855-2782fd2.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/438e658b76e2bc04856f99deeff34218/graphql-hive-client-0.22.0-alpha-20230102165855-2782fd2.tgz","_integrity":"sha512-5F8DXGsqYKgkUHC61b4KX2UdU/J9omd1gfuraMptLD2YiXEVODuQBdGbcJUtq3P/W1SuUXvXE35RhYrKgnVBDQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230102165855-2782fd2_1672678768397_0.9658325466678372","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230102165920-0a1a693":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230102165920-0a1a693","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230102165920-0a1a693","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"bde1a84f37486a417c484dabf1e713d61493bf52","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230102165920-0a1a693.tgz","fileCount":60,"integrity":"sha512-wW0d7lYrCJMComWRRrkx/5qGFGEw8d495Eq+AmRnbq18xfglukTBJUH4YMwawGV0icz8CyvcvUIFkVsi5kc6Xw==","signatures":[{"sig":"MEYCIQDE70QEFcXzq6Qh+VKxgfPuz3bTvCR3XCKWEWP00vbCMwIhAOOMOG+FZmbh3NqInG0Lt880ld0rGRjpm2VgUKn6tGuO","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjsw2KACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqrHhAAhu9KG64GatQuIykNOZfq8yxVDNxX2wj+qoqaEjwYVFxqCLLr\r\nN58OnbdPLdQYIsT0B+/ijWeCjDrKNkf4dMZBeVwwN+FKLvN592XmAgqiP3ff\r\nJabDvKBzeqsk84lI3Es/qf0O6n9448x56abc0C3tHpriCzOi+6CS7xUxW1uK\r\n9UzOxUANznw6QNtTzBHe9mcSBj+iE+4od05vQfykkKUVRWZYmxwJMzOPQ8Fj\r\nY0cXdKkFRWgCwlq/gDNtrY01J2Ypy4cwCIEGtFIgLQrhfq3vrb1xhBdyZIHB\r\n3V3sFVE4TxijMgCATMs4Al+EDi5wB2Vj4lp2B6Xqvshph8EVkle5zrovPVxR\r\nd+uouHHLSPQpmeBl3CXtnZyk8gw5bURQNcqaFTGDfzpj7oYLyLR+y6+0cVOn\r\ntIYBYxsCFr85qzdyjA/SI6wQIysitcW353xGEv5kdYnzxS46zatmRqpk2A01\r\nh06CtnY4AOzrt9ZVFu/NjJr7pdJg9KORphuJ43DlZ8LYrItCxSfQJjPJM3ji\r\nCXKpES4o8SKS+7CQyegyFGmlmQWDczx5qD+BrV42SevWb01DEauWf7CLfbUF\r\nF7EZ3HA85tCFk6v6AKFmhDLJ7l42SZIU1ug8EncW0fvsThFGmCJJz7jiC2jM\r\nEw+HRm5qbxBlLq8Ul6o0EHoKAIA29INzv6A=\r\n=72J7\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230102165920-0a1a693.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/8650383ac25d69d94b21c9c84b84c015/graphql-hive-client-0.22.0-alpha-20230102165920-0a1a693.tgz","_integrity":"sha512-wW0d7lYrCJMComWRRrkx/5qGFGEw8d495Eq+AmRnbq18xfglukTBJUH4YMwawGV0icz8CyvcvUIFkVsi5kc6Xw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230102165920-0a1a693_1672678794741_0.5014096060304531","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230102185233-1cc3be5":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230102185233-1cc3be5","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230102185233-1cc3be5","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"c5ef48ce7c4325712c2a0055a7a228af2205f36a","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230102185233-1cc3be5.tgz","fileCount":60,"integrity":"sha512-pqmBrJ8vbMh0Nskw07eP80KzW1qQ474vKF19uY5+bc8589p/f7EMT5Zyh96PARikJuTbQXa5BrmxBaoj2TjR3A==","signatures":[{"sig":"MEYCIQDaL7Kw/8RbBL9j5EHCXxv3Af6v7HTKlUSHEHYx0BO78wIhAOuYow1ujT6f6V7H5R8m03fyj1TMPUu4geongt0pyzrv","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjsygZACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmodBA/+Js9VzGxB6AvauxHRH0vH2J9b8twSqgTdqmF9zupYP/psEEDX\r\nssrdHgwxj20w0KvM8bsWgSNWlaZsSqHEjT76fUREM5stc6DPD/nNgcihN1fM\r\nMG5UHNc/72qALh8TUJ6vOU2gcCOzSCmrvSjmxH8IcVs0T3YmhgukmJSBZ8R/\r\n9g28vnR7LesKgN1yXKsC1d2RMO2s9wSSQgxPGRh9e/1Xtq0fxzj2cGauH5ls\r\n7m7yBoCmixUKAApy6ppxG9QAuTKBcBQ4rAM7wmkNFCPqemjt3DOKt24hBRbR\r\nU+YNL5n9O9NzzNu4PP9h9XH0qPhX1B7GIUcZ45OHMtJ4fPkCenJBh+sg/vor\r\n4d7bwHWsTTsmitAgWuyBpudF7s1xlwdrDeNKwOpYO/e1BPCz8ZgsrKOtSI9d\r\nBuSX5GyFRFlsYC/R1PpWjsEH9F+925VKoV3Ty/I2SYGxjDxnjqs1ih6HEYWI\r\nC0XsjR9LPm5aAhX2G1xYvuhuRWjELAzIiO/YST3wXP8HwDd8MSa0Cky3gCpK\r\nooCOeMVRMqBIkwuzRyP04+IX7UqbQoPWw7eRJenQK9UZJ6PDylKDUOWuGbmT\r\nzBq0+621+6/n2lCN4AyWvTFDAcGmIooADZsl220wjF1F+SKWbkR4VgbIn/P1\r\n9ZgVrdQm7XjcTtWCs3djl/yFwlfvdJ1gtUw=\r\n=s1qy\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230102185233-1cc3be5.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/c6bf544a1087e02568418ce19e65ee07/graphql-hive-client-0.22.0-alpha-20230102185233-1cc3be5.tgz","_integrity":"sha512-pqmBrJ8vbMh0Nskw07eP80KzW1qQ474vKF19uY5+bc8589p/f7EMT5Zyh96PARikJuTbQXa5BrmxBaoj2TjR3A==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230102185233-1cc3be5_1672685593746_0.40230943129968666","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230102185418-2f714ed":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230102185418-2f714ed","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230102185418-2f714ed","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"4adcf3e40d29ca2dbeae33cd765fae09c7b7e3cc","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230102185418-2f714ed.tgz","fileCount":60,"integrity":"sha512-zmsCUiVS21IPv0rmvGft8BN5secrEbMj/Wq7TmWWk/b7PKr4lTacegEnE8M00qIqM5zRnpDJIPkuUlvkNMgSUQ==","signatures":[{"sig":"MEUCIQCbN+sHDG/ggpk+Hd/Gf2i8T9BiJ2r5GKzkqnNlq/FEfAIgX71cOiYtDLQK7tU3QbfKVfUvDkTj2f1lJKxx6fBCI50=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjsyh8ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpKtA/5AMtqgmK81kt7iu/OJ6esvWZ1iPopIS97nSBtmR+hNFBQzMG9\r\n4Gq8DTr7ALeY1w7pYffqdef0tiYa4AEWhZwao3XhC0nqMPb/FhyfYR01Jg+z\r\nXijSKQNIS88uqaptB8gBdPv7qBZGln4JnG2qHYGLV3PU1F72cYF/JCXsQTsL\r\nWRicIk+8owVsDsiZrzLIxrWbTe6NW1OBnfY5Iz3V6C08dOvKIRlDjIF6MBVT\r\nBDF4txEeD2HidU4MsKYabi8a3nNNQqLs3nippy4Ez+CWnP9sBV0cstLMvoii\r\nilnCkd5pxG/UIj9KSDYHEkjPWXZAwdbUeovzcg1r72aNnLjNgS6/TgERx6Cv\r\nIxsrT1yuU5qeRDNkLvkbLobBGhZMybzULHFt2rXyXwideG4hiIHrExm5m9LO\r\n2qO8bf0muCmZYLoJW77UJWSoAWZ1Okf5ZMB9p33zG6fsIUGh+nakpsu0RT4/\r\nehI1PTCeOYUyXkYNJmyNBs0dyi6yFYHQqy8IbQUI7jfhPzZ9CordeYnWy1Ey\r\nEbBo5UPfuq7FterU0p55ugKBM6oKpUwp1iGUKBSc+WRg46hhmSQotHbvuRHa\r\nAzPeohmnSkxqifCp4LGPXt9FgJfQrlKBGmXmycFLaNCMtuMZc3d9L/GxZM0+\r\nBnGeOv+OeWsiyjcfJ83H3FhVFrDz3iwK2mk=\r\n=veHR\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230102185418-2f714ed.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/39d1617532ca6c470ecda2cbfcd43e54/graphql-hive-client-0.22.0-alpha-20230102185418-2f714ed.tgz","_integrity":"sha512-zmsCUiVS21IPv0rmvGft8BN5secrEbMj/Wq7TmWWk/b7PKr4lTacegEnE8M00qIqM5zRnpDJIPkuUlvkNMgSUQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230102185418-2f714ed_1672685691856_0.424195228769914","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230102185915-7e804e6":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230102185915-7e804e6","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230102185915-7e804e6","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"4e7d5d767782ceed37f2fb68836373331715046f","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230102185915-7e804e6.tgz","fileCount":60,"integrity":"sha512-W1k9T2+WRinTZz8jaQjRK/DffJh5+ywtk0KkhFvGGv1kJU43iZv8BRiaki65RNVS59ZtpRNVc/+NukiKAO5RlA==","signatures":[{"sig":"MEQCIFGRgbRIt+7ZC/8T6x6nnXxfitDwn8dn9CbxltydftP9AiBortv1vK/yOo2Su+3Pcm+z6hXPHNrQUjdAVZmLhxPw0Q==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjsymnACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrFoBAAh8/MrtubvWKLSqwQOb3/8L+bde/Tno8KszLvB+zBSU9qqqdD\r\nfHeoDWxbYqu9LRvTUDS12RB6cmP149IMbhENLVPU9TG0uAoLxEpAGjTMxbBj\r\n+Ar+vioJRsLclK1zMQho6Rgkt/puh5r5LncAhDgxhfTxafxXzaggMvwjXtSE\r\nEtgQWGS0SRA4ubSb4idPreNy1eNYcTSC6kI3500fv1w4N+nCfjDfAkF6RUBB\r\n52HMqSZ6qgD51wEuybN/RlkT/e6JYgTXtumyyMCYEY2GYlyLilfFeX69rkIJ\r\nfUQeySg1dvh3xEDwI/WL52qDDXY29S8dhjTupQZ5G1dBtVanLCxEvXHserbu\r\nvfcpaiM78uJ/MV0QeDf3ekbijkEZpHrw7jaiiFGrLvEj4/1V/EpemXa63eri\r\nppbAyS8bjMCv8wRTUm3IOeR92Zb6QoiI8fGfaRob0sQJ3jadRl8p533X50Oo\r\nd8Goi8ZqXgz+UfT5tC2HpvsYK1wF9qGTkIpR8H3CxEGZnjqykKlP61mFTdSO\r\nzQTygzz/LGqNBXPFZ4fsEL8vnN6BLpwnv3HATwLHA9qc+Bf9kvsiNsQcgAE/\r\n0CaxJotWuXGpE0++eEhN7MPf/cxswGZzHR5lE42K+HgdP46BRfHiwoDH1HFh\r\nq1wqXX0zPrRlcaVVCn1BiB8pCYVsHQcG1Xs=\r\n=TTkl\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230102185915-7e804e6.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/c7d462c0641451f691f551ddc94cd932/graphql-hive-client-0.22.0-alpha-20230102185915-7e804e6.tgz","_integrity":"sha512-W1k9T2+WRinTZz8jaQjRK/DffJh5+ywtk0KkhFvGGv1kJU43iZv8BRiaki65RNVS59ZtpRNVc/+NukiKAO5RlA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230102185915-7e804e6_1672685991758_0.9968685446500412","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230102190003-c3141fc":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230102190003-c3141fc","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230102190003-c3141fc","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"c8a253e7cd7d3e963603841cb80efcd20e7199e5","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230102190003-c3141fc.tgz","fileCount":60,"integrity":"sha512-bxsJl84WT939TtwCQ+2KuNNkHGpASnWdDT6rD/0L9mvHo6+Ct87DjSB4fMX22sztI9tMzVnVJ3+gZTulDWHKSg==","signatures":[{"sig":"MEYCIQDAiOSPPDhCpkz8jAG2QZnitP3UGFqMZeKBI498S+MXxgIhAKbfbZ2yKIvCxPNQNMEWnzMMsSyKrb/Zzp/uPHwiEAi/","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166345,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjsynYACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqnRw/9Hs6hEI4MYcpqC6cP1lD/2c4QjIoG8SPMMEx7gD0ka9b1mURf\r\nZnrf1LdUAzit7iR+EhZK8nHJZeN1BafhLfwZ5RCOyfw5IAJFq99k4LIf4Rcs\r\nlBd2bjTzx01klSah1WpuOEyzDz549kBViP5lENn9mk92nX8tWnsMfu1zMokf\r\nHjtJwN59F4e3hfg2PWhfwCSHpPTCFa92IHiJ+KsXdrznKEvUOfcp6EjTcJ86\r\nh69mbfJ7rjrb60ByC0VCRW4xaenV+4vbk9tfA90z/IyS7+WkdvKSSdeBzU7G\r\nHRBlIzg230I0QUWxjPGNV3JTjyymD6C1g7dRKQpgRJ5DmOxqznaWVESIVnGJ\r\nHj5hbZekO7KioIiajl0q0Y82XlvN39AdpCX3C8oNn57MszpZAeSOti62D5dd\r\nbG69c96r45wriCOEUUR+/4e8KEzkQGLensUa/UeU5MGY2OknACCRAqZWgW63\r\n/iJ17rvg3I+4yHZiTiFbbBqpvq4nz85HgWuLfac5BNDq4Ld2NKa98ijXYgtV\r\nBA8h10RmClxUO5GYZAPx/KnPxl2xBug6zT8lB2WFuCM4bmjqDc4TAGGqme3N\r\nuLY1ccLqqe08Aym3Fm+WtE7hvaW74Vej/DFD5T9i9AF9kc7tsIspn681mrME\r\n8BJ2CyN9USHGUzwzKg4eO9lAuPuEzrsTi14=\r\n=X/cm\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230102190003-c3141fc.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/bdd95ef3b9882cda0f8d01b4aa449c7a/graphql-hive-client-0.22.0-alpha-20230102190003-c3141fc.tgz","_integrity":"sha512-bxsJl84WT939TtwCQ+2KuNNkHGpASnWdDT6rD/0L9mvHo6+Ct87DjSB4fMX22sztI9tMzVnVJ3+gZTulDWHKSg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230102190003-c3141fc_1672686040530_0.3401104008792819","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230102190415-458b2d1":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230102190415-458b2d1","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230102190415-458b2d1","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"5114b597169892fff17cfe98c59f93d77d0ca722","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230102190415-458b2d1.tgz","fileCount":60,"integrity":"sha512-M7rdZtuR9lmiaLpx08D8kgJTf0VP/GfhqLjlViJwyo7tbj3qvd+qNEmrU/RJeLLTa5tWJU1DeVQwIC+bN21f+w==","signatures":[{"sig":"MEQCIFV9BG+oWGCw5fqEdjhitrvfu/FBrneNG3w2ppN4S2lWAiBFEn+GJ52eqRP5uYY3rhryKz3/KIO07wfQ8MgvSGlg5A==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjsyrSACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmqi7xAAmjZBEkGMZ1cIZxGIKoPe7oZ53IR18U6O9zq7RXrh031+x8G0\r\nIzXI17nuJCxri1AVj7OAchvqInuVPCwUVIZK2OU24nDgkiZFwJ/JjKRyx8VZ\r\nCvvxybutJwjIridEtlQembumK1RXcn7LhK7jxfsesKeA1HyWf9xs175L2g9+\r\nqGN/X2HHxxX4nCNU8U8xBTQd3LJbVu8ghJF40syrHp+K1ykfzP1JCXR78kgi\r\nxtIXCK9iOrIBQRyb1x8kOrSptg2km1QzzgwTPsvQqllmpmoXP0baMjN3Lj8/\r\nezum3kPpqZBmWpvJiWI9RcxrOmcPOmWQtXuLc4O5pMMm+jOkX+GKM/METj5X\r\nncHCKLk7Byu/6Qi5ps44sPc7bf/Yj4ndqu0M9tWSE/P3G8L46Wf+nwfVNIfg\r\nl7PC7GfiT09OwMjYqmrEqlfFtOs0rylQ8mcNiCDtIhBiv+HFGBkfqCvfqgOb\r\nIAg/dTH6FGuSHxpOsHTXBHCXKlsM1/gF11tISEesoO6N441M4HNCmaHWrpKd\r\nBONOteIf+yg+rynv9Bo3aS8RefF1EJBf7MCnf+/83aIOz3STchAI3ksZ3pDN\r\na+Vx68NBC5RuTZ1AiAT8CBYf8o8PC/05Sr5iiFjFJI7a2AImT2H96ipZjSD1\r\neusaIAk6KYwHTJ1KlJnWH7RW7ReUDvP3YLc=\r\n=IHW1\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230102190415-458b2d1.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/b72357315c880bccdfd9000e9d975ada/graphql-hive-client-0.22.0-alpha-20230102190415-458b2d1.tgz","_integrity":"sha512-M7rdZtuR9lmiaLpx08D8kgJTf0VP/GfhqLjlViJwyo7tbj3qvd+qNEmrU/RJeLLTa5tWJU1DeVQwIC+bN21f+w==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230102190415-458b2d1_1672686289923_0.016579573951793325","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230102191019-e62312c":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230102191019-e62312c","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230102191019-e62312c","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"cf92fe409f8852ad3a128c4699ec88f70e08bf9e","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230102191019-e62312c.tgz","fileCount":60,"integrity":"sha512-5YMsb2WihmC6Ji2Z97cARlU5Mw1K6QePW4K2xBFDr6CnMYE9Bgk0RoaMynmntqqNvPmUlYQ1mEyusIj/qUoAtA==","signatures":[{"sig":"MEYCIQD9S7LRmawpIrHUnnu6tg2aurH7MIFk9qyimFYmPiuPfgIhAJ2tS1GOLilaw0844Ghmh11qF3inqcXQL7CTKKXjeqSn","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjsyxAACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr5vw/8Csi6aKvj5Wufy6W0JLl3vnCHFI3z8k0UHz474oMsfMznTmDZ\r\no9T9Led8G4ehZF/O0FUGIoJII7p9QvQZ1i3u+xYNOH2dCLeLQGmpHDFi4uNL\r\nEfqGnXaoqzlUJeyr+Ov1MxHIdDEu/sAncszBl3SFjBRrgpNcaxD/CvOaGMLl\r\nXVYlHt16hmqAbsKSbMdTHMYiowBvnGPrgmSfFaYzJMW3TcW3NWc7oUSt9G2A\r\ndfQ8YGT2ryaifaJOtt/MsW3MDo8Uhc+QuygITt2FddFz6n6/lwMx2doFLVOr\r\nzUP5Qvx14qOEsBpUSBCaa+MXNwf/eSZ1mMT8QPq5p8jTAXuXXAbIMXFS2Fc9\r\n0xdyYCxFdWX4YwbcUDaqWl5UiHhHApn840nKsdvLBgvQCKo1iguUQ7Z2p7Wn\r\nTPJoqSPGZRcG4293CJZ6BVo6IO0dUR9vtHOMq/206DcCbHgGYGOB2tvyJGz3\r\n0+bVDQmwjqMHKapt+UNsFyvKxbRpBbrAS4XpDlrKg85faieemGuFlP20viul\r\no64epMu8DBJJ0gD+pLtuHvii88aZkOngtohm6JpHj80gA8bu4KP44toURQ7S\r\ni8SjDalGP+pHQdUPryxMyhrN1cyzJi4VPr2tk2VlmounJEPhxYiMRTZYFYi8\r\nzx/08G8W19m0xAw/GbtP2rn37D/b3i/l4UU=\r\n=XBXQ\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230102191019-e62312c.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/e7ccfcb6e304649cf19fa44d5dc7dd1f/graphql-hive-client-0.22.0-alpha-20230102191019-e62312c.tgz","_integrity":"sha512-5YMsb2WihmC6Ji2Z97cARlU5Mw1K6QePW4K2xBFDr6CnMYE9Bgk0RoaMynmntqqNvPmUlYQ1mEyusIj/qUoAtA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230102191019-e62312c_1672686656621_0.7677489480545399","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230102191549-c77feda":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230102191549-c77feda","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230102191549-c77feda","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"b2c4f01b4708b3880234595059ea83771abe4594","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230102191549-c77feda.tgz","fileCount":60,"integrity":"sha512-bGN66T49AodgIN8KRk7sr6Rdrlb97ILSUphURfBiGZzXjtcZccLvZdRpIWtinXWlafIuq+/DOKKS2El7cxaLOg==","signatures":[{"sig":"MEUCIFFExzL0Sa33OlIItKign6r0PPiEtZfqb1YR7ejrKjdpAiEAmYsfKFuFhDvH8EOWm2ayN4OwHL5Ve0IZBzgRDrY5XBk=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjsy2UACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr6iA//WiMH4+wA/FdbJkS3/3bEx7cJfygv6f1a7LJSqkhYeSC7QEPn\r\npMZYEgyZIdXG6aY+Dpg/giYGubhRYLVskCkf1ih9DljWkS5poO9r3NhBpgav\r\ngpUyJz35HZ5Y9VjbD2NR1U9bVNiO44vB6NQB17O5qFPrh9/qltO/QaXXmNme\r\nDAav8YpWNKBp4gb+9bKaXTpqTKjtsJ70qJnd3OsG/mwodPYGQgCZ2wvLTnqd\r\npwxrJTSSYenyfTVJPIFpsk57LQBIKtjNtNnSssvBQEcTggPmsV15yYi4B0zH\r\nZy6o9oGYfcqrAB5sHX3ZplDc5yi0QV9Q4hd0RXy7X/JcephKNLoBxoFaJGEn\r\nyY2f5dEaaA47aveJ/6UBI02dHdzvp6Uh169OOWQDjoIZvpcPtd8z0EyHHzC0\r\nJVU61bdfccrcMdwC21+4vJGw+s0fC+ooVBguQWAgON4Q90R3uYBLw/59Eaqa\r\n2G0W49fV2qYviBDHSTTKdMWpV/GHdSkOL0rJm2MJYMz5QlM1b/vXcq6iLe6m\r\ny1ljopYeJGlw+8yRRme20V51IOu+nTc3DFhmcHUsCHJ/8X4gyTlIe0Mimzmu\r\nbGhNpSKAX8/7JEHcqF+xMZPgPdkAEQ4peFy61ryCMsqUuRUJhVSSE9Eyvw6f\r\nNajscolMKPbp+Y9cx66+sglpea5Z9ne1f3w=\r\n=VpDl\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230102191549-c77feda.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/d7cdbacf80bd58d048cdb2ed49b5ccf1/graphql-hive-client-0.22.0-alpha-20230102191549-c77feda.tgz","_integrity":"sha512-bGN66T49AodgIN8KRk7sr6Rdrlb97ILSUphURfBiGZzXjtcZccLvZdRpIWtinXWlafIuq+/DOKKS2El7cxaLOg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230102191549-c77feda_1672686996473_0.375790178652585","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230102192330-35180a5":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230102192330-35180a5","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230102192330-35180a5","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"db1fd0ab5f269047f8c0abf60115956cb5b72c41","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230102192330-35180a5.tgz","fileCount":60,"integrity":"sha512-1rwkNJUXDK0F2nCizxY3iSPTEVBoOTE5H2YxpXU566w3b2fZGqArx3u9YVShQ9Li2wuW+jIEl7u6PN7gUkNZaQ==","signatures":[{"sig":"MEUCIQCXuvVj8bKVGphBBzheEb6c4ysPHoL3IvpyJCLk5vh2zAIgSyTQ7hGXaonOhHXhn90L1XJjDAeqKZXRu/Kym3QMwK8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjsy9VACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoKEw//YR1775U6n+jva324ZzC7XAHhi9hKlsBN0YYu3O8SfdVyzqsy\r\nnDxFQxjVBIwkbfCWnOzG3HcTGHMWx6aPPLCKACdLO5UAOFf9KdJR2lrNfzWz\r\nMYL7fuDIsyKWULJNIGGy4pdg/+hJbmioTEDCjFLMUf1gEuEltIYEC0ek+9Cn\r\nUii+fRAn63pcdjvr/ETu1Pr/ZBvMUOrakaRPg7WVfwpLHaFwoXuLAQf+wn61\r\nXr7hFYawMd2qKx5gg9vlpCzALPbvV0p6tJ+E6cbBbKEB39jrg9TmD3U81a58\r\nA6RvI87FUhj9KlG36VysQTDn2eJZSp3hrtBZ5vTLakRLoHo89Bitc8eeiPt/\r\ncpP5xQlhe1zOp/ebcqOD5HtmRCQP6k950B2w0M0BBrrx2I/O7NUNri7TDZHL\r\n7rK4cOTbV3Z9h7vY2UBWkj2oIWf/XRFTGBHtpzyPcYF4uO7JT7nlUtyWayLm\r\nilswmFjjZKIOYOHQSsbx8k56Ele8zAvoQEQpw2gnL/TjnXvZzq0t/AFiosuh\r\niaIEcztayE2/mmFuYcIZ+OIqvwFNgMp1vqVDCJpe9z0Sw0h9jSmwB3tyA6cj\r\nlvK1cJgnwFhic1wm6KGeM1uEPUQNhlMfTIKdWysEzLiQJORqW93rkWb51hbz\r\nnFdS8E5eiO9XySytNxilAkzp6q0bkOchp4I=\r\n=Q/2V\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230102192330-35180a5.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/c799d346a1b9ab3560ef5620e54df5d5/graphql-hive-client-0.22.0-alpha-20230102192330-35180a5.tgz","_integrity":"sha512-1rwkNJUXDK0F2nCizxY3iSPTEVBoOTE5H2YxpXU566w3b2fZGqArx3u9YVShQ9Li2wuW+jIEl7u6PN7gUkNZaQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230102192330-35180a5_1672687445217_0.5530538827906006","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230102192344-fc1923d":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230102192344-fc1923d","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230102192344-fc1923d","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"1b8b4e75fcaeb50a000f952e512d497fb47f94e0","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230102192344-fc1923d.tgz","fileCount":60,"integrity":"sha512-MPUOUUKKnUkfltZW4jJeuMgn0r+C3ao2kG//wg+gcrmw2IRIQ176H6+WMCrrPSZWAlWGQMKNxnR67u5DhKdVxg==","signatures":[{"sig":"MEYCIQCwKiSC5nZVXR1MLk/QDqRQBgcg+Iekvoml57mUkvrxfQIhAPedi/e20/mEWwTlRsmErPiXU2nDA1xRBIcVOWD2wzfV","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjsy9tACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmquFQ//YJha/qLRVhU+WgVl+Do8OM5LN9oQ7t+1kNDelq0dvGU2tKFy\r\nt0RXuTNPWCFaFoINcqr/0oZ4vg5hQKjrBwcvYJYAfHkMW694I+h+I1KNxPCa\r\nwbCEZWILEw+L8am0ozHm5wenkjcm+ypgTJE3/WhxDuC8G4Ru8lTfRfPomG2v\r\nMl6trRvVB63zZPY7ElmmdCxvlA9icTxF1W1IvHR6vULGt6ggJ1vmEvkQoo1w\r\nysT0EJ0RBKwSvApHWJC1Ql2lokwSAxoTRQJTy7iduSAgILKhVzqhRcehz3Gm\r\nFuWhpbEIsZepsv3CJwWo1FNQET26uN7vAJK5IEwlRCIy/2SX3dnpQK1JRDe3\r\nlkXjg5lUK/JITBSayFWJHVjRTadx1A6BMtvKommYOa6RQhhj/qKh7USCJrUT\r\nTvVLkGV1qOn+Dph3uNG0CIx1DHz1QCY1dECQOzKFBxGFS3ILAaYUdjhX1/i6\r\nzBIju6a5DHiOek0pFvJZaBLd6D118RrXWliBYUDkN3A2zE2sp5Odh+mQkgLm\r\nPMkG45jv3tsgaoLbjPOwrlGuVAWDvl2xhPxvYVX5LUrinM5DXejiLeSBhhoc\r\nMW5dMEKccjlKZpp/Q5zJ7W0aqcpP6qXTevkW6DlfQTMwLwVq0lNKs3XIHEJ/\r\ng5hc/0fZryDg0BgjOjgvvqHiyZRn/5NpOR8=\r\n=Kr9c\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230102192344-fc1923d.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/3db87799ba6d4dffeae9a4d84f26f43b/graphql-hive-client-0.22.0-alpha-20230102192344-fc1923d.tgz","_integrity":"sha512-MPUOUUKKnUkfltZW4jJeuMgn0r+C3ao2kG//wg+gcrmw2IRIQ176H6+WMCrrPSZWAlWGQMKNxnR67u5DhKdVxg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230102192344-fc1923d_1672687469338_0.42247783501548786","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230102192912-62f1b0b":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230102192912-62f1b0b","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230102192912-62f1b0b","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"7f158c2f6e1cd6a56de69a1282d21303de51f444","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230102192912-62f1b0b.tgz","fileCount":60,"integrity":"sha512-9pKmAmh295BmgO9+BZVHITW4Jpy8MbgfR+2tXPihs2cBdpXNBog9uAbvtynb7KqvA8pxp2e3oM3FHOctGPuGbA==","signatures":[{"sig":"MEQCIBV8tXpthFsedouu/hhs9lc/ekHpekJ6QE/DBanda3O0AiA/ZXZ19KEqVvY7DAKvRSzcnzf1CBLtozCZ/haSbXWmqQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjszCqACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpDGw//QCsZfCqta89RzaoPJRYhI2yQCra0YMtEjfHY1qwwKso0WFup\r\nFi55pnYpjeW7sgGNxS+83N2NjkSGwlqf9OpvUzW8A/qFm2aUmE7XpPJCxVp5\r\nYCLSMGllknIa2zpLVvwYEF2moGP2Itm819JHPPGQlvGATA5JtBEC3U3sNXC9\r\n+HAgjwoif8VpHK73KzOP5G5Qjve7S5fI8Zmys3aNEZkjRRsm88Jq+p8s1ars\r\nMfnHmCE+x6nUqvLxQvN2QuuKVIEL9Zr16VQXF4Ff2a1mrTuBCnMacsNWTHEL\r\nDAmJ8lS2IySL/UY9X6kYN/iAB1qezj8j3bP8dRmtdD60Z1WJ/AbHcrRmmt1B\r\njHN/Es+MX/tC6hUvdFnChTArnq5KX6X33wjnkGYvuqvvEPaWpPWk/sY4Lpnc\r\nJ5GJqT41sDc+K5k9OMgu15qUZKn+CMEGUBS1jv643JKWC9Z0oD0cyRc+yNHt\r\nzeYDwWlT17CsVyATkG1WuRX4p/US9Mz3u9w7qLI7kYs1tt6k5DFVNxbxIMlk\r\nRSFaH32YyWVCxQjME3WZRzaJSgqqhNZr2l0CX/20sRyZV6SfPLXd1qdaY5Bo\r\nuH+30reYp7cMU2aplcT+aLPKpfJXMHOn4ZZWGx/hSBMqZFoHJOQ3LLc1Jqul\r\nk/6zEup1eiEBGVU/N1p2uh8+irkv2lyOQ9E=\r\n=wl1c\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230102192912-62f1b0b.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/98b071ea16e2c12876a95a7ee833a9ae/graphql-hive-client-0.22.0-alpha-20230102192912-62f1b0b.tgz","_integrity":"sha512-9pKmAmh295BmgO9+BZVHITW4Jpy8MbgfR+2tXPihs2cBdpXNBog9uAbvtynb7KqvA8pxp2e3oM3FHOctGPuGbA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230102192912-62f1b0b_1672687785906_0.3530984631804064","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230102193428-60ba2be":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230102193428-60ba2be","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230102193428-60ba2be","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"bd7c7b728a150562a271ec28b2e8d58a16d74f64","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230102193428-60ba2be.tgz","fileCount":60,"integrity":"sha512-mavWR2FA/k7jvfnyQ0FQNS59xFc/Ze/1mLNxjWvO1+DtClJGeDpcs9iganfu5VoTumknpn+ScZ1NDP933SDIog==","signatures":[{"sig":"MEQCICcbPoCU+9bxvKUo550Ski9Mj3QzQ7osoAVDfP5m1CAhAiAhxoFbvu79kMxrIuaM6badeaSSZq38Aip+1ZIyx9daaQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165581,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjszHnACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmq7wBAAoFGFOzRWIysVX8N/wKJP3Oxx73NNSG/NcyUiyTd1vtFi36+G\r\n+D1pxzXXDcumTfmvp0gh5hxcwZjoRD6CKeHmqsKoOXdSOZNssiL2qDJWsE1b\r\nE+FCh0TeHTzj60tcOgRlDj2rLbQ02FT3xGP8RG3IUFC4TRXO3JaVFWQ7buhh\r\nNXGnFbvrLI3+sfzIYp/NglmukKhpKHyGrW9F7KJPELU+qR7ZwoDg3PIAJsGV\r\n7SFL8o6/Y6dCNcBYTNx2/kHh/blIavY/GxrZQmmSrkxbk1vObpVEhl00zMV4\r\nu4DEjeUH7jw86PWtAe05JDmdGxCPC93+gghTztBpeqee53raEH9RKEDGxWvA\r\nYtzoDDL7i6Ns9ylS1ixN61AE+UIU6zJN8jMtxyFyCQXLrHpQhu3JBDczFdCs\r\nI2jpoEGGB+v+1tiiqWBiLW/2yLl/qza39tpnw6Rv1ZHkMXqm5TMz87VK5VXJ\r\nJqfTE5LTljPJtKT6y5wQU7ZCNCvXRTTHPTVByVn7s09ycvdCsUJgXlBw2Qtb\r\nb4npe6jqXAG95ldwkNoZ/UUn7mSv2rKSgvLx9limYExXm22u6I9Z/5Xjw2gQ\r\nBNuNue3KRJO3wCvfdQefLK2lPDuKNdV6gq4tCvbdaLYD48cC4uMQvxhVF385\r\n8GK4BYwm9170wtwir+CKwxVzDuUWsiTX8i0=\r\n=lcZB\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230102193428-60ba2be.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/1a2bb9d17520396d5e34cc39ac467929/graphql-hive-client-0.22.0-alpha-20230102193428-60ba2be.tgz","_integrity":"sha512-mavWR2FA/k7jvfnyQ0FQNS59xFc/Ze/1mLNxjWvO1+DtClJGeDpcs9iganfu5VoTumknpn+ScZ1NDP933SDIog==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^9.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230102193428-60ba2be_1672688103259_0.5457411970621968","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230102193958-c1978eb":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230102193958-c1978eb","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230102193958-c1978eb","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"5c37cbb6f667fb2db6e56f485c1a220d67a00774","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230102193958-c1978eb.tgz","fileCount":60,"integrity":"sha512-MLp2iEfNNyyttgRxr3WUuc0Guw2z2FhwdIucJkJ8+dVXt1d+VwiHYFXbbDzvfb2fiSnACGx4rUaEI/USe+/76w==","signatures":[{"sig":"MEYCIQD1HLmJ4NOCWnmE0jWEsicgGQMnQaJBu9mAZiz5VZtChwIhAKWEHaGcyn+aKCUt0s023RfpCDbIkjz5QkfxOGKUkIVC","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjszMwACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp1qBAAkPbGsZjc6uaTq8KdfiLalYbGEOOBABg0XniMvF8LG/+nQdkN\r\nMu8zogVe9CZbTh2Dgwujg4B50jgXMrgYVTbEBcDDVKNI1Qf579qJ4CMWdZqJ\r\nEQwAGSQVASqPQCsYFBNGvdTPy44ET0aMnGcJva5V7pGk/eihGenSMphVXct3\r\nhbEzbEdXP0bHB8yCfGhIJfzrJfe9t/rB96ND5W1dNouCHN+ki7zalWtR0PZR\r\nDCuxPG0CyEvUXL1vwZZ5F8brDTTtBqaA9YoG1pI/taRpYqSM9AgcTJ90FSp7\r\nh9jF9gOJvXEQXg+Va9KeLV5Unwj1G7UnqMLi7NXEVoUZHo+sZcVjMEajBpbi\r\nEbN0Q3yo0TwQjeyPJFCTYtQ0tM/BkNPNpYT0hZnUGhl35xqLhOz0aC6c0XH6\r\nQwkcW4s5F9qZC5DuYj4iOl8kfYxF5HoblspuqU60duCWRhL5BLWj9hPb8F1O\r\n6yHA9oCkmr1Ooiv12PGDozMChrB9cLAWhDbYQy09rbjYuv2Y8dauxiUhmi0t\r\nNyNCyYxYaObXdjwSGtMCz8X0MF1r0UGwD+7VVNuwgSopVt5FK2JYKCFD9TqF\r\nv67kLY6mpsbKsiF1QLChYWYr4L3G612ONto4dEQX0ZWVLslOGY8VXNETYVja\r\nF4+sjHnVxa/8aiMHpEb95XTHnjjtQHFuh0Y=\r\n=jBCa\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230102193958-c1978eb.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/9ebea6e22448f94b8ac4e786abf0285c/graphql-hive-client-0.22.0-alpha-20230102193958-c1978eb.tgz","_integrity":"sha512-MLp2iEfNNyyttgRxr3WUuc0Guw2z2FhwdIucJkJ8+dVXt1d+VwiHYFXbbDzvfb2fiSnACGx4rUaEI/USe+/76w==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230102193958-c1978eb_1672688431879_0.73601336471645","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230102220314-6908bc7":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230102220314-6908bc7","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230102220314-6908bc7","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"e9ff5b9f5773a06dec642698ad52a1f6cb2f9f83","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230102220314-6908bc7.tgz","fileCount":60,"integrity":"sha512-MNzLAqXV/fbHMMEhOuvzXEz0szELLTMZY6p29BpvHEoFMP26b2xYpOvMVG1AwLIrYheLZXhNB7eJ5pXJciZamw==","signatures":[{"sig":"MEUCIFf9ybRzfPX3KFEtyN0omeqoDpTbz9cV2aNR8RipmtzRAiEAnpNvNKX2FWqkaGo7zTmFA0VdY4DQOdNKDO19J29tyHU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjs1TOACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo8LQ/+I/0Sz7ZHJ15XuK+IYPqoZalMccD3P99jZ6q+da6VMjxmQq9B\r\nMuk+/sGBoALCAM4aq3ZUvcj8G3PzF9DxrpH4cNxXuXk3QaSd3pr5qT5olWEH\r\nj9THpSkmVwIP2Dcr/olatkrKpRHHyIpsDT94dbrj/icXqjv9plGP472331wU\r\njZlAotL/EcpRg/MjQnfHKk/mHf7Hyggn0ILKMbFC9y7Illz275oeTsvQ03cd\r\nsvrD0fVdRVFueA9NZYfm7jhYdoDmMegPcW+B4oXK64+jDGoAMpJVryrSQuV0\r\nZ9+PmNhx+H6Jz+Q+tJmMrkK/gZEMDbWKb06F5Faswn6StTyybuSCIutVV/gt\r\nITY+BpJXk6rB3g4MNnTBoQ0jQOxRlgvqaz95jethRN/EUp8cp/SdI4ZRXNiN\r\nagZ6KAUzl1wJ5Gw/254CzEjt+cKURWsDGFtVegTG5bCbIWLczvT2EVnK0ezo\r\n7wuIqDTr5bdJZ8cJozowf5QLNIhEZiIneLBW9a3lJa0EGNGoR1uzcFZhfyfK\r\ngVb0epK2zbQeuvSIDqxN4Wh+gdjecxuA7MjQGxuPzuGYvgF6HOwK8jr8rjGQ\r\n+mS18c/n8AWnssopd9OGJlmbgmRfT9D1cdPUim326T8NDwY7messWag4/4Ds\r\nrLjRe/k93LoN2AufZ+sLUeeZNys/QHlXTKU=\r\n=DHpz\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230102220314-6908bc7.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/941d67d35232412dde3e986b5765eb06/graphql-hive-client-0.22.0-alpha-20230102220314-6908bc7.tgz","_integrity":"sha512-MNzLAqXV/fbHMMEhOuvzXEz0szELLTMZY6p29BpvHEoFMP26b2xYpOvMVG1AwLIrYheLZXhNB7eJ5pXJciZamw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230102220314-6908bc7_1672697038474_0.6158854298679795","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230102220800-5c1f0b6":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230102220800-5c1f0b6","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230102220800-5c1f0b6","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"d1a2383ff67a174d257e173456b55f3b77fa24a2","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230102220800-5c1f0b6.tgz","fileCount":60,"integrity":"sha512-sQU/UUlU9/x2W0e5/M569DOREdAK6kmcdu+QMcLjAzmvX+ahYv5AZBlfBHbAVivhFJt5VAfKynpqfjTu2VjHkw==","signatures":[{"sig":"MEQCIDaCsK682p4jxzUGA8GzzgLcHeZ92ScV25aiflV+/23BAiAXe+TgkP92Ft8ZLVTE9NzYtvs0p2fIC+vfJPVuEBW+HA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjs1XiACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpQKg/+N+FG5vXb58HAEGjD61/9smDUXC0+j4zCgfm/41wX6jVz8XNR\r\nPc9RnBOFH4/tw19F6AlOqq2uJpfpcj0BF+GnwRR4I4go5SaGEny0bd1vfVYg\r\nGCddKpsvGoC25jJtOOUmkLfUzIVg7nI2n/hBOLLVXkCn4cTOc6kBT4if0BtQ\r\nWRsJZtsoh5SHZVk/go6jcpW1XbxHSTXovOnti4b/M/hne6y8RTXI5ByHzITu\r\nmyuYpG02uqT6gGXlam78dJVo/lNuPr1on0GSOsFsuun1+ifcEqYMAxx6cGuD\r\npV7AnYamNMDIswCFjh+DG7hQcZccd6m2kLU2IBoRyR6EyMh7mq5mLj6fabVV\r\n9oo+O9azfWvby+lTEaZFrGX6pxOoWzocKTdd8R5uVnF5vm9CbBFB3WYJCChV\r\n16g0DL6fq7D9EWP6pf61CFifzCfVeOsjvlIp3WP6BGUahgNO1xmxZe9TEu5B\r\nagL5qC/PNLPRusKZGayFQYb/lwBlzx6TGCVQFqtyPK9kM5qjwcn4UJzOw6Mo\r\nj7dReVpbyFubezp1L0p3FcqW195g9an8cWJ8LuaHIKQ1zMpXbVITffWaXkH6\r\np97eYhDUjR6TV2YOm8Rja2/1H9dkjye8wWCJX9vmuK2UJ8RW2qZ9IWa7oVi8\r\nMUu6QifrG2YsqpHRTOCmJKLbfPjqUraDDrI=\r\n=m3Xp\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230102220800-5c1f0b6.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/824095d4a370bc02a9ae1965d3bbb2eb/graphql-hive-client-0.22.0-alpha-20230102220800-5c1f0b6.tgz","_integrity":"sha512-sQU/UUlU9/x2W0e5/M569DOREdAK6kmcdu+QMcLjAzmvX+ahYv5AZBlfBHbAVivhFJt5VAfKynpqfjTu2VjHkw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230102220800-5c1f0b6_1672697314309_0.7724676018533903","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230102221448-37adb40":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230102221448-37adb40","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230102221448-37adb40","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"521ef9b718cc59062d064c696d0c7baaac7ddc34","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230102221448-37adb40.tgz","fileCount":60,"integrity":"sha512-Ta75BazCI9yhag970oCQXIdtwMiyJAnUE/z2ESaGiACe24YE3eH28qxW6jvcPmabq4iPsKYpa6eBD9mlA0ZTOQ==","signatures":[{"sig":"MEQCIDe5U2pPRUit5FCnZP4n2VTayvZNr+Q5HsbAhCSlxsJhAiAjEsEFS3CMil1oJ2tWkHpBtAG0Gt6pU7vI8P1T5/Kx9Q==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjs1eEACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpsZhAAlLS5SMI7e1OB0NDKTMW/fU1ish0uS3BYqlEtI6pS8vWieUOv\r\nZ/jPjeV1X/9xkXfsXf7KhoHsGlC2K2dsbGk+A3y8OohOtXDUWYbiNyj7LT2F\r\nc0O6YNEXkffV1mI0kOvkWfWTZc5xhg/JR7ddX5YRXgl5qXtP6laUj2OMOeQx\r\n2INgMtFJ0cYOTNpZijWCuhphUPP7q/SULc7JS1BUDY9b1vj53xq0AQknwocN\r\nz620MGuCut/NR1LPgzr1svLjdnnaVv/SReQk5z00JzQOs1zrYn2We6XqiOq4\r\nQCHdUPjRh8BY0xlr+7wasHcWq+D5VbiniG9hPcGiaDJYeja/QVaU7O4OS97e\r\nAsAbTxuCCM9FAEjMqQXO1HnkUsiXBSeoWcpCKBIfJAvUQM1mX+Jlk3+CzEJN\r\nK2CXuyjQ1vrz77R9vUhPMLMaWhYlp3jZsQGNYVePzMGYDBDwk0RA9ZVX0nkQ\r\nVjl112dS7fRGO5BkESz+PBf9IH6rJ7avj4RWrgNx9AuqeQr0bJbGSWCFYkEI\r\n7XhPKo39FOIwOap9y10kjo729s/KA9AjAxUjM3Vmt2rqpugl9e2+PQHqUHYe\r\n0jTB0jAserde4LVqPLYszlhHWQX8PeX/chhbCfkSmEOXdhbsHcnvyjyOCjV2\r\nCQZbqiJ4CK8xAeaDvgCr9o9iOZKHMJoV778=\r\n=uXdW\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230102221448-37adb40.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/3510e0fa9dbf27e070bff7e76c8de5bd/graphql-hive-client-0.22.0-alpha-20230102221448-37adb40.tgz","_integrity":"sha512-Ta75BazCI9yhag970oCQXIdtwMiyJAnUE/z2ESaGiACe24YE3eH28qxW6jvcPmabq4iPsKYpa6eBD9mlA0ZTOQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230102221448-37adb40_1672697732346_0.5775252040496328","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230102222017-830af1b":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230102222017-830af1b","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230102222017-830af1b","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"8ab664cff5954b432ea6b4677f7fa3d4c451fbe4","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230102222017-830af1b.tgz","fileCount":60,"integrity":"sha512-0IXs4ASbVm25ivsb9oId1WswtVLnYsMirVMCIsG/jWVkQk+2jU5jeqpxVKsMlHVGlej27YlRHe61D2IrVZDLXA==","signatures":[{"sig":"MEUCIQDC4D3SyTjMQGFOTyRpSfs+ctHUriLfmBLkO7bavDET6AIgVHF1aGtRCvASdat8wHBTAgf+UGaobr7w5r2rM1TGodk=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjs1jJACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmpbfw//aUNKVXSQhTlP6IM28ZF2G3TXurKxLntBbeRCnTJwSJVr+cEY\r\nqrscGh+Ejyv8URMKCfz3QNonDWkDf1aoEj8POSeYZK13bixHZ/qTDsBscZOD\r\nX0vIhGRjhZeuBEJX9VXf+rDzBUejkp9G5w76rM6A4n+qYfP22UquQEsm6ya2\r\n3FONkCuzCTbngcpzZDyBGU5/W+EHmWaQZAeCUo4VjprHouVUE7a2TIoFlrCC\r\ngiisFGzu6eZbRngh7gxwqv95xOohZT+7joKt/V8vlDz5sYRRvJNRNq3zodx7\r\nMKS8PTN0n22Ygxswf0R/jeO+Lcs1VQ5HLi4xNBDa9MPLVTjEKq/r/5nIjVrN\r\nX4sBKkeHTih/A3nhk3RUIblOr0yU4h61UY9HeTd98sLvkpI+rvJluUYCb93c\r\nMvbOI1jOB2UCQ1cJgwwRklFVddU/6zFghufziG+OSKWWIeiXH+TeT/355dWH\r\ngUHKFOK3JD71t4zkK0Ry89IYpVoBfP3veoLS6hT3IYKbScYUmx4Jif0wTVG5\r\ntKeUBQpa7l6YyO7NbglDVB1Hz9ezRT59+mxfXOwVbeeD+iNwycfXziXM7WwU\r\nOIIitTLl9ExOJNrLR8FDyqz0jr7j8RBIG1VUkcZs6xw2Coy+qebNU++kBJBb\r\nNerhBHc+SWX9p/Swl1RB65tCir112EuTqIg=\r\n=TblL\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230102222017-830af1b.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/ff25e0aca5bfb13bd9396b11fc1585bd/graphql-hive-client-0.22.0-alpha-20230102222017-830af1b.tgz","_integrity":"sha512-0IXs4ASbVm25ivsb9oId1WswtVLnYsMirVMCIsG/jWVkQk+2jU5jeqpxVKsMlHVGlej27YlRHe61D2IrVZDLXA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230102222017-830af1b_1672698057596_0.14304090958445226","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230102222511-2e81e74":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230102222511-2e81e74","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230102222511-2e81e74","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"32727e25d0c893ba96d18434ed96bd38db67d925","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230102222511-2e81e74.tgz","fileCount":60,"integrity":"sha512-sHmM44Wa5F9vO1TVmafUxlDNrDSclOd86qmtYXUqaqsLxMswGQd6m8OP8sN4eAdmV2Bx2kVso1+B0FcVzaUTvw==","signatures":[{"sig":"MEYCIQDCvTaY2TR7NiHE3NNmLc8aLq5LUwG41vnjqxRQwvNxfQIhAKvy9+oosM+M+Xa5/bdl8/PzM4HPzHpmiWVqATy/lrqG","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjs1nqACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmq2Wg//fvWsvAixbYpDvsSuMt9pUh0PwX5M/4xBkxW8C2Zn5Hq+WkEk\r\nK6cbU08bESmLndPOPoWQvQbgQoxGYcpuGKnnyeFSit58h30wC2gaQzUiqAy6\r\nNvB1m/xf1wpH4miLXQoZrwTIiJSQims5fXuv83YrD4I+IwwvkHkz/TLv2AB8\r\nZsBNm/6d41qaGLfZ8klt+Hd/o2kR8Y75abulHjz3sHkInvEl0QJOao33zOmC\r\nGxlYFc5uxOl7Fa+2klW8JMPLvURVhO1plhZfo9gCKkF4Ug98ULceUmKt4Wea\r\nCJS80Wlqz3Z2w/Twc7FIDbRi2VikzchI2uCbJCU5Xq224G2oUZud2YwHd7fC\r\nA6z6/m3N5CsqOVwL3vBgDlpuQSyEfi8HhdwU+02U8mwZap43Wv2EssWE3mzb\r\niqs4NKq2v0F6v5t9A1X/oxwDJvruB+Pguk/opuCfKSL0DuG6jVw/55b553mR\r\nh7RGKIEWE+/gGZLKP5rTKS1ZufzwKDMPPfFHQ7e2ks4hGwivb5P6dELT4ftA\r\nOlKzvTtXgm08zotrLv+zexiNLcXR/H61D3B1eRbvjsAsQLHsx0jGrDkFa1/r\r\n775sHLoPFDSv/rNqlb7lD3z54pPt86+jwV1nv9maTjbAbt1dBkUDQMiZwu67\r\nZVLJi9wCttGtJbHufGcvDO/hZHG9jf3Qn4o=\r\n=Mde5\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230102222511-2e81e74.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/15c31ee2aaa9c68f181c0c0102646581/graphql-hive-client-0.22.0-alpha-20230102222511-2e81e74.tgz","_integrity":"sha512-sHmM44Wa5F9vO1TVmafUxlDNrDSclOd86qmtYXUqaqsLxMswGQd6m8OP8sN4eAdmV2Bx2kVso1+B0FcVzaUTvw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230102222511-2e81e74_1672698345865_0.4312031008138897","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230102223029-092f6fc":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230102223029-092f6fc","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230102223029-092f6fc","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"5571a780727295ddbd5c84f2d07255b19e8e2d41","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230102223029-092f6fc.tgz","fileCount":60,"integrity":"sha512-9/WpTQZ2L4Cjclt1025s3zb2QzUlu6NkQiyuQD/dgiS7knPoScCuJXXXAgyDPl6C3pQqblzAd172svLXLeE5sA==","signatures":[{"sig":"MEQCIE3CR9asmatMiRP5UpU4PoPK1L3qEc6uar0ckQMTU7odAiBpTAdC8iL9MW+TPCoA3JwfIGI673j82Pa4DDvX04SVbA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjs1snACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrFxg/8DaVe05g0qTA/xiJSktZtpuQuCaQyAvNJfWpJ0bubBX4fQYUh\r\n1uPlckuRvTPvwMra8v+JrXxvCnJ3gl1Za/5O4pmWdHEeBR44grPpYriOPueV\r\npqTbB+W2Q9frZrNLn8xxADKgg4vJKmQ4el1Kccnak7HqVG4pSBFRDUwQY6W2\r\nWvqIdG+xMFIfjTpZcD6VPCv8vFKBmDAzbxpHDeqGzD4ajyKaxhZznwhClNpV\r\n5tvlgptW5oxF5ojbecWDpYSKNzjLlqSs+GkpTuGETiJMB23CFo7qbDmuMS3n\r\ngpFAl2yjfDDU0YVGwuPXgK+GMoFCQ5W/JjFUEuNtcoWd47j15VjlCUewd9k5\r\nZBH7sebfnHpQXJarVt5Jk74GN4w4BM296vw23cxAuLjP8LTOurw4R0jGyU4s\r\nj7FD1TiI8lWlyt2ZBoMhzvgcRbZw+oSsVTwLMmLzEDsk2mv9PYBH6gl3VcC8\r\nLemL60pDOJDGgxS1Jso796L4S4RzpVKYI6NPd6HntifwlcBnuRnamC44Qrup\r\nka/pW4wCNSv44Pxr0CNiZv1m0nYqgTfGYK5oVEYwxQZOARZw5C/zQvGI/37l\r\n7s23vIe0K0UNmEW0aiVu6pceSEJ4ZKkbNygk3d1aCc+1jYvYaUup1h2KEDgJ\r\nF9pBL0b+DYJc65THjTRfBkQNEd08/FRMPYg=\r\n=wlPN\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230102223029-092f6fc.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/6cb6cdd918c5e7fd873e76742c027912/graphql-hive-client-0.22.0-alpha-20230102223029-092f6fc.tgz","_integrity":"sha512-9/WpTQZ2L4Cjclt1025s3zb2QzUlu6NkQiyuQD/dgiS7knPoScCuJXXXAgyDPl6C3pQqblzAd172svLXLeE5sA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230102223029-092f6fc_1672698663013_0.624388070055983","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230102224109-a3e747e":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230102224109-a3e747e","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230102224109-a3e747e","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"a58e7148d664b3d4f767740fd1a231e7e1333d56","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230102224109-a3e747e.tgz","fileCount":60,"integrity":"sha512-59Dx1Yzo4bz1Zn4axfeKJ71IJEEG8hZHG/RIqhzzB64s6pQUFVkAyiwU0moBSuBPgNLDqPPjM4JTmp+xYpG72g==","signatures":[{"sig":"MEUCIEElK6rvnspFSozfv4Lame7DW2ixzjcRV7ku8xdm1si+AiEAnJKHaCZRsPB/eOpb0a0VccrW9Cf9MVFFnRky4fwVZpU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjs12nACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrhTg/+NGDxSzg/N1yOJblGQ/Lnuy5bObrTSMdyCX+HsmGklYQlt1fd\r\nPnW217uJe3JJhUefIAA3M6wGq25FELYYh748G6cAvyqN7h7g93xVmGEq4Ihe\r\nfNzUhX4/3KS5Z1xJWvZ1b15tGb1jkbWwDHfy6a4mYy3x8m09DMw/O+dzPETW\r\nYRy27hpog/KKxP8q62AVQ5jqQkXcNRCE4BkWclM2di0tpoFaPjsJrkvYGpMR\r\nf2crv2faKwvsMwwEtojOUyMFLJ4ny/KjInhkxgeXb8AqwZwufp7+Rz1u+kEg\r\nYOZiGPlPVBoZrH1fnqRshb0Z7XDK5nF+sc7q0ynpf6pXfLkrqRr7snhbVGHr\r\n9VqZDMEjX5ysu6SDrOPddQ7CiSE7Xbukn6ev1wrsxU6kXSnRQJg7VWH5FC4k\r\npUkFq6SJRAYosVxaGP5+OeGPnvBaNEGTbaMu4i8Q9INBeiIqBdfmvFCJA7s9\r\nr6o0Px28O1axiQ0+z2V3WaTGeRo2DfgEEhcTleoFM6eeG7lf0G8XCFxQYkZV\r\nQTrwK2NaAY144xOw6lJepB2AZGfqBl55JnP5tNV9TfSmN0nO0++mfnsVJS8t\r\nr7s2IVhOzrIGiB11x0ErFTt3RlBaj6wvzXaAH72yaOBwjAsZ+hfzT4BbKlKC\r\nnM6JvhOOEASq0Erxz38qB5uguS2/+xPr+5s=\r\n=hGLj\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230102224109-a3e747e.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/3e40e4f0fe91fea8e06ac04f5eec0ef1/graphql-hive-client-0.22.0-alpha-20230102224109-a3e747e.tgz","_integrity":"sha512-59Dx1Yzo4bz1Zn4axfeKJ71IJEEG8hZHG/RIqhzzB64s6pQUFVkAyiwU0moBSuBPgNLDqPPjM4JTmp+xYpG72g==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230102224109-a3e747e_1672699303682_0.3661246989525564","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230102224639-f474d9b":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230102224639-f474d9b","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230102224639-f474d9b","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"92a0dcf6b6bb91c1d22f51cd8a062588746db425","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230102224639-f474d9b.tgz","fileCount":60,"integrity":"sha512-4oGGF7aDo2VYgMPTrL5hQuM+KcPcWIHQVWROO5j6Cb+1s1jN9TeKm+HeYSQ/NhKYEkXj1ddsWT/ghnNzNtTT3Q==","signatures":[{"sig":"MEUCIQCs5H/8a2quUKlq3tmYLC7z23O1XWZJE4Tc5R01q0GiFwIgE88aKXYTVoDEJkIrqxvGXiYooUsfb2X8L26+VKEfUeA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjs17zACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp1zg//Sx/tax5dIta4xAE2mU4hRVXCWlXlG6zOmGIHLiXsUckPafiB\r\nicwB/1ckI9ll2+cLQ0Cg7vtVl1ieh+OLYpme/k7CllnTO7dN4Ly3v9H+AdDT\r\nv28GK0Avb0Uy1LZTloLhao2RUNBx8yDUFqy0NZ6qWup91JQ7JEhDkKOB770L\r\nRzxU3fqM0xBjqHd3ysy/mxOc05tAh/opG9ankqFyEANLoyoBqPj0QJK7Uuld\r\nfGu1Yv3cA10L6lHP8Vo3dG3Wy+Mw7t1wKEY9MNdQom6cUfju3Cx3wxZ67wqe\r\n6MXf8nDM9UQNPA8+w35c3cPIY+xjvtuwx0mskIVoBTJgnC3HC87GxOrma+rF\r\nooF21+jcF4VMHgzrrSqQ2eUNM7iSBKhW1lSDeh1pfKDGybuIhukzWTCTzlqK\r\ncVztTQoBj9WBhKmBtBKL7+ZlkjIRbFzes8S9CEfI/dakG4eoVG+ra4rwUsPJ\r\na0nvoDfdRg+XBIVoQL8vH8hMKx5393sbF45q/wsbapQ9uAK2dzrneTgD92BQ\r\nCMdtePlfHCuuCuwQxKt9SWAYtGgtI977Qr4C2goBXYB7RaEwA15I20tGMLlM\r\nvhWpAXT8IOaapjWxypWWv7qaQvjUaG/RepNw7oFfxwhwsEPfeL0OQx+JPVbH\r\nIviEOPeOEU5mgIL5RWYqeS5J3VLowTfYFPc=\r\n=h88t\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230102224639-f474d9b.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/6575be20d02475f2e517ab293a1ec050/graphql-hive-client-0.22.0-alpha-20230102224639-f474d9b.tgz","_integrity":"sha512-4oGGF7aDo2VYgMPTrL5hQuM+KcPcWIHQVWROO5j6Cb+1s1jN9TeKm+HeYSQ/NhKYEkXj1ddsWT/ghnNzNtTT3Q==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230102224639-f474d9b_1672699635543_0.7544210026364828","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230103005721-c8faca2":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230103005721-c8faca2","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230103005721-c8faca2","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"f7ac03c2b22787b50c4d998c2d357c4cc350041e","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230103005721-c8faca2.tgz","fileCount":60,"integrity":"sha512-/AZYHYw8t+HK9ObI18l+Ce6uT3uISp56SxwSHrpC1q9493CpjoY+muL7R4iYIbcHPaBFO7uEfncmga70rF771Q==","signatures":[{"sig":"MEUCIQCL+hxjEBcVHGkbga3A1S2Ha1Ln1oV9bIBDrEfphqn6qwIgYTpdywQMkGQQgYpvRianhll0p3VJsM4kiGyS1L2adtU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjs32UACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp85hAAgprhZInDLHyN7Z/Zy7zRyv5+NNa0ereL5P0xVWWD5rT3PVhp\r\nycKKLuUfYRwSELKD1g3fzG3SICN2NWZHAtqRCV1H8gb2269SRevbXfRu3VCy\r\ndx9P4K1OmwisNCeusnn2PoOw0TdhM6RtT4EvIcpxHn8KcbZyUzh2b4EpyWdG\r\nBQyhFxt5DeQ9/vys4fW5jreEpfs5ETLUzJVz/xD2weHQs91Uo2BcfQDHNP1j\r\nzgE724i6iMD1kvrr1eoutM1q45L/cnY3gkTesV0lf2Mj9I2Uahrbqu5VTZmQ\r\n7lFi+UFTjA5jT2orSMDj7Ul/9MjokWhDsATWIcqTvkbPo+zbB8kAe9/u0CZp\r\nhiZtCI7WQjHQQxOvaf3q/rPgikISi7cCOV4yNbic7U3/mu7fN8oxeMOGcGDs\r\nqbB2s2Akm2YE9bfzHfAN+qWfJkdCpcB7zYEck5Qcj2vw6dcACj35dqD8tDcY\r\nbQHSYyqiWsJOlX/Gh32tKhk+TFROEBkEoJIYm0/kbE03jlXTR6v24nplMMmh\r\nuiyEhg8jOKvy9n2f2Lf2HaDeRrU15cTen+LkbAOnFKGPCkIDhSgEO3UCWMoN\r\nuGINg4/Ce1w21P30YMGy2aZSyZBiBT/B/EQkYRmzFdaO9h0Gje+DOps/HuSM\r\nEs2ysIEq+Vw5K2Ly7FZtqcDzo1ViflI5050=\r\n=Q5ms\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230103005721-c8faca2.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/92f7096deefb8e202d824b6b6d4fb273/graphql-hive-client-0.22.0-alpha-20230103005721-c8faca2.tgz","_integrity":"sha512-/AZYHYw8t+HK9ObI18l+Ce6uT3uISp56SxwSHrpC1q9493CpjoY+muL7R4iYIbcHPaBFO7uEfncmga70rF771Q==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230103005721-c8faca2_1672707476501_0.9475926750331607","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230103094814-c59aef7":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230103094814-c59aef7","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230103094814-c59aef7","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"a37b91c7b8afa015af071f42459bee650225e8d5","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230103094814-c59aef7.tgz","fileCount":60,"integrity":"sha512-JMKBFQT3XfyoOYt6zNkaXdNC4lw3AsGzysjxqJliw/gxB5CbHfvk5lTf4PjD4Q74uqMD98cfwSWpFEDwebxK2w==","signatures":[{"sig":"MEYCIQD4wMXkXYtQB53b4Ep2c4b0OaIKBHcsY7+Pt0wMCCWoOAIhAPMILgVs+oyBZXsHR41CYCkVCPeyD9QXvKPAIa395Uho","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjs/oBACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpXeBAAgpZ6D9mBwHKcVrmblPoZQ7Ow5Xvh1J0DiPBTcVMeMvXY44W0\r\nzRbVWAPfWTIDVrao6Y23Pj7qFSARyvHU573C5ByzpSzulekmGzmu3qNoLS7X\r\ni589kChcJg6GVdTubMZs2yd/XfatWlJWuzsbZzxp7Lr6wkHl18kxkm2+p412\r\nC0q1NCWPxgLsUGrwbdyZ713QLCqvtPTFGLl2QaVSeac2xkKuXjP7h7Dsex/h\r\nG4gjgbOjyLPeL4Bq/JJ2YFYP3h9gZmCR29dKdFokY3YgWdR1fA/+tC96eTsh\r\nBUI//POZSu7k4CtJRvz/n4tx/+T1Gj7oyvZINIGVGJANT0rXJt3lB1xpvPiK\r\nsmanBtgmRE7Ll6zZ74pJJW1BeyB7FG3xFik7m4YOZLK5BfnUsD79n1CydqVy\r\nWfE8t2W3kzbS8wsB3j155nF6nISSkNs4c/qPSMUAZNSGJVpDD/ExCMUIWkUc\r\n4cB9ccTAwm5H71z8MfMSpvHTcJXuj2NmvVA6W8ZBDtex7T7/RcRD19abrYEh\r\nyAMelrMyvl4g/9X2gs4SkBmFy9HLDEnUh9oDUuXdlvAbZAqryh3Nu8ej+9JT\r\no77i+CRfYwKS21TB00P/PI8ydOUlCfvRL3TER/VOhvQdm9mY1XWxxOKYVEUu\r\ntSXGPcOvMmWTTrRC943sq65+n8jqj0nM5LA=\r\n=POdB\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230103094814-c59aef7.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/b4cf38152ec602701d1d46ab27a4a33c/graphql-hive-client-0.22.0-alpha-20230103094814-c59aef7.tgz","_integrity":"sha512-JMKBFQT3XfyoOYt6zNkaXdNC4lw3AsGzysjxqJliw/gxB5CbHfvk5lTf4PjD4Q74uqMD98cfwSWpFEDwebxK2w==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230103094814-c59aef7_1672739329278_0.6637155769683647","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230103104005-54b2781":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230103104005-54b2781","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230103104005-54b2781","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"65f385a35dff5e26d0cdae6c91957d5554a908f0","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230103104005-54b2781.tgz","fileCount":60,"integrity":"sha512-wikKhE5MLv0KGGeqX7HTKOLxkReXFI0AMzcY+U//J0ofKcg/dCed1gpN5PkDsk8knZ1eAl/mnUUvtbVPR85OmQ==","signatures":[{"sig":"MEUCIAphqZFpVzeoSgoLnYDueDtASdKEaQjjaKzz7PPVlw49AiEAm7ULCtScfENLYyzES+L69XVkNLqkMtL/1lP28zlBeto=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtAYxACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmog6Q/+IJGcb30qe/SNDI4IBXPHcaxBbbPoRT2GbWlTmmG8XAUqpnJU\r\nOA3T8ub2YmvcwgEbkgIpJ8CuXZEvzfSYevSldWztflks6s7086g0HJAptTZB\r\n7O/kOpxuBxCBmolx6LkbYkyvJSrWfoMRvEU/llpfWmF6G9D5wEnridxWO8xx\r\neT3MLDks4FnLaqiyK8MC/BTZUt635DSCxjCbaX95jjKQ+fdspYgAx2qMfHSC\r\nsIx5QZQdy4tDXTH6l4HoOsV3jkjBuI4hK7Ilk0a5+C7+HVOe+Pej9ThXFsS3\r\naJfcYL1y0e9sCvhPEzXdCfDwv1UNNAluHsDmNZju9lkVzXbOvFvtn3GyXgK5\r\nc3o3V/BB/t+30flhVpjWukC8p8yi627fmcd7EqFphVju9+91kWlHkV1d5QYd\r\n6O5m6ZAF3osJhZvuly3Zh0p693QQiCWt4tEEEe5D9rAqL38zYtxpfBMUJmHF\r\nKAdifRWgRsFZn91pAyQQqS9v3dwR+A/2z2VfYWtalSeifY9Yx7HQq4v7DTe2\r\nAkHG9qx0oXg/o7te5gszHDjj9vhzF9cjHWFykD7OtUJife+Qw1NEokfwxtfv\r\n+sh8x7npHJpWbEoqQtYmv+nxyRUq3WArRmVY4uTrTGCZKyViX9Z40Q+wQjZT\r\nnlHK3gJVNUyHyVKCtvs4kCIkeOpOO12zorg=\r\n=2L09\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230103104005-54b2781.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/9d461992842ec15a53d2a001052b35e2/graphql-hive-client-0.22.0-alpha-20230103104005-54b2781.tgz","_integrity":"sha512-wikKhE5MLv0KGGeqX7HTKOLxkReXFI0AMzcY+U//J0ofKcg/dCed1gpN5PkDsk8knZ1eAl/mnUUvtbVPR85OmQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230103104005-54b2781_1672742449658_0.8081448335763795","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230103105639-2b32923":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230103105639-2b32923","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230103105639-2b32923","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"4f4ec806719276df7b027c0d23394ad614d02845","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230103105639-2b32923.tgz","fileCount":60,"integrity":"sha512-MMS2b9QlzEiwHb6maYET8gmB7Tod9yJ721fDun2Ly/wshav/7izY+8Ivy4DnkMi2m+rwLooLCGSaRNHBFtuVDQ==","signatures":[{"sig":"MEYCIQCpiqpvvWnTMH8NKtGrGhfuykhouUMiZPUfKVSsY0hdfgIhAMrpDNb3OHDuANdBru5+OT2gwAroJn+hCEiG1a0gfrI7","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtAoJACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpB9g/+Mk7fSZGI3PHMD5/NcwI1/5ZECYMCuscumSDqRHoxSjv/EUsX\r\n7eJ9LTmhvav+T8y1glwSXw2oCmAK6BcgkI/udwRtHx0roigfzffqUSmA9jqb\r\n7epuCzyrt5n5u/nvKEDpgpbWzcZHaeFplJrUS7c2iPtt7aaHGrQ6RqO1ZY6G\r\n4hiHsz7ePUiC5Vq2sm28g0DhZTUHvZeNT1QuCJcsQvu79osrxdjdMD7yqSz9\r\n3+0uLo0w6GEpHzAlJxNlzVc4pBxuQpBRPorHhIcnmBK7+1EiISqAlFLIhUq2\r\ngiaePKZK2IibZrAMrCT9eoCLcX6qTNmr7ekm91UoGfxNsMeMQa8yBPqAjOC5\r\nY3qkR+jjlGd7pQSj8mmOsTnaGAyiDLAh7E+RrrjSZ0CP/TxofkoElgGX0IF0\r\nzrVkcbCIWN16eMe/ZyFUHJCbDGUHS/FXpDP62AP5eZJ1o5I7GQi/XZZDd3MV\r\nKIQkA/cMG+OkjO10pxWZfpUEkEepah4aZqHo80IRA6LpJHsavOkgbG4Gb0Aq\r\nSlRHjxprG/2X2Jr/ZiTeRM1XTR7w9Jr57Dt04ivRozG2ColWhUE6a0xFHOx4\r\nC8C0FkoC6sqlIn5of+vL66Vh8C8AyyHAXXWoxEhfq8DSetCjRMPIWRkVjkxd\r\nLffQoUPE4luJjLuUJpxFdzV8fd3qS+JFUSQ=\r\n=bZZf\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230103105639-2b32923.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/050166b6ebffa5e1cdf8d64a13880710/graphql-hive-client-0.22.0-alpha-20230103105639-2b32923.tgz","_integrity":"sha512-MMS2b9QlzEiwHb6maYET8gmB7Tod9yJ721fDun2Ly/wshav/7izY+8Ivy4DnkMi2m+rwLooLCGSaRNHBFtuVDQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230103105639-2b32923_1672743433434_0.17028065264974224","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230103111123-b71136c":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230103111123-b71136c","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230103111123-b71136c","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"559b023daca1bdba7d2ba5e3d73958d21748575c","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230103111123-b71136c.tgz","fileCount":60,"integrity":"sha512-itgh51zWLaPiR7ZJax/E/80MaVFYjNZo2shgT4aqSIk7i4RHwT8mtgwa9dM2Bk7Dr1JZM87tx76vBLDyoFFAFg==","signatures":[{"sig":"MEYCIQDlERpPmJ3gs9P0ZwSo7gsb9URnGVtUwTIN18Y5a5AhCgIhAJcS8zIF2gGbUHCJ/qjXe+nX0aPxDsa8sNelk/Is/SjF","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtA2CACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmrlkg//b+r45oTYKSdTGScp6kbTkiXNR5q72bBlrNtbqRMIE0Z6zzb0\r\nrD/ubzR7RxgnbPT3gqYOGS0q8PucmmHaD/Vvw7erMY4WPofKmF+Iyrtw9e6Z\r\nhUqNw4P7FLodqzKo1goHqfV1siAJu6LQMKrojirb7gGOBku9P/ssERaucfJz\r\ngqcOOyChkqs4+rSkCuAXRfeAeJqGNZW4Mvq9We/Ovs19ujEApNZCPC1i1YyJ\r\nHvuKRU9dtgzJd2fJbVhXFnm5ZhvQ5gCMaFx5+YE6api3NQmZDJPM9ZMhIRVC\r\nIGQOK0tslIVk00jwIKQSKW5JAowjTD17aOr77+XZuE9GS/CSNBALxb/OJ4CK\r\npF28baXA8/6qtFiiHtGoZKjaw5w3o3B1RC8xgzZ5S4J04y4lkQAXpvOiYgA7\r\nOVWJTsE/IgFetp9BzJLxhnEyUodKKGovTLOgY8MchusknMERHYCODyaEoTho\r\nuoRvJOjI3qiuPOh/p+v9CQ8mQi6/NANYJhfWvVjz2boNJIiojMWQuDfvfnDU\r\ngeSanqE+maINohH0udN/Vygm0RHOvdf7SpvREnP/AMUA14IAg4hGDpqfAMXS\r\ngYkT0pvQAP1S0Q5Za0HY9/h82uFdqBRFkkVmBUGm58QNezzJWOcIF9zzV+r1\r\nbCP9sdbIoUyc3rmj70WEsdvAXoNtZrhIqO8=\r\n=wLnG\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230103111123-b71136c.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/cbc5d31e6b2c1182b58e9f15bf566189/graphql-hive-client-0.22.0-alpha-20230103111123-b71136c.tgz","_integrity":"sha512-itgh51zWLaPiR7ZJax/E/80MaVFYjNZo2shgT4aqSIk7i4RHwT8mtgwa9dM2Bk7Dr1JZM87tx76vBLDyoFFAFg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230103111123-b71136c_1672744322441_0.008162476733811097","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230103111344-a974331":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230103111344-a974331","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230103111344-a974331","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"c32a1889cfd30ead0e5c696ffe7ec16e24a5568e","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230103111344-a974331.tgz","fileCount":60,"integrity":"sha512-2JIPJ+twz7gkdAtzAxUVK/9dHLHeze2wayXdEOSbQ8Og54Eej7XUUxim3QgoUYFEzEjbwZ5iFLaKBEYm/kNdUw==","signatures":[{"sig":"MEYCIQCiUYBATkLCJ1gJuEMeQin9Git6ioFGkub35eDpO1NPVgIhAMhrtgSHlFOocNzooyjGm84vhL0peGI+II8CUOaQiHGh","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtA4XACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo5oA//SYt7uLzppJMiWsqh9VSjNbbnnHHHZdSfI7SNit3yZcHWupks\r\n2Dg0m/pnU30LnqLkszijjmodegEyg7wrvYR519oW2Tn6cWnGMGKKk0CcvvTV\r\nz52NnTwq87N/SMTvbF7ScociK9LzywWkjDGqmb1tzddXuzTfyfnJl1ONRWAq\r\n/omcsTmrOHMGF6VvNtPpnE6QrBRqmsZZuid9Lzmwyj33lDy2CqIfPlmQV3h4\r\n1HA449R9cuRrqT+CDQXm7ZvaWoasiSReF+dvA3iCMZwOZXU9IytWrSwB3Ftb\r\n39vNM+fY3NMsZRO3oZUXR6DsJf1KCHsZ1GtIlu1a7rrbZbnWka8dq48OKUxP\r\najtVy7xwv+Ntd49TiDRaZv+Z86ZmRFHCWH33Bo4onyXWR01LBEspYH7EZWwA\r\nV1/5JmQGIrQ1melIBFwXlefJDEhc2ngwZFdUN9+geqvMyRKbmYtrj9BOJ5FJ\r\nAQ1CvD0Wp7Nu4rQEzxoq1gHnRzJjR1gdYEs226NhPoEnQndnIU0E1H4DksAs\r\nkaXK13oGBg+oc42ZKxTiAQIysQEGAcvtftcr6PZ+2lX0ZJYM5Ii/5dU0zNua\r\ne6su3OByNz3FFL/gvCx24CgmKxRFm9hJzektmViT9AoDJZd3SsRLm9sQiyum\r\n9vK3RI7UjPSK0Myjut7JagTXdfgGdsYEIWA=\r\n=bOu1\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230103111344-a974331.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/4aa4da0af1c2e36eecb57c3765cef85f/graphql-hive-client-0.22.0-alpha-20230103111344-a974331.tgz","_integrity":"sha512-2JIPJ+twz7gkdAtzAxUVK/9dHLHeze2wayXdEOSbQ8Og54Eej7XUUxim3QgoUYFEzEjbwZ5iFLaKBEYm/kNdUw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230103111344-a974331_1672744471414_0.38040374237019425","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230103124947-496a97b":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230103124947-496a97b","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230103124947-496a97b","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"bc20b3d92384b5422747cce674093c6e483fdb9c","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230103124947-496a97b.tgz","fileCount":60,"integrity":"sha512-kVjOmNN9feO4iCUmX78JzVPUt5K5t/tU8MQ/tJ/z/A7oTN+2/W+Fjkkb2uFBXdKm3x4P33iIRzks4AEmMyGOrA==","signatures":[{"sig":"MEYCIQDpfzF1BO+aI1nD117IroxvtXBug07bEVoqAxnHRPSBLgIhAPvoDFmh14tBPa4gC9DHqa4deHsp/Anf23xLb9b41aXd","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtCSUACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmqpsg/+LAAn8oRY9s7luCML6jMvhWLAzzUYSSw5EqUuA/DLWMXm36Mq\r\ncYaih6zFbybgGX1bGAtAbavE/rXCdfzb/i0QOiCGWX/Dqg2wjJUyrnbhL1Z4\r\nzNbHl2r7KpYb+kEJaEOINnu9nzE/fs82NDqGOwRWlqwhCUQ8XNyaribbkglR\r\nSVSGEfbe9YaSAov2qY5k1etykg0n2vIEO6P6FFTVYMUQT8cVc5/DzOX3b4EC\r\nmI28uBBntu9lzinZS2NY2PysieTPF73F0qfcL1g/DaugkvG9+/2KImDEgWON\r\nG1XhbAeJlp2tnQuK5XmhZ/74refX3AMp5o8ZF6wb7VcoX1AjwEPoD/mIhWmI\r\n76I9tGfxQfH9RklMS9QK2iqSwdGeAUNJqLL29Hz5vq3sq6ZDYIuXj4rXmFoO\r\nBBavDTZNJMdwPD5FTVczUOecOxNyrGgMFUOGXy48EVUnBxeD+A7yqDJp/Cf8\r\nXxsg4/Bg7lJpj/Gg1sBnnG1ogbahxiIfE4XRXLeJGrBCwoHNfZ4inVlfuESt\r\nIwiIg82/rxf5ogZsNUO7iweGwme5oS91NBkvxxcIW0q9+NDht8U/nWcJTb6G\r\nwzyNyymPin+mmKbPZFqtdcgV3K1iuhelgEMmRpEOIU+9UXtrR4eOTkXuUXnX\r\nL7Hg5C+pP1U+JvnTvcqaAOAdjXslYDHqZ8Y=\r\n=WBDV\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230103124947-496a97b.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/6f7aaf85e318c64f432a040d6409c117/graphql-hive-client-0.22.0-alpha-20230103124947-496a97b.tgz","_integrity":"sha512-kVjOmNN9feO4iCUmX78JzVPUt5K5t/tU8MQ/tJ/z/A7oTN+2/W+Fjkkb2uFBXdKm3x4P33iIRzks4AEmMyGOrA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230103124947-496a97b_1672750228086_0.9691756251843451","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230103135015-b53a461":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230103135015-b53a461","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230103135015-b53a461","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"cad7d6422b36b682a23c518f26d0b57a2f127840","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230103135015-b53a461.tgz","fileCount":60,"integrity":"sha512-Ct26ymQQAl14NArDjHFLcAlyV0xxXjotLPZhrJ4/Eu1Yf44g7RPnitysVAg1jRh48Xjks3gPuuB2O71CLMoKfw==","signatures":[{"sig":"MEUCIQDFWVHPEpSuI9PEJvUqIIiHzxO7X5376Y+VHepDUL2tLAIgMKltheoo4EQPnb6Y9gU1B3sKuquhY4mKu4BLugBjVrw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtDK/ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp4gRAAjLW+sH9mORgBj5ou4bVeMCS4mCJxvWAxEZKvwySfYxnSLBFS\r\nDL1OnTE6UxjP6s22jnHMmxIOba2iDlc3JEfNKSEKb/HYGzkL6xx2H09+Mheo\r\nMtYF0BwEiPKuVoQXrItJhYK5Q98x/QVGnpMGpOydMHjElm72iI88HN6kaa/F\r\nnJS/hlUTjfTxHi157DOgqKUq8iM03DrhNYsTlgIU/2I8rEQSPRC0vc32CYh+\r\npZtXNwMi0JppH6RWmTjbLgh/yiJOtSlIvMfxuROVIRfSVVDLk/V5RNdIIlfm\r\n8iq3vmwtuYiOaM4mus0VGSc394MYge1UH1OMdi3+9nTLEZEEK2ye6r7qLh4i\r\n9JfgrM5PI1CHJ0rujAQRBwWlxaVccoerTgjMJ2zVzaclwQJlWpINwWJqJC4p\r\nnztQ4s1j4pKvmIdqGxJyUsqr5r4UxvVX4cpt/NGsfHV5T4PYWV9NtErbYhO7\r\nGrUnuwbf3nnFIYDc4d6rmnCTome4QOi0+wN7LPQ8bS3m8Q9qEp5rmbGohlgG\r\n8wB88E8w5G0g+fZHTYNjMpWo2kFWYcw5bqiKVqpvGAU/dzjt1BheCs+iX4uY\r\n6qCxMzcAg1i+gK5T7of5vcvU36JYwFndyOZyQJXICCKPqxGLth2xJlrv+UTt\r\nziFI4yRWROnvAwLirYQhEv7pTajLGQSgv1g=\r\n=+XTf\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230103135015-b53a461.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/ff60820c0c1b6d3c8b8d6f8d66ddc6c4/graphql-hive-client-0.22.0-alpha-20230103135015-b53a461.tgz","_integrity":"sha512-Ct26ymQQAl14NArDjHFLcAlyV0xxXjotLPZhrJ4/Eu1Yf44g7RPnitysVAg1jRh48Xjks3gPuuB2O71CLMoKfw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230103135015-b53a461_1672753854828_0.5355396114623487","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230103174257-9ab8744":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230103174257-9ab8744","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230103174257-9ab8744","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"a407efc607f42a4addb0b7b545dff52c04d3c804","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230103174257-9ab8744.tgz","fileCount":60,"integrity":"sha512-Ct7lvZiW5ir6TeN/k1Hnl4s+sH/p3l/SPg5oF7ykJf4NFpZKpgXsNrBchikRuyJqrCgzlBSOfRH9hbnP/qlb/Q==","signatures":[{"sig":"MEUCIQDxwIDBqEApzzHe6hHD3FV5YFOpEhoqmne8CdBDEbUN1AIgKB8VMcccEGNO1ghREM0Xn8OQYeZdkhNSFibfTAZB/yE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtGlFACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoZyw//ReJePa0p0o0XQgB7RhhHQ6QOsjo+bGLW6NyvkUNVt1/fqBs9\r\nho07l9Cx862uj17snkiVsVahDIVF+1WBeFxEpfAZU8LTSeqJVr2dpRUArjCB\r\nykhUX761cCD6T3kZs4atIc5NsW1vVxrVgtvpZe1yNys2ol8LouPqqEpB1fMj\r\nw63IVuwz9TQY3lNP/wUmoIXzgh9bLeuS91XC1JLxAFeKV+Sswa6IAmAvY9nf\r\nOAKDJMLA+YucevIdBqf/zB9Uy+YeUb/s82Pg/2s2T0iZm7xvNzYQWXLlsMZj\r\nPaJXR7uY8kjvsCt1xHuTw2ux31T76sSknqrIOjPnbHf0ng26G6O3+o2IrNG1\r\n7WrVIOJ0Z3kbXh4Ws1IMh8aIDgKutZll+3iqbSLw4AJA7KJJmyRlAEghSS88\r\n6O6rWqz07cNJshViDUL8BQKBJy6d8EK8P0HrLYhp+9mrPdp81625XZTda+RK\r\nsuaggdYPghidUpKXyDavaX4kZ8cj5zlDXmONz1lKV99v31V0uXAHU18ztGbw\r\n2mwY3nloF1XF0UQhqamjEH3AOuZdRZAh8B53INQ4Axa57342tdWcBAr38YYo\r\n1rHm0rKAK8KGNwnkBpbkA0ltNFT6ZNi85kQGEHIDEo0BltGNJGX+0u2KQF58\r\nKslZupwrS+7ZnGVcUdOLSX9DeSHmzEjMa7E=\r\n=0t/H\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230103174257-9ab8744.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/54d5ce30ce2d7a895d407d73fb8ef97c/graphql-hive-client-0.22.0-alpha-20230103174257-9ab8744.tgz","_integrity":"sha512-Ct7lvZiW5ir6TeN/k1Hnl4s+sH/p3l/SPg5oF7ykJf4NFpZKpgXsNrBchikRuyJqrCgzlBSOfRH9hbnP/qlb/Q==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230103174257-9ab8744_1672767813163_0.9088685065821043","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230104101808-5eb70cc":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230104101808-5eb70cc","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230104101808-5eb70cc","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"d59625d38a43a25fddd5194f890108b182b4536b","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230104101808-5eb70cc.tgz","fileCount":60,"integrity":"sha512-jvglECWmE/rty19u6blisXl2mrzZpCT5SC8BE04RJUzyrhJO7q91XU+SjnNMz/luz9dVUllBvhTa/o6s4XNQ0g==","signatures":[{"sig":"MEUCIGfhL1ITo4qYALGJafYIhv1/RLkZmXTxSBI80x1DduEfAiEArhjq4NGGr0Q+0IhNogVK7kJI71sBinW/+3KtnbziTTU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166573,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtVKDACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrkHRAAhCSl6tfKlo2zELE92cAGQl6RSJVO3KNWxf5owhhbqMdzs2n0\r\n1JpEOwkupTbhBwHaywG+xP71pgJK0eJtitDWnLXCaUzKboczHGdcnechSuvZ\r\npoafaFwYLpD0Vpod0pZLE/8s3ptAX5L40EDpsY7dkbBtr8uoAYw0CxeqD8wf\r\n1bnYKQlPj3LxzjG5FXa3hwTzkTynlmeEBgb/1nPnqi9+fZHBjrTi3rcu45LX\r\nE1hfR56pG2UOUNpyn0JZcxX4NMwSrM90777nErpumB2UK0JsVriZUkVrxVl/\r\nk2AU/dN8STQqSKh5Gqvdjg2qTM3Rh/6lXKv21a0GrmOeXyQ1CCz3ynpkgd2l\r\nEgs7HSgJ/8w99CChZ7/YESEZe8Amal4UI0r1RvdCldNcpvgIRh/BoDr4zgod\r\nsuT6MiBmqoRkKJ4GVsn1/1+C9ZRBNxmfQUCKJkDW/W3lSeTMc3siueZqwFhf\r\nDgvfiASlFk0vqGi0vLA2B0G6WmxknJVqZTMZXJgxS+oIowlpOsS+NJb0k4fk\r\nHpllRGwQJcSHrxyNXx/tqiT69rpydhkAv9OSm12IveqO8PoXkc7R263r7LKX\r\ncQsndkAQjWLHQ9F8BE0M++F3MWFA1EkY2kir7QUDmeYsfvWrbQc7MnlTzpKJ\r\nQXSLchl1HWl4iMcp3prqwcd9Y8ze2noamjc=\r\n=J3mK\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230104101808-5eb70cc.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/00cc5212de8f94df9757fa4dec055ada/graphql-hive-client-0.22.0-alpha-20230104101808-5eb70cc.tgz","_integrity":"sha512-jvglECWmE/rty19u6blisXl2mrzZpCT5SC8BE04RJUzyrhJO7q91XU+SjnNMz/luz9dVUllBvhTa/o6s4XNQ0g==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230104101808-5eb70cc_1672827522975_0.5798850605164418","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230104103107-dacd228":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230104103107-dacd228","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230104103107-dacd228","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"be8e8ed6b88ecb054818528cc99bdb19438adae0","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230104103107-dacd228.tgz","fileCount":60,"integrity":"sha512-GM9MICwRNeXZsg2rl9ZZP00n4gJF7SR3TZrFAp9n4mKo5+t2KFOWHKq8XysUZVUiCHVTjuzq7fwPN3ny/TFPBg==","signatures":[{"sig":"MEUCIQCectzh23zPoxohd+uUnnRjY+RqU1Kpc9fzNHE+YvMtSAIgWCr6wnVgadsuKZAA4FfJkb7lMWqLyyjalu/f4RPL3Q8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166573,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtVWUACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoKtQ/7BJAklBCJMyIoOZupPxOqCkI51+s6pqnfZw8lsIxVmkARqDse\r\nsq47cxLsXfWaDxgWJF4v5AXkDFVc85yp42GTdcrH4CVnXQYgqbvLS9rNPmRP\r\nXMJu3UJtjK3pWqtUqZWA3Prio5YgiNCWYC4dicrMGJG0B1m6LbNug0ZxweKn\r\nXdxEepL/QS38epQAlpxmUeIpovUzjngf0pf2QXRCVFda+gcZ13zaoFL8crYX\r\n7fKgLxog05lRaju+D2OHt0hZfxmFYx+qiOloeYQ9bj7+hvMrURkhA98Y3BxX\r\n9iZ6CtzFGlKzQ18rrqRlgtOEo6luoZ5oq1h1BAOzZIMzu44xmkx4kmzBmAT+\r\no/h8J8av88WPpTEwdC2pDR6ESEIeW9OPgctTi4Zle1ot+iAhghBFE7m96G9u\r\n8n9dhpra3Dr0BfjCHk/aOwQRMMCG1s+u3rM5k4CXwgkwv1MjknDBmKhW0WVG\r\nV0eF2aJnZFXBni+sVmtGAYwbFwbiO+eGqFseN1ylqtP1+UGsU9sZd9n6Qcaq\r\nt94VFYs/V/W2QrZD7wdmShvh//KfgGURlAKc5523y11g2jYcfyp75+5Nti2l\r\nVTUvcWmnvwflYJ3G1VAtPdzzAyM0xYNpLhTYb9wnW7jjlnngAgksJgogFcVv\r\nqOli4ETIskYdIaLCkjYTQLUjTv9gdX+MdLk=\r\n=n/AV\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230104103107-dacd228.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/d3feed7e090aea3417019488722a943a/graphql-hive-client-0.22.0-alpha-20230104103107-dacd228.tgz","_integrity":"sha512-GM9MICwRNeXZsg2rl9ZZP00n4gJF7SR3TZrFAp9n4mKo5+t2KFOWHKq8XysUZVUiCHVTjuzq7fwPN3ny/TFPBg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230104103107-dacd228_1672828308217_0.020530362150571246","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230104110214-a1c3632":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230104110214-a1c3632","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230104110214-a1c3632","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"b2916b26cc8dd1ddfb3815c9293f6223747a3829","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230104110214-a1c3632.tgz","fileCount":60,"integrity":"sha512-DNN922OhYw1Tq0HrTYaLostAmBCv9zTi/wyRjoIxDkqx917pnyKTEFUf9sHcmObz2xhevja2t2pzcyGt5zuxyQ==","signatures":[{"sig":"MEYCIQD7XiXuMfjLgpDmRjaz49iYbs7SnyVC1wqz+ktMLQjqPAIhAIuuSuHtxI3R6X+12aN43RIFOzziff6alzQjVo1pSinb","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166573,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtVzbACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmro1Q/8CczVlgf7g3QljtdS+jMPk71WJARPZmdyDSgoRuRAHZffVWo2\r\nM0rEvFvd+NFTc1DOORQZZCAEyoIwaATBEBJiQL07inRL/3HZuf4Cnir7NoY1\r\nN1qyPRjQK1C5b1Z0hN+tofU8TZEk0PEFrqOvdKjbu60QW1Sc09wFI9k57T+u\r\nuBenqObzEru2E7GFVn7QhiZ9Ol+u+11KlqfKx3G7P7Eo8b2UUeUxpnR7Ce9w\r\nrV0hyB8BN04+sb7oSVXEOL28VDm2we2k+AB4IKzTEpY3i1v1schuYCMwCTaa\r\nml8dvTHiCI7G213Oqbx2Sc7k01EbXk+DWexBoURQ6a8xDZAB2Ysf4jzJTZvx\r\ni4PuFv1o3NC2lTy3dHGwjA4vQl7gqNeFBq3W5tCdQZ3miYHh9Jas794eE90w\r\naqjvP6MKqq4b9uApyDqiRWc6+EiaNPS6fds7iIZyLJHYwTY2pi4jaBODnU/5\r\nyjLBxmmEVKIIf98vfK1Er6/Y040zO1nnNF/URUhas9xC/0sQczghizz2HEdf\r\nIS8dt6qCrTidp0a8qPx3PCf5FSTy8cW867xDbMDKO1de7KjBDUh6bEh74b9z\r\nhMitGMDCZ8Cwhpb5Gdfo1QjQCPZigmrBV/fef6K47mJT902WB5tPfaZhSIF8\r\nkviBnh5PyYWdn8K7pDFXsFOgEhsCqi55/t8=\r\n=7TMG\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230104110214-a1c3632.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/308a36fbf6b298eb913d194ca1026e7b/graphql-hive-client-0.22.0-alpha-20230104110214-a1c3632.tgz","_integrity":"sha512-DNN922OhYw1Tq0HrTYaLostAmBCv9zTi/wyRjoIxDkqx917pnyKTEFUf9sHcmObz2xhevja2t2pzcyGt5zuxyQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230104110214-a1c3632_1672830170938_0.7595831060147329","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230104110948-2d6903a":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230104110948-2d6903a","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230104110948-2d6903a","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"0a361d344cd7e541b32cd4673778d9d4575c1f33","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230104110948-2d6903a.tgz","fileCount":60,"integrity":"sha512-Lomc8CrHyYefZ47EmcyMU4AMA1HlQxOn8AkrXGpiaWWCdVNc4kC33pAXiQ/l5TvO3WsQ3j7UYoAcXCtBvysIxg==","signatures":[{"sig":"MEQCIBCCJ/nf1nk+ufHf19z0FcwYgwi8aGsVGBQ29GZCOHQlAiATd0E/wqzDlEM+muf/CqcBHWdtl1pBTDRJMFNzwEO4aQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166123,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtV6sACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrqzA//cbab+bxVF9wJBfnhHz1IUd2AqYDfwbziMAHUxW7+EfTNRVn2\r\nHOLnzK5SLr6/1vf1nF4AlOMnzdPSncZ9CgsDVltiTVTwQg9YqkZeLq3ud8a4\r\nAZKpFxWU7dnjyd6LwiPspp8ROYVp0LdgKaaDh2dtO0YZ7Ibx6YNi5epUo9Hg\r\nLFw10pg46AxgyLgoyrgZnSafdK01vVrA/8lW5TavWxf/Fi7EveNfTstSKpvz\r\nx7jNMj5u4aL4eANkv7elTd4Z/Hc4VVKAqsqK+o7a84zm9f7SEbHrVDCN+PxB\r\nf8QNGHcBSRO1byKSWe+/1/Q/wnKaGhtT+8/CYP00hxprdXsSlq1o3joz9dU4\r\nBHRlFbTDLp2Y+nCWK1M2dxZ3TNXrkhBxUNshhDA9XUyHtWN1XG0D0/dYFthQ\r\niRtz92cQ3YVIXeCrnK9MSRzvqbHqbna6t8Sk5ZjnA5wRTIsb1LsWKib2mB3V\r\nzbVp/t/GR9SrJlXCf2V8DXadD7SKKL4dnZRX5fpIdCQjCT+4BuhWTKNdKPqT\r\nzCilI1h4P53WNhIFQJD7n3ZOcnLh1/NfRTI1CZGOXe+EDijGBXQHabRnV55X\r\nlARp7Iv0v7GDvRcjt1a8PzHWtpJ5UHBJjLKj5giDw9cbONjK+15iLWqJLey+\r\nlt0b6vOs7QLhveaioo/XSV1meXMG4bH+zmg=\r\n=auzc\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230104110948-2d6903a.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/fe1aefb72c9712768b2c79524a12dc64/graphql-hive-client-0.22.0-alpha-20230104110948-2d6903a.tgz","_integrity":"sha512-Lomc8CrHyYefZ47EmcyMU4AMA1HlQxOn8AkrXGpiaWWCdVNc4kC33pAXiQ/l5TvO3WsQ3j7UYoAcXCtBvysIxg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230104110948-2d6903a_1672830636640_0.03965768881458631","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230104111008-ea324e3":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230104111008-ea324e3","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230104111008-ea324e3","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"3e74ab030fc0a16af2138afb1eaa26690803fec9","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230104111008-ea324e3.tgz","fileCount":60,"integrity":"sha512-v7tnpjI/SjDQ8QlOGUeWRAgslNw9AIw3TQFVkhWYVUk6qZxjkyvSztYhC6CzaPBWJFfZhn6zqrWO5C9BcEiZpg==","signatures":[{"sig":"MEUCIDH3H7l5GHSyidUSHdj4k9DTHcHrWfMvH9+/YGHawW7uAiEA27csVXoBjv3N0Q6JL0vEvGPjKEo4GhDtUp/b35XbqXA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166123,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtV6yACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqwOA/5AeJtrABtuiFWm3EK9VGOUA24dpxzBxk7PU6MgqjWmklpFpdd\r\n/T/nLtLspaDDrU2t4DdtaujlrWaMzBQz/HiDV+koQSwjh7kBCU71KbcoQLqp\r\nIYcXV5IaVueQvZ8Jimmwp3u29kigfs1ltUL2MFQBvOXTyf1QUNe6mWHllt5L\r\n/ZFpVjEe3sl8M2bjxHhE2s25WmE7Gn+LXuNkJer+bm8qGem7OKRCiPziXTJ6\r\nZksOsaVJXkeJ3ddhatnPPus/N5BVAw0yPz46QWdKCKoCWkVaDJV3tcogH1Vk\r\nYjH6Fwg3dBYOiH/9JW7BbvTL0gFKDdDPYYy0Ld2hbdzY6kmxmBy2IGlehz9D\r\nV4dNSXqGz5waNxQbWd1FpPck+hWyGXlDeczAV199nlHgN2HTOgm395pTa2oO\r\ntXiAkAybQVLVUbOPDmKJspd9S0sdcCR6K2Urht58OISWp/EG/UcBS4bKnVI5\r\nfQWWx55aHqjQWHuJdIymsGeFAeOEZTGKumOt3AGf2wdpZPMOdbgjwylm2LWm\r\ngZ2gPUiyx9c9IYf1BHHPSd75uRUTC5xKtV7jpXow4Zh2sGZHdxBmaR7HrVnw\r\nLsoSGThYBexqPWmG2WJV/uaLcoFPjFCw+y2i7XSfNAhJY/IPm9dAot9pKCpN\r\nt7Mth+gXNBtsOIFFgGHhMw8eMhxpIF4fFwQ=\r\n=09Un\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230104111008-ea324e3.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/266d09cfad884237709a6e58b770e0a4/graphql-hive-client-0.22.0-alpha-20230104111008-ea324e3.tgz","_integrity":"sha512-v7tnpjI/SjDQ8QlOGUeWRAgslNw9AIw3TQFVkhWYVUk6qZxjkyvSztYhC6CzaPBWJFfZhn6zqrWO5C9BcEiZpg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230104111008-ea324e3_1672830642430_0.6055821098065988","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230104114353-ce099ee":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230104114353-ce099ee","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230104114353-ce099ee","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"be4a6204d628fc9ecf075ade21848c21a4bf985c","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230104114353-ce099ee.tgz","fileCount":60,"integrity":"sha512-MFlsPm70zFoC0CibiZYmyzo4KG8B/P/0uK6qjSl68h5mPehtoDCnJ4BV8u12+z2mYDAh8ua9cPhnBfRN+8flEw==","signatures":[{"sig":"MEYCIQDc6vlLPbfqKS120n0ma/JFpWPRY19C1PdBkAlYJy2MDwIhAOeZ2gN/X0DIuxipmFhxON8zVBdgAAU5KdmL/G2CCbGv","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtWabACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmrsxg/+Mcbq/uw3uszALIJCAn6oSTug/EmMrpQYniPi/VD2RhaPlX5Q\r\nWDDMWnO1B5PnxZ2MM99gFUfaSC6JPEEE9Z4GwdVicrOgHU6/zB6Equ2By+91\r\nvPOEqDSrb8lY85sxlepAfQDQPM3VoXd/JLKSoEcebLEwXIQ1j/ozEJjFxWyj\r\ntYJTG0BnuQgWw798fo9BxNoGRgIKBPJoCix5jdzFGbsg0qvNIq75GPeIYvlc\r\nNyatjx70uBSxTfFROyXkx7fTbJEnKcXD0P5W9nJZxVqb/IJHLroeVyM3KOmO\r\nak7Nh0YeA4Hk71zeU80hl5qQy+cA7DkK5U4258IcB1WWh/ggZK0v88DdQMLn\r\nlVc4f/aiCnpxgVoOTbpyiM2M9a/5t+GmBJnecCHzFPWhZTLANxf1W/XMJDEg\r\ny3SmB+AXfytyl5ttVAi7nloUx6hy8K/S8LkfdVGLKFeBBiDeI7+uiCcfN3Kg\r\nxNxibEJ9VG2F9am/V8IH9Ox/Xl/COt/7sKwTPULdL0Ip7oQDFPy3XQrw+Bp1\r\nnBHxWldVcN6+rjGzxl9+CsMwykDM34gL4LddcjV1XJ56Ep/h6apBVHzanjaw\r\nSGe4WBh3cpNfCyMM6e5zJ6u2enm7D5gZdewOHif1xROfr6iKqO5M9+KzHtUP\r\nt5fx/4Nr6lxU24XKAb0BKfRVzSns9ByPvhU=\r\n=JM61\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230104114353-ce099ee.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/34f1561e73bd704f7edacdee3b599ed1/graphql-hive-client-0.22.0-alpha-20230104114353-ce099ee.tgz","_integrity":"sha512-MFlsPm70zFoC0CibiZYmyzo4KG8B/P/0uK6qjSl68h5mPehtoDCnJ4BV8u12+z2mYDAh8ua9cPhnBfRN+8flEw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230104114353-ce099ee_1672832667451_0.28853216158692296","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230104143841-ea324e3":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230104143841-ea324e3","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230104143841-ea324e3","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"0b5e4cba4534d602f9c707b96ec6c7a59af39a33","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230104143841-ea324e3.tgz","fileCount":60,"integrity":"sha512-VQJf+pNXkC6wC1jMmjkS7j46gojx4QIF3lbNXOibrNSBYEUCEBw+abdSGJpgNBN81yNAvl2VTi1Ubrp4YMD+ow==","signatures":[{"sig":"MEUCIDBVeLZwI/qfPpKy0vrYqeuOvPn8qHN/ddvDwaXE+2jBAiEA+jtelAuU0eocBjXKkKslv3gTivNKA+YDcrUzcZsKZcc=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166123,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtY+ZACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr40w/9GnyW/CakUHAEcV3igV7Hp+WIx53p9Cks60JSm6c3lX3FnMQx\r\n1AVT7KILSSFSodtA1a/JiVWkwW7SrX4cKpMSVicUhoJOTrH78tr56e1BlLTZ\r\npRMw6+LJ5Y6siN0KEYRyvDUCm7WKIuhuzUBcZ2bwspGZo0cnCHnOP26TzoYW\r\nOuNURR3Y99hgzTTw9A3RXY+dcD7LBcFwyG3C9zyxdsfBS3WbySqK53jJcyQd\r\n6DSZUWpkXaymJm9nGOBmQ5MmojmrnKmbuBL1nXHmziYoYpQfOJ5SK//T5AwH\r\nEtHL2SWblf1Pi+jlGmBEpTw5Y5O5vmpwaMKhMiL1/Sx1zhJIhOpiDGxsQ4M2\r\nWD1w/YMFpJtEzfV6mTZnBUYOBLjLA2GQBHamqJSZLSGBlSuYxPFWFFB1O9//\r\nQGfPmjfqh9KKKtA3lUb5zYD801Rfe6oYTD5PfKsjaz4KIRYarmV6H6uCntw+\r\nNgUYizZ5uIgW9/TzCBa0ylVvXXZTTH5ro2CtNqCXjbA0CaTWdndklPHLrLJm\r\n8eLb75Re/lhgxnn9BaMYD1BDISg1hjlKTKEtONGKw0hCdCrXDvPQbaRfCw66\r\nB+cSO9gXwJfvRy/E4ELoEBqFvlwWOmwIlWvo8NGb+kHrUA0vfsnpfLmAslAf\r\nD/4zlh4D12qGRS8krgeHzKj6ISEnwCfJzpk=\r\n=8p/s\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230104143841-ea324e3.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/a2e6a8fce5b2c52504394a472af5e979/graphql-hive-client-0.22.0-alpha-20230104143841-ea324e3.tgz","_integrity":"sha512-VQJf+pNXkC6wC1jMmjkS7j46gojx4QIF3lbNXOibrNSBYEUCEBw+abdSGJpgNBN81yNAvl2VTi1Ubrp4YMD+ow==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230104143841-ea324e3_1672843161261_0.06297156709432139","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230104161513-4f4a02c":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230104161513-4f4a02c","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230104161513-4f4a02c","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"4cc13000eae8a0a006ef510cc6f23d9caa91eb01","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230104161513-4f4a02c.tgz","fileCount":60,"integrity":"sha512-/5ci5813p5Q0iuyyWw3x7FZGldB6g0kicCgZ3yulP0CAoAmjejIlGH0V/y3KNcq59jQ6hn96aB2givIGiYHNvg==","signatures":[{"sig":"MEUCIDSKQauK2Tz0hmHiGsatI9BCYh4mwSucP4NVRFk0dl8ZAiEA8CwkAMQOV0gM/JJlDWDA4ulZUS6xc4iQl1C7OriNjUs=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166123,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtaY1ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpDXQ/9FpZ+x8I6JkJnZJOVjQyPVjnMQyS8zLC0DrBXQP7axjU0N/Mr\r\nIXCOg27UMxiGxTtQORZR/LB/8WmDnbxxYqoKHDSFKaus3Jc/Zw9u6oh4EQac\r\nZabCCnxrEsl+3FilnB3TkJSgjeiqtwvciteMULBONUoZSMlDcDCxc/JeepLh\r\nPcZJmnmHzHJ9FG1i8dZ9HaJEAirvKArjUG2NWuD9kwBJtVhEko2OACKgZzZg\r\nWSAybOSWrN5vhw8wE746ehfTBjTMPWMFNoi/ysOtc2PTMGZqx8EW88lDl3qt\r\no6KSBVvRHvenpNiQpxzA75pluwtISWEGTp4PNjzVPQQpsYBvzG41wMIPapgT\r\nOrzoOq7AKfvs4VGFL4w8MGp3MNmUjKaMfLiGwiYVmJoNiRtfAg+HWFg8OhyO\r\nuyhvNlcYzULxMaWLieblqLRbxLeMDWFf3gTrtsiHvj41GaffRQUu6BIk7bBg\r\n/ZWIBbUwd3mHfSpiwL/YqJjhoorE6SQhbk/jhHIawbsZtuDYdgLMe6Y11MfP\r\nWjb2R9N5yab6gdG2XSeYNanlz7sOClNAHeBrfFxlgH4up4bAkerYPqD/Gc8r\r\nwNpcV8Db24naAo9iXojRExupUFcXlv9Q4R+6IWur2MO5Ac93Y8IrvLRhaiCh\r\nyq+Opld4ozNewfJ8nAWbIJElwJJdT1HG/Lo=\r\n=xVrx\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230104161513-4f4a02c.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/b0b44c82bdaf63b3392868ccbdfd4fae/graphql-hive-client-0.22.0-alpha-20230104161513-4f4a02c.tgz","_integrity":"sha512-/5ci5813p5Q0iuyyWw3x7FZGldB6g0kicCgZ3yulP0CAoAmjejIlGH0V/y3KNcq59jQ6hn96aB2givIGiYHNvg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230104161513-4f4a02c_1672848949207_0.9481328124044497","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230104170544-08d7883":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230104170544-08d7883","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230104170544-08d7883","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"b02653d8af26baf15bc1e4f5c129416afb75854f","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230104170544-08d7883.tgz","fileCount":60,"integrity":"sha512-BbxRb/gdl59E0ypmPJYhpG3fOOZU2YL0tpGnztmruZ9bcDsV08IxBMOpeCbMc3SryXiUIM6KRMCVaYtm2jTWqg==","signatures":[{"sig":"MEYCIQCJYwyuneCRWmi4x1FpT6TxA6JyyV0qNZVc7GZc6+gs6wIhAJtqtka12VhtR2EOQ30WkWv/4792uvBgmQUa0bQ9BE2f","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtbINACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoTbBAAj7JadCn4BYvYcfLOR3NEwrJgIVf4n1NOG+JQ40KaRaKrIK5w\r\nu+OhIDT0Bdu67qpVKHFAtAMG+mwpJ9fr6PTA6fqFdsmlc3e9TAHQcPvv7Zzh\r\n/+fMge0+I89SF1VYs0tbx+tgtiRvp1O8IAYbezfmHpAcSSI1XO2YlMVGPDSi\r\n7UBbq8F/sjqZ76cGn7V6MNpmTU2gMLq+oD/FehcGG4fZvEZ3cHjtn/n4TGk/\r\nXkj+Lr7j4rOvB/2MTpCyHIeUkRvTMaheqTMt0Y9kn+vecz01xEvXi06eUbtJ\r\n+gkeZgFkoiyPB2sazrGppiQesS3YaDwrsIVKp/YjiBVTBMVwquhb7Doi2lzE\r\nVuMQKbsXUbiK1CWUYihRca16kofedkjjYepykbyZOGX/3jkPpxdVbaQgkksJ\r\n0SMtGbKR+2HM5ZrYxbp3zPY5EDL4G3emEb8+Lgb7dOUTX22Psb1lM2lLSdTV\r\nyGM+SMiWMVSQZNI4m3TECMg9cEQ0M49OnhIALtE5DDunY8wDvIW74wqaYm92\r\nJN+lRoE/bsMVYjBPeLIF91WxeJpwjUmvAgP7dat0r9ftUWCssZa1DeznTJWe\r\nt1WlzeB1d0YyspXidx5zKHDKJLrANkIEb9DaW0tSNG30QTimxjtMlKWFA8oE\r\ngDsbCSt7omk5adQtpDQoDFndQ/iIJx5+l+A=\r\n=q762\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230104170544-08d7883.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/1a40b00cafb1f3cd8803e660eaad1822/graphql-hive-client-0.22.0-alpha-20230104170544-08d7883.tgz","_integrity":"sha512-BbxRb/gdl59E0ypmPJYhpG3fOOZU2YL0tpGnztmruZ9bcDsV08IxBMOpeCbMc3SryXiUIM6KRMCVaYtm2jTWqg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230104170544-08d7883_1672851981053_0.49464175502813945","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230104174800-953a3a6":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230104174800-953a3a6","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230104174800-953a3a6","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"38c9e68e0fbf276b999cbbf7f92e2af02e128a67","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230104174800-953a3a6.tgz","fileCount":60,"integrity":"sha512-3Et7R1ZmHsG6Qm6+620gfihUzmldLQVj2W5FkJ8JTHbt02ck0Er/RfjpshYl3KYquWEpeqHib8jU3vv1bDOmWQ==","signatures":[{"sig":"MEUCIQCdWcbMSB/siBvGZxg2KfihL0VXWFiH+EqeLTAtB2K1bQIgeI9Z3pTEV7iJSv0M56g3BS4rOZbPsIWZ92xr9PqQgug=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtbwAACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmot3Q//cFaim+Mxms26iDAyQkJ0TEo0WV4KVhY1513rATMgHtFV9seq\r\n4FGxjQyProkTl/7ozWkA2B9+lHETInACW2eODPwLkj56nfV73+6cLnxv/hPt\r\nCsm3ypIplyESNjeTt++PKAvtsmx0Y/H+V8cTrbIzS5VVCD8hIicV7cpshrGC\r\nfcrvhrjK4REV0+bxyzWHgqyIzq1cwd3KaXrl06a7hJpAngdmeQsqbc1pUsjx\r\n3tSCye00m4Xq/RpR/+r1UW+I7TPJxFlddo+xmVr2ZyUQmvUNq/2bBeGVTQi3\r\niGc0K1uhKxfmEL8lSjXCA0FxlyoDbca/rR2PSaFlpScYyXo5j41x2fpyGW/N\r\nhuTdz4XOPowrCdch1UIkrFKSzqedfLGgn/TlWJzACgge6peeZ57cHAAQlogR\r\n+qAjqty42kKSubFPGavWZjxogLJ2nKN4tG9PuefYU74IfUHadSJqmxrDSEgm\r\nofHcVxQbuCGMqqWmIUM+BYnEyp8vOxaxnx7yOKBnih+ek34M5+91f0VnZxyk\r\nbGaD2pGHYwhwFJT8Fv+UhMBotbqhVJ4pmG0aN6omdq05IBd3jPqr3m+PWjwE\r\na3ynwmQiBEPS5I8nAuCfqWyLolJrWZIkBhld/jTOm7Cnav/jtGInDDrLOPGh\r\n6GRsWhZFrjSoT0jFfF8hRZ+R6j+l3idhrYs=\r\n=Hfq6\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230104174800-953a3a6.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/d06479787b0cee47c9b4bbff1aa7ac3a/graphql-hive-client-0.22.0-alpha-20230104174800-953a3a6.tgz","_integrity":"sha512-3Et7R1ZmHsG6Qm6+620gfihUzmldLQVj2W5FkJ8JTHbt02ck0Er/RfjpshYl3KYquWEpeqHib8jU3vv1bDOmWQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230104174800-953a3a6_1672854528455_0.3336165610146329","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230104211015-359cce7":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230104211015-359cce7","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230104211015-359cce7","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"c4131b99d49b95494c6c9f3b5d5f2ba789e04af5","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230104211015-359cce7.tgz","fileCount":60,"integrity":"sha512-XOEtzm085vf3rRTqy6wK8YTIIaROSO/wjQ+b2zKYICWGnKJxRovYJIAVEmufelWwjUgMiyP+h4/LENjgOEZ5rA==","signatures":[{"sig":"MEUCIQC7x1MUU1N1Ol7sNVLl49BoDKdplX7UxfcSYBJeg2me7QIgPD9XIcBTMFv4EOmavHlRCHadYcBarxH44l+9CCJ7rU0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtetZACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpCRxAAndT2ahddyPbSWsyilLeQ4+XOJdwSUCJTTosVYQZcjzUSouhC\r\nJhJdwmAbH8XZbv5oX9pReW/ZIYTGSGaJOIZmnUa1CrfEbZyXEHQuHSJuobyK\r\nyZOgKtjLIAlEkhAa4BU+Ut8L8oWWx9a+UOK5z9Nhq1wK+npsTP5vzhWGBRc2\r\npp1yi8By0c4bHtIAvaUyW3GA7B7vlqse9ft5rin6jcu482DXTnRHJ4SzPakA\r\n4rOsFoO8LFL5TjprSbWmnhAvS4Lc1rI3rrvfIG9jQwq4uHibPdgMd2amFxU/\r\nldsyWSf/qkspcVAc1y3NmxttDtaQa7eFbKjXflao5MX+A37TV+DqacyZXIs+\r\noFj8IKKbxyo5HkmzFtH6Z2+0/si5U2L9pugzQwWZxn/xaFQdFvUxfohGpWDj\r\neGVkB4vrrt16x2QC0gPYQHZjTHkaOrwv+z0WrERdPXhV7DtnHjq6CbXkBgEF\r\n2XYjx60WGQRlbzYS8M1cWYJ+LVCE9ph+2LBdGBURH+r+9490eXsOJ8EAkLbD\r\nldF5U8LoQywqiYetUc9hvihE6YCVZnwVxfKzOJa48LITT8c8nypTt3mhdE8w\r\nm3LdhbAJ7qpp69zz/5yX7dxu/3uya3uF/oH6Pj2gfMyY2kE0+CBdObsj44SO\r\njb+tBoDzII4RugC4x4wChWLj2owYw0qfclQ=\r\n=nNDB\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230104211015-359cce7.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/6e65d7634d7a09f39ea8e7a8cfa1b721/graphql-hive-client-0.22.0-alpha-20230104211015-359cce7.tgz","_integrity":"sha512-XOEtzm085vf3rRTqy6wK8YTIIaROSO/wjQ+b2zKYICWGnKJxRovYJIAVEmufelWwjUgMiyP+h4/LENjgOEZ5rA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230104211015-359cce7_1672866649235_0.37643226987770095","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230104211529-24b3aa7":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230104211529-24b3aa7","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230104211529-24b3aa7","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"a640126717fcade99eaa1571376e5b204ab8a72c","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230104211529-24b3aa7.tgz","fileCount":60,"integrity":"sha512-pbMvmHwiHBz/i0hxO/mLVZ9hbTJn95DG40h8C5fco8dKP/IBYWHFxYmn9b2EqSWMcf9in8VR1xmsGEBAnQ6WrQ==","signatures":[{"sig":"MEQCIBKvzwegy9dVFq3E6AmZNNagkxjW+anSoDDQgejUxGmxAiA9bhRHQqA79FFFDs7Z97mdqDqNoK62cAj97Ztf5fRWJQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjteyUACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrIZg/9FP/kbo6rJFthCN3zoSnIZrYAeDNyBI4eV3e+RqW70fTNRMB2\r\nhcubRn9nmnA5K7pNyXlOEGcd6FMTF0gYvFzcJawyiJ6fmjXTf8sglunzbnjg\r\nWDQoJ0nsaXbaaBX8uPbKyZ1ElwP44772FTCkLY2/dPRFG2nvD6XHIfxLgSRU\r\n4ghfnX8eXT5KUAp5GwlFbS0TfG77XPRTy5SmE1rN6zhr/sg87b7dtAYpet/B\r\nXykvI7DKxw2Ge9Q2lGO+4Cy4qZZiHS613jfy5v/5qoJ9JwOch0jntc2rRpd5\r\nCdhty7xr0+k3F/VHN+ucu6o+Kp3vmahgPHSd8IDmRjK5Bebkg54hu83/Wb5F\r\nHUzka9U4opv9f0sIJHM8zP9Nj/1me1pyXIW0/K/vbF/NvHGPB3b6gI2nw5Eq\r\nyvCEvNG9/ZeD5G0hwyTELYCZqopW6YyU0PIX2EfqPLJuRC/d3b5/1AiQLbsn\r\nAT2+QDBDsKpW4b3cVvfe4/onH3o+vhd72wGC3UXGG8BUS1cMyJLGvb1GJINw\r\nk5RfUGtRwX9K6CT9/M4LlaZVTuZEj/QoAnXh8L8caxaKoEU0DfgG3s6ZV7RH\r\n50a1rOl8gkyrZn4eeEuBCDgutne4adLt2atAJJOORX/H1V64HMQk4l79pq6w\r\nFlVenKsnm5WuO/wIitYk02Nt8NFHs07Bggc=\r\n=nEd6\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230104211529-24b3aa7.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/eb3780a1ce6467a93df676f14f5f2b5d/graphql-hive-client-0.22.0-alpha-20230104211529-24b3aa7.tgz","_integrity":"sha512-pbMvmHwiHBz/i0hxO/mLVZ9hbTJn95DG40h8C5fco8dKP/IBYWHFxYmn9b2EqSWMcf9in8VR1xmsGEBAnQ6WrQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230104211529-24b3aa7_1672866964153_0.23527651858979004","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230105100628-48608f6":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230105100628-48608f6","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230105100628-48608f6","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"18558df4efc49220979cfdcc8653a7a5686f7434","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230105100628-48608f6.tgz","fileCount":60,"integrity":"sha512-zPKE0dW36EsPf5EN2qfKo2f0BXWIAUv/MkSJ5hZ04LoMYxz3sHldYGnXEL086GYr49N0nraQmdSchc9E4MZbrw==","signatures":[{"sig":"MEUCIHSw34fkbp/655NidosTq5suN9Ozzvnd0x2gEwbY74liAiEA9UTNh3KLV8mLX/ONmGR4VAdrb/cJXqMwx/W0r1Rc5P0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtqFIACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqkvA/+P/zH6dFhIq4Qcfl/7GhW1DH0vlSJKjfFcp4tR56hGXh7UQG2\r\ne0X8JLDQmQ0f94y9Mkwx72XZJEfuL1bntuUwWJjzEwSL4ZUvFvR0h1rBu2sT\r\n+HhNvzAdskKef0DiohGRbNXSTdssYiostJNWZ5fIG3tYVMpTNJl62TfbJLlb\r\ncByBFrwcJdEo7iJVRerN17qpayXFsw1bxBlouXA0NYxVgLdQYRTZUg+bJq+9\r\nsNSHPKJV8BrTB4bSkInLtX/52XU/df9pnApXYX/IL8yHjrNQYsogJMVGOgVl\r\nkETFiW63lzml7nVo6yoHtGNV9mA05T2Y3wRg+p47ZJ12kod75iN7DEDnthmD\r\nEgHu4cW7QUH7xojhvVydmtiKBhcC7Ndip68cePlhgbTgy2BM7pl9kG9i5VOk\r\nMtXqChx1EBgqn3t5GG6PBL6ysywjIeEAht4ZExgALgF/Io/McjNEW6y432+K\r\nhhM8Z2Wj+73ypT5PIvKFgA/jIHCEE1i/O87Q5LV6LSuglBITplWKRJSsXuHH\r\nJjOInwZLaEaP80GcXICf0wvVCKYFcGNdX5jDbHXp2yqgtFtNDPmNk4FdvsmV\r\ngXbs7v2OkVU+z/OXTL2W1kl2lAlBBFyUa5HdvUWCprqpbpzZNFtSht9AAFiN\r\nk2vjLulPMClSXsDvoZJr9b9g/5D1ZoTGUb4=\r\n=TuZz\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230105100628-48608f6.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/84dbaa4c5304d45df38cca36ed907836/graphql-hive-client-0.22.0-alpha-20230105100628-48608f6.tgz","_integrity":"sha512-zPKE0dW36EsPf5EN2qfKo2f0BXWIAUv/MkSJ5hZ04LoMYxz3sHldYGnXEL086GYr49N0nraQmdSchc9E4MZbrw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230105100628-48608f6_1672913224149_0.9332006344365265","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230105101153-0d1afc6":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230105101153-0d1afc6","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230105101153-0d1afc6","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"6cea4eaa6daac845d4c52a1d539cce17472ae76f","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230105101153-0d1afc6.tgz","fileCount":60,"integrity":"sha512-X4exPJCcEABkTVq3wMzKrhC/+yfvP1y3rgZOcScAf/RY8vuN6Ql7xVAoe80EFBW1uP1nQjAaosjiYHyW32I/hg==","signatures":[{"sig":"MEYCIQDAQHtpjLrsDWHzlNiwwxFch5K66isEQkvcOAcXcy2pCgIhAK3IzVY/Ky2LCuZ5I1q5lXIprn4l/N5cMm3F03uOnbA4","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtqKLACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmpq9g/9F8cGyxeb93kBwOsR1vx5NZdkx/yK98V1fCpwDHlJaev9XEvA\r\nuEjoxm06vaHOBPlYligrJR8SEV3JwQvXtoCAZ9dvo5cYE+9FvDeQoqoeieRG\r\n0mGd64IxC1eiZ0Oqj49TTdFCuzYIZJLQZPzr0+RZWI7NNKs1cyx5EWSNJGDQ\r\nSLXjgFOxRM/ePfyu/nOvhlcTGbiiJGTJcmOedStIpUuXjvdWWxke7cOjKi0i\r\ncF3Vyak4UQhXseme0EVYGRbi4KD+T2PCOw3SybM4Cqdo9LKKLhXTBDwXgoIm\r\nrxcOUCS0Kd4XUFQOVNXIAUGTub8lFyusS3k0iYTep8pVj4q4c74Av4DK7Ft+\r\n5SoIDjDKB7eYIE+vvcGXMWkukVfHHrux4mBPUH5LJV5RVfEISSaztm5rIpU4\r\nKTYXBjlJmYJMRgn0QrQKG079PMVW0xPjQT9HXo1Io5qSZWKM2U7lXIv6QpRP\r\nx6aSFeJ6BiWJyzNREYS72n0i39mA3mpKu4uEdlIsVZdWuyN9qDuyuFDS/2sG\r\nhw3I3LObIAUlYepauH40huh3tZF4Jo0c1ZML5G5wuIXPCHKn+H1ygfLUJ0jr\r\nhmdlTfbrNjd6xjqHSNzq6qXLz7oAIQ3fow+gn/34/iLk4Xab+wWVzEj1gKWJ\r\nHFbDy/T0T/ON226HSy9H5fRr/HHLYqyZ93g=\r\n=alvY\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230105101153-0d1afc6.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/0e1e4c5e00f98e8a84fd66ff5f905f69/graphql-hive-client-0.22.0-alpha-20230105101153-0d1afc6.tgz","_integrity":"sha512-X4exPJCcEABkTVq3wMzKrhC/+yfvP1y3rgZOcScAf/RY8vuN6Ql7xVAoe80EFBW1uP1nQjAaosjiYHyW32I/hg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230105101153-0d1afc6_1672913546761_0.01483273059521606","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230105103324-3051862":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230105103324-3051862","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230105103324-3051862","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"309fc840217ca2a682e52ce26dcf13a74b60d258","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230105103324-3051862.tgz","fileCount":60,"integrity":"sha512-tRRP/ReyvWuTQk6LrElDaod3hFYkzBpcFohZX9KF1Eh+zLJctvC+zLiy6GPnyeozLoBOPrAYwHHKFOgmyYgvJA==","signatures":[{"sig":"MEUCIQDk9ktvGWDcijn8+I7codZLJ6FQidYZIeXM3KewBJBb7gIgLMNNF6hHN6Yqh+MdmS9ZpdxEkRnIvtTXPPdMBPTJf9U=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166123,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtqeVACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr/uRAAks+L0Pww2hYeIpp3qUbJGvlkwzFjLa2d9HHc3LV6b0MqoUqj\r\nJZRjx4JIU9cT66aj5puUZ28hBK1K8NWWa3L+pvrxhKczHQEHctBaVOu5gdTe\r\ngVSaeHiIKmBlLDyoKev9V987HtBDwj803O0QAw35+GIh0Uaui51MAeHGWZ6w\r\ngq/Gwqd466UfqW78x+WUnzuA4ybDIYvCoWIz79Z2VsTu+dmPr5BE9AN4qdY3\r\n1+So3VVYbVGrc3QkTHXhq9IYch9ZV6SDVo0oVln+NboAECj7QSbkD0UvW/fU\r\nykUzyL9eBYMEd9UDHm1hPV7TIcRMqoNBBW9MqLWeIZteROZMYMyL1EEjnxPo\r\nV6EiQt9BvXQANwKeBgBHpXP7BLTPO2SonPY7lmnm267iuHQ+g2PikB8mSq5y\r\nrDWQGhxf0Dxe1gXuehtrOioJHR4xMS6/tTcELjfdZ1PbHu2leOOESOd4Gk3d\r\niM+o7webW/F1wdasEwhriMYkfThVRRe0Xi+Q2p6+3IjEz9XIxlGQcDX9NDIM\r\ncPACJqOJsw0wOXYpkzNBTZz9z0x68UcfSc1XYwz/5tiJvGaKP9h+zCRq2A+N\r\n62FbwetFWGKWhdjsh1ejbrDnz/pGcT4hAmQS+9ImIyQbEuU+T4xs3C32lN+T\r\nG5aws3z4U5iDSkRRe6KPj0qQApSWCCnfQDY=\r\n=cBeE\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230105103324-3051862.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/6cf57905213d88ca0e123db166a4b717/graphql-hive-client-0.22.0-alpha-20230105103324-3051862.tgz","_integrity":"sha512-tRRP/ReyvWuTQk6LrElDaod3hFYkzBpcFohZX9KF1Eh+zLJctvC+zLiy6GPnyeozLoBOPrAYwHHKFOgmyYgvJA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230105103324-3051862_1672914837230_0.5002691049016508","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230105103712-1fc87a5":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230105103712-1fc87a5","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230105103712-1fc87a5","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"7c4caa92ad10ebf3f31aa06f72721d413ce1a380","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230105103712-1fc87a5.tgz","fileCount":60,"integrity":"sha512-0rDq/laidtRoj0hLrsI5r18afBJqB6PAGW9x2ssaV3K7Z28GeHu8/M+FJgpyv2i9ctpn31grXrSpuDmmqKfP7g==","signatures":[{"sig":"MEYCIQCmF92Hlnu9EbZ7wIwfG17YTQ1qhEkkqVZWRhILc/Pf1wIhAP1ys3INd5AnYAVLA0hA00Y6yDQtNN8ngk1YxDERyIpF","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtqh6ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpmHRAAgg504bGNwIhl7XRUohCS/+8C094LrLA2BxhldtkeM7pydcw2\r\nwWdljtyebgVYMrezNlDbF3/jkmmmCLtX+z0HeDSgyr/KLYgG48wEqSfZJV6P\r\nNIe2zJ16hcF4jZrHI82zzZCzUKeB3IDCJXzfQld7qkS440jkzKPHe51st4D7\r\n82CM7OMV5WgM6S/F4VySRavrvReSdIvFSPCKi3ugiOR/uB0gtgrnwLMaGtzQ\r\nn61I9wKCA63cG+80QfLX5DqX49UqCRoN21vDXZ/WgiT82LazJj4MDuOmkFyf\r\n06O5DofCTdzle5+2NR16NOKtQL/9eEa8by+fxBHN5v/vzIwJ7nRcH7yMpPBJ\r\n/OQqY5nuEmf6rPIokYHVTP+/O31Y96/3GMweTJ/dG74SOjzWFrZut/kW8eN0\r\nrJaKXSa2Z9JqEp8tBW1HQag9HKL/u1VTHpM0Fw0x6WVr5jCJviW2whkVyMD9\r\nHJZppQ68tHcnBBEU9+aRNtsltmX7hSh8jk7pZ7/9rDXocirgiYNxLUFBsDeo\r\n+G+NUYEPhc1EJWjQFEL1etf966FDIapqCvch2Os1vvtY4cX1xD9flrGGLBZ0\r\nklHcs1tVIGAJ+PFr0NC4LvkJ6BbKruejgZKS5REgkn2PvPjMjBu6DEbya1JQ\r\nLqHltvtU/Zx9OD+UBlP3+wu+zYCeCAWy0P4=\r\n=h79g\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230105103712-1fc87a5.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/ece8309722e69d6b6582a67a3f0bbbb4/graphql-hive-client-0.22.0-alpha-20230105103712-1fc87a5.tgz","_integrity":"sha512-0rDq/laidtRoj0hLrsI5r18afBJqB6PAGW9x2ssaV3K7Z28GeHu8/M+FJgpyv2i9ctpn31grXrSpuDmmqKfP7g==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230105103712-1fc87a5_1672915066616_0.3284156425486766","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230105104248-33e492b":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230105104248-33e492b","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230105104248-33e492b","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"c2fb2845973f639d360fc87b8a0da8b925addd60","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230105104248-33e492b.tgz","fileCount":60,"integrity":"sha512-lQnI9SNPlsloi+waavgvZtZ8S4Q6nxIyk4bY409YDLcEZwzOOxdjsY4CKKy9EfRM3HfY7TJqVPZkmjsXfTdanA==","signatures":[{"sig":"MEYCIQCo2e+CIjoApgFo0K/CeMFF8u5UGLZrfBGOyYoJ6C5hcQIhANM7NNzU1btsVMUtKSG2vjVVVgNp7h14RNKsTLcRiUq/","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtqnZACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqHYg//YDfTc8X1S6ARrzFyxD4FS5gGDfZ3FAnROw3MYrAvp3n7Y16q\r\nVl2pZ3on1eygK1m1m5XOsVAvDOPwXvM9auPWfdXrgkZV528oN0eiSXDhjL/o\r\napYPG48B275J5oQMapXwbfxRHbfjPU9D9vDtJtU1vn0HLEE6UG3/W/FLhTPN\r\nFkvNI6VBisSCFq+OetTJmmAkPKyF4Gyas2J8Q6DB+7P0qlIZmkLBlHibxTos\r\nht5wrFL9WKEfskV/d/B19pVomJNHucM1sL7SXPUlYdIH7vanFWVre08WGOqj\r\nr+t9ot/+JJ48ZiunQtAeD57bGMKuhYxw/607o0L/3BwkSQgE4BNC4vb3rTW/\r\nncUOhHm7IMACAGRyiJlRO+Lkd9cbgpzC66AA8kDqI2rZzNZd9dmDmyRXbQCn\r\nPzJZZcLnFtUip1Q4bMGQ58kleum1wfVixqca2TVjprAGVohRfoR6hegeOd+C\r\nTAoGdlMg2GLtVJ6hbeoAz3eKCGA6nlrjiiMQbVIDYGRV4GgK/7OtmXwYlgvv\r\nLdbhNi14GdZdFxxc7RGMPMnR4yEvQ++yH2G3CGdGTYxoKugT2DNToxqDn62x\r\ntF2gc8SjF6dPK7Lkm+uN2e+vNgndaD0sOlrRJoOot9v2aVZRwHiItF1kcY0X\r\nl1Rd96804M7JPWcEQrCMxHwRHJUIi6ANtpQ=\r\n=NQ//\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230105104248-33e492b.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/6eda2093e29a9306a7e1944885faaa1d/graphql-hive-client-0.22.0-alpha-20230105104248-33e492b.tgz","_integrity":"sha512-lQnI9SNPlsloi+waavgvZtZ8S4Q6nxIyk4bY409YDLcEZwzOOxdjsY4CKKy9EfRM3HfY7TJqVPZkmjsXfTdanA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230105104248-33e492b_1672915417812_0.56370069418192","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230105104412-cf981aa":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230105104412-cf981aa","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230105104412-cf981aa","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"62bb1291d391ce0c969a409b3192fd9b48bd9a21","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230105104412-cf981aa.tgz","fileCount":60,"integrity":"sha512-Kxo4stQW+0R1h1Zk1W/srqOXEr5eNhaHoBNT92FXorrF0ICkVvESuHGpJWQ7DklX+gj+OS19hbeS2xprZOSgDA==","signatures":[{"sig":"MEUCIQCGgvsKWwbhC54uMB4LDcG5mRSzdpYAoRNUU+anPvA0SwIgcwHtr5GJV6j2prH1Bm5F1ViCK1Py8peeRpB4L03j7xM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtqofACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpbvBAAjbcoNWei6EoiD2Gx8w7l0LD3X7iW8Z8+eOfIAO5qGK1GxQaP\r\nTHetc5Idokq2cVhijuUB1roebmvhLyncj+O4FWpqc7jog97XZOj/GbIEh3Pb\r\nBqmfhjTN8/08ONdJJY2qiJmAhZ5KRmFFC2rsBniMNG7YJPS1RcaPEI2zghvg\r\ndzrUWI58FZmgt6MCwleS/HDiFyBuz1m8w3nsyZJcIc7ti/j5eAH+h+gdDqAS\r\nrja5BMUwwea/6IDC6bMHDPOldhvkDjGrVVSb6eybCv4NvmH57W6K5CHH5+p3\r\nayswjZ3k48c8pO0FqfkH3/4FIyI5u/jtLat9mKRTLYE+nAjN1F19HSe8ibx+\r\ncFJk25EQlb1gKz5yc5+P8GYFWW90P9mFvLFbGH/O6cPfUR9lCTVMmgmXm9ej\r\n7oDxoP/8rLrvyAHxx+RHZSN0ZofnzurVTSAfvlfhz0IQKtLN0YfubiMGkDOf\r\nU2AZmGOhn5uUSGmX9HZk6uYmCnX5TaEZnWub+8vpR71Yig4nREf7vBSjfBV6\r\nbNSDUM+8gEp2X1ZZfDpIhJP85KDdqgomFwRZYPsHd2bNoOQQVj6uvEpJXfaQ\r\ntSkCv76VlThoV7C92M+2/eQJe9hlvoDUwdcJIpA0pIXsbOieRSAqk13sDB08\r\nqD5qu35neRDHNhThMk+ZNSzVGtfCCrrwExE=\r\n=pT9p\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230105104412-cf981aa.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/8da7106805225ac88dfb9f30498ed074/graphql-hive-client-0.22.0-alpha-20230105104412-cf981aa.tgz","_integrity":"sha512-Kxo4stQW+0R1h1Zk1W/srqOXEr5eNhaHoBNT92FXorrF0ICkVvESuHGpJWQ7DklX+gj+OS19hbeS2xprZOSgDA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230105104412-cf981aa_1672915487357_0.04328539976089729","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230105104853-5e1b518":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230105104853-5e1b518","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230105104853-5e1b518","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"6f12b565eba1debe7f0ed66d053951e9170422b1","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230105104853-5e1b518.tgz","fileCount":60,"integrity":"sha512-QDKCFCyA2XjEN+5NMwJ4GWr+YsD7MUMkzCGNrn+IP52tlIzZKW57mpkZxH3x9nPit7NmpKW7VDUwqfDIxO+2dg==","signatures":[{"sig":"MEQCIBjt9dI/79RU07zDoaQah7JY4RPRLm+rNIc6RHl72SJGAiBTuxQl084Sfmg6E8jVzO7C3wSqnnfWBE0OUG/vlF7pMQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtqs6ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmojnhAAgrdFyUl+ybNx8AKMWwa7//vS/8PjTQaI4PbcXvMnO6DRIOiu\r\nM/RVewPFQquvwBmCM3ZktSnmVkKFIvGA1OF+OVHfQraRiyGWbdaWQS9T6+7l\r\n/w/aBtbGUGHCGTb65sDNx3ALgUFSKgER6LvSbHVC80eNocB56oSqLhUGnvhI\r\nYUK1oqozOw7tZbv7HelOIeRMqxNRRyjqC4Bs9qALbRuOX0wKtoRR4SfR9pLY\r\nnq4K53uYSH2LouHeUbxz7RujIQYJW/DWPYxczg2PBqB7+QUk2HUX7U3HDG0D\r\nF3tOgBmQjXEFqpxktqJ0kr1hlVA9lcavXZ171Me578wnCiZVeWC+VVABGsCZ\r\nKRr2h3AWQzMzuBGZK4xwFYEm/mHvuFDRYjhU/852B46hA7/Zoa+0dG/tbN3N\r\nTmAfLJ0EsYQgk/DW/QRwCOqHb4pB3zZbEhPjY0LCvgr7cYiqS75vHmxVCBYS\r\nAXSGlEo1p2tcPK4CVAtbVbb5yrj5dUulqB5+Oqm0jksU9iG/qqtMDTW0O+Cq\r\nMnQMKpx9xUAiVDxl2MR+8cr0Hyox1idLMb478FkvOWxF1ezZjV0znTyDxREX\r\nU7fsCQInMSTl+/A1HZN6hJ1PmDBm71IS/YfJSxsWadY4TPKJnCxUqH6STfhF\r\nnJzphpNjmWcY0sdgB/1Rf172RhBk768/B6c=\r\n=MAeA\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230105104853-5e1b518.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/d2d7d4babc08abb3c87f36bc9a2e0645/graphql-hive-client-0.22.0-alpha-20230105104853-5e1b518.tgz","_integrity":"sha512-QDKCFCyA2XjEN+5NMwJ4GWr+YsD7MUMkzCGNrn+IP52tlIzZKW57mpkZxH3x9nPit7NmpKW7VDUwqfDIxO+2dg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230105104853-5e1b518_1672915769959_0.22646225780357865","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230105105406-cbfd269":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230105105406-cbfd269","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230105105406-cbfd269","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"acf63c17703a3df7b05699169398c2c1495b214d","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230105105406-cbfd269.tgz","fileCount":60,"integrity":"sha512-qCuJOulch7ApzAoQrlPFs57Y53bh4NoqmHl8zdVDgYI5P9ZfFZKOcjpwSMeyOs7SGjWyCQGtiQZMD88yj6t89g==","signatures":[{"sig":"MEUCIEA8tbhk9ScaxeexMACvbfb8WPEDNSsQcKqeQoiEHIlQAiEAvrOS2346stk48j4vJ78eufxAA3EAfE5IVEAhmdGwCOc=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtqxzACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqYUQ//f4lb1WoG6sMn/a5CZeUMjTQ9Zg5NNa0f7CYkVI8JoL50tqxF\r\n8Z/psheUH96ARmsuonIBnXTZQwqbIaN9anDChVJOx+e2/UywDm4uw/FXHcUG\r\nBTiDUjsJNokxz6xdDzMCNA/PABUepTnTExMNB8BMHToHybZmpKWcsBd5UpcZ\r\nnTKhrdiZm6yWOdb+mApby1vpxOo9dbYh9GMTNpjz9w36fDngmV69X2VPZR+9\r\niTHNS3jWl88MunD3pXq5g2359YyXuoRK9XOMOHyY9lW/nWFKfJ01W6dnFlO0\r\nqCvaeUwmeFv1kFD43jVyobQMvfzOvUjq9T3cpvT5FjPzENjjDrtocrNcRS7m\r\nwEslsK8x+7BxmY8N5NCdR84cw9xrVIOQ0dxbyfUZHHQHuWXjoeFaMS1D2Id2\r\nQxYvylGKUF6AzlVZkQ+OY4UQkVm1yA09cbgLvJg8BWyb5qMxpPAQhzP8YFid\r\nQZ3fcQiaFiItPT92nvDsPEcOcX9kGIpxa4bOpG2IYLoPGneGOCIoqSvsL3xe\r\nm3sovz2pBXC9hrk4OcQI/FNPukVfZD1oLa7LvioOoeAMoRpIzJDjPG+TdES/\r\nYnyrrgvEeFvaDOMrs/KKEjrnogz/XxbmmtgHmNi17LaxyPVqkQwyrZ9zBHkI\r\nBqm/pIsAsn7lqe4KnrIVwZllgoGRv/Q/WpM=\r\n=6HW1\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230105105406-cbfd269.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/ebdf3d641938347de618c289d117ccc0/graphql-hive-client-0.22.0-alpha-20230105105406-cbfd269.tgz","_integrity":"sha512-qCuJOulch7ApzAoQrlPFs57Y53bh4NoqmHl8zdVDgYI5P9ZfFZKOcjpwSMeyOs7SGjWyCQGtiQZMD88yj6t89g==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230105105406-cbfd269_1672916083012_0.3365503663411282","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230105105854-730e80f":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230105105854-730e80f","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230105105854-730e80f","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"5680c1c573e7f080c4554518e1997c3b7b53dfa4","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230105105854-730e80f.tgz","fileCount":60,"integrity":"sha512-+bG/Bupjs3RTWguLOnhakUb4Q8WRMVq/yRyWWSjOdft8+ivebx7Bb8MgnZQDUjIxugqGBHhODzvL7tAzoCl+2Q==","signatures":[{"sig":"MEYCIQDOqJ3OhQboNnfbFimig3Ws66JiEsFCNXT5Nlox16Fp6wIhANnjzr0Lqo+Eg5AvqFggPgX5t2o5TYsm96DUAh1qfJ/E","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtq2QACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrdwA/7BY2G5XZssOILS6ZAsWQy69hs7i453y/cWiyFYRqgvDSLXTlD\r\nUklw64rNu3VNJCnVD8dwIJyb+lfS/hDw4YMZyUK/7gNxgp6EzpKhbERYs53/\r\nVozaJ+kpKhIt7VSIfmcYgYdD/QMsALtr339Qeu69lZI7q5HrdudD6FSlvSOx\r\n0HGf95Bi2nwDxHFJ6oa0ctQdxJ2X6Oedv5eu/lL/V4eYU2lu3U0oqlFrMVF/\r\nGAPwww4lRuHHpsYnBZ3ds1MB/dqfNEh4Bxwx/Em/v016R5bqSdChkZZznJhd\r\ns1QTKTmCuKP1Kb9NOw+dhanf1eEWPYsWsdSE+5Bz64MSsMrfYHMDZz4TsyDk\r\nqZbKXP4bjahj6KYc3ZVaNl2E6mT41xEixw0ysrWK3R6TcNKjCl5JbBpQXvCY\r\nXhNvFOuUcD+V6VUw+3OkmR7j8w1RSM0mPDA2drmhT2zAKJ2hT5E2YAuHFJyH\r\nxlRIk3PEXmtYADKpksGYBTvNblm79HsaUdofVdP0BVjRWw9ydWNz7b+uws2I\r\nmH7O++K12NVDoleMZbEgo9z5hxYeg6FNy2VeEWYz8PBXW0ROp8oZUWHkmHK7\r\nkxYVTeTM9GRmzVd8WJPdWK2VRwrFmXLGO5Ur314RjXOH4Vjega3DW7p6i56r\r\nqBBzY5KvmVq8q3rHARtM7rbo95cFKpilEs8=\r\n=/I3j\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230105105854-730e80f.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/ebddcdda5d3c93317d3667562dbb6145/graphql-hive-client-0.22.0-alpha-20230105105854-730e80f.tgz","_integrity":"sha512-+bG/Bupjs3RTWguLOnhakUb4Q8WRMVq/yRyWWSjOdft8+ivebx7Bb8MgnZQDUjIxugqGBHhODzvL7tAzoCl+2Q==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230105105854-730e80f_1672916368654_0.17377533692189684","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230105110356-cbeba4d":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230105110356-cbeba4d","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230105110356-cbeba4d","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"5bd13a22e42e5d9240d83f708a31414604b01f1d","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230105110356-cbeba4d.tgz","fileCount":60,"integrity":"sha512-eesXebjzVdX6jt7+1dhSFYc25OMHXNwZfIbT4ZqH4r2WRbgTkFrQz7ES4KBM2Pn8kWlvLr9OHIJzZ69nh0CxMw==","signatures":[{"sig":"MEUCIDcztewrL+uvcKy7UXvIIu8jNk53AnMVQNNLb2hyAseYAiEAtix5wK/VRNi9ZjlCrJtfdBGV+/LXegn83AaEkj7kdmo=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtq6/ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqqiA/+M3FsD+ez45i2pKg2e4ugC+/wjRRYqPiUV2NfT9xHz2gOJ1D1\r\nb5wWFhAQhXX7/UQ4xCAxBQhhmM1+VwePSUoReOEi9wGPEIe5JwpD1LhjKZlg\r\nobVF5AIPwtO3k1NrNbx5uQUdMQBAHi63SMvn+RT8sp2eLjxvF3RkImo+Pdaa\r\nJ7l+LFZOMWOAj5+DR7mCvAOZxmcwhzsQojjD3x5u7T/Y+4jmqyZ0yUZPVlQf\r\nwUhlKEV4B57JTObkhJ7URRufxPrldJeqpcA/SGcKSQETy2YErSxmixhpXQwS\r\nfjjruAaTrNx4bdDb3GSGQY3uScJo5rzMkaANNMY0l9iq9AFbuGTTZOw4spwY\r\nE1YiUbyfp0VMMiAiyjfHQIULKbp73WspPRQi/jqV0gmFu+iV+V0BFJlw4r6j\r\nIq2xR2UFgC99W3O9cafoxrdsqNxNCMtlanhtwi4mvQuESOXqRqqPh9zkdet9\r\nybU4PtN9HdkPBbAAJbJOje8JMtRG4023+7je+0zHFSHwayxvkC1DfP4CO4Bq\r\nOEU3ZPKwoXQ5+DNkvQwWMcLW3HjmH0y1ub0n22XkwVq9XdjVoZEiiMT2l+1p\r\nYNBRkdEVHpVVD8fDJO5JT5fHCvEWSenc1Kwp00r5CQkG4FpShXSrNXR//+Ay\r\ntqq90ELv4pl65OnnJSd790L9LgUOYczm1CE=\r\n=Vghy\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230105110356-cbeba4d.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/5a806b3e2f287df8c7d1f19e88e32cfc/graphql-hive-client-0.22.0-alpha-20230105110356-cbeba4d.tgz","_integrity":"sha512-eesXebjzVdX6jt7+1dhSFYc25OMHXNwZfIbT4ZqH4r2WRbgTkFrQz7ES4KBM2Pn8kWlvLr9OHIJzZ69nh0CxMw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230105110356-cbeba4d_1672916671014_0.9999764809276865","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230105111439-df0825b":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230105111439-df0825b","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230105111439-df0825b","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"b4a8e6a5a25042e22d41660bb4bdfaca6c71a365","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230105111439-df0825b.tgz","fileCount":60,"integrity":"sha512-ifG9cB1RNYXi7B+XfshT4UTl2D8ACCdZ2ksgK4VWYYWNlcxB1f1PNIgXUyRaPS4OQsTPnbeUo7m6E8JJ+A1h9A==","signatures":[{"sig":"MEYCIQDgXCroOu7dmB03dNgO2sg03PrMFneQ3wl/WHlHnyCncwIhALWPCKksw9JrAnHbDAydGx/sNfftCptGq/2K5Jm2SZWm","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtrFLACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqjDxAAnO7NzUw8xg+o41FNem10uBnkQgZOEWq7aQdZ0pxUKzZFBpgV\r\nLhPbZ2Ua9cHbMDO0sUAJS+SDnkB/OaopOYsinbEVSIuwSFAFqzm8VEZPqI9b\r\nTG+2BAL2vM3j9ml+6A+38g8rHSJEuQMb/JUbjMVJi2W4zLfI6NQr/X2oQu2M\r\nnexV+QZigyIT1YyeT+U3fCgbAZFd9weY2PklrQb1uUITwhTG/AuQig40TJDA\r\nfhb7WRvLyralUFT4X4YrFdo220juN7D73k9B0U4Fydoem79UB/5vx++P/vZ8\r\n14FByVMDRZxozP8RzlGVFSjbloSsKqEeMvdySRSE/kuK8wM0oHBtK2uw2Hiz\r\nEKifdGVyLtNpclQ+lpen5AiBnTlMH6QdiYwqpC81r6BIHbBRCR6V61ZFIpJQ\r\nCW1e4MvaMVQambFlcOhRGBPujj3vERcK1BvO9ZUMuIdPXg2TMuFojM+rkfeE\r\ndCS4aXVRDKxjWFiqufhRWIef98lCs7Bm2M8Mkw3PHwaxIKU/ujhec5Tlks5J\r\ndQUIG9g447SbGaaBxfaP7db+0JrGzrELec9v4TidZsoRO8db7LwRiOrr9LW3\r\n4BR/Og5fLoXN8bRjyiT+V6Ic7FJ/z0DJDSzadMsfL1gRYJlIWSnx3KDCisgd\r\nvuhgLZU+6r2U8P6Fe2iJjZB6B1bI9eI4oNo=\r\n=c/Aq\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230105111439-df0825b.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/36edd0eab9ee77c87dfc19e43486b3bb/graphql-hive-client-0.22.0-alpha-20230105111439-df0825b.tgz","_integrity":"sha512-ifG9cB1RNYXi7B+XfshT4UTl2D8ACCdZ2ksgK4VWYYWNlcxB1f1PNIgXUyRaPS4OQsTPnbeUo7m6E8JJ+A1h9A==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230105111439-df0825b_1672917322975_0.16847958534161478","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230105111457-8fdca5e":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230105111457-8fdca5e","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230105111457-8fdca5e","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"e6078e709fdbecaafacee265df0e91851fbd1969","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230105111457-8fdca5e.tgz","fileCount":60,"integrity":"sha512-mnAw6t15wJtlDEdzIQYbluQoLmVTElexAnOaGdX8t7DPWnKeEV0HM8beA0RE5MsV3vYMdZaiVnWLzTS1AkBL0Q==","signatures":[{"sig":"MEUCIAeQNF14l3g0DBXqMuue+NXOL9qMokeUEC6N/F9d1Mq5AiEAzW3/2ahjAfEl7trYKhY0+EZd4OeFF0fJh6rXvHdo//U=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtrFTACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrWtw//UNMG8yQiBYY0gE3UboTLwFljmvEyFTSA80yrarrurFvRw+tl\r\nMivwizydP7gcG9Th0ZcR12UWgjXMuJ3f1jlvKcD4UGeQkLp0AdwpM42ykMb5\r\nrRkZ1/Q2Jm9kZzOMnaRPaT7b27rd0D8hc8Kq/FZSTRoaFiRj2bc5FyT6Fhh2\r\nCQ5AxLORC7ZUVf4gJPf1ftKG/LcBTJBgJopDIWZhINxIJs9+0LoXHHva3I90\r\n2XrWRO2kzqr0zy5jaxdyTSW8P2VsCX1MrewD3kSbTy/L4Pz8eTq3tswVozDG\r\nDkGwWzDUZxXnN+A91psFP2MojFPKZrFmby+XocT8SFp53IFMjp8x+qEtmhIE\r\noRuZ/YatLl1jnwBEcTAZx17W5nuvGycfywNVf3uuIwXYjNf2/J06+RONN3qC\r\nrb+HyVWpaUYg7Tg6CWmr4KXcD2ids5C2D1BfZ8LTV1REwzpOkL6ukSkWQc6I\r\nR31EJwf1/Pi1K9oYkuXl+QS2JTUnduHMYyMmZOPUQnwQHAa9HrY3032Ft6od\r\n900VDL0QsqVD4Wzt0eCnEvayGDHK+8I1h0oPdwybjghoyi44q3ZEzTFSGwAS\r\nTR91s3HEDJeQUBZEkJLOdAiGWGPHCZcDRX00fZbl4eucYPEjIhH9NNCXJf+k\r\npYXlg00m7GvgVu1mIInGkUN/JQGOMI78WOQ=\r\n=kuFi\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230105111457-8fdca5e.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/881464a87ca0414501814319c6959258/graphql-hive-client-0.22.0-alpha-20230105111457-8fdca5e.tgz","_integrity":"sha512-mnAw6t15wJtlDEdzIQYbluQoLmVTElexAnOaGdX8t7DPWnKeEV0HM8beA0RE5MsV3vYMdZaiVnWLzTS1AkBL0Q==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230105111457-8fdca5e_1672917330829_0.8326609005934242","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230105111834-e78fd1d":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230105111834-e78fd1d","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230105111834-e78fd1d","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"5f21d73a5158695b456cc696cb28e53da2683da7","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230105111834-e78fd1d.tgz","fileCount":60,"integrity":"sha512-iynk68llx4DT7at4zMcJbJsWbvy9mqu9UqYIsP8XDg3OnKtTSTIiMsBvi4cJD0bYcw2GhTMJuL5KTODtWDZ57g==","signatures":[{"sig":"MEYCIQCqwUM9dZdoQKsiWZuDfKp5j0Xd0RSfQ6X0MppKPwkV2QIhAIVjqXEUt89noIkHhEyP7kOQvBIhAsSAqcDYZ0HKYwuS","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtrIxACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqxQhAAnmtarQZ5KjIVYKboAjKIZXxO4wvOMa3Cnj0hjl4iupEHEIrg\r\n2jfqCWnqTk/WAkO0gvWIrO/zpmyXq7VK/jjuh+SiY256Fgpc0E7zLrHxGcv0\r\nfT7P/JzwUbj0I4Qj5gP/srE32Rvn9U21b1CQ+1lQkz0iDia1C0FrYmxNRK7Z\r\nHkyUes+uzNTfAfloV3njg/CqMrvZTwUJ2sZ2yihmaF3oFuDpzZ8Ta0naZ3be\r\nj3JbmVen2In8Ic/UTYEgw+QnFpkkWTXcJuYvFi0G2Mkgm/FAMuYpVbqDU0S5\r\nwCRgX6maPjNM6ZmjWCqzYX+u/2EvCEIk6OJYjChNEQj4Pr5lU3hv/lVfAW8g\r\nIAUbZBF8xDu9zbVconHOQ6hvxDTImpVqlw8lC0IfSzOUX993OladfD6bK/Ts\r\nzgM5IDveHpb7WPF4jbHTh1K3DH/xh7oOkoxQY8fgFogEGJUbkCamaHeosxnA\r\n+fxqp16vlIGt6ool0D4MbYChOZcke4TDhFTHmThTeGllIdoql6xT3P4K7JU5\r\nfJU3f6utUDTL44wXCV5qQD8VcQNmto/lh0caCpkdl9PM/F1grq3YgQKI/lZo\r\nNSoBPAmGzg29nVtwOZ0GWSNs5B4sb0dvXAdqucHhjgQ8Tw+mk5T3NS+b/hhW\r\nT2a6NHY2iwLeVl4SUXRSpyRoL490vY7szME=\r\n=N+l+\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230105111834-e78fd1d.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/3cf71ca95bab34ecb7fbe6bbb8e5bca1/graphql-hive-client-0.22.0-alpha-20230105111834-e78fd1d.tgz","_integrity":"sha512-iynk68llx4DT7at4zMcJbJsWbvy9mqu9UqYIsP8XDg3OnKtTSTIiMsBvi4cJD0bYcw2GhTMJuL5KTODtWDZ57g==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230105111834-e78fd1d_1672917553552_0.8429834169656207","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230105112343-cb6860a":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230105112343-cb6860a","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230105112343-cb6860a","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"c304e1687a2dd3b630c1a8bc6cca01389ba071d1","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230105112343-cb6860a.tgz","fileCount":60,"integrity":"sha512-fr1igEmptPUnhtCUKXfP3UH4y9UAZeWaHb5FbgxZyLlxwkm89OAiVUPs3+VRfJUSFCREyJwVweGNqasyWpHcFg==","signatures":[{"sig":"MEUCIBbhbEo1Wc22gZIc/9L1XedVKO1xf0iy/DYMnJj+nNFxAiEAxjY/ToPGTZW8eM7SI2gcFsXbWMZ1KZBGR8hFdqRDjcw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165581,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtrNoACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoZTw//SPggIIgqAqw3ZPcFzQpGoCZvmCnTg5hfjC6e8qq/LOUkiRhF\r\npRlkPZe7BW5UvSFQd0YmyeteCxnJc3iFHcyQ1J0PbzxddThb71Gy4rj1SzMm\r\npb3ykb/i5uUt4ljTrN0Evcsz5X2vw3g1/vQxFSAL9Cw6r0fNuXt1eBOSciyo\r\nG1aYJSTLUuzCy0eMBG3nVa+3Aw3MYa62XVHbo7ZO0M8h4iIkfJPXB6XXLnx0\r\ncv4b3TiHh2St5F8jIqiYyQVoTAt+vbsED4YuP4Fm7TD89TYzSeDL2Y/njLJC\r\nTfFFlfzWH1cmZGPiX99/1hh7wcZKLJCLwipGyaN1A3jtm3d3vOGpNXmNEFpV\r\n/MOojdm4YNizVY261DAwJbdz8rm/v3mEnnqOxaUiZEU0cQizCTgpBGxdUxaa\r\nboli2XjChY885P/22xi9upZi1UN1MRvcEg/V742zP7NhxgNFRCwnds1I0jLR\r\nNqkb5bYBzuJsL2NfAOmDnV+VLVXkY83xg0wp6dJPiu2Q+A8mYMpDitsU18g7\r\n67DsZ1c3Vb/Ej9bqEjLhug1HygY64aqPNAQj42pnUkt607MMJmDmzwCGE0kR\r\nKBi8z5vZK8bTOesULs8EW0kjthsYHOIRfjsAFT4F6iP+mlmBLGILPVjDXifp\r\nc+y6c1p36msZeoRfcMio+NXGmHUySdb4TV4=\r\n=hmwH\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230105112343-cb6860a.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/41a57ecb506815d4edac0552ebeef55a/graphql-hive-client-0.22.0-alpha-20230105112343-cb6860a.tgz","_integrity":"sha512-fr1igEmptPUnhtCUKXfP3UH4y9UAZeWaHb5FbgxZyLlxwkm89OAiVUPs3+VRfJUSFCREyJwVweGNqasyWpHcFg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^9.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230105112343-cb6860a_1672917864013_0.9083953363989952","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230105113809-3836e50":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230105113809-3836e50","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230105113809-3836e50","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"b65c4ff6d27be0da94c28d816b79679556389192","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230105113809-3836e50.tgz","fileCount":60,"integrity":"sha512-Gr4nrYVm1ZUoJbmG3CfNIeVgfPJPKBqGoqQyrFyHeYwdRcoFKT9d9+P4HrFL6SJh2A7MytMIF5apVsQEITwnZg==","signatures":[{"sig":"MEQCIGAfyMzwVcGusGwHw4wYohM4ix6yG5xhfHy6K7FDEn3EAiANCwQ7w4Sauc5S+k6CpUdPk+MXyWxgHU16ChLUUFA5dw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtrbEACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoqFA//YtxRZLKwGgt7nAxyXi3UndElYfCxfRPQRwj+ik/w+KoAPCL6\r\nGfrsKztUkzy5cE91afFUBANvdNx8QFQs4zNueQH3nzWCv4hFHGjJtLzyAl4B\r\nofulRdzfX5S+9XioiyI/BVflmnl813AmfgURDl8syXfgwEWhheE+nrZkop4x\r\npGUhhqZr3L5dk3TD9VQhSJpmd/cM1oken6q9qbDsId/sqPkRTmNIlvVcbji0\r\nDNVLCxI42kgeWMB90KwIPHsm+OhlanorEjdzndjnJoL4DgFrTCH62aSlFKcP\r\nOLnfKwvgjBT3SJGMbXcIhDn6bGh0T9aeI1KRFWXl4AJ1znrSlUyBCsbvvl0P\r\nE5HYJIJBYX0m7+H3zgtL4g0ML9rHBb2GizdAcf2bRFaTEFnYH6xQCaQf+RO4\r\nOdfSXnCY/wSm+AV3zwfXEabEjGdmLAAoCWJWheTtJ173/qTIwQm5pqX1g9eA\r\nMdXA4Kudtitycbc9vjSL4O4tFq7LwvX0BGAXljp8E1DTQ7ZcNxp5U9cNOlj2\r\nfoiLqFi+w6y4jpSXxb76A0zAok3+5vo1qQbr6xAlWc4NcdNR0tSjcLMo+pAj\r\n6x2saDNmWVNHnOUFBqurZLREVmbSVsq8J3vN3V75zNQ30C3sW+OVnSKQ5III\r\nFJyNDp3C5ozdJArAdRBHOs9aTXePoXCdvSI=\r\n=esGl\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230105113809-3836e50.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/a1a0d4dd48c10d7eec6d4323708c8f59/graphql-hive-client-0.22.0-alpha-20230105113809-3836e50.tgz","_integrity":"sha512-Gr4nrYVm1ZUoJbmG3CfNIeVgfPJPKBqGoqQyrFyHeYwdRcoFKT9d9+P4HrFL6SJh2A7MytMIF5apVsQEITwnZg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230105113809-3836e50_1672918724603_0.7742973221393905","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230105133613-6bfb6b6":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230105133613-6bfb6b6","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230105133613-6bfb6b6","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"33f2e58792dea51d1f5191789ae8204789caecfa","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230105133613-6bfb6b6.tgz","fileCount":60,"integrity":"sha512-DpYzvLAmIdQcagdP9d5xhl/6ji6HSD91CVVhttoQgj0im7U1BMRZEbI1IS/phzSHgI3DkyiFi58tW34M+rfXUg==","signatures":[{"sig":"MEQCIAWJJY07MC5TSK8sIqDYz7vt7FxEsALfZVOPGEQfF4+WAiBzU6dmsKrFG7hkXyg4KEqPwb0rj0Whbc8mgV1nN5OOXQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjttJyACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr9oQ/+K+1qtGKOxemqZEK8Q0A1KM9Cob1K3/sKJ02G+rNdpBT5O6li\r\neZK5GVqaA0viLSQ6UGDmir4UDhquP5o/ucSt6OZMFGyWOGtPd0OILqDokdVm\r\nJSDUoK5Xr8Jkfmoao6PkvDwir7/fKjx3rOH7b5UrH0/7XWIhFJAaDuQ3Jp7Q\r\nN8wvQNGk9FmsSJXJ41fgffyoevDyVvKwEJ+dKmf02CQkE10Ceahu0m26LgcZ\r\nsbx4xq7MnTtv3OtXcAOAR9pyzjLPIM/2RkF5o5Ox6xHcP8n4uBxp/LI+mHZI\r\nkug4PmvSMkCOXHPlW4LRWxGGTEMB4UZAHQzb0hcn7/2j3GBES87feCebvHFy\r\nxsANyTAhf/pTEgfP1uy2J49MSuatbpQKExpvSY9glrKHA+mge2VhFPOdFi0r\r\nK2Fl7jGtKzIX3rotQroX88V/pKazszNJ652mdAAyCelAis9T7no7KBGVYYzj\r\nR3M7Nac0m6IHbGBzWnhbhzLwDNu/PF0ZMTTpRWsjKwdx5UKZWfqFQ0d4SuDw\r\n8ER+a+HKD3hH8WgBXHpj5Guk0CZVGWVOTwhuhIeCQ+Nc8CL/UC9cdYZgwoFG\r\nNePGDhlRmQ0YrGJb7rxGjovg1jwK0pM6OcGxYTW8q8SGCZdvdGvByqtVI2xQ\r\nEkxJI18zdjR8+7BwkOFHTVhgjFsa0mPwNiI=\r\n=f0Mq\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230105133613-6bfb6b6.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/01c93014bbfdb4ede18ddb8048ba9d8c/graphql-hive-client-0.22.0-alpha-20230105133613-6bfb6b6.tgz","_integrity":"sha512-DpYzvLAmIdQcagdP9d5xhl/6ji6HSD91CVVhttoQgj0im7U1BMRZEbI1IS/phzSHgI3DkyiFi58tW34M+rfXUg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230105133613-6bfb6b6_1672925810518_0.03785248067810265","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230105134821-bc8a9c7":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230105134821-bc8a9c7","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230105134821-bc8a9c7","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"23580531641650420a75c23b33237dbead9d1ea1","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230105134821-bc8a9c7.tgz","fileCount":60,"integrity":"sha512-2iXiK+0zAo4q52hmPcN1rAY/1YA5ln//HSAcANqCGlYy4sIK1RlMxvTk2WM4EymiMSqkGAUnNYqpqHqgcHkggA==","signatures":[{"sig":"MEUCIFebV1mAPARTfMJ4q6xKWOoDWc6nlackZLJvwdS0d+RRAiEAnXMPiglNklLn98ppduaSfO4fcm48+WDgmxPCbGy2kDU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjttVQACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoTKw//YwXqggxsQM2dyzHgKqVnl5bN8IV6ErrSUKz2qLKYcp6iF5RV\r\n5vtQKaImh0rtcwnDnsiSxshoOn3evSiFkEALkTDU8EuXr10I6s72FXnZVrd4\r\nC2RY9b8ZaVjcPY8YwCrMtCG9/fWmaDmIUc5dg5YXjyt5SFYlC911QufdsCUr\r\nEKDCJOX3w8BOZuC2af2VUpI07BElAU0yX0tz8+C5S0X9M9KYXP4WNMl1t2dz\r\ngeW6oPWFPMPNYaRUIgXeBW2P4iWU3BT4maIM224014YpLdri0bT3TnHhZnQ8\r\nCxaIhgeEiqfQ2rSBjRPfjEnijE/7NE5Okgk8pAhLDq9+TkqVjmwZ3oTv7JHG\r\nnKlqVaSkmEZA3DS0UjuHIGpRySO4FoE0Vxe+KPFDjdSAAP/7t0LuQF0fodt0\r\nqt8x9EpsTj0kDnePoYRhtWlfSw2UTRVk1BHoPPC0pAFEVRnjJ0/ICHPOK8CA\r\n/csGzlAYTd0wsW4xhbmDYq5R5Mw9VMe7iKJGo2A71Ka/wVDgMZYtL4b7YKr1\r\nWV+PQTDofPRSNAighA4f6qFByL4riWbc7K3BSvm26PoBJQvd0cS3HlcBPamU\r\n6Uh/2t3VWk4WWji7FRWE2mHlUB9c7BKV+2+gc3UOMKCOAssUch3b/uv+RM/F\r\nkkt6+B1MiEYmJjyQE2CriAkihs9K30/LXg0=\r\n=VnrR\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230105134821-bc8a9c7.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/7835acca10e6789b82afe7f94f73d3cb/graphql-hive-client-0.22.0-alpha-20230105134821-bc8a9c7.tgz","_integrity":"sha512-2iXiK+0zAo4q52hmPcN1rAY/1YA5ln//HSAcANqCGlYy4sIK1RlMxvTk2WM4EymiMSqkGAUnNYqpqHqgcHkggA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230105134821-bc8a9c7_1672926544536_0.23192442338710162","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230105135259-d90ee79":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230105135259-d90ee79","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230105135259-d90ee79","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"409f14a1cff293f988ca398fbc64f1ec82700fe3","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230105135259-d90ee79.tgz","fileCount":60,"integrity":"sha512-VSxn3uBDfyFiduPRR2zDwuANDeWmALgSPp5T4Y15M30BAo7NyTOoXa65RlvvSuQDMkVfT69o7UoRizgnTTQgcA==","signatures":[{"sig":"MEYCIQChsQEUMVX2JKcHEFUSeMLRXpUetZ8WIoL7lz4xq5lZ+AIhALxEDaBJSoGQaZOWpD2hWhx2gDa8A5JuvmgezoXAt7jQ","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjttZfACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoHZA/+L7Md5vzTtDVnK6SaxbyS9UaXUSHG9TBhIexDcj5yiNpj1RrO\r\n5UjHhcif5e7tQm7xhIbr1OiGwgg5ZdhUghdxxqJmiD519ynRsgZCJov6H2kQ\r\nBZBiPp4HQX1jN8sYseVAzf3vwhgBj2gJGW5mjFlp+kvegj42GKIZzQuLpu9H\r\nVst7cAGK8D+GCBKz87ddfQUjjbtro96kaVzR7KZIIsrHwYPN0zB/VOL1zO5V\r\nUh//8c2kYk+jS4pJzKt3Ud+aqCxwTuw81zDpI1nLQ8DSDWKh5yUOQrfw9Ruh\r\n3UlEJh5wIVaC0FMay2m7jCWTt0MkXt4zJtApHZ9NvEJ5Tva6jLeWq6RDIo3p\r\n/3jySTqeU0AuschkKbAoT7NXQExXuEm7eVz2gQzs5+X7kEKElS0ZGb30IS/L\r\nalkpL/5ajqVQVSkizkhwdAWcqZP50yErpiO8UioE6BjvHGwjrG1ZFTRj6nPg\r\nEbmb+t/ZyYyFH/ppLyJ9vclqW/U7xTIkeXsArnYKrC1l0ba05P+J+W4AtX+u\r\nLn1+6sCHyswNEfuEI9c9x9dpWpBWjOWFRxzosrTOosxAs5GvEdeyF0mh1OFw\r\nrmaloQ9CLhW6uABJujNWu+SJJQOIO2eKd70vfCkSbYLk6FkJy+bzuJn+W16g\r\nYq6IffF4Mp5ZyF7GZoRcVYWwk1mW5xVaFZY=\r\n=r44x\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230105135259-d90ee79.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/4739f080f2b72b47dfd247ae46aa71db/graphql-hive-client-0.22.0-alpha-20230105135259-d90ee79.tgz","_integrity":"sha512-VSxn3uBDfyFiduPRR2zDwuANDeWmALgSPp5T4Y15M30BAo7NyTOoXa65RlvvSuQDMkVfT69o7UoRizgnTTQgcA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230105135259-d90ee79_1672926814965_0.273508265412324","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230105135454-9cda8b4":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230105135454-9cda8b4","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230105135454-9cda8b4","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"133d9f004da91e0a8788a94ddd634baa2dc8fd75","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230105135454-9cda8b4.tgz","fileCount":60,"integrity":"sha512-aOxth4EWJHwfZFGr5OZ6Da6FGi3qJoRLM7SdvMYdS4hLiDrc/dr2hKbapW0KTPk2k/5KTYGqiMbXOhD7cqvs3w==","signatures":[{"sig":"MEUCIB1Pot6hVs1guMgvrEzvxZEQF4uZadmDV2H+NnKU6QBHAiEAk+wAuKCh9D8OONVmfONVKAPMZdGvuna7oV/NIqQ0/GU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjttbYACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrDMg//bacex5rI84Bz60+ddeDzSAcf2WeAw3Gbac7/Xjthe3cVBi+G\r\nPrT+cz4E2XTgiyVgDDwMgPE5SJUKyfz68xdzWqemOm6/3BkDOzI9sf4WrYds\r\nZgtg5Q41Jb1zrqhWWjzK5WkTE6ypmNaMx0J6mDnj3hD4CCeMYKW2xxYhCmBq\r\nxdD8K+oW/KVYsCeiwP23iZQihsj8Bgf9Em5SmNRt5ZomV3yfquaSjzt3fH2t\r\nJ9basol8+BJJAKkd6UFrhCclU/+DbselXfrhqDxidHtMVKv/7m1ZZL8ukrJl\r\nGlo3ZIWntJ5buYYSjS4rzhn2ZJn4ilTDII62BVTcw9Oq0uIFcqEMii9Vjv1k\r\nZWiUaF1PUrawDv+lGNiBKcZ9jMrSk+Nbj93RHAaqjdbFST6FioVnvqMDIc43\r\nPjxzkvI1LCOmS50+h8JWPaAPEaNJGgvwIPwO7cqPnhTa5Mx0ihbncjm5HwAx\r\nrhMLbs5pKTg9fb+Ype+mIXDlwLOpPOOoujsqe4W3rTv+B3b4RC3WKjLVp0A/\r\nx6wqeHGVAKZkvGIZZLMjEWpgo6J1szoS4hrv2eXacCEZJ/lXY68dPf3NrEnh\r\nEMUz1k0Q1w3SDM5aKcc4cSnwx81mZTPHg5i2MRPZTMTD7FiYTsz/yxFZu1dg\r\nnWdgCOJoJGjVodejAI8WdSjh1i2sg0oidPM=\r\n=Vm2F\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230105135454-9cda8b4.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/bcfe7a61b9f493db0b370644c217df4e/graphql-hive-client-0.22.0-alpha-20230105135454-9cda8b4.tgz","_integrity":"sha512-aOxth4EWJHwfZFGr5OZ6Da6FGi3qJoRLM7SdvMYdS4hLiDrc/dr2hKbapW0KTPk2k/5KTYGqiMbXOhD7cqvs3w==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230105135454-9cda8b4_1672926936214_0.47470909559461627","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230105135927-3c13ff4":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230105135927-3c13ff4","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230105135927-3c13ff4","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"ea1eb1b51c01a4c4388ef83ccb58a31f4f03fa5f","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230105135927-3c13ff4.tgz","fileCount":60,"integrity":"sha512-ff1qMgjqI7Y/VCn1jEdMcZr5yCmgX8cCm8GtoHvPhKOvx3DS5NVXb9e74XXXPvbH3OcDRpTG0X4V9qVttrDTvg==","signatures":[{"sig":"MEUCIQDlTbmw+dvVU0wtoQ3/DVPLGLBLq+t9oOHgSfynk6+UKQIgFtI/4b4/EdKImjC/GTQKmqTysa7UsgtIMTu60F0h6N4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjttfjACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmonLg//bkU4vKJcEFeGeVIL+WvxHLVLwTAKbX5MfJL13uB0ITWg1XnU\r\nW3nCdp4a+c7U871MGfdVkuRYV72sOm+YjG3xnTExncU488ATrzUmRckb8XQU\r\ncEc9hj+u7fSDjj8c8LjVr0vaH3qy5U9xVUyjefFi3Pwsyz4B3Fimm5Bj1ymS\r\nNeKZq14jLdXcU2T/mQc9Chi8O2/6gp8R7sxs1c2B21WFY4xfQeG8r0Y8F+dY\r\ntLGC4yZ/Y8g+1lL5Ksg1yUZblsztH69sKucFJsBJY/CvoXzEOFMLq5WujfNA\r\n34x92Z9/r47wty9qQu2Ur/7FcwrhK23I0GGRDyeZmHZsH4qx2mGebjYafFSZ\r\n5mpNlaMYrKs+RsN2LhrHUWdq49Dnghghb6asbSNsbAtXmzoDuZoX++hjGKu5\r\nf9Oy7AMH4v23f9GA7RX1ToxxHDCwuQNK6ERNzOkNUq3nwQ02lq3vZI4RA1nT\r\nTC15p/jn439afA3kXD7G2vodV8G5z9fi3zZ7hDrWfohB7/FqyfF4kbvLbw6c\r\ne1RlZsOEuxN4vt7y7IQ+ifSDd7SLqU1OJcyHpmDTcuePqzI7h2RNAbQc6VKz\r\np5/gtOMKlyvEpdZH0Hk3EFxWXnocR6DpSj++YIpc6AwZJgWn5Y9gkYflKSUK\r\ncfJ153EHLWNyTeToADp2JEqFsGaKwTfRn14=\r\n=9du/\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230105135927-3c13ff4.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/d07c53404c9a7cbcb399d3f1e37ac4d9/graphql-hive-client-0.22.0-alpha-20230105135927-3c13ff4.tgz","_integrity":"sha512-ff1qMgjqI7Y/VCn1jEdMcZr5yCmgX8cCm8GtoHvPhKOvx3DS5NVXb9e74XXXPvbH3OcDRpTG0X4V9qVttrDTvg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230105135927-3c13ff4_1672927202070_0.9414759306607448","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230105140000-8388e43":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230105140000-8388e43","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230105140000-8388e43","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"d8f5335d20a63dd520af21d0a9955e9f3148f339","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230105140000-8388e43.tgz","fileCount":60,"integrity":"sha512-7d8ENqt33nnbra0f0HttdEmGpJef/dDavZylIA8Cg3LQKUmlJ25dbW4tfINlgs3yM0DVDOFwfP3ytGsbHcXMyQ==","signatures":[{"sig":"MEUCIQDLWi+qcco4P44f855Fbi0eYjTpyQ6G5QtwsZuZSw+hTgIgRKmhvMGYAt8ouzBrZGvylWuq7KxhebOMA2ep+fgCdRE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjttgDACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpLFQ//bj861ggzeYCRzj0IMFI6e4QmjAEZnJBr9K1TGRxBt7nWK9nR\r\nycdRzQXXXT361qPGh35nXOclGe1w+DyqCJt70wCx+HGkhTsjAEkKLNhEy4Ax\r\npdU5ZnF69F5LWa2oxn6vQqq0zVxB+3Gm48vPNHzbQzgGG85dLTpoWWnd47+q\r\n0F2FsqMFhZeZWd0jmCeMpdPIAFbXZkA2xnAaZsdsNg6VQeXY/EWL7Ee2DtwI\r\n+61+kMKqEfa1nvpAXmxJFeuiO9T2+ZJefHaLynWB7elqHG9iAk9SnP6kxiEk\r\nTI+DEQXWuwJ5GpvrIpXeh/GswepEpQw50mW48uS9Xy6JvFeC5Yk8n2HzaAf4\r\n59wbo1U1mGs5HwQe8B31FFENyyZwPw8RkQwpMMWpH9vFGECEEHciiwqgOgcw\r\n3BKOIE9R9VnEOiKtrmRIZCozhVKXrQVsEcIvB20x2zsVGFxXKYdPB81FtDSx\r\nmKullx3vPElFra5DIMkTJVBA8LlYRijOqW9gYDzi8QRaVDN4k8WdEtQ9I+3E\r\nsbKZRbuOfW3HQhzs9FuLpaNLH1xbrtg2KUmFzuZY2OKQ1gAML4rLr2P0uxwd\r\nv/hlawZI58GXgD+dRCbo4ZRgxeWezohTraiHMiokyPGCi1tEPH3c2dvIm1MX\r\nMQpfqSQmW3jbiuERC5qmo/504Sxc62wwfd4=\r\n=yAG/\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230105140000-8388e43.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/23a186756b897d7958ac09fa45bf0cdb/graphql-hive-client-0.22.0-alpha-20230105140000-8388e43.tgz","_integrity":"sha512-7d8ENqt33nnbra0f0HttdEmGpJef/dDavZylIA8Cg3LQKUmlJ25dbW4tfINlgs3yM0DVDOFwfP3ytGsbHcXMyQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230105140000-8388e43_1672927234864_0.17553464234525418","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230105140526-4ab93db":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230105140526-4ab93db","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230105140526-4ab93db","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"915d93577177d0cb76cf944cbe9f468b57f768df","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230105140526-4ab93db.tgz","fileCount":60,"integrity":"sha512-6DXnp8K88S/S92yKJVjA+vcyvbQXgWWsHN94obVrbAmc2QP3Z0fr79Qn6XnZ+PzyHhyZ5/6519cVAGMAKDIFdg==","signatures":[{"sig":"MEYCIQC9NyiFkLFLJYr0lAJ4QfPcSpExEwHTkOtU0aBhZSigRwIhALeqxqSiH48CLbzdJ3d9DcnuxPPW4Uo4G8q9PT79gPp/","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjttlYACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr6Xw//ROnRMi/vhCi4OdIgsVevFOfn2pUCJQ/EcbVS0wvrA2QamiBg\r\nj8MoC+BkeNhvac+N6OkcbgTV1vSTyxHMMK/xgl3nTLwsfATG2hAC5mHrXLjq\r\nRa84UcrMgofGhm0KDr9UBjZ7Ls2/QAtzzAigMPPl3t49hyl2Tax9UwlRbPLo\r\nTTWZ8Oa0JlRjH9cLb3C0THEpFp3wssfBBAFI3G5glMCLMB3xK54rY/VGqISh\r\nIr1gTtA5Ld/SseW4/HsKh04xdk+j+xkKTsH3MIsrRyKS6MwgfQN1wj2gW+vv\r\nF4Yl4AXnotdKgZzP0XKWDiTDkt/1xuc1lFsNOdToFETFBgiPZDAsIauvXtjy\r\nEYyMlEdtVLRYx2FBrcAQDPTrCBi97rxmNZpouKE0803SS/kn9QSvM7IGo/80\r\nSUj0UyHxhTNwgXHVg36tDrvqwmZ8SIX1D0tSIs/gMit1emiJfLiCwdOn3i18\r\ntnaa80TB6G6B7KW+qG0VcPmxi4yjaTGPas/Y7Z3MKl1n7S8ErBNE3iiGrypU\r\n1Th5zAiPag+L41BQWv/zRixyGBKlApoNTRsIsmuE+qqx8qFxw+HcdOGzUibD\r\nt4nRnXBmBdvdy4yR9rraumPMvR6yW7z44yQ4TLXcYNgEekjJdSbkgskuQfTU\r\nHlClDFrQUCj7SPTZ8oyHVecw+pm3JnLUx94=\r\n=LVi6\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230105140526-4ab93db.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/795373003925674a5645610bb208f283/graphql-hive-client-0.22.0-alpha-20230105140526-4ab93db.tgz","_integrity":"sha512-6DXnp8K88S/S92yKJVjA+vcyvbQXgWWsHN94obVrbAmc2QP3Z0fr79Qn6XnZ+PzyHhyZ5/6519cVAGMAKDIFdg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230105140526-4ab93db_1672927575870_0.3846697621356059","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230105140916-58d8926":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230105140916-58d8926","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230105140916-58d8926","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"190d111d9cfbbdf96d2d2d50b61d2e071f5c49f5","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230105140916-58d8926.tgz","fileCount":60,"integrity":"sha512-4EO0V1IuR/E/Ibd603ftfVlB5bjuv9Wi1fTs6Qe1NgKTIDqkCRANsVQXKoY8NVSBWcqWwxhnxjbN/UgoWAJjlQ==","signatures":[{"sig":"MEQCIC855v147UDuks1vB/PNbbFrjZGjn9GxOmS1fd5UjRTaAiA0LSZmxknsG50D3WSQhUu8J9SmDOsVB6l8esu8/3+I7w==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjttowACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmqoxw//Ynx7hpJtepFSkQ/aeoEccyB+GpxrqW+6IQ4ZDVXDP/d6A/pV\r\nHZ4lhKXpC+fUXAB7drheKq522Icg3tCE5j5qvM5Vcp0b0er+24Ahv8DqcfbY\r\n+nV2+65Bc5zefBxm41pVevv5vND6Xz+9VrtxXcpfFwSjHw5Bz0grYkK7WWBs\r\nEk0SvpqzenYBmZyIumKpsC86sQdIwKGSDLakmOQG/QpwxeyoAwRjw722ilfF\r\nJPxl32kkCs6LqF79Xp6sQQl/RTQOgIl6JevjC1MVRXFEHx+95kE0EPwioyuM\r\n5wOf3qJU2He0rQejBrwEZxdcN5LqvTv/U7HP8r+6fRok8QG2HlvdWaWZ+IOb\r\nva9bNCbe0MHTo7/h5diDpC2uUVtbdhREAcyXRsxVoy0u+ubaenG6roIkwXMp\r\nJFK4j5h+t9rkEVjki/ZBXQ8hyev003hI2VKRll/SKYq4+u9srIg2sEtUDkGu\r\nbWc1br62XrNc4I1hh/uXKxgJ5BBhhRSW93w0yqoKlTRfLxoPf/SIm0J+Ib8R\r\n0YYlnJkoPGrzfZlL64Qp0t/H2wl/jzUEK+tvzlTlT7EMkCkp9yJlI2RXo2op\r\nEkYDjLSNmWJgjLvjy56Qsbohgqg3lYtj8Aq5orjCYEvGLACiIBA3VkYrnVjn\r\nP6wyW1HbnbFNtbOZMJ2OthBUnJ+MkjaOK60=\r\n=PuUS\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230105140916-58d8926.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/24deed5270c107d888df985b0e93a769/graphql-hive-client-0.22.0-alpha-20230105140916-58d8926.tgz","_integrity":"sha512-4EO0V1IuR/E/Ibd603ftfVlB5bjuv9Wi1fTs6Qe1NgKTIDqkCRANsVQXKoY8NVSBWcqWwxhnxjbN/UgoWAJjlQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230105140916-58d8926_1672927791806_0.28052728766019563","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230105141355-75a4fd9":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230105141355-75a4fd9","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230105141355-75a4fd9","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"82ebf3ede4d234f2911a95f038847e3e11031781","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230105141355-75a4fd9.tgz","fileCount":60,"integrity":"sha512-B9z9RbY6Vc/vtjCfhCGRZtc8YDsaFnP6VCNFpNEQrszHMk99lrkp6866ZdJFIIyeOU7C+yq+CtHg8wrwZE4DnQ==","signatures":[{"sig":"MEQCIH8v4yk1UzHfXMSwp9VYqYRptqWWyc1gUxYE7MLEJI0SAiAFiaVL83AlD4KhfeiPgxVPhlHzqkF5Q7b+b7h7YBlaBw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtttFACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpdwA/+NVXM+isTMdAiq4B+wrVuHieEP7m8GRy5EEwU3T6x2xuCev1W\r\ndPqJ7WNQfreYCza6sefKp2pzJP3sCr29tmUjHpCDh6v98ViPgPBwjnnGPCV3\r\nvO3XIf3oojkaQAx75Kdm0JFwcY5Ge79mr7LJWKkNtWD92CfMBcaHiEPYgWdS\r\naGFcGErJdTj0JRIUUrTnTNsZ6f4GcJtyG2V9D1XCEXOZnsNj0A0isN13Z2qf\r\nwkvsRguRqbGvdsOowkyIfSV4DSgYC4evZc5okWb51fZB2J5gdS1qAynr2pZW\r\npPIqdz+3K068vDOSKGYUU2c1qF4eGPZNRQjbLuGyAJKuksHb5Sqwkrm8l/EI\r\ncIEgwa3/wZFUC1fdfSOP0GHtSF+uiTGwKLBnrdjJgBzivCIBOCRwPS+Zdt2d\r\nAit0rKeoSYi9rYFXUbD+bMwoJpBg6rf5V3JULd40o4aR93lZYzbuQ3I6d/5T\r\nS2DmsEGg6HRRgeFrtCuiOXqQdp5Ps5SaYuwdkEruv7B9ShCCpdsc42b6E0Gj\r\nSNflwske8JCOwLcokYfcbWDnH+VqE8XTYNpFWq0sjUh5J0r8uHi8HcrNKh5m\r\nrLJ/RNGYfE3ZkihTJqiqDGIFpCE6jakG+Rdugr2GOrEbECV5orY11gB3V1IE\r\n1QItFKnGM7dmsydWOH1vtrKlG6jpuJnWmWc=\r\n=yjWV\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230105141355-75a4fd9.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/471a6f8a11325c2b4a446604c7ca9581/graphql-hive-client-0.22.0-alpha-20230105141355-75a4fd9.tgz","_integrity":"sha512-B9z9RbY6Vc/vtjCfhCGRZtc8YDsaFnP6VCNFpNEQrszHMk99lrkp6866ZdJFIIyeOU7C+yq+CtHg8wrwZE4DnQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230105141355-75a4fd9_1672928069745_0.8616700540195101","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230105142238-69be9b3":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230105142238-69be9b3","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230105142238-69be9b3","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"8118d75f1928beb6bf9ea1033fe3dc908cc19cbe","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230105142238-69be9b3.tgz","fileCount":60,"integrity":"sha512-DIB4SqpQ6/wks24ud7JPlFIUcGk1J/P8SEyU9dszisSrri+shPzOh161BZMOgfsvki/jhS2MAAXh+V2Gm6vQCg==","signatures":[{"sig":"MEUCIQD4qyAGpsMu+CV6mCsifyugreaTVqHfTZyozLV7+RgRiwIgGufPjdH9DCw69QKF0oLHpZDDRb8IYlej4tc1OG8XhAQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtt1SACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmprsQ//dPb+3YJXYkZY0FIrc+p9Zg9Zh8eUqY+XZCgMf3MwEFS9qE+x\r\nhkpFEDMr/cgjwKgXjCIzTgQCTZ9apLUxHsQj4tOW//xiV3vOs1ATg+IHGRUK\r\nCQPXI5mY+sZab/1dJOUD5WuuGsgNw29BHRlQOMedsMhaetVdfAgWXIfWGn12\r\nTi76tgYlp5jXbUJ0xkebIOEb3F6Fya+rhb/5bgB+SmzKvbtWWhjuyeK+re1x\r\nH151QBI8YSBb9oZWx4WpdVFnpMptvVgzVhyTf2wXSFk8OxLitXGLRwYriYw2\r\nHukj+rLVOqPgtPJrRJCuCtyi3oCxX1j+JrXCq+KatOy9hADAZtr/lIaNwUa6\r\nPxBzddHKA0ytvkOJ7P+IoIud6hsOgyAyJC/8A0MKXcDfT5PpGZ2j2wGmdDhh\r\n7WgWtnKUAV893X1GwSrCnbNXRqV3/X/1XIg6bQ4qfe3+exGkMsOM7N74BufW\r\ntEJRXM8CtmAgOA2m1v+Q71THfuXowGkXXECt0tYRGk5TixSuI4Np7Agr5ahn\r\n5J8q8xmg4UTDtS6lhLNCR8iJFpmIcEWi8KOU7Qz83AxR8nWzJV0zvHQ3maDE\r\nFUT51uA8k6lzX8ElA2CoGhloMeBJCwd7t6zzeUeuHb+JG/0mDlRTkYooeobZ\r\nSJpRj7GSUGmgOWZocTEqlbrSseiL0Ezs9l0=\r\n=zttZ\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230105142238-69be9b3.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/951a264f97fa88c0855d418f121476b4/graphql-hive-client-0.22.0-alpha-20230105142238-69be9b3.tgz","_integrity":"sha512-DIB4SqpQ6/wks24ud7JPlFIUcGk1J/P8SEyU9dszisSrri+shPzOh161BZMOgfsvki/jhS2MAAXh+V2Gm6vQCg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230105142238-69be9b3_1672928594152_0.05312992565941177","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230105142245-3cc3566":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230105142245-3cc3566","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230105142245-3cc3566","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"b7e73753a0968f2978e79ca383b6334bad8cd480","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230105142245-3cc3566.tgz","fileCount":60,"integrity":"sha512-Pqbbtv3BoY+kcDjrldcWlWkAwRweNGEeq6rb7h0wqPW7ctOKA4hnJsN7mCG+KNPML+N2cw+cOmLViGoWLdNJ+g==","signatures":[{"sig":"MEUCIQCgvJmOX+JHbKJrRl8SY1Ju2+oFaiGI6LJk/bJd4oO2kwIgUdY7OAqiadBugrSIWE00ds1GLvRco+fWOm0oq1PASSs=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtt1dACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmqntg/+KHOO3f53IHJigOOcdA2x3LBJQnZJJ7pjmOkH3sagEV3Ni2fF\r\nMhfcXh+iaq8N1E4sUqyN2BN+h/dJ9bg6LpnP1B0XfNK70H3excm2NJ1U1/XW\r\n5zBBMVjA0baYQc8tpbE8vS6UFbtMKqm/I5AiLvraGfZ06Ra6pAzalmDjODDb\r\nJPiOFTNosLlpYANU30r7S8pmkKyqE2Kt8zuSLTPIaZhb/5io+6zWnMjwD9mk\r\nnXqBy3cUqsFByZVf6vG75Ojq51xc0ysLtkmi6gzMIY0jPpYT8A7BNDvg16hb\r\nAVUp70vSef/qBqUcf2Q1lnuRbOjS5d2fdFQUQbRLJwvNSOcWtMmUB/y8zgvl\r\ncOZKn+K9FkOtDlQYb7KjmQbqVQWMcKX5GIcu7gPEFEjdRH7hWueJYrogPDie\r\nYP666wu9DR+wUCwptmuKmNwRM8B0pQGaZxSp/i48Y4k/s+ChAoDXpFFkwMu6\r\nPDSaCcHddz+zSvISd9NMW7YqcVF+nirlqMD6IK7yE4JHJWzNKbRgMUaj00a1\r\n7Gg4JZ8MA45/hDljdv9cN+Qgegiw/kof2gKRKWgbrF4u9vUdpDZmWPClokJt\r\ny4XgyADdEu3GXwlyl+U2ejM9EJZAdXMoPwu9nZ8e3fORwcBEz0FT4d51+htJ\r\nzUpqtBfLWXb7oYp378oQ14z63mgGU4P/1ik=\r\n=D2K+\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230105142245-3cc3566.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/e5a372ce1e59495822d7787e6d323e18/graphql-hive-client-0.22.0-alpha-20230105142245-3cc3566.tgz","_integrity":"sha512-Pqbbtv3BoY+kcDjrldcWlWkAwRweNGEeq6rb7h0wqPW7ctOKA4hnJsN7mCG+KNPML+N2cw+cOmLViGoWLdNJ+g==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230105142245-3cc3566_1672928604894_0.3223367960197663","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230105142801-2c8122a":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230105142801-2c8122a","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230105142801-2c8122a","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"d7fe5e21cdd0db8a6ebca804e9b97603424fd99e","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230105142801-2c8122a.tgz","fileCount":60,"integrity":"sha512-Y1zvtFNRGkS5ggrP9wzFpgDF3LwfzW/E5MVXWEZys3EY3Q5dKr74R9W586uqSshbLKHt6Ft4w+0j3itQoU93kA==","signatures":[{"sig":"MEUCIAw/wYSGFVtzdB8UuJC7tcXf6VGfRDUspkkE6xrLKVMQAiEA82oXmdi9yJenupVyMSQZ1nXDhxj3AzGKy/1+jata+2Y=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtt6WACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp/RA/7BbrfvsgdgXRb/xTJEvLDiSG6xqhtLGR2kv16X/tJAHdeTxCG\r\nD+4KoBZbhiTF8sKlzl4IOjM7xcK26YMLn2CovJjCYTfRgo2GT/d66TC6lWMP\r\n6WUHXUMgv40TffiVcx1itg2X1GJq3BVLU0iMivQsXAWaYil8IeRNQfD5dMj+\r\n2LymN7bi4sYb47pR8xGUbD59v1UvFMuFBMP/agAZYpm0puBHnPykvWU2Z3Yc\r\nfl6AfcEH53qy7Fb/BcuauIMGayr1XkrYG3Gu9hKLMqO2aRIJqAL9skG9Jhha\r\nVp1LbvxL5+GT6S0KgweUSsreKICeXM84WV0pEltGIzwM1kb4DSESE7Vtmg9K\r\nZsshRjgZpwgeQor6IIggYVxUS+wWnUmrnGKF3ugcR84x4aMwYi1B1Pbm7xbF\r\nad7MFs4aqlGYCuGWFnSIqE0Un1I+kbjT4BwML62esC45TU1iv24G2/zioxDm\r\nDy2dgs+r/IlM1XvMxKP99XqqBFnUfRyIfJSRmBHiF9X+HF57ToQeqFDmVMqi\r\n5pIBp3kULeyeuFrjfcCC+f4cn4c/Vu9QMGtiMp+xcjobfWlwI/akq8GKgtKm\r\nmeigkQ7TFmleBZ0um7nI+0VoL8YTXf4jaPA9wGsevmIDw5p7WLYaZCSr1Uie\r\n4bysFuPKLqjkTyATQKcIJ2C1K9mQKLd5Gk0=\r\n=8Afo\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230105142801-2c8122a.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/54e0457c7210f9f7d10684579fca8099/graphql-hive-client-0.22.0-alpha-20230105142801-2c8122a.tgz","_integrity":"sha512-Y1zvtFNRGkS5ggrP9wzFpgDF3LwfzW/E5MVXWEZys3EY3Q5dKr74R9W586uqSshbLKHt6Ft4w+0j3itQoU93kA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230105142801-2c8122a_1672928918519_0.9908971341496329","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230105143301-7d72225":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230105143301-7d72225","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230105143301-7d72225","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"1b306a6bb7a25080b0cd0db94a178296947e9398","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230105143301-7d72225.tgz","fileCount":60,"integrity":"sha512-mTqK0yg68QZYEh3BpwZmRZy+31xfgQeMF8KNWwVsYLBF/lx1bRHXdDOTCfBSSY8S2SyPcVtTWH9loJwSoag6ag==","signatures":[{"sig":"MEQCIHKza31ZZy789rctuyv4nIOXhiIhe6SY/o7DOAgw3XTDAiBIhFp7EtNVnFwELaK690XNDNqbrlNKIFs0//nzANnN3Q==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165581,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtt/BACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoZfBAAorp06jXjFyTkE73HkZjEH/p3rBd0gQ3hhzUpAeD+t8Ay2iw2\r\nFQKFKNu0yL0HKou/mvHWrUi1UxF0kIoDbxxPAsyVZfZhmVoT9PfRoOiOcxzK\r\nY+Fbbscrkq4aYhNPZTP/F4zcAr1njtwYDYEkXIuOwQZKqhK2cwcQ/5WDO/L2\r\nDHlbHNtZ3EjPLaVLeBntN2heJQA4eG8BwkjFe4IyYTChBsO+0L5KFEJX7g4C\r\nEiB8JLi73/tSD2q/AR0ploSSNGIi3Ad2rqvLbiEPXfj9hx3a6dSsVbxh/hby\r\nQ8I9AJMqNrfNfGiZ7VVtyln5dPJ/pu3wnUpjAwPe/0/KBVzB8ULOp9K4LolA\r\nTES1aG+kp8dOM8a/UJvfToQiW2LUuvMd+yc0kq990ARID7cRKe2k9rGDJZnF\r\nssrcD6BWQzcS56gtKfD1o08RWkRNKc/ZtDv+M1lhETWWqRGodFD+D3hq3J9M\r\nZTh7hZq1d/9xNdn0Fy2z6AjA/pU356xm0SGUz56KoYsYXTJ4hxlXdfFUPWW7\r\nKMiZwG6hmOLva/zZPffYi+ZlSzY14GPG6Q07fTJAuOu9je3WNaHWHAV42slB\r\nlQgBYL/4zhGL6u+v7A0P2emQlH8n0c3V/jBKHLIG2v7kEcExVkDM8iQXenpd\r\nxhUeNw39k8qmjQ5eTiedV5/i2tBdZxrn3nk=\r\n=x0yc\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230105143301-7d72225.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/4675b619dfd83b55ddb18ab063cc97af/graphql-hive-client-0.22.0-alpha-20230105143301-7d72225.tgz","_integrity":"sha512-mTqK0yg68QZYEh3BpwZmRZy+31xfgQeMF8KNWwVsYLBF/lx1bRHXdDOTCfBSSY8S2SyPcVtTWH9loJwSoag6ag==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^9.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230105143301-7d72225_1672929217510_0.19938600308187127","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230105152320-20ac28c":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230105152320-20ac28c","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230105152320-20ac28c","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"e58fdfd347aa9bc00bf578d7b5a8434f36b573e1","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230105152320-20ac28c.tgz","fileCount":60,"integrity":"sha512-CqghfHy9YsvS/f+0reqgEUEuavUnIQ518Tx183iNlkob6DCyXFrzLr6Hr90vEcUo4gi+xJCv9njtrq3MUlluHA==","signatures":[{"sig":"MEUCIG1NHXy5BwBZtpQjSMNmNpAQeDNSQvafkm5HMpwPqD6kAiEAlF2/wqanmm8zyXhNl/L7d2p2hyPmyK1K+n+RrNE1L4k=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtuuMACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmqyxg//T4rDTYZrhUc4w4OV4LMadfcHzc4fOVON1W9WfZnD9EAOX8ma\r\nzaG9bk3YHczOHfWMB/lvcUs5siKgJE6tnmVRKJ4QaFPMnBN2JbVMRA1BhHCM\r\nuIDXE4abu7BysV81opfMdEPuQZAYkaRKRP/IwckfkmMjftciyJyFESTEaZLO\r\nSxIACxxT0MGMsFbYSvt+L53OHVZN1E6RUjdksW22w02UJYE/SnNkaG2XcwpI\r\nPPnKoFcm0q3FYPA3Jpufu31hVICARX9sQwIUG0QRkxzxaUGe634QaCh5KFRQ\r\n9ld0sJk57h/dW/il2toa0mMlxR6LU7ruhOcYsK9Ki7PjBxFnZ6AC23VT6oMT\r\nuYt1WRojb+BGYkrnC7ktEmhJ4QLdUQ5aaDCyD86MZr97WgZCMrQCwqfpa4/r\r\n13SepGf11Pt1EBWycDifXpaR9mENEHkPSAk+bYPxv+geER6kqGpDisFoAUL1\r\n9Fd+OdDI9tl9Qs9T1sr4dXHiPK2/3qQj/XS6WgHALW/mT5I1Jf1huSe2Gc73\r\nBn1wvUSAzU2viVqgHjSHeCM6S/D/1A9JOO/YVjTC/WncvJSYm+K43JmDgOhK\r\n2MgpI1HQTKH4D+osSH3yfFz8I40a4gtiqzzg3ijjwrUEvWQ/srVG+Y1TjBI9\r\n3BZiCMlg7RgfJbsmF63pZG71AJkY7FwlPOY=\r\n=Rrii\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230105152320-20ac28c.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/af64d4c650b5cd86c1fdb33fa3bafbf8/graphql-hive-client-0.22.0-alpha-20230105152320-20ac28c.tgz","_integrity":"sha512-CqghfHy9YsvS/f+0reqgEUEuavUnIQ518Tx183iNlkob6DCyXFrzLr6Hr90vEcUo4gi+xJCv9njtrq3MUlluHA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230105152320-20ac28c_1672932235990_0.5227829925618195","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230105152550-5f16991":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230105152550-5f16991","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230105152550-5f16991","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"49b9e6332c379c2be65810c563e0103f7d5ef644","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230105152550-5f16991.tgz","fileCount":60,"integrity":"sha512-2joyuZ7WzwGU7n0m1x3eVe2dKSzW+8jV14xMCOVE3q6sGx5YqE2lfAZdzxoI5Ylo8i9Z2+IloeSkyhLa3E3djA==","signatures":[{"sig":"MEQCIFsvUU2jA6c320rwQfFCrSVQBQutljJ1y6cuacRyzqlaAiBUWHkgIxQ0ej7SwOH1D7W/cpHIvUWrqXutQCXCY2HIIQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtuwrACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrfzhAAoscA6vkSmjTqtVlGYorbouQubo9N/eIv8nmeH5RN5PUDgADj\r\nHzODgE9jXLkYJtLrNIXBuY1MvomK4cUSQDKkUEDDJd6Hf+jilREMtdKPvJTL\r\nzbQ4LI7vfAMfBdVbXOwEPwU+MMDrJ0VsyMCnKa0ciy9VuFOKUcVoZgW2KCg6\r\n8VhorAg8puXCAdxQSfksb4czBUMFx7Gx1AF1GhwIrnaLnxeoqOv90aSKlNbW\r\ngIcB8mESHuM61dDhDFxSn5v3Zl9kwGr4mbGuFG0SHQzlifvxj0THlMdWWJ7B\r\nSx+dWeXcaCH52rxO4wVmMdpTQfJ8wiDQyWYFCUGv14A/Eb1ey1bxez2xrDOZ\r\nsQ1zLIc0kNPwPozPYCB0Ubju2n1EnP5a0W6HNUPPChPay5/fTTLAw77Hnw6X\r\nqNa9R40zHCSsTMXqeFXNyorV0oVx9eH2yxTftGK9rfafZ+bCFTCi0KP4djLx\r\nAMOwLZBs63LpNzxsz3/+3xqOt3wx8/NO7uhZ2aQilCCuCxIlaoxnxVl6yrKX\r\n5EK+3ElDWh+cPcSc6Zr+kNX+NIfB652c+yJxqyu1fu1L2yR6W1Ft7IoSL7Ya\r\n0HoJ3mEUs5EFm/DQk6Hwl7nLxjuVVsxhIXsUaIrer0jTLvRAO3gveSik7g7R\r\nuZh/n5KPZ6YEYJRNiy9xIVIDrx9OTSXODfU=\r\n=wjr1\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230105152550-5f16991.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/0d1c3834615c552ea5dcd59d7f239542/graphql-hive-client-0.22.0-alpha-20230105152550-5f16991.tgz","_integrity":"sha512-2joyuZ7WzwGU7n0m1x3eVe2dKSzW+8jV14xMCOVE3q6sGx5YqE2lfAZdzxoI5Ylo8i9Z2+IloeSkyhLa3E3djA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230105152550-5f16991_1672932395741_0.6410402341916661","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230105155231-c50fd06":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230105155231-c50fd06","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230105155231-c50fd06","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"2aa3f8e3493a930a6febdca10b4ba51f23b885b4","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230105155231-c50fd06.tgz","fileCount":60,"integrity":"sha512-bITmegxS2eoBMmPWuHxLwWsYJCosSsa+1F8PutSAmXY4iY/lGcOI3pa/9HQplmQcu8tTOtEgrFELbkiup5b0bw==","signatures":[{"sig":"MEYCIQCIUuyNCBKDL673BNS5x17ZAeMuwXhSIx32XwENX52IeAIhAJ5Z72PUtVUQPhuyQIX+iJc6XI5GXMfkMQGdncU0XsEU","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtvJlACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoHeBAAohcAroKYdjtuWmHJVNBKHMrPTkc4CytDjBhaAFZ6DDlU9EDQ\r\nbr2rAqkict4EVWWRyhm0B4/TihCFLnwYycUIg1m7aYD1pdFR7dLGy99hbwxQ\r\nqfeV1XIfBQjVceyr9bTTiF8VKoVCe5ovtvpOUntht7Wm3oOUu91CKijI0AGk\r\nNdQKVvQvABf+YGg0kgU8+5tMJLTdmDkAA06WaGXwcL2Xu41kv/SLR4zO+vVD\r\n0ab5XNfEDiGozmdyvinJwNAbFRIpiL6RDtPyuYOLLwcvqvh039WOv4ysV8gb\r\nSonqExT8nXcfcSp5WkcQwnfcUYzevOoH90n3uqKSICMiS2cgk8PeVaiGMkA7\r\nlqfwwzFPJsFjsONSoenipksIBJ5K355D7NTHlNc+KyQK5oUzp513/A+xJD0l\r\nbBRPH1vlToBBXRyB4QSnZCxbOmG6/JQQvJpEQtR1D9P8R2060T4tf0bhN56k\r\nSoqCfHTntSkjEw/Tr8Moofw45212ca0yWSrcG+BfK7CrQdag1HSpTMWUF5/3\r\nLYgqRxTNexmoEsgaBJOKImzjEu9jKVPefzq8ZTemLOi7uvHRcqzFXNrwfTRk\r\nIARZsTv0YlydSvZLcxhu6oeAvt+vL0nS78+0ysXIwdzGTsrqix2/FmCzNcvD\r\nuGDlK4BSHsNuGjIpN5QLOrAvCvAr7TR9+ic=\r\n=Sjc7\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230105155231-c50fd06.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/000b89153a8db2e4cd32602b5d331523/graphql-hive-client-0.22.0-alpha-20230105155231-c50fd06.tgz","_integrity":"sha512-bITmegxS2eoBMmPWuHxLwWsYJCosSsa+1F8PutSAmXY4iY/lGcOI3pa/9HQplmQcu8tTOtEgrFELbkiup5b0bw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230105155231-c50fd06_1672933989476_0.7492057955987481","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230105155644-4fce363":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230105155644-4fce363","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230105155644-4fce363","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"dca771d78f863ea0c612654e57719dafcbcc4bcd","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230105155644-4fce363.tgz","fileCount":60,"integrity":"sha512-XOBKbtbhs8GlQJ6C5sjG31BU3+jH21NfmF4mEfaoV1Wv+fRS4DqFfcNtQpCvdDFfmmBes7/J7ZZ0nmI6J1F4yg==","signatures":[{"sig":"MEQCIEdbO6hEsN7Ukc9UQST0SZMdiGLVh1tL84jk8Zw+rMxTAiBnUDU1BkVP9v+Pc7XDd/xeDulTE5uJGqqI4fpXH94ntA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtvNiACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmorpg//Z44xCHiys9Mis09CvyHeXgXjJklGVOBXCqZ2BvQQGx9FKX5e\r\nRUm3goE2n5qgH46FNn9KDZ/8vimDAZvOVsqgwo8Y2qnxwnYzQtA7/HZt/QAg\r\nCSNtMpqTVPRNkuJnBFDH49UlA0VY+jdrGT9ArnSb9UIBFBMJsERJ/FxaQn6z\r\n4fk8OiA4qZDZkPhdOQhmE6ny0PVsNb0yflO0PudT16aog9ghwmNyOzs1L5bK\r\nWTwaZiZ/Wt5x7r2HSXq8KCm3R7B4cXcnGTn4GqqKWe0TOUArViRdSp2684vm\r\naWL3ksyJqssD+8cOuwQlHA42j2JN05Vw06RDVGWcDr7Xf2wLVdhlHGsyJFRU\r\n/O4zu7tG4zBqQEIeu+6uK/u07jxtbs2uClqbguL2h4haJb6mGg4JyC9EoMvH\r\nZ7vHLiRbpZuCuqIa9WjezD/QCt9EAyjDnWW2E2B5weXlM3W3/HT5kVrG4cBG\r\nCJVCME9kXmeqT7jaJg5UTHOSklvfJsuh1ZhUERbeAcVmx8xT74vSXscD3IVN\r\nHBdyvLlWnty8JeS6iAEdBqh81uVSY6YBfsRMRpWSJCnSIjYKEzjRmiua5320\r\n86l72GvlYjz9Tnpcegc3wBRKNwVAEHnuMGSz9FuGqR2/xXtaVwFqT2Lkg/lE\r\nQivZsbHLxXRG+V7KU7oh9Ce3XGAHkTZV7PM=\r\n=x6N4\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230105155644-4fce363.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/442de78c0af1ec93f987d2b1ab6f54a8/graphql-hive-client-0.22.0-alpha-20230105155644-4fce363.tgz","_integrity":"sha512-XOBKbtbhs8GlQJ6C5sjG31BU3+jH21NfmF4mEfaoV1Wv+fRS4DqFfcNtQpCvdDFfmmBes7/J7ZZ0nmI6J1F4yg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230105155644-4fce363_1672934241961_0.4390462544884066","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230105155728-ef2d4d4":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230105155728-ef2d4d4","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230105155728-ef2d4d4","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"c0930066489398fc413562216d98a06a7152519e","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230105155728-ef2d4d4.tgz","fileCount":60,"integrity":"sha512-KGgSeAhpBA3an5eaW4aeaRJZ84b6oaovq+2xU07C5wdhxh3M9LVZ25XxLwIKQmhjZhzim/WCrxBfmfz/Y69Ypg==","signatures":[{"sig":"MEYCIQC7+K5FiTHZBSmD5FELa7J1epzWyF599de9wR/6MynM0gIhAM8EkYUDbrckO8q6tuxIkSixnLCwLuZVLOc62D9JiZK7","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtvONACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp6/w//ZDdRp02peC9PT64my3zB4Nlqq8jqEpxlK1ZIM5S2nC+gFRd9\r\nRbVIdDIkvPmCujDpcBLp5z/+EZ/p3FIv+O2XBWPxUdcwJbjaw/mS9XdLwYye\r\nHLxTFcix1l6YGdy3fla+d06pH8jZMR5bgZP2FlPEBTawg1gJc2sYd3F+sU+C\r\nHfSVB7S8neqQpx1nwUdIVTrDdqSDP/2ZFD4JewH1TLtnjvDn9oZ9bAJCGty8\r\nhRCKKbPBoON0PxCzTmc17bqN3ub83XZE36/1JVvY0xLtUBMyQgf0sRH9ZiKe\r\njo4p6W2OdMCEbtgBWRihL5++qBrcefBpC6qQvz6gDIkGneXjB72Sk2Xxao5Y\r\nLQjVJDu1hO8HBjqjG7rrYV/m+M4upipn7sxKa4LwO/8FFVijom1Jx7kmm/jW\r\n4cvIeSrkvhx6rx7r8oQYEfC1cTvGYJJ8OASZlEDh8keVxd3dgC7DQuqPenhm\r\nitUDowbkAWAeaNBw5r7pFMPMRIrVAd2iwPPjDpyN2V/KxfHXX/qBrm4cI9gV\r\nA3T8m8JPoJ5IWqnlbD/D2PxMyUxcxhTRenQzjlBEUmoEYGw5BB+iUXmTLXhS\r\nt41rxRwoETiZNxOIpQVYerf3JM8Zf5e8jDD5XVDWxdFoE+/VEwqhVy+h/rV7\r\nCRiq4pOxToztW+O5Ro/7MxKHhpf0ZI2r7vY=\r\n=LCBK\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230105155728-ef2d4d4.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/a013a6d69b656cc2ed97d6e7a4d051c2/graphql-hive-client-0.22.0-alpha-20230105155728-ef2d4d4.tgz","_integrity":"sha512-KGgSeAhpBA3an5eaW4aeaRJZ84b6oaovq+2xU07C5wdhxh3M9LVZ25XxLwIKQmhjZhzim/WCrxBfmfz/Y69Ypg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230105155728-ef2d4d4_1672934285528_0.35121109013956153","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230105155918-4024791":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230105155918-4024791","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230105155918-4024791","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"a37bf5683a1ef21b6c91dd13f7ba95607aedd0e0","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230105155918-4024791.tgz","fileCount":60,"integrity":"sha512-z9s0fyHyezJoLUGxztvLmAgT4OeWMzbx0H77VwQJqpyPJvESsyVi36oLaWV+F8WBTF6c+7+IQEXaGf+azA0M+A==","signatures":[{"sig":"MEYCIQCPvwiWy+9Lx5OqUQDanQfIm4DcpUX4k5+4fcFHrd8RVwIhAKv5BGCyuxgDXs8QzSkuSmOq23WS8qtZsKjIqrsnjkjw","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtvP4ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqLiw/+JiNOwyNLZM4+Pzl8351HBDCtMWVX6+XKviXWCYBC3AT7nR8C\r\n1cikuiFB4L8+hVTYUgfByOtGF0iUhCgyTK6LO4Q7N7fE4/QSVR/ckqhHAVvh\r\nAYBmhCIkzHY9JtnCSjNjW8MyYgyW+Y4t9uQeOgu5gskp6g6IV8kt8savSZ2F\r\nAFLHBCMS1C/nUf6jlf1O5uAweAq0yPTUOgRv4KXduskpRzBS7qaJmAwAakyc\r\nglwHM3XKoaUrDAb9p39vD451jDKkIs+EuUXj5AnR5ARFguO667q8diuHNXgE\r\nZqDPc3C4o4UJmYnSqTjV/jeKaQ+xds3Q9G9e/GQqc1k7+xsHO8Sm1wOdmxix\r\nJTuFRNVGwYxMIPf4MQR0TbDXfZiwXCyx5MwhYnYJQYQsBHmGbG6BGyyZtUdT\r\n0dnM2bvAnNa6iuNwEloYAyLsnV8puAemrQW/O7qPAqTUPUPhNh/UCLRzMPSB\r\n7icg/3L5O6GBV6zPD9XRvh3ZOWKdFi1Bz/XTU7Qfhdw+jyhL2TYF7H+DZdHy\r\nto3+0M+qY9lw31Qum5qfudhy+AUPRKSyZypP/5kenyiUyv9v1ZbXdQmqSVG8\r\nzf66FYNMprB2GfvMmXkSDc0t+54AXFzTxD7H8jvSlnpuTNiy0Y3BEVXTIBLy\r\n4+t3J9Xt6/DFgqeHg642zV7CVfX8oNhSVq8=\r\n=fEgH\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230105155918-4024791.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/4a6ec3a05135c6135fcf6c71f6d760d2/graphql-hive-client-0.22.0-alpha-20230105155918-4024791.tgz","_integrity":"sha512-z9s0fyHyezJoLUGxztvLmAgT4OeWMzbx0H77VwQJqpyPJvESsyVi36oLaWV+F8WBTF6c+7+IQEXaGf+azA0M+A==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230105155918-4024791_1672934392455_0.4014032509201386","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230105160401-9a2d54f":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230105160401-9a2d54f","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230105160401-9a2d54f","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"3411e3ff6bdb336803d2b971eaf74442cea45e25","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230105160401-9a2d54f.tgz","fileCount":60,"integrity":"sha512-uKkJHTPrw81NR30SIlAt0EsMhnbV1ZBh0ujUXVOejeCRCIL3+zlQspadKrecBA79nTNVMBG2UpEZk5HFQYJB2Q==","signatures":[{"sig":"MEYCIQDr4a7ZkMGbk/jj0z24p7lB78PjleCMZYyJpXczAPxMeQIhAPSiGnrt7Nc9pMjgP5++WUe3HTdOGRey1P0l5dnuV1Or","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtvUVACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrGchAAn8JbiFOdC1LcixCnvY5CZxg7WI6emczDl85l7C3E9qjUaAnH\r\nxtGG1cHbizqq31mo2v+dWLmCLUptHRHm0ZYVzQSsLWOVluKjkZYURQxqHTio\r\nOfT1RwN6XWcBpWC22TMR0RiqFzHyM+HFaSlg58iKbII3uZ3nRWmuXgxrhzAJ\r\nGrKtVqonL6Dz5UN6EEXyDzFeWzEOQwk56WDIZiE5cKAXakaq5AYdDfIC1Vqb\r\nPkiU2PDQD4TG2KK4iLRja3Is8fPPupVMIhHqhGpJxuSu+kv5tIm7tUDZxiGx\r\nSWQXyLBofvEdw51JGcHoswFhWWFlk7ROuQl+Z3rlUCxfsxK87HHkOw/uAjSH\r\nMowRwsfkP9FYUD84Iz1YB2Hz9GdCgsoD52ghDQWfkL6rwI9jZMEO7SIpHzXd\r\nbpmfHpRFEevHt/Os+RU7gvL6AF6HhtbpXWo36AHQ3SUxU2jA8FYLRz3PtJCJ\r\nSuJF6j5Ec25oJWzZcjmCrVjbrEA9B3xQ73HfvV9/kf/Enrwc5wUo1PcZH2ey\r\n8A9DEdiIR9vjt6AeH80knw2iiUJUuzDoblzDM0tj6cJP7RRFj/CkenKMlcQ8\r\nPFwhdq4imF2B+6usGh2Yt0K6l9KMINkqC8Sk5gbsSJtNPYGnLLtT1cbMgcv1\r\nVp0HkPPDJ6lnu7yAHxWkEEEB1mcjufZj9VY=\r\n=tVxf\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230105160401-9a2d54f.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/2b2879b3ea0489810e5d76b16759db91/graphql-hive-client-0.22.0-alpha-20230105160401-9a2d54f.tgz","_integrity":"sha512-uKkJHTPrw81NR30SIlAt0EsMhnbV1ZBh0ujUXVOejeCRCIL3+zlQspadKrecBA79nTNVMBG2UpEZk5HFQYJB2Q==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230105160401-9a2d54f_1672934677221_0.4169922237021726","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230105160941-b6f584d":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230105160941-b6f584d","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230105160941-b6f584d","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"404a4bdeae6e85064ac4da15058194d04a5ec703","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230105160941-b6f584d.tgz","fileCount":60,"integrity":"sha512-U6njCMdVnFZOBuzU550PCr9wz+7x0seAZ6rw9WK6h1akOUnoHwgjkRAULCtUfe92zv3hvk9GspAGeRTk+BxNQw==","signatures":[{"sig":"MEQCIGkD9WhhX8KJbvGym49j++VpFuasUAybUuhqgiNbfxVnAiBjhXn+QUB3eK52vqIg3Vc5TXMQ02aaY9KYdoAi0xOHFw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtvZ3ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpK5Q//f/twvCpFgKO76K5C4WCsj20Pomgan3Uh+QzI3qh6dzaQliKs\r\nEJs5MuaGog5SDQrsS0ZvzSGqptfQCAFbjCh3OIGIajnBuy2ObfqxLM9fV5VC\r\n8X9VuErskITDw6NYz4r24yW6+CS/Tr3evGomyZHJPKFDiaJ90YsliJwBCvle\r\nFBdmn43RAcVRtiLjIrFe153VhuwhPJnsUyR5wX3EgqZ6V+j8JK5r3QtL0pvY\r\nEJF11PQt++XCsbQtod6FMHV75c+F0O2yGyCJghKLtncUWwGdio+8vK0sSaxl\r\n7Ns2wmZB6nzc4Ada68/dpy3KB4QIgB316qWiCto6Emts3nPzSQZNtTGqUfpF\r\nxdjA/KmKjl/Eg8rB56iOV+xfq+9tcGtuT1Fiqr5p1ySVzqBAJPVQhmLjdcjj\r\nzYUwelJPt/2oVryI4eqjPxGmrU3JOCU6Ee2Q2JEL9uIe8KEvUGK4h6YZFUhZ\r\n5TriJ5IzKiVTKv+gbT5oMlW/bIag61JN/K5JAoH/A0hPpOWNzCshM/5tdIQ5\r\nFHCK81CMHwGVwtzS1TU/AW1hv3IS5y3CcqgpGVCQsMj+goX4p65W9SXWkIiK\r\n8nMtwFtm1KdxwMsjMSbZ2SNg1v2jJyOH0Y2jUSIQSbiFWateAAHTGn4Rlg0y\r\nTVYGvxlXbWR0Vzc6jI6rXjMTau7vRhe6AuU=\r\n=YKkG\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230105160941-b6f584d.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/d737940550d7fe809998666f2fc49551/graphql-hive-client-0.22.0-alpha-20230105160941-b6f584d.tgz","_integrity":"sha512-U6njCMdVnFZOBuzU550PCr9wz+7x0seAZ6rw9WK6h1akOUnoHwgjkRAULCtUfe92zv3hvk9GspAGeRTk+BxNQw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230105160941-b6f584d_1672935031647_0.6038092092758536","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230105161410-ea9d2ea":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230105161410-ea9d2ea","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230105161410-ea9d2ea","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"2a8dda0efe10b97db53ecacd5b26758fddc0d36f","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230105161410-ea9d2ea.tgz","fileCount":60,"integrity":"sha512-/909Za7j1SGFIqD9pVlNKQo8A3gO7+qo3GTtu+8s9jgusVtxw2HtYuP8dwaViDvGezsV5FhruiL9JWjuU2dpDw==","signatures":[{"sig":"MEQCIGrSlbuLwThXVT+6FtisAghbd/rwwg633yaH6DDi6NcyAiBBJNxTVInp1BnJdH+GtBqqXP5rlL9IqqmskcxtrBT/ng==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtvd1ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpZig//U1tRtGXzjJ1uhfZI7KzYwdhYIc6uK/xaCUElhmgzUuQEpvKn\r\nf0kKbIb2b0+ZzzavqQHbBBXDuGiBs2/qO26w38t6kPk1ZIbuYHOHBwJBfSZf\r\n0t0NVsqczukqEdJX5uK/5qpvdec7e50T81TFlRdwPYcMNHfJCbV31V2GaFoB\r\nsyhwCy1/0QkkQ2SufNg73+MQnbRCXAb6etFqKDWhuaDaVpAqsZi4AnXGbLrV\r\n2Fqfz7D+Jam4TlzskDSikdqIIoc1pk5Z6YRIxG29GTv6iKTPEenBkBuUNGXq\r\ntc+ISrvqBJl4I4AOid4bskV/A/hLrTKmy25KvEb2xSGvtWNRDzeNZxUGrTM9\r\nhB5hJ0qAxMqNUNVrlB5UxJY4jTlcQYfJIsOIp9egoP3+oW2UAeZavU/Gmmmk\r\n4dnAZYmB28tPgjUrdRrdOEP1MZoYtmJp6UV7HthlxBUX5ATNB3LnVlbUDHCk\r\nTV1NnglqH+IaO18is30BBuAbNGQKytPVsaYqBitnLXUKaPC8RiJ4qYr3We/E\r\nw2cJapFOerbC2y9ksvjgWmei5IQBbhp15vZOmh3dNQV1/xdepD0b6b9X9A6P\r\n8Lxgt7Ts4uKUvQt0YXaq36ViyLdvqE/LW9BHLAO1TNP4X0S3bC4Hlqbfea0t\r\nhujrMsoyrRbdnLOvYE6u+7wl+IfbHdE7fW4=\r\n=X0xi\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230105161410-ea9d2ea.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/160b4f0e6f7ddcc267acff4586d15752/graphql-hive-client-0.22.0-alpha-20230105161410-ea9d2ea.tgz","_integrity":"sha512-/909Za7j1SGFIqD9pVlNKQo8A3gO7+qo3GTtu+8s9jgusVtxw2HtYuP8dwaViDvGezsV5FhruiL9JWjuU2dpDw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230105161410-ea9d2ea_1672935285623_0.05728928609767614","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230105162409-4fe0482":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230105162409-4fe0482","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230105162409-4fe0482","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"adb5a7ed5b6b0c7d7b9a9c0b73fdf483c3111631","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230105162409-4fe0482.tgz","fileCount":60,"integrity":"sha512-nAu7eROffQIQlsmabu5+392m35xjljLVtntCCZmAYP/E9GZZItGD7wLtEyRae1cCBi6SbJRvN8PfAnelkI2HTw==","signatures":[{"sig":"MEQCIGj9nVF9md5qsX/2aBiE+mivRIHplc0VjnWYSnG2Ez0fAiAzG8T4fIxmRNIE/AS2ffItvZsA/SBxGvjER5C4m0D+SA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtvnWACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpF4Q/+LCvPjFpb2gm64GLxAR+K5ziwI9QbYrbEcBV3HHpR+2+F2UZ6\r\n/0rBk7z2Dz7bVFoL4QspB/ytovZDYj9Zaxbl5HPekpy69Ok5yPoMIBXVNd79\r\nEWBqjbOKrlKlpDKTo8CDDO+UDUimyRtzrBjOteTfAX5Hw35vHCPT8HGzUssQ\r\nMCi4zQneLq2D8BxwFPJC9FFVv42QONlq1JlqFIhWiYFQ+GBQfyUFpsCh2OAk\r\n+GStVIs87pIhL+KbEb4phuYCUu1Fzs5HFIkhVZWqtl4Es8jtlL8kMrvhjjhU\r\n9RQbXXVELOOOvTgNq4PfZiMW2/zb5LGuuOLJkINh7z+WMPLKj2o5qSqvg3cT\r\n0pE1uEq/G/qTsAYJ/Q7Ejuqw+PMO3eNCJdELVt3Lx41TB7EpoDcMsEpe7SIE\r\nEL6T9DFSaIaqx4Eme0cE4Ow83GZMkHpdhI5qyUX7/INYs0vsHucFPD3bG1od\r\npbdr/in5USr+/mP6gU455qy0kCORJjfgz+ipuYW3gr9IjlU7+6j10S0DFu35\r\nUnoJRMezZjcKQa+r2JQ1gbzKgVnOxgfLV/BMunZ3Ds7m9Wjnh+Yr8BYsunyi\r\nqOKlhsxK4e0/X6WM4aAUEhMiu6LnfUjxAL+FcRoh5DKK6BtUGdXRPUKZYje1\r\nOoUV5NJx9U9Rb9QoaBOWZG6xFsFn9oYgl20=\r\n=7td5\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230105162409-4fe0482.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/2e42803fc311f321dc3653e271c7a585/graphql-hive-client-0.22.0-alpha-20230105162409-4fe0482.tgz","_integrity":"sha512-nAu7eROffQIQlsmabu5+392m35xjljLVtntCCZmAYP/E9GZZItGD7wLtEyRae1cCBi6SbJRvN8PfAnelkI2HTw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230105162409-4fe0482_1672935894095_0.17135207312353273","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230105162433-08ac06c":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230105162433-08ac06c","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230105162433-08ac06c","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"74ea11644dd46402ff2553539e06375f7bd1621a","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230105162433-08ac06c.tgz","fileCount":60,"integrity":"sha512-cafCM9Mf5z/Zlit5XMkTroTC/ONspBqhgoAmnhoBJ2NYJghO3iRp9sodPx3/Kv+FXv0tC2J1IO+pyw1DCWPhVQ==","signatures":[{"sig":"MEYCIQDd+FLbY2qiNxQFGTqtjRIQsRz78ns0j4OsavQAlM6qIgIhALIiyk9Lf7FjMGYS5GYbj7kZnGUfOdUrq9CAapFoJjkf","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtvnvACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoDPQ/+KKQubOKpjReVO+UroTCBcruwOl0IW+emVDy+YlUd3p4cXrPT\r\niyrZ/k4LnZywfwYFRiIYhjn0Wres9ThdblhXWc/9uMY3UtBZEhZmQrvSidCl\r\nCS4LduEXqP6QQmUnUpgqaLPPcROmAyWsw14nwYZby2pw+aX0HC4FfCdeLuvi\r\n4tuhWtsGsbz27V1DyDNJ46fLuqyDBXeGALf1YV9XiQnnPG/Xv3IoXcdIh1rN\r\nkVUVW2jh4XDDDjaaVd8gXi8MUPqbuPxN75dkZCZoDq2OsX5vWNqh0S/zZYXy\r\nMi//Ju/q++AC4QgD+q+1D5R9qX8VoFQp7cnXz40W3I5T78kGuKlPHkF16o4P\r\n29EOi2VZJe/EZbqarbAsbNcr5tNlekCobn+jxQ2chLQXRN5jDKygLhgVwvBR\r\nArgsTqNfSs2D65SKQjWk+Pc0HIGeAeA/2e8kLEYlC6P1qq2hSbweqeKr6L7A\r\nfIWK6K7/faK37xvgLQ2TR1dcl1q2JTYgvyqiBSxw9h84NNXIH7Kw56df16nQ\r\nG7ZVHqlNrPlSaKxcivBCCIO22I2QFK+l6JCyH76/GZeU7o8PUuiZdjhFE41s\r\nrIP0bxpZblB9SXg8fIaAuGG6D10IOxQ5wYXd+fjelB/wFMjlTJRoitYHNy1x\r\nF98QHiYh1r4CHV796R9zOUjWDC3tHk3cZJA=\r\n=d//w\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230105162433-08ac06c.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/b2d5f76763058beb57791fb8eb10cf5c/graphql-hive-client-0.22.0-alpha-20230105162433-08ac06c.tgz","_integrity":"sha512-cafCM9Mf5z/Zlit5XMkTroTC/ONspBqhgoAmnhoBJ2NYJghO3iRp9sodPx3/Kv+FXv0tC2J1IO+pyw1DCWPhVQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230105162433-08ac06c_1672935918918_0.7162661955251624","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230105162936-c1252f7":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230105162936-c1252f7","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230105162936-c1252f7","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"9dfd5fbbc302c58eed5490805fdd56e325ee7e01","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230105162936-c1252f7.tgz","fileCount":60,"integrity":"sha512-whFpYXEyrJ0t+OOdivJ+3xy0oQzAANeiANnsB7ziyVZ97PMxuoQ+RxngD/YnxAhczVX4M4RsBLAnUoVcfPjIPQ==","signatures":[{"sig":"MEUCIQCi0h6h/AqNfniGfQevNny6L1WvtH2ryAnGtoh5DJ1hewIgH8uJr8xdy5BiupoMMzNm8+oL25uy804PfFcr5BsjQ64=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtvsUACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrzoBAAgka+UzRg1pimklv510LOnMcVEr2D6Js+7xXWJZ/u5yHeenYB\r\n2CP/GqG5cmjzTyG/a9sRqOHU5FfL6Qtr/L6F7i9t564L3+KUATJ4fw9HxOpD\r\nlGL4OmAC/VQo6X730A0KaXtOWeufjUBU7xz0o0g8N3qDjkhz/lkkz44LW4nr\r\n/4h6c4Vg7JHcwspcjyM50to8uYvbtUq9xgjAYmEMZiTP/zmPVDCknGfsf5gO\r\nJID+jAfdCixD2chO2V/7BG+B/8VYOY75NxlREzy5DbrkLqarQyGuCuFoCYN7\r\nCnFHTQNhyHEFeRyB7rhRX3joEbu/97YIuudBRCv9K5cy0G5w4BD+VgLAwOYa\r\nQd11DzxuBmJ6HiWz2+vvsWdQrZ4anECljKoXyofhjg1nvYGO4ZrBK917xaEr\r\n6x641f/XzOpKwHSrbQwpA5kPEd3alWa5zb31rVQqxCCJzbAiBcGnmp1vae4I\r\n1ru0Wk7LF282YqCsoQtzjIXxVTPXew0C7A3VKbf6uIvH5vr3uimFGgGFAy1u\r\nQ+griRSXfStoCvGnsXUFaWwPp9aE66LKAT4Co/5Fut02tOYPU7LPlq31rZV+\r\nSF1zTAzbviNXrSxokTfzbR1i+p+YZcJscyMBB3f5C0r6dLROZ2O7GfB5oUjP\r\n/3GNg45vwYDozLIrJburAT3E811OOFzh7zA=\r\n=fGft\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230105162936-c1252f7.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/c067fb6b48dfb5e4b437422ec5ebf99b/graphql-hive-client-0.22.0-alpha-20230105162936-c1252f7.tgz","_integrity":"sha512-whFpYXEyrJ0t+OOdivJ+3xy0oQzAANeiANnsB7ziyVZ97PMxuoQ+RxngD/YnxAhczVX4M4RsBLAnUoVcfPjIPQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230105162936-c1252f7_1672936212216_0.8409281875582009","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230105163503-634e5d6":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230105163503-634e5d6","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230105163503-634e5d6","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"0b7fae66635624ccc7cae4c4f7da2c043b0bad6b","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230105163503-634e5d6.tgz","fileCount":60,"integrity":"sha512-IFV6IfY0e7vttMmM9+YZqfUhvy7O51LWOCYeNkPc1cTOm6swkmId+ZLcUhBhVpEA/aaRsfvbTIZQ5kckEaBi/Q==","signatures":[{"sig":"MEQCIHqj7eyO+XWbrJ2t6u3C9PjnBEe9HiVdhvXD2aQxCpVjAiBqt0GzWs1ELQUcDwjC79CQA3mBKIx1IT8B4Nx2OQjfxg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165581,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtvxiACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo+pBAAkvwPgG6ZwT9QxARvliD0iUd9psa0Vg/z4P8HYfbNARdQGYjW\r\nAb9v6tKvWi3/ozv3jgIwbf6DWa4v8mEBD1m5M8ZiQ/b8Xl1ARamoI09swU9x\r\nmPSHSFYzGhAkgEukdUn1sqB0m36Kmyuu/V7TbCs6EJGaGNV2ysgDwxBzAKGU\r\niiqxoCa6PQXYoS4Sz3CWLQRqA22wunGmGWMovC0USkfds8mswQnbzQwtMQ+a\r\nRPitkhmLTzZ/LKYaSdlWCZhOgoSlpPxt6qjNdfgnCR7ixpn0zSfYsUPBDHNQ\r\nqzXffXdQV+dnb2qZywgAP6YukFKJnONSli09gdsZ9fB7CfQ4NMxMFU0mnBJ1\r\nbJf4/kPwepkCiYEa0iHIdhhE8ujHzXeN4XEh/vFhBiPeHVivVfLE1dCFQB5A\r\nrm1Jb7Tf99pJm5beOgiqlZpbgK62cqdpR4+mIJ/mEf7bU3ChhR9NrfiMEcjz\r\ncrZ1f1DZdFhMqMouL/AHTV32+fx3CvsrpKZdDN8qGM2frhf3AXkGaoZPJePf\r\nhxReUd8esM36c8MVDTpRVe6ccoYyfP7WCXtqGC7z8hG0LG158hra4dfN3W/t\r\nL8q1noil4zDwIaLCSSba0YldgtEunqWKvE/WcK4qOwANMopdjY6czfCtI2cg\r\nQ/CBpvE8IpPnahR2gx6lfEG8KPCOLYeAfQE=\r\n=yMF8\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230105163503-634e5d6.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/19f6f8f241c0ca2c86cd2bef73ff39f6/graphql-hive-client-0.22.0-alpha-20230105163503-634e5d6.tgz","_integrity":"sha512-IFV6IfY0e7vttMmM9+YZqfUhvy7O51LWOCYeNkPc1cTOm6swkmId+ZLcUhBhVpEA/aaRsfvbTIZQ5kckEaBi/Q==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^9.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230105163503-634e5d6_1672936546006_0.2177997698288121","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230105164119-3a9969f":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230105164119-3a9969f","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230105164119-3a9969f","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"069141ffddf62662977c58b32e3bd3ece34a8048","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230105164119-3a9969f.tgz","fileCount":60,"integrity":"sha512-zuiJ/7tfcvZqemlHQksb15wUBbhMQWoO6Kz2l6tWlVoD3gvTnKozTswkygKJzSeinCAlqxkXoaq9kR9dRR0ftQ==","signatures":[{"sig":"MEUCIGDcftiYVuO23CbZNeKEvx3Rvasym/F+MTzJSBK2GlbuAiEA/ZSBAKFETwOTP0HbqvWrZ/gu3FRzJcA3YzxBVzpjYTs=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtv3TACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrKgw//R8mwmiOD3Xz/n67TFi1yJR05ZPqnqtlzTf5Ydo24U7d/tapr\r\nuQhPejVgRTylQvJEq2kexcDd0JYVUtEXTRUaIkiMc4kjRPKsgEAZLH57s24I\r\nF5KKEctjc/cRsTabxOGEn6KsnVRWyKOeknmahaI47J1FmOk3AZvGZtUqB1UR\r\nrCzPs1CqYi900u7CqVlbfMOwQmt95KHI47Oi4G1sWFAJchIIp1yz9hnIT3Oi\r\n9esxwbZSyFdKDOjB6WjFgv9CJOkFXUlJfK7rtLt+rKdQ15X/FuCLAm89MIMf\r\nbfd7LS9Up1W5KUNUJKKTAH/4x0e18U0PbnUxTNncP+EXixeyE7voBfhS4ilS\r\ncRnOH77kcN+yBB9Ptd7JXkah4Qxl4GKBpN0Hm8gXNnn5yjTqwSDhO4iGUdhx\r\n6VTvhm4oSn5K3sg2CHfmxT//c0fpyvuqc86Z2JomTC7oapoK23ECfJMjC0VO\r\nRRN6Btw0Qp8O04O5MYfc+WQaX6w11W56+fEHWIBGRjO+i8JaeBHWhaPxUev0\r\nrWBWaICggpibMOf+SHtLcb9Le9AFJMOTzEZHqS8RkAVtFag3QpfYnWyWZC5E\r\nIRfchJs3C+Ro3bIHj1m3HSgVbgvQKGsH5ff2MFfBZArqqQxooktxe6nObKP2\r\nCjb4RLC1LekqSelsK/+XtjCkXHDjhTOf8FU=\r\n=b5cG\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230105164119-3a9969f.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/55c63238f19b4c19b068f3d9c73ef0a0/graphql-hive-client-0.22.0-alpha-20230105164119-3a9969f.tgz","_integrity":"sha512-zuiJ/7tfcvZqemlHQksb15wUBbhMQWoO6Kz2l6tWlVoD3gvTnKozTswkygKJzSeinCAlqxkXoaq9kR9dRR0ftQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230105164119-3a9969f_1672936915123_0.52785605903871","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230105164326-cf21d02":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230105164326-cf21d02","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230105164326-cf21d02","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"25278024ee9f1479ae746892ed86316114cde1c3","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230105164326-cf21d02.tgz","fileCount":60,"integrity":"sha512-gkJeaMiyn4NkEfwgeSuq7gFZkkTlT9674zT79Q/u6uh+XkxlOBiHblmLxBA7mw5v2b6SLvfrYlBGhJvikB4U8Q==","signatures":[{"sig":"MEYCIQDc7/fttNyGI2e8IE6HMWkS2v72IMbl7am7E+rdrvpRmQIhAMLfL+0ES/RMYQHw161bsg6TnvBpYV9DHotIuRw6tmFt","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtv5YACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqYsRAAgzGpBzMzkRc1WBrd4MCR6xOvPiBzuxBNxE9+FQFjVIOl5ZDQ\r\neIiBk+1VqP7J7dAITg19NcjZ6KEvcB/4o4+I8+JCZBA2YssXQIUz03Sr58RL\r\nhQPYHEPqTfVpJ+IonJbudmuCOdWYAcJ9QPV9wJeVWhOmdmc1lxXsWOPHdXka\r\n0L2zWOCubOj548Lx4vDFf9ZZvKJWYX5RileuITfhXzWouX36nKkfOHgfpYzj\r\nSL5uRrxRmAGxqxQVVekOEAxa/It6asNgd/kcxeZ5OiHJ963rh7bu8PJGLxxE\r\nUbPruVlEtTvgIXkPd+9KtikqaZsZlD8lGmH75sKWbH4dzeELlB2vfNMLNcPP\r\nquEdNrxt3PI4oNFBBNiQ5AMsSFUCLD+4oXNMwN46V3QEMV80ouiQ9y10vjXq\r\n7DSoARu2L1ldz0hQkNu+nE203Vu82OvaUjlL/I+AYOAgSa8U+a54qirY8K4i\r\nrl/UlsymEIkdSjZim6PkNovTYu34NqdH4osvC0T+b9cPby/zuEp/moXPaWdq\r\nxUSizbvqrVCYcyKdm61uZ/DLyXKs1A/qXt6JTvHwEWY9EDqNTv6Yhrs7psro\r\nFCBFsvI8qTLwnYsjIcykj3Btsl9fL9DTA3wJ4iOkzdgfqAHy0iFd+2sU6WQa\r\nu0i4vcfmMsz+2zFjS9fWJ7oBghgc/5zNlkk=\r\n=Bs9i\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230105164326-cf21d02.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/b85abb76767783dd47b21a209604db0b/graphql-hive-client-0.22.0-alpha-20230105164326-cf21d02.tgz","_integrity":"sha512-gkJeaMiyn4NkEfwgeSuq7gFZkkTlT9674zT79Q/u6uh+XkxlOBiHblmLxBA7mw5v2b6SLvfrYlBGhJvikB4U8Q==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230105164326-cf21d02_1672937048166_0.06747974060200868","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230105164819-8facab5":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230105164819-8facab5","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230105164819-8facab5","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"438ede4f3e239db2cc87c3d3c54f02a9d3810b6a","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230105164819-8facab5.tgz","fileCount":60,"integrity":"sha512-fAPJGMHsenuIUmpWxZFh1jyLZokR3RnfW4LcXTf9EL/s4s607hkBc7W8hzNePMNInBcFL+nlG2uQTRRRbMcuMQ==","signatures":[{"sig":"MEUCIQDirz799HX+E+BF9qFzC4CDZf11WSUDuPxNU37Bc9Cf8wIgF4FCaup9ZYiqPGKv/UzrgbITg3SXwqs+I/qzHIgqmyY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtv91ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoFoQ/+IAgv9OlBcdfRhpAteI+3jGWb2g6UtzSY2LMiIwY5Fubszps7\r\nMlTdQPr3bWXlTCJZ8yPSSR8g4tkoqrh0mC8/h18e09xW+ninhWFfzlyrzYWt\r\nIGpqCQCpfiAiga9Z+NO74IDwtHj6jXBKf3f9riZcfLXXpWjn1SbHY1C35Lgj\r\nGlIi0WsmDwsiWMU8qL+BQ2coWpZ402pK3Fiz3jflSVWO9r1dVpmegkwMarbY\r\nAJhmwM68+KL9q0vgLIy4JPjbwgt33tpFJygvqIt8JqJCcA8Chj4OUg8VuCzh\r\nHjGMpGCkGLYopWu6A+5nMaCkUmLQWuvko5lIjuwBA5tYq0dvDZt7o8XJ8SC5\r\nu4C7TRepSzMdNrrOi/gu6NROXzcjONsJTbpNzSLJSsTEAYe+K+Fi60s5wxwM\r\n0qPteC1iCnEK91JSMaIxemDabElXGCKFbSFOrs3ZH+3GM9jQznCdRYUVQfqj\r\n6vQ7n+mVr+BMVgXK1OEn/OO402Xwu3qDNQ0vIeyOBJVrUBIRSJv4YmSHbJX+\r\n5kFe5AlTiMAK1rNJZT/+wMC+XLzfBkWq7g/83N+/LDjwjMeslKLPR07ZE4cm\r\n07A/asRlMV6AJfPaNJfR29yzDFaThHS7JReSUb+XBZmqlmeBA8l5FJsS8t/F\r\na2vksAZr47l8PFZC/Jt9iKpjqAPd15e4rzw=\r\n=1WVC\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230105164819-8facab5.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/70ce04de48ef10bab21d187ffbaf619a/graphql-hive-client-0.22.0-alpha-20230105164819-8facab5.tgz","_integrity":"sha512-fAPJGMHsenuIUmpWxZFh1jyLZokR3RnfW4LcXTf9EL/s4s607hkBc7W8hzNePMNInBcFL+nlG2uQTRRRbMcuMQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230105164819-8facab5_1672937333231_0.5711159648002888","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230105165320-148ba33":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230105165320-148ba33","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230105165320-148ba33","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"c68d64a8f42978e745527bb42f9caf47a13a4a22","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230105165320-148ba33.tgz","fileCount":60,"integrity":"sha512-5pxNyDPbYa4g/M0HK9D8T38JPx0uAO2XMDSgjIFFnLDzzjtRdhcJMDzP6rZ62BJ7q0w3WRLDSwuMRnyHthfD/g==","signatures":[{"sig":"MEYCIQDzjuucMhDNkB6jNElOPQBT3mrJ/O0nfnEhDzjspAzLKwIhAO45HMsX8Lf5G5fK3qGwQ/BsyCwU4F8AA/+ueWBpFYLe","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtwCqACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrZERAAj2cE7yOBykXkvaEg1rLrThlOny1rW5UcdbX4jD53UEb3t89+\r\nHh7vKy1tL763ntYhWi+I4L7F3d4QgSeig5otTCi4YyFQDGoMqP6GfeESFXOC\r\nsHB+xeomsVrwZ72vyeOFFcsEB5MjcNaCp2qV9gVIVn12AtY7e3AePg2KFeQI\r\nu79grgsJYFzjjHj8BjIasvdLyoXNIM6vOyKj3hTDcu7LnecyOIGUfA3pWKS4\r\nDEQWZVL8adHkC1DH68VZyMOQ7i5xBNQ3dYPwLVYo2O58AKyo+1mLMF7/XMX5\r\nFDA6tzZ4u48Exxgk4Oogo6fz0DvQcyNzpqfhK/2m9GAaftN3jcQTeJhiWEnn\r\nwpZFvrFTHWFNol4KyHXBP7ZZBY+vgnY74seU2LE03jJhF/hPT/fu59mGrDqf\r\nzGyfoCQZAkAreMjfyR6/wcQq3n70/R0H65RDWjohv1hpX1ybXICsvhmw4hig\r\nFwqsHEaahqG2I3DtQHTNUgo/SHY3JfA8tpW46dD7qhb83fuSWTCe0t5tPuW1\r\n/200JQRISfwMaB8m3pJFOv75otOREwlKK3aPoHtEjgY96kQMZq1j2JESArK8\r\nkyJMoCxhXbU4iMgJ1NS9QK6AaopWSO5b6torNbHnrp2wQJffGtPJ3xDVIeoE\r\nMj6pBjFa2UnemgBc1Am4KIGjEOWrjT5SO+o=\r\n=yN1y\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230105165320-148ba33.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/63f75d845a5d5361443b021f33b9c27a/graphql-hive-client-0.22.0-alpha-20230105165320-148ba33.tgz","_integrity":"sha512-5pxNyDPbYa4g/M0HK9D8T38JPx0uAO2XMDSgjIFFnLDzzjtRdhcJMDzP6rZ62BJ7q0w3WRLDSwuMRnyHthfD/g==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230105165320-148ba33_1672937642420_0.2638514209545446","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230105170249-2aeb560":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230105170249-2aeb560","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230105170249-2aeb560","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"b5aee37ce193119501383ab9a80c84eeeadcc263","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230105170249-2aeb560.tgz","fileCount":60,"integrity":"sha512-EK9CzXJbt3I/deRQoiTadbhTblrZUyGr2WIIqWp89fUeg4v9KYSdLniYKWZblcsjOAMndwUp4e/W4Xc2RobQgQ==","signatures":[{"sig":"MEUCID3uv95CIyqUnyWHXDyOlbYfc1JojUHq8QDjkhIplaFGAiEAvQR1Jg/8cxqhbGS49+lmYkZvpxoBuLGUcQRYOFlgbwo=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtwLdACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmopXg/+LrtbJ+yywQDSDbFxNVO/DKK9AL9HtRllUjoGmvVeHljBWJMA\r\nN7XsmUUzKTggjCLfWb1Dz9moY0ndoUpkgUu7JbTOmub3ml0+hTyilsMvKuxt\r\nlGzoec+AHivBkGTy7C8AQ2c5yMWl4Z3DkpB6CTz/1EnILx+yYguzBeQxzWc6\r\n80QU55GJLQ/7IXsRqHm5iHk6Xt2w5hz39AT1TXc2JlfTqAvhUceCuTfHlTcM\r\neYgABGmU7P9fnWX/XO4Bd/NkZs54AweqveURXCII9My6RgtDxX6W6rKiTWPS\r\n5o1jYHUxOyU7cBbcDOlMATgKj22yX5oc80hIAj07wiWU5weFNAYJt98Jq/fm\r\nHcjsfgZ/aDeQxiSjZZOieb4A69qFbyMDoiKxD6JEBnyZh1mwdihkiZCBo7Go\r\n6euuNiAi4d1ZLhWvJXj3YSbqNogy640evoBo8afby2L6e77bgkz/kTpLao86\r\natn6bRm2eBdqzfZjwl+m7CEmxs6DMoNkVxsMC0tWk6jA1/nZCM5I7/31Tt1N\r\nXJ8fd7o+3O2tFzRUxTqFrNorDaYUGFTuNN6wcCKm++673Mehv5bM7p0dvXK0\r\nFYdzFHVpN8yYeR0gL7RpcaQC2cpA8k9fGcF70V7bKArsFTe/GwwvbMM/MxJs\r\nZgNbnIdqn8SBhBluquybAnvBEWdG9kFRBBs=\r\n=nxLf\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230105170249-2aeb560.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/7e73dafe65bd00aa0a7e90ca8eb4c32d/graphql-hive-client-0.22.0-alpha-20230105170249-2aeb560.tgz","_integrity":"sha512-EK9CzXJbt3I/deRQoiTadbhTblrZUyGr2WIIqWp89fUeg4v9KYSdLniYKWZblcsjOAMndwUp4e/W4Xc2RobQgQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230105170249-2aeb560_1672938204884_0.43400074209537776","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230105170311-ec91c46":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230105170311-ec91c46","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230105170311-ec91c46","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"4d6e0ea907c9d90387974082e70eb3b5e19914d3","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230105170311-ec91c46.tgz","fileCount":60,"integrity":"sha512-LsD24ccjUSb6EpLRmd7AxQc8tC+L3vy9iAKR9++XejKXt355ebfeFU6kGvDnriwGef3Iiljjy16qkCiTfIlijA==","signatures":[{"sig":"MEUCIGCZHYnp3xFa1k9rQQnJ/fboaD0RFGItijh8xkPHWgVnAiEA4rDm/lWKsqKeObUNXg8/zc8VdesCdtEvDvh4mKAnbek=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtwL8ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqNrw//ehvdml7DkMypUefsSLF1AI/PLaXz5bJOXiysrXt4+B0vY0bU\r\nFaLF8dhhRBvWHre2mUrc+BErzzSY0xt5jiH9NZ/7CW7z/i/1lXYQsba3ggnQ\r\nbr0V5PxkCBBiYEcMmpqPxjBGtSd2MAR+MhI+qCos53Ez4PaJz2ETLrxe+pa/\r\n7tGU6apGePejLpVIvZ/my00PWTCTVS/ftrkKNWmu6nJAh/7W1oX5+E/oU5A5\r\nfjQaEpRLlPNIMKr2WiDM/uIo13nCctj3Gt/XyvapVs8NsqKszawqKqVbewJi\r\nHfNp51T0bH92G23UwM/1X4zXaOf7sg0DiRk0RriUlH1SNxbKAN/F01O5dlDk\r\nDHB2CkhbpMR5E7BxjtxUTxx1H2VN7xELOWHJQlxr2hZL7pf4cRB6LjI9DBgA\r\nUSEFt8SYSO7dLwip5Pvjp4/73502bU1Xc1KZsQooAZLuY+LqrkoaPgx4gCdS\r\nOj0hxIfKGDcDoK30lE+SLfyhPmVRt0WdIK5kkYOaDza+JGhjQXcVJxA0L0xg\r\n5nXPRD1kmpsFpFWif45Zan9x/EpU84KiK7ax63x6NLuxUlFf4UEOOUTWPqKD\r\nMVUCAKjL7KC4RdLtpYoG9FlrqLNuWJifekYd23+xdfDS5aYX1z86hL8H79GF\r\nBVvT676GIt4VNIzkqzDl+jF6U41M0LEr/K4=\r\n=kq+n\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230105170311-ec91c46.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/aeaf3ad4aba02e2c2b8b23462e74788d/graphql-hive-client-0.22.0-alpha-20230105170311-ec91c46.tgz","_integrity":"sha512-LsD24ccjUSb6EpLRmd7AxQc8tC+L3vy9iAKR9++XejKXt355ebfeFU6kGvDnriwGef3Iiljjy16qkCiTfIlijA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230105170311-ec91c46_1672938235762_0.2693551877159186","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230105170831-12649ca":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230105170831-12649ca","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230105170831-12649ca","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"cc7f97ca4bf82e7ef467de86b31f4f9eda79902f","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230105170831-12649ca.tgz","fileCount":60,"integrity":"sha512-NG3YsMgJRon5z7Ert0njXLQZ118ATQFu5mf4opdvXRNCkTPGimlcitC/jufTACT8n8BCyuNeT7m+Hqoc3LreqA==","signatures":[{"sig":"MEQCIGJUCE2TdLnwwBDGiwdPY+KydWs7iy9JVTEaB/oPLx1DAiAWYgzNM02sUF07coOskZEyI2rlJLy3R7dqjuezNk9KiQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtwQ5ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr/7xAAmwcAhnlM0cru7EDtMLEBN6yTUU391JNE85nOgOPLkSSZB0mE\r\n54DQKM2VZvGL37eeCul9ke43Dua7IYpTjNuy/bhK45F2uDeJTrnj6r30kBS/\r\nZgGzUusDI266f71Vj/r67630OECJu3fFWyW9QQr0LXDcJ6kMXxDx7TxeiqoV\r\nITFlA2zhOXK8mNYmg+tqNFoJ6DqZt1LSHRUOAw7ZM0AGwoJ5B2BYb9NTkkxJ\r\nGSOXa3rMuaHq52UcVXOyj793SBjW9Kuq33/F1VZPOrymLegSFbtxAuehRr8T\r\np0uqHnD4vQKoLVNa3HD6hFkKBPN4bDmoFDzaFPMG+eWZTP94JUYOomHXrdnE\r\ngmoXHz+wd1PI258iEJIZFOxHTPUlnbgPNRyA1VZn8mAI0KxQLOvnlFcdYHKf\r\nIexDNPhUvKBYTysAz6GbkbXhMgmf4TV0oUAJbkomEhSNoUyIEyBiKKGx9PKJ\r\nqp0r1JAxV2F9EDcDQxMt2viOFKhA9pnVW+VNbqyif/6FcUeD4Om26O5q29bV\r\nkcVGXdzSpZG0oS1XWM6eLCNtj1iL18yfbw4PmcbCsxnSHcqicr+KhgkTdMDL\r\nM8uUwE6L5BgQ83aqlXsYohiUj6tgeP4hvnrLDquMW2NjIfBMe+83O9MkitA6\r\n7azzyWnN0Vkpm+dWr4WBdkugBZOHmdBB1Fc=\r\n=CZZR\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230105170831-12649ca.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/74abc77870d104bad2afd9e1ade183c9/graphql-hive-client-0.22.0-alpha-20230105170831-12649ca.tgz","_integrity":"sha512-NG3YsMgJRon5z7Ert0njXLQZ118ATQFu5mf4opdvXRNCkTPGimlcitC/jufTACT8n8BCyuNeT7m+Hqoc3LreqA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230105170831-12649ca_1672938553537_0.5854061063301008","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230105171322-8bdf340":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230105171322-8bdf340","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230105171322-8bdf340","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"8c137bea208b50fc7b37adb8739f6ff501ba90d4","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230105171322-8bdf340.tgz","fileCount":60,"integrity":"sha512-ufokg/kWfWaRPBtlR+9SzT4Gr0AABEJPl2tpQlTdoZLiXIAg/P/ea+hDqrPch6e24SxdyMTBPf6OwopFAQOKLw==","signatures":[{"sig":"MEUCIDOJgZ4aQUXAPxigAcm1atDEdggjz/IRZY6aykJCKDkxAiEAp4CszSCW0JXTOMUP8903Ao8F2D4AgnwHr/zc0RMCjMk=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165581,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtwVbACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrwmA/8CjI2kF2ah2TR1goK44s60h729O5DKqqYSg1ZllSgbXgaJKsI\r\nUikmmk4lulAuHKyPB9+fzCLisoGdrPeGIlHVizoi+tjkAlwNCWuDNGXrEdXC\r\nUhaNEqzRxdWP+yFttYd6R21Ln3G7XpBHATNwCssMzvSCIGDlzCf4vqKHjc8m\r\nk4O5XOylhdW3v3O4ep0PCuCw25Ekzfw3XJPHewCR+ESBxvqkMVnjTdeJ6Jwk\r\nZAaoOxDBk9Zr1noJeYO5KkMkdnQwDz2i5j/p4OcSdd90hnbvcIBxx/zX+cKL\r\noPrQ3UnLm7NSHTo/P+J1sbxZw3jMW/pRCM69EfV4NBhzrU4pnPpWQTPX0JmW\r\n+BrSAaC63rDqPGJInQjTFJ/ZYPa9e6QBMeBLV3kOQDD+zFTEefRXo26H1buP\r\nf9zTJXrA/en93yvrxb93U7vKXS/lRog5hyZJLAh1yj6qDy+h15zW4LIUdJ2+\r\nrCEYlftpX1HX0B5blWNxMP7ax7UdFmAnnkGw7KVMWhErg15QBJXmsw4It9Hk\r\n3vijpJktQDyTk6Zn8mhIYMBiwcVFJNb6M8s2xCdoFSKzsGwSyPIU8RSvsml6\r\n5lRG4AfanbVgDw/RpPPA2OSpczG/yEWOF9EgjiRByMI6lkobuJizVt2NqwnH\r\nJcx2qfocAMFEHFcAvofLmX6jTxh6nh4m6Vw=\r\n=AOrO\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230105171322-8bdf340.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/20ceefe49b341a55d98a89263e79c84f/graphql-hive-client-0.22.0-alpha-20230105171322-8bdf340.tgz","_integrity":"sha512-ufokg/kWfWaRPBtlR+9SzT4Gr0AABEJPl2tpQlTdoZLiXIAg/P/ea+hDqrPch6e24SxdyMTBPf6OwopFAQOKLw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^9.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230105171322-8bdf340_1672938842827_0.8932342071886012","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230105171858-d3fbfe9":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230105171858-d3fbfe9","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230105171858-d3fbfe9","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"ab248c2e7acc3385789143c6d7b0a697570c76ab","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230105171858-d3fbfe9.tgz","fileCount":60,"integrity":"sha512-0VFWQq9Vk+HT1BsohwqyunJ2ECwTDmVHDyoKSjNuNlzJKXiH5Nww/aW49xWa+ETFAakbUBwnd67GHzRRZdfCQA==","signatures":[{"sig":"MEUCICLxC1S01BcjcTClMq24F3HtuxPizQnPgvnISW8JjlqTAiEAxCFl+g/KZueT60WjeOHql70sBUu1f0iiI451IUkAQss=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtwaqACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr5iw//dcOJi0E7X88vPRf+KE7MawGnJ2loVxjcKxlzYNj31Cr+IlVM\r\nNxTCpkTygncHApXHL+kGoenHee0N/8872Fzti5D+WRS33e3mwdnqCJEc27d9\r\nJbEhZiStGc06gNGz2UvjSrZe8O0xj6mWC7sdv8D1EosL87lagpw93/VabbWa\r\n7QtHQmspgRVsufGpKbrw6FhLte99bmHt4ivI+z2SgH1tjUw4Jb101vOaB/sF\r\nb5qtvPsrTWH1NA3cA7BneRaa8iyPD4XozFQzbBMcLdctzdXvso9PZkFNWIxX\r\nAvyvb2tKzgVwhFLizVFTkPfZu9wtzGdDSGG9bRJZnwJrO6VhwzmFxJB71x/Z\r\nURTHcV5//LrHxFhkNNUxE/ar2yS4rLcEkCQF8v50/gobA0JWtdpBD4OqD+Ji\r\nCuT5K9LsOPQYbEoKqOYlsvs7mYd/m3apQKxzv+AUQetGG0GfHLS9PV65lc17\r\naOfj1UrgmOw2qYWlC8hIxwMg1dJ6jeod3qntz6E6M+O/xtjOzUSss1SV4lor\r\nwXYzGuWspXUzysPZPXTPkVzPVt5mGvVVoZ1aDFZt2b8J/IMQhdRStC0M6mx5\r\nroiH8bCv/ZbGh+ulXdCOz8maaB0sUk8zyd7rzI2NyQSkhwFcQXrxM0tGRYWH\r\nBSJJHdOflhnjJvcl8u74GmP3+L5eO91xzkM=\r\n=qwEM\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230105171858-d3fbfe9.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/1b160072b4999d1a3f095c1ec4845cde/graphql-hive-client-0.22.0-alpha-20230105171858-d3fbfe9.tgz","_integrity":"sha512-0VFWQq9Vk+HT1BsohwqyunJ2ECwTDmVHDyoKSjNuNlzJKXiH5Nww/aW49xWa+ETFAakbUBwnd67GHzRRZdfCQA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230105171858-d3fbfe9_1672939177709_0.9794979239673927","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230105172358-b29254c":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230105172358-b29254c","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230105172358-b29254c","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"dc94dfd22fbe19516b2a4a56d0e7315ca4f4e6c7","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230105172358-b29254c.tgz","fileCount":60,"integrity":"sha512-AI+EUktq0cYNYtcO+zWM1CZM0aENCqqVIdXk6fao4TjnwURNTQxn2Qx1Mp4veWbEzOBQITM0rdFZhqAH6DG79g==","signatures":[{"sig":"MEUCIQCsYgyhlyKqOI05ln0aWD2+N+hZ1tOHeaLqTAVycnRhDQIgGyjFee0M0es8hJelSjv3+1Uhf8afxQecEv0oo7wYFOk=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtwfZACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp/ew//c/Vg3vB5+mWHdekjiyvVuPUhcVD7+HQond/jokDlyvhbPsZP\r\nekHRqHsGmpN+FSCLAWPottFke/SpklgcNi2fkSfVX9Zwk6XNTDJPwGuYqsnb\r\nhHi5n/4J4i9w37FWQJAuUDjwPNSMb13rzrd3GiNy47w1PkLqxwCJeQGPqE+w\r\nqe/x1CTPHjKaLi2dtSvJUzIKwshRBoH9rqN+iTrXjNUu13NcqzNnIiVQXcbL\r\n8j15QIn1ZImNtm3DzjJX/CyZLqCwUNe8Gtjb45NbAaJZgZW6DBx7PwJYjih2\r\nFfo9D3CGm11sSkfBTZ/nVCw5qUC+fHgb/HlkKSFH+xSgqbTEJ8a/OQzM+iP4\r\nGEcQRXL1o+S+p2m5nQGAqRpecEwfUTMCYsytRsbZfS8+Jo1njhlc+zU3tseE\r\nYwT0OPWFGCy+jf/Zkd9Pbesh3wmZfz3m9VDyDfx11zO/WP2P587pDhGgjIeB\r\ngq3INlU934wtVZEif8iFks/Nyjp+hw0kdADAtTBx32ZCxg9dAoRIrTVGa1+O\r\nS8lMqHjP/Nwa4Nb+4sQA8MG/8R5JPL6VBd4uCh9+QuKLXGiImvPnAC/KXR9w\r\nRW7jfCZIO+XIbgDVrShXBRfGAwyEFRkPdYAX9zUkC1re0sLjUz7+dXmgGOyG\r\nhRD5A5Dv2ECyc2H3VIGjofgrgJKbEUzx5+A=\r\n=7m+d\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230105172358-b29254c.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/6f75da81db21df21f19ea7f9d2307ff3/graphql-hive-client-0.22.0-alpha-20230105172358-b29254c.tgz","_integrity":"sha512-AI+EUktq0cYNYtcO+zWM1CZM0aENCqqVIdXk6fao4TjnwURNTQxn2Qx1Mp4veWbEzOBQITM0rdFZhqAH6DG79g==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230105172358-b29254c_1672939481235_0.5549403466708749","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230105172611-d622858":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230105172611-d622858","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230105172611-d622858","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"4e74646139faff4de436d278e53167e56df20589","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230105172611-d622858.tgz","fileCount":60,"integrity":"sha512-c/JsQxp3Cj0VuSiYcTJWFR7Lin30zNMenSwjoYgEEaaQ6h/06syXqes9H7IcDbPCQfxN3D3gsuaDhic2zBv22w==","signatures":[{"sig":"MEQCIDsxvttdjTdu/A2xZAs9ycg5Me3sDfgKtKEzQyC8kGVgAiAiFR3XZJxQGHomQ7Tk3GIVmv8fiF8CFkzWS/+wSxJ4Iw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtwhWACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpkSQ/+IELKfs2RDeNRS7zEvfbLSNIZySbRiqZfym2jBFPY+hdExK9z\r\nZSzPjT9XgV7d0QCqg7NePpuTjFrVqhKBKeUpxJw8js7W9X98HZnljzd88NLT\r\noioj/CukIKWwjRadE6IiAl+JHYyzEz+pQuv+5cnAz04uUlkl4/smiayDlzpQ\r\np7S3NPMl26h7UEWpXP6ly+LjIlWtp9JnMLtVCKkpIjZyXHIbH0DiFjFvVpaE\r\njmyZdwzjPiiMfW2FrGgGAUnOvoWGY9zHWq046dkUiClm4PLGAI4NIf6OOwks\r\nRJsRbUEdbNq8msN7eK5N6nHjezfy7Qs1yDPEX49DBepujoXks9bv0J5adl46\r\nYgKZLaZn/yOEBjFcbyRRMwTb0RfYLuIN8MPpw4QN6RkvxvPixuhvvZ6zlRpL\r\nZPsWONaXG3eRwiJoMcby2esH+D6nIItglBrH3cD4zWR/xy8f1BWEJdrBX3dc\r\n8LCz1rz6qclOqWQwIUCxrSRUudiYgvt+00lnTNOUtxRCLPK2QYQDV/xeEMWQ\r\nU0SROHtSuKY6E1T/1SjdE9Ow5mMYD7HUecUJhdSMaV9RsyygU0Qxs1l1bQ2V\r\ndA6x/YF7djuhJU0x+HQ2Deg7vICQZQ7STN7dq+AI2eHUw9YlQw3sMyODmQw5\r\nCnzFghxUEemnne9rDB3kjBsD1KhpmEJOJi4=\r\n=my4v\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230105172611-d622858.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/0606df461d243d26b969312a486167fa/graphql-hive-client-0.22.0-alpha-20230105172611-d622858.tgz","_integrity":"sha512-c/JsQxp3Cj0VuSiYcTJWFR7Lin30zNMenSwjoYgEEaaQ6h/06syXqes9H7IcDbPCQfxN3D3gsuaDhic2zBv22w==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230105172611-d622858_1672939606557_0.7217475696402549","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230105172817-e783929":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230105172817-e783929","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230105172817-e783929","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"ed4723044a9db4e3e376cd456b889be831e99e4c","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230105172817-e783929.tgz","fileCount":60,"integrity":"sha512-80XptA8jUHApMIT3GWjAyAljv19HuCXj9dQkbBcKyJSICfsTd6hqVKZYK1jn7065o8zVKe2y/o2IZPE3fsog+w==","signatures":[{"sig":"MEYCIQDbmrrAZA9aWYDlc7+ZCVc9yhzJ+44jVUaD6QXtb51EiAIhALiqFbyXKZz0HPOL3dA6ykcASrr55UzD4fCe1ws8ZMgo","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtwjVACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoApw/+N8qAlqaJjACCBRRYY6xkbPCQKSRDF7gB1TU/iYX5OcxOZfhZ\r\nDEb04Qq8cTIjDHMVmh45ZAnuy0x7NqHAsWcgswSJGsl7y+LWO00Ne0tiy416\r\n5skDlS1eYHDJCkdSVwwF8iA2wJpkuknWn8p96UxhaPKjVS/122Euwv4ZIKQo\r\n11J9PeYQ00/j4BTPZjF6fmGqAjq4eW8tXDS7Vb3Jz6DDOhoLTAci9JG6bOXG\r\n8fU6EGBWimN/B0ARJmODAaYSdyh4Y/EIfkJHFQcG1U9s2PiF//Q/gTvTMDw/\r\nmnwyZAKesB/xHR8W2GXpg12KzMvs6t3ihabiX39jKNoFSDDCgYrv8cItAl5B\r\nJeOF9Rk2y6DAP6uSXU/VzGA7XGYbfVrPKyGNR9SCj1rwVE20/oFpxgW86PLw\r\nugTO3vL9Y2zBfiW+POp/0KOm+ZhCT8hoTQbeUhD+FmJurmzaItfBqj015Vyl\r\nUJxXDqAgEtCa4G5sY7yTWyj8tntkKMM/wIzn7BK8Ee1Py13fcbnGZciZ1iZm\r\nuoufXE24Yfv9/nLBkiv9Dva5eW0Gu04xnh7BLReRAbLUPHeiv8uwsAtqhInQ\r\ntiN71WLD2Icdt5n19+FAA9jmsaNBLkQ31/w41KbJVPStoSkYN9g5hfCVtI4s\r\nIKB4b4DZivv4mDTRXGtRgV/iJ/5BYj1eQAA=\r\n=LGee\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230105172817-e783929.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/56e6e320d16efbbc6a891b5c2919a19a/graphql-hive-client-0.22.0-alpha-20230105172817-e783929.tgz","_integrity":"sha512-80XptA8jUHApMIT3GWjAyAljv19HuCXj9dQkbBcKyJSICfsTd6hqVKZYK1jn7065o8zVKe2y/o2IZPE3fsog+w==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230105172817-e783929_1672939733392_0.40702241974109055","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230105181525-24829c9":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230105181525-24829c9","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230105181525-24829c9","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"f6b2632065de111bfca8aaa8e66e7a307fba796f","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230105181525-24829c9.tgz","fileCount":60,"integrity":"sha512-WhuYM0U7kdW8B6lw/3LlWULDqH8iJV0ML+jFDZNJ6/bweX7ZA9h55X8mPw55JUTalff9fEPRFspXsdZSUSB3AQ==","signatures":[{"sig":"MEYCIQDTt3iZNIe8PfQl5psuGcnuFexPhBi0gSd/bnmZ2db6OAIhAJ+7a8mUdq58mMxRn4L0qyl7weebRlPcA0ukk/HznGQc","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtxPtACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrRuQ/+NWGDBQt2qUPZIN3Nha8QAiTD7RQPxX9aL3lRID973yQdGrSc\r\nkstjWXhayI2Hmhz47CUfBpRepbUqYkUxCnj0FbqMghVHcAPMdl70atBR69vF\r\nhyC77Q/1sSRe+NWJGn9SPp7lI8FZstQBfgZDWYCtNP8MalfMxMCACCweG2t9\r\n8ku8yqwTkuZ51pFrG50gvqJCKRFRZVbgWdVzxKPrXTnJP+UP72U/yCtILFcQ\r\n1smMUBpEPmhrRqlqGNAXHIthTbEMAsifaFy97P1sDTYd4+RzCHvWKaWkX1OI\r\ntWXfazSW3OchCrYEYv/Ra+P3E1PLc90EfiOJMSCe03yle2ziZZ4d9TFEWuIj\r\nk/OD1rnZuXH5kVrUDLG4Y4SIkt2LEo5jU7wB8uth9ekHaGsr+RORQtAk+k7k\r\npKJUCyBI3DBy6zMbAdpBD+YOia8SDEvoZJlNyyiJ3iPT+T5eFoCSJAjS8sUI\r\nQy1HBtPddgXr56k/fBqWtP956YAfKBrALBFZiGrTq/SRSVxtj/AirI84/Zsn\r\nqMVe6wscS5AINj8NjquYTYiyY2jRFAg+imPuLVZXSj2HiC+Kf9TbLd99GceE\r\nmfbpQ4rj6AlER1oTRaLkkcNXyND5uQgzXS9UnMXsxu8Ji98o7gIMGm+u5kEQ\r\n8zNBKW6G2FbJ56ffSbLoVOK77omcvNPvwzE=\r\n=D7G/\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230105181525-24829c9.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/b030f4463c48363190d3145522b91313/graphql-hive-client-0.22.0-alpha-20230105181525-24829c9.tgz","_integrity":"sha512-WhuYM0U7kdW8B6lw/3LlWULDqH8iJV0ML+jFDZNJ6/bweX7ZA9h55X8mPw55JUTalff9fEPRFspXsdZSUSB3AQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230105181525-24829c9_1672942573633_0.2746088864656715","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230105181716-453626f":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230105181716-453626f","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230105181716-453626f","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"9ea50a40f7a1b4167e05ae9893ef52f1d6237388","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230105181716-453626f.tgz","fileCount":60,"integrity":"sha512-33r0u0FceXqlDpqWn/nL3zMLLGtHZfqpm8o2c0EHcoN+QM4LlCpxV/GjzQJHUpBABEUw8k3RrGnVCE/f1t1huQ==","signatures":[{"sig":"MEUCIAp3EHnuWI6XQ7PjKwWMuhWQdZPqwZyZxsUiyR8r+hoCAiEAuhDhhQJXlQTgzvrN3Z/O7yz6IxbSfX5WnpI9cluiKCY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166123,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtxRTACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmqi1BAAgoP2DZa5Q1CMSJMERCuXs21ML08VpL8FZCSs2RcCZaegcm5N\r\nzpirfGqRCPtz2x+9q4taEvzLgn7eA/jBBkyCYlvL66kQ1edQVGjfUcIcGKmi\r\nzRdx3WOc5wYYves2L7UzAu7NZrt5PeY/gxsjORGBLlEjhogKORwoLmpmwUYT\r\nqsXmCAQjAuzI8wEaGVzseX+QnoRC3l5hTNPSwMwfXVDKu85oWulLt19EsK+w\r\nOegW8fr6cUjH0JxgtIFYiyMoffN+HrXlUt57zqQNiygoBJ2HEDZisjH7g2cG\r\naVeNxnMu3g5mEDNRtkjFSYQFCTF0jafx5VVsziCICsBVY1F78jUSyBUZsy2p\r\nE667ahmFBcTDMd/dogoCcmwsfocGA0Sble1EQkzLUEMYNDCXMvdoYR/LWxj+\r\nFx6/7M5dLIny+7ZG8vvuUSGdLWgatTaffVEGu/q4+G5QCUsWjObXH6BTGOVX\r\nsazS/8q4tj+CRRF7BuX/IesQoHtTWFePEzuwjCkgbQD/zDyEjXu77CzXm/yy\r\n/ewi5dCHy+F6x7AqqtwUkOpwYo717EBnRqGLCVLn034Dn0hp/EO4O6HY13e6\r\nP5EpEw3f7onS8Dq7mE8ALiAAZiCNsbVeOhU4NidkFoIOPUxf77x003/gTlyX\r\nNVbnJ/Vqh6/Owc/GfkAJHqziBZ05IvzMobQ=\r\n=3oqx\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230105181716-453626f.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/570f396c5325a4dbaf3967c992c6a79c/graphql-hive-client-0.22.0-alpha-20230105181716-453626f.tgz","_integrity":"sha512-33r0u0FceXqlDpqWn/nL3zMLLGtHZfqpm8o2c0EHcoN+QM4LlCpxV/GjzQJHUpBABEUw8k3RrGnVCE/f1t1huQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230105181716-453626f_1672942675666_0.436476679684463","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230105183347-608016a":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230105183347-608016a","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230105183347-608016a","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"7ff767f50319b3da6e79c43cb6f5e91d28e26a4b","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230105183347-608016a.tgz","fileCount":60,"integrity":"sha512-9avDNn+T5zgrzWS+oM+J1UnjBX/oG7320DQN77asrpYXkiAe3lr/BRwqT6KlrMCiuozDQKJ518+7A8MbePPIjQ==","signatures":[{"sig":"MEQCIG7PHehERwzPTNrT5xP9rS41g0CMMkbaQ4EzCEP6LFKjAiB4EJ/HN4ZBgTOWCwwaww9fSfwx/t4FSIjWy/N1x92B9g==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtxgxACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp5qA//bZshCfo9CBPtqG31UlW9hSSO1cOrBB8WuJR6FYoLMBZPdj2o\r\n9hFiKp18ezHvdjSK2LrqrPRA9xvJXju3/wQJL71WLj4sQ6K4wH7ED2EbNPL6\r\n4p3CRgAif7EsQLdQhtrPQvby/gN0CdNsTVts0d4QtpH2sUMG9meUoFEOt4iP\r\nELGtMkm/WQbcqlRwXL5zHFqcYsycnV1oyUgSrGdqcRsZox7/zwiEbgI010Hm\r\nGRSI0qMuT+hdjnkgohHbt/bIC+rxxSSKOjOVC2lTNahicvps6Bv5ajYTEJ0I\r\nZS1pNaZpuWVse/VunI7cjVdZYxKHuIWfkofNIRaUVZCZXiDYZtjoTIZ1a8yt\r\nt44AMSIvWIWfkhv4QMgh2fGgbzgtpIpNhjwvxCVs+b3q1H49r3M1QXK8Srrw\r\n/hgehVcc1G9lcHlIKdOSjDKGC/BQPmyICmKxwyBdftiRT6a05WjhdyT+kv9I\r\nngBzdni/qtrwDeAeU2fFYBO7p0t0KyxbNQ0OYnZFUs3VmOZnvQ2UjoIaNtlE\r\nFJRMvADn6cAi/Mjco66cdpj5ToAq6t/kpHuXCY1ctDM9oqHLofjzWtC+pvQ6\r\nrJ+L9QrBsOEwZx5pfKdEk1K9hDWTb3RBAIeqfS46iQWG9TO8amyG+4X8/Mz/\r\nS/555QaZ8GSkIg0UrWXkfjSw1zXjgCEKldw=\r\n=95yK\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230105183347-608016a.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/61b4f2a95910331b8d22b96d55d20d13/graphql-hive-client-0.22.0-alpha-20230105183347-608016a.tgz","_integrity":"sha512-9avDNn+T5zgrzWS+oM+J1UnjBX/oG7320DQN77asrpYXkiAe3lr/BRwqT6KlrMCiuozDQKJ518+7A8MbePPIjQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230105183347-608016a_1672943665077_0.6052574798955268","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230105183907-59235c3":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230105183907-59235c3","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230105183907-59235c3","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"3fb538b232b5236faaa55029f4987b269fa109f1","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230105183907-59235c3.tgz","fileCount":60,"integrity":"sha512-jWg/m4o+E0V3N2E/hM7A7ZXOxL3oNoStOcFWwDERYcf9fK4Z0S+5SjijqGHG8d47W7vVmmR+uWDtC4bFohaS2g==","signatures":[{"sig":"MEQCIBYCnobuDzrQ2rwo3d3AO2tRjofkFVVRtJ5Xb/no4AzdAiBSzCm0n0r1t9JkubY+eYB1FdB/5gziLzLnFgfMM/5MLA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166123,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtxl0ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmojiA//bCsWdejUQWCw7snwmV20xc2kbnITRzwGA5Qr6sPLUwmV3Nny\r\nDpnm0nZdLMbynVTd763Fy8Q5DDDh6thkJAYGim/VxMF0TU36A+nQBx9WIBHw\r\nO1JHKWoOokrwZfJdpsnKY2Pt6GqZ2OQB/sD2QbZqX0BmL7HdOlJlwKJPEEG/\r\npTH0zIX3bZ5rkBaLNd7FFalAcklswcDIg8FAAkVuyd2MEs4pQSN8Kp8QAiDj\r\n9nlqsj8Geeyg1RB0D/Ww4WwAWUkk9ZrRMaNFrjau3/Jsz5y6L/MFG3xTukIU\r\nLLLEb/cQGTv53iT7miJ+okjeBSU1eqmuOgQahv7SJGXkjLa4abyGiatWv2Dv\r\nmN4+BrGJE/2oelLyNoX56wm/GlHmo4P2CRexOBwrGY3oUaj54Qv674Nae7/A\r\n7ParhpQCAGYrOPOtwgcwiilL6Hgn8SGhd7BtkZybRgJQZT5wjNBTldswb45p\r\nJM+aGMCbVrwezcf77sLNtABW7zK9Uw3Mj5209oPmoy5PLLy2MlxBWzc4HWSe\r\nDbmoj0XkzLlqJObVrbTIjaJVpugvjLarnGCbrBAIEqFJWS0lM/tEOhaeKTsM\r\nKkdNaskVEkmR/bCIt41fzWXlEJ2L4ViviUQRYJvpoKpSxheWHSTiS50WVigx\r\nUH8wie2EPgZfPzbTce+X24wMQKeu5q/kvBg=\r\n=sXuZ\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230105183907-59235c3.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/b68a948faa4770bdd9eceb96d33e1ef5/graphql-hive-client-0.22.0-alpha-20230105183907-59235c3.tgz","_integrity":"sha512-jWg/m4o+E0V3N2E/hM7A7ZXOxL3oNoStOcFWwDERYcf9fK4Z0S+5SjijqGHG8d47W7vVmmR+uWDtC4bFohaS2g==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230105183907-59235c3_1672943988570_0.29256582939211273","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230105183949-1148c84":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230105183949-1148c84","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230105183949-1148c84","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"2b3f50e7ccfe2d74bfab6e71a3ea5c7318b87a57","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230105183949-1148c84.tgz","fileCount":60,"integrity":"sha512-VdMpnB6VAfySUGkVNaph2FgNySyTttQ+P+mZFbrL6GUj/n1jiBppOmVAmmuyBqVpUGi8Pr4LNvee9Dgs+ChFJA==","signatures":[{"sig":"MEQCIGPE88rtM+Jr/SClM/CStPK4RbK/Do/5Q0Am2pXRzZzPAiBQHr2FT0j5XLK+0MeiIIuGy0KSpK6gZzG5LobB5kGMqw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtxmYACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpCbQ/7BTG2+fhiO0bdo9lWhar4m6AzWJY/CybWm2SMB1HO20yP3s6K\r\nLsnYW1qlkzIQAUvMZrugu9ZjTiZ5wE3gNrc/znq0Hd/1hjVloSiCYe6eowp1\r\nnJZxG9O8MhmNneI5+0c9plpVlCzdDl7qMbNqT/NDsCaSv/SDQBsYga/eP5yX\r\nPwaHSaEz34T3ZLvni9gmwNivkj5mmO9l6iFDd9ZWVWZxShUsYvyyyCcKzHwd\r\nNkH5XxKy13qeQ/qVctPYRoTydq/nN1MMsOpIHqTxCxDa+qLt3e4bIrjwlDoK\r\n9eOBkEdLvxWmfyrgkog+GPF0uS3ST3p6y9zJSk8mmfFndRgPuaCO7uwhQ4/D\r\n5iHG73cSZsaXUjN6LW2O85cBSeYj3LAXYLKuzJCGst1Ir2e9GuW8DEEgkknL\r\nLSwE0DPiusiOCnkCVX3XgMG+ocYIdsZtXSeua4ybtTVniMOUq2cp8ukPAQqS\r\naOZw7j17VsOlOB3XB4LX3yZ/4pw0ADu+NYg9iYG+6dmX491b37YDa3+FHBsG\r\npms1NloXZUAJnQSI5xMOUEMY3hm7I6osY8gpXGtU7HVsnNqKx7Ihypl2hpJ6\r\nVFT3WT+X32btaSgX1+FhbQynsY114gVfIogqyxwkS7Pj9E1PRz2KDHfFV8+2\r\nTs+FEwkPb9vT+ozZkaW0vLL5eDp0l91Ddgo=\r\n=fTla\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230105183949-1148c84.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/5f7f7d5f22fa5dc55ff93ed9d18412c3/graphql-hive-client-0.22.0-alpha-20230105183949-1148c84.tgz","_integrity":"sha512-VdMpnB6VAfySUGkVNaph2FgNySyTttQ+P+mZFbrL6GUj/n1jiBppOmVAmmuyBqVpUGi8Pr4LNvee9Dgs+ChFJA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230105183949-1148c84_1672944024073_0.24861182890984002","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230105184153-f4577ca":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230105184153-f4577ca","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230105184153-f4577ca","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"2d6625c2e189bb9874ab145de972fbc1f54060d6","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230105184153-f4577ca.tgz","fileCount":60,"integrity":"sha512-Kw+rfNOyayZDJxRekH1cF2LMC/HEjBZmrTqv21VY49XCzGKoPm7iUGa5dX1+psu20LzLw6FyPXSsnmdYIGEWmg==","signatures":[{"sig":"MEUCIBED4II7P7I6O3FHUsoBtjWY4zk9w+PwDlmWlS427E2YAiEA7g13vLaXNssoFY/qyviXB1V8IKaUzY29NjlAJovbFoM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtxoTACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrOFQ/5AHJJ9W+uw3cp33o5//VNf4M6lz9/NF+WZsvxNzkHsjuXoe5/\r\n9nqMd8PS0qfkRTnmp75CMmvqDvbM/SqEAutYpmpclp+m1lrY5bnvuJSgWDOR\r\nl1aLOPCoodzn9PxBF9pGXfBDCtFk9UPiWtFunDXywbmGD5BMvHZvSQ3B5cgg\r\nG6tGSNShlixMxKJ1mlnK+sHhdT0+m7pSTSpye2febLpXAYUD+/YvizyC6p8y\r\n9QkyZPTHwpZj0TbEsTGrY8yZ+DpoHx7YJAK9Wh7cLrhGzc58WJHCB3+Fidaw\r\nrcAucV91F6734HuSTKkGKshtOQqtabrfIW54qYKCh3DZcdIKqEXV3t/BsY0W\r\nLCw0N8YF9AwzoCZdcKe7tWVD+iBrZPSaF5TqJC809q2VItNzxVhAwio50vqB\r\nao/bJQ54grlgb3jGg4j02Fl+ZQtEOC3YEggt49w2b786T8Qk29YhWr/cGoGc\r\n2kLdedVOH3A7bPWZZDRem3SCC8pjs0kNBr26vH0v9K+NbjZmm/g16zfcHJYi\r\nJaW50Q0Ayw5rmEb7LnY56wpzMLvkY1nI65ea7jpBCvBK0+iyE+TgAlfzWCTo\r\nabEjGJ8bSqNvPTb4JUVO0zJcQ8UdNMmi4JhYmqVSr1Y9Cq5sBe6ZO4jwIP0E\r\nLpqLb2cZf4ysTjhaCbyQLXve/704HA4xkBI=\r\n=UTcr\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230105184153-f4577ca.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/9327c805227f80bacf44b67645ab1c70/graphql-hive-client-0.22.0-alpha-20230105184153-f4577ca.tgz","_integrity":"sha512-Kw+rfNOyayZDJxRekH1cF2LMC/HEjBZmrTqv21VY49XCzGKoPm7iUGa5dX1+psu20LzLw6FyPXSsnmdYIGEWmg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230105184153-f4577ca_1672944147696_0.5953756629784228","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230105185307-4eec82d":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230105185307-4eec82d","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230105185307-4eec82d","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"b308cd39f6750b4802b405d71ea423b8b51fa93c","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230105185307-4eec82d.tgz","fileCount":60,"integrity":"sha512-21gHImHVcmpyCjUx0H6DGIXtIQ8nzRSQgeeEk6ZKaG7n9L9wgc0IsRay7v/zw8t0M1TJMxCCOfsM+1vSbBhC6w==","signatures":[{"sig":"MEYCIQCFl0zW6UkpA3EK+l21N4ZF0Z44c+VQftHLp0e+Fmft8wIhAK3IgATnrPYCBCdAlcSWKhCJadBvhC0Cfc6vgObX7orc","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtxy9ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpSmRAAiB03rKS4W4ygHNlCfL/2+2IdcLeSUbagjQhwcfLvpjIfzVmt\r\nEQ4oxFV0lJDgKAjVt7WSt7M/D8jGJD43e6uedKJGzvq4giZnUav7PDDeIjOF\r\nWQZi8BUTW1ideWBNZIrDilaUokILNImdkMotPpQI8cGNGiWY3fSfDzIgM3En\r\n6Izktum+lNM7aHd0HUcdOvb1yOdi8UGeDW8JcIm2WFLEArAZihOdxwKaVlBl\r\nPzSvv8YqKOQKsJNpNQKN4iDqnayxEOQ1OzRMdXxKL5hfhzV4Tu2GG49BOGdz\r\n+9InE+bjyGVTAh4dtZOM1HPRBpIu32TK8EE7xngDeK9nOBPcVXqV60qB4pDX\r\n4jRyZzGO2SGVu70Ffsyjyw1DqHdVUyMt+y5A5j0rwpExTWHd8BMFiPBtPni4\r\ndNbRT9N58OVxZfouRUzUsraqj9xJNoUOdyRKb3TD+t6Bzy7sLQPZIvirrOP8\r\nvHwbAxiGT2RFc0kvCFmQ59C1Hbp3fDldFmWEXsZfalt2INQo13dipMIqmhmR\r\nFSPYrJGwEA77hOnwVRZ677hZsnD/TyQSbkgdeoU2VEk5OPZDTe9OzmZjnlRn\r\nLTk1T5PVkghYy05YYpBKvpjYKprjJPqeKn2VxTh1EW267oU8OSGpzG5yrl4w\r\n3IoTZjJcJ+XHvxmre55ec8nyrr0eUeGbWL4=\r\n=xRmh\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230105185307-4eec82d.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/23d9531383a57ab6def931f9e5f6bc41/graphql-hive-client-0.22.0-alpha-20230105185307-4eec82d.tgz","_integrity":"sha512-21gHImHVcmpyCjUx0H6DGIXtIQ8nzRSQgeeEk6ZKaG7n9L9wgc0IsRay7v/zw8t0M1TJMxCCOfsM+1vSbBhC6w==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230105185307-4eec82d_1672944829597_0.5109095721628363","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230105185839-bb14de0":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230105185839-bb14de0","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230105185839-bb14de0","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"47883924239ee1d6d267509cee748732c668c732","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230105185839-bb14de0.tgz","fileCount":60,"integrity":"sha512-JQK1+NyDOJEnzIZWCDDjX9NLAHJcgmwo51jfAalnJHp//zIMy0yZVQlhO+3tEXvr/UmRuVBPCAKvtDwOymex7w==","signatures":[{"sig":"MEUCIQDyTmEy2vL17doVQxvbkaqQBWZ8tn4uJcsqvsQ5m3mZWwIgBZ/CsFg6dBG7pbjq4yc5/mCXkVTZoln9z1KkSCuhmXE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtx4DACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmohTQ/+LS0TUaYpmSP+eKIyOnMxDGR9Qg69y0MBXNmEdpGfBQ8RCb4R\r\nMLhVwsh+LuCLXEG3hyFi+rL3etgU/Lf/fUL6IozgRAHaUH10B9P/zaDd3xAt\r\nKHEYfWdiXLkQf8uqfiuRgYlfJn8EL/QmQZb1kgJWiiDyliM8XFlvjSaqy9zn\r\ndEh88D67Qkmc8aOFqIwl2ErR6Zik5zrcLZPtW71MTpvOj8MmsxwVifB2HiKx\r\njseuZCVhVjv1YILdwpLm677cI1nwAt7eSTUtFRPeTWl8Xb23bAxooiGnvxfA\r\npTb4SRDIoxZ0EL+R0sgG3i7TwyiT0ZUbgkGvxD1p9E8w1p79Es/1VQNmz6lk\r\nSHhCvtmsrGOOvwUDArYZD/bqSTtpkyaC+vCAkISLs7J+wIrfomXHi07avBk/\r\ndR9YINKjvmPznhehs7L9estCB0sBW3cqPBgeCa/FwtJEv+5UioOBWL+TbkXB\r\n0y/6znfrEDIfyeepum/ibnc/6AZVQPrMrs3cUK/Hkpowv/7v193AjgthHDT9\r\nunEQFEnRcpMjNGE87t4GQsR3jLz56dFEJKIrajYb5LoWKHHrDRVbYml7S6Uk\r\njRvqdbr4TmZiysNx7kuty31wSfXFEuvtFKAxS8WKB8pzH6L6YMHwqdi25QYt\r\ntmBj15AOhVUzzld+ebXVodRV0XvnqGURqAc=\r\n=Kx/G\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230105185839-bb14de0.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/8a33c6bb4ce57e5523d8e045b658cf1e/graphql-hive-client-0.22.0-alpha-20230105185839-bb14de0.tgz","_integrity":"sha512-JQK1+NyDOJEnzIZWCDDjX9NLAHJcgmwo51jfAalnJHp//zIMy0yZVQlhO+3tEXvr/UmRuVBPCAKvtDwOymex7w==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230105185839-bb14de0_1672945154992_0.4016017562254557","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230105190139-a841984":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230105190139-a841984","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230105190139-a841984","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"9a67d0ac46a354d0fc024f908a40b3d50dd22dd5","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230105190139-a841984.tgz","fileCount":60,"integrity":"sha512-4/Z7fL4/7rLUtJWw5r/jTZHUQqG4Fxbd6MO7bRA5QAHZwcIbb56YZQZUcjojJGyhlpNXI6j4ie/QAdrXZtji/w==","signatures":[{"sig":"MEUCICk1i4BOL5xAFhmOBIzjqvqaFJPwuZlDsySZJHPW5ULtAiEA17kTPONjsPR+C3ABHRbuLJ5pedv9EXgC/Oax/9Idckg=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166123,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtx7GACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmpc8RAAhw7VXs1aNQGSZPo2jNB4nRd1kaPurU92VRQ80Rt01X4NNDvN\r\nzXkMXIi+OAfnSxURGgIgvlwWBzM+5v4hwI6VIsPliZcaap1PhVtTWWs2fAT1\r\ntqsGH7N/RUQl1NX/tU+KoHRTGYb2YOg1aLy63GF+g/sEsvHOVSy2iQD+h5qD\r\nzuuUSMu999tdzrdp6dPM/goOGUPz12RytP8vbY4Ui0VgzuJ67Gib22fvh6wi\r\n6CFMS0+yqgkozquZOZ7yFzEG5RxbEgN7/vuZlqsnP9ECW0D4JAv051bnEAiw\r\n5IqtQceZyllQB6jhNZB4BSsOTSlgRwwXYMoIJm4rPny8WSc4csZ+Rx6u7x2S\r\nmj5BxUa7AJBBdLnFH87dlnA/gMDpuvhI2rx/UOaQYfG9/CT3xNXnl+IiHaC7\r\ns3YkSl267PrWXo0eP/16LoZwFjDtI7L/ByPrM4PQ971SulcXeCqzlmqqkii6\r\nbIlLjoZfs5ikLbbP/SKyJ+LAsV8jXLQnzttZb/pP+S3bTdlGGWZhQRNdwYut\r\n8gqA3xMeYXnrKNBaSg3PEO3hrzAGuueDwwf28Q43NLgA5EadUFKKyJdaY39w\r\nK8LUxDdCoGZ+tpDxRFGZiAJ3MNiCOYjvwg7Wybu+hzVpfzq2Kr/xjD+9N3/Y\r\nOx8/l12n4sTobmz21TdaEh+ogJ4Pi2OZy9g=\r\n=RJ92\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230105190139-a841984.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/0cf222740419e24afa5c9284fe661ad1/graphql-hive-client-0.22.0-alpha-20230105190139-a841984.tgz","_integrity":"sha512-4/Z7fL4/7rLUtJWw5r/jTZHUQqG4Fxbd6MO7bRA5QAHZwcIbb56YZQZUcjojJGyhlpNXI6j4ie/QAdrXZtji/w==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230105190139-a841984_1672945349923_0.7919122641242846","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230105190416-5cdb38c":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230105190416-5cdb38c","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230105190416-5cdb38c","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"ae8542e96a2912645fff32b9fbc381e938cd4ba8","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230105190416-5cdb38c.tgz","fileCount":60,"integrity":"sha512-4+HDNd/TPY9SASeipzN6yDaTDmZ9QH/1hPb8b6kbZN+QupEuWTiP2c0Nl4gKGhKI8xjN0wTAQqz7lB9XWuN++A==","signatures":[{"sig":"MEQCIFfiK25xqEhI0vBQ2fX1UuQjX0YIh+AZxOJGo2xtC39yAiA2wr+gkeMqgZ3GFuaZcrFSfJ+1dLEfKyhsS07M9Un9EQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165581,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtx9dACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqYhA/7BWe2mxHmEwjOeSLM88zyAehZEQceyv+HbqPWfqRD9vU2Mvvi\r\neVfz+CqLCXM7Ut+OwTEL5eO11EEpRsnq15fa6AKNmHL09yDiLFAaLn1FpEAd\r\noay3avW0P8qnXYX/qPUgFT6OQX43MF31mvSB71GlMVzyroeoVZA8F3MuS7kg\r\nEK+5png3hBwGN2L7cw1o2eXvu+ge1FN2zdQ6SlioIaVJREnuult6u7oR4wfT\r\nxQg14xV7ED6lfIZMmeB5CbQd1qLeOgVYlSi7PZGtZ815w8pKx/87+/M/M0wd\r\nJQg5tTNIL8zOq/Nb4HiBG1IAybMCxnOJQXOCR68I4YDSR5dOHpF6BZlwVbyh\r\nymLvD5ox0K8XH93TvyIJzpezW+z4mc8nca3xYuguGafBynk4fDAhDxSBibun\r\n/niA0+J/8zO49U1T7DTESY22UWWC96T79UqckP0cZ7x3anMQ4DTvRytjr0KP\r\nIUvGWy3eujkJBLwzmF8l3DD3pjgzlFD3nDeAPNWhXAD1LkuN/RyhsPtP2AO3\r\n2YfX0cRhzQf8Kcr6BbdN85vFtt1pfEqcwUxhx0H3LlbuM1i60DBM8W3ZvQtK\r\n3ETou1yo7Guzl4Li5CALREpH0D1XQ35oUiOPRk5G0zEWP19vId9LtjHR7f+j\r\nFhkUMTs+npi8t0mrbPpAatE/v3cka7wZChk=\r\n=BCfH\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230105190416-5cdb38c.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/7d4fe154aa1215de04c416f2c18c7373/graphql-hive-client-0.22.0-alpha-20230105190416-5cdb38c.tgz","_integrity":"sha512-4+HDNd/TPY9SASeipzN6yDaTDmZ9QH/1hPb8b6kbZN+QupEuWTiP2c0Nl4gKGhKI8xjN0wTAQqz7lB9XWuN++A==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^9.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230105190416-5cdb38c_1672945501554_0.2963709865742188","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230105190915-cbe911c":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230105190915-cbe911c","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230105190915-cbe911c","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"7c6cc8cb83d75ed5feba647316e57c09a437209a","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230105190915-cbe911c.tgz","fileCount":60,"integrity":"sha512-TDRRw9ernmOCz5egQW4l5AZtsprH+Ra9QgbJ8zpdQ76uZpz//oVYU4hXdxyRCDUU3RxBXhPcVYTqzmAKAdMxag==","signatures":[{"sig":"MEUCIDuUFd1W1SYHMk7CgsqpfZtcOJ4X3Xd5EQqYz1CR8ICgAiEA41XRB3CIGepMtnsHfMo72LlQfRfZkRCFa0A8pzeqPlQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtyCEACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpSAA/9FkDQaQAMKHw+FW5vRyiSM3HKTI3NkMGXg7m55YXydmTAc715\r\n1FtL1+cMNi1iOspJNwOLa0IHU8LRqRNlofTmdX50zvyNoqeokBNItNfT2NrU\r\n7b2GrCWnr4hhf2/PoG8Y/NP/4HWIhV2WjSNFrjnKqFf72QSXNqtQJIpa5Ddq\r\ny2XFSiKzOrzu+qjxhTdXlBETTcH+b67Qdmkd2wPDJa0cRSa/CgCXDD7aCO4d\r\nqyI6XGkLORmwFEK9OYCytmsXsQLK5xvwPezB6gAA1zzDfTbItVrWWZH8YWc2\r\nThb6hjprbC1ScdoGT82yODx9QaQeJwOuFUBBF29kP6u57umqyEFIRr34M05E\r\nOmq+23kbDwAFD1aKPUVVi0R0EOYNKprAtqorMccae9m3O1rS6+8SXE0xbrwC\r\n8OIkSLhMWhwkQvVY+QYi7SfBSpJSW5csuibF5mSB1z0BeN/YNgL/ChjPCMAk\r\nP3+y9ZAgmugU4BZ8OTQmzfyKgqcflZXOyswRuZ9kqbU5Qzn9pjLe08OAUcjn\r\nZBolFEbStw1ayO0D0yepnoAtkiPw2EBWS7JQTMiToC9SGU+YjDtKW4+HoeQm\r\nMA1BE4I6AT3aSxElPkBG2t2CxhSWG0cvl0oZOAaKZxMw8EcrUnbkSEsrHH3K\r\nstpKYfIuKlRgzjWqt8Gqbx+W7seoNXHyB2s=\r\n=mJcN\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230105190915-cbe911c.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/65d4ae19c880402b3f7798b3c8e36b64/graphql-hive-client-0.22.0-alpha-20230105190915-cbe911c.tgz","_integrity":"sha512-TDRRw9ernmOCz5egQW4l5AZtsprH+Ra9QgbJ8zpdQ76uZpz//oVYU4hXdxyRCDUU3RxBXhPcVYTqzmAKAdMxag==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230105190915-cbe911c_1672945796436_0.8351881960905196","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230105191249-7e9e4de":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230105191249-7e9e4de","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230105191249-7e9e4de","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"b20525f90b96638fe25beaa3dc10093810f19595","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230105191249-7e9e4de.tgz","fileCount":60,"integrity":"sha512-4rPiVP+z6UBHJ/QmJkA4YJ1qzU9G+UJwuGtFEBqUTIxMaOpAVZhoKaHDeWj9Yy19UjO0sVv0Xuc5/cmHOh2oeg==","signatures":[{"sig":"MEQCIFepqz/NOHs9zxc4C/Mbt3T3efPNf7MT0h8ZAsPsjLgLAiB+p848JNHCwNedsOEnpljqFZYNv6iOkKgFDWk5v3XOPw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166123,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtyFVACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpqtQ/9G5FN365eo20sNMxd3fwVmcveLBcVeDXOCB2wWj7H9xfErQls\r\nwBLY6IVd8YfO6o6lXQWjNIrMIaK18M+V41axNPDXfMBqR3VLzLnuIze+6Gv/\r\nYmCVSBeDJPanbADTd3fItziuVVWi/LEM2G5ETaV9FaYiuy5XpI38O0Oiap96\r\nKNru8qM+AYenmyIr1DfiRYKD+ZOH2ceTj6996XLYoBMQWMWdC8UWd+yBHRTJ\r\n8mQKe8oeHnQvlmJNROB4tPJRopPH4Drp2auXVqIUfOhvAdOMu6K7lrj74Miy\r\npW26Zq8N+pelgDezArom+j+m+kYLdg6uzeyJqICF5rozqttzOHzncm3cpyp+\r\nCrZjHhuGfe16n3wp5oOOupX9T4eEtrhSpjnbmoUxjQK310OV/eC5OcenYg6Q\r\nJ7TSO5iSV/x6gq0mbC4NH78lIFl6jVx94Fy7Sv1eiK+EHv4EClKSlxkNsce+\r\n8KWsNyO3RnmWDCwIqTCFDpm65kV7EKwV8kn85JSacYPZHVUnqeymX/eBt/2s\r\nWnnwUEOWurDN4x+lgCv+RuXhohEmmQCS7e2g6C7bzQ9Jn06HE3ACIJ5HK8Uj\r\nlPFNRBshz4AA0tf6oARbnAMFAIxXjSyvXez8fHiFsJ8W05noEcoBOTDEtn8X\r\ndzEJ2fVrlJvacAJkd6kxUy2KCXxr5zLSvN8=\r\n=nD+m\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230105191249-7e9e4de.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/340edf57edaac246049f263d48727b9f/graphql-hive-client-0.22.0-alpha-20230105191249-7e9e4de.tgz","_integrity":"sha512-4rPiVP+z6UBHJ/QmJkA4YJ1qzU9G+UJwuGtFEBqUTIxMaOpAVZhoKaHDeWj9Yy19UjO0sVv0Xuc5/cmHOh2oeg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230105191249-7e9e4de_1672946005470_0.5369387295244199","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230105191502-442206a":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230105191502-442206a","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230105191502-442206a","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"35f4e5c0b792d813ecce0457c3222c728b6bf018","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230105191502-442206a.tgz","fileCount":60,"integrity":"sha512-mfkn2qq/xsl+ul8b5H3KHl/5DQtK4O0NznAC4wbs98drXlS5L6c8A+5p2doZNf/03WiC4HjXCUsW+EW6e//jlg==","signatures":[{"sig":"MEUCIFAslF63ItquysQI8CORNr5x+rq6IHxQ3kUKbUH9sW/fAiEApY7DDH97147I3rBumLKXGV9W5cAeuLE9a1srA12ytQY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtyHfACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoX7BAAhwskfbAO1gVSmPJ0BSa4d1nl49sr4nCs4iTW4u3jMk/ZDqKH\r\n+Bnwft8APCXpXjmSKIa/qb3dSdmhqij6JMZdshERX7PuYYgfO1GIG+zGnEVq\r\nAfCb5gAVme12D4iHTXPSMhweyqVJlluMZhCThM0tkd/PGmNDOo1XUth0wMv3\r\n3NbEbp4Y57b3mye3BTCTx9QuCFu233oo7s0q/lOxKH1Po6GygCxqnZnj2Enc\r\nsudUbJ577Rxezot7M19lu/ADfJjqclDmhaSnU7lyE9oVpQjI49j2ANm5tq2A\r\nOvKY6h52Pw8QEE9cdx176UskkPkl7325/T2MCRHBPp+V+92SUhWcnooTf0nW\r\n4TSkn+chhQocMuVo9qAFYUAarwLgvHLThpa1M6bg2N/KgscQXMOIrruDNF4k\r\nVB2KCEGAJXB5N5T1xYhk2M+RPoWc2Toyjf+oqvNk+5cNO4kjIc9NuEFMbngl\r\n9wJYiRTZvbbSNiUa1tCU+5gVw5/SjuKK3zTqGoof1kQAX12kBMv22Ug8R07s\r\nP60W/OXt/B7pl5aoz3Pc+EaRq1yB8zCoeDkszJbSAWEtwQfDdDvO6BLYHqNB\r\nQgpoOBns7eCKusEaqAiNps4tM3jcVNBu8orqf6yMmpOhkPdKr0FcT2dKMgHG\r\nA0hDf//8J4AEuX6AIWXmRVXoQzVpvJuUU0k=\r\n=IA2v\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230105191502-442206a.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/43dd5b9236ca58ce84cd49d5d7a97b2f/graphql-hive-client-0.22.0-alpha-20230105191502-442206a.tgz","_integrity":"sha512-mfkn2qq/xsl+ul8b5H3KHl/5DQtK4O0NznAC4wbs98drXlS5L6c8A+5p2doZNf/03WiC4HjXCUsW+EW6e//jlg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230105191502-442206a_1672946143158_0.879568839351484","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230105192215-8ef8e36":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230105192215-8ef8e36","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230105192215-8ef8e36","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"17336b4c8e3ffdc72e26f6cdb0c08a983c9ee0a1","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230105192215-8ef8e36.tgz","fileCount":60,"integrity":"sha512-ZvlURBXUEbmIYbSx9tUZ0tFT7chOcmDcprdfTkf+nnLRxe14Tkk+aTDYlW7AweiTt6Ti2ROnrMoiQ+jrOV3j+w==","signatures":[{"sig":"MEUCIQCaenPUUfoQyZQMJrYxNAfram6NzXC5FsHehUVG2raS9wIgOv7yIj/9w/p9Kfi1HCZRkXmJBK3E8RSFBgAeriH2PkA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtyOKACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmq0Yg/9FBM2cycVbBBFZ0s4d7DTB+kRUEjUG0xWN3zNl3bU/nc+JNpt\r\nUV9R22WPqBqTih4PyO1lZe6+I+gpW34AMHgqoA6UMbf+6og47qv1PnuEUKQM\r\nE4VTCVCvSnL3eyoFRgi2U2/RBgb00YadAlnxfavv6wCwXgNwqv2mTK6bk4qk\r\na7bfLemb6Tz1MpLqfE6otLGOuxCCQOm/vnAOycVQYu8c3ddA2XWUplkLaDXU\r\nWbfvt84jjHePizSfadJD75MbLAvVVESbmDenbRnKHlvrXZgZkiADx5+4RSHP\r\n2s4n48tpbOnwv9LL3rf/YG95YHdYN/3Fh79URsoY+RzluevRgyKNRCytVxEB\r\nurIoSQ+EZNq/LPWfGNbkLE3zYN/EuSNKZUIGjLEd4eFPCZOPkuV6IBRGGCdG\r\nf4akvXH2JrsBtpTKuGL3BtGUdGh7Koj8+E/97qH6QFzfl0BPV1abd3OlRvnh\r\ndTf3TurMrRzOjecDDZMA+lf9GYmADZ+lc6xjapmLVgHz7xhy5WMDwpsXT+ah\r\nINzDvLFVZojlxQwStTGzIGs1Fbd/hxHVaDJhQLOBBDJhs++FnVgAsvhDK1Y0\r\nAS0MMY8iaaCzZl8cOl+htnF6Q1lg4lYuXkchkPs1QJkjRP11vGKlbZzchVkk\r\n2ASsuTXXyalXUw8vNywIGoNV8GjOvFMIDK8=\r\n=CmAc\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230105192215-8ef8e36.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/19f82eabca5f433722e1100708dac6d3/graphql-hive-client-0.22.0-alpha-20230105192215-8ef8e36.tgz","_integrity":"sha512-ZvlURBXUEbmIYbSx9tUZ0tFT7chOcmDcprdfTkf+nnLRxe14Tkk+aTDYlW7AweiTt6Ti2ROnrMoiQ+jrOV3j+w==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230105192215-8ef8e36_1672946570197_0.3135223194462915","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230105192704-95f449e":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230105192704-95f449e","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230105192704-95f449e","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"c0c3cec1b413d81fb5ab6b9d87f1e97fe511a0c2","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230105192704-95f449e.tgz","fileCount":60,"integrity":"sha512-ldyc/ADvEFJYBr2uJqc21xgaBu9oMdmsCLV3BSRoQcDoz48fzgfswS++/Yvq7XIUt+C67unoEaoxzav/YO1/VA==","signatures":[{"sig":"MEYCIQDalbGB3XNlDMYohXaXB71GXvE99kOjWRUjN0ZvLfs1QQIhAJKtKEHyRZOcpJwdPuWnlSrD0jdnL+nS/BLAZwx+cxFK","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtySrACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoxSA//dyab8ekRpyQIy7u9QMYNsIRhL2HpqPZRD/YCU6b8l7vTGAlK\r\nUBqfSdl7EuBfr/e2AxNxyYV9QLcduO494a2TVhv0BR617U989BOt47Dwk/dk\r\nWhcjiP/N94RQifouvA/0hFzostvU50Bz5lE9vc/5prXcLXDfBYzhLkhvm4Z+\r\npD8XofsEYfdUm9lnj2mbbiPWt7J3XxqAgyJfyIT0u5QhCrGhr53I6y6z3db8\r\nV7C+wbkp8NnFwJ0YV9hq2O7FgzPTGA88FYFNXDz74U+dUQBeqgbRAJiWuHOS\r\nH91YuY9ArCxV30dRE+UMNgUqgpbq9nXpd/blh9fphf62VX4rfL1Sa89Pqo6u\r\nsr3I04W9rqrBU/zhvVHEI67zOt/u4L65BmN2Jx4bziS9oqa3GSxIxLySmn4x\r\nd33Zhz3Y8xFXNJ78wUqNGrOGjYmoTssBplvtHD58wpzSEYC1WolD0LyUCj6p\r\nopS8yQeSyhk4uOmUZskF8MRzWDJ5TNYRYCz4m62itFjmdBqe9tr6owrxx2H3\r\nJiJZt+9sRAMWk6hxQw3YhROFDfFP7pAanbrMXoidDI18FMwRtwp6JiALvMXO\r\ndzuz27yjqqPRvmvwbT+S2Q7wrnuulRqu/XSkgH/Ay5xR/kHokEN4JmwLmCMh\r\nKk+7eSnIw572nYeDN7Gv+tfIqED04RPJQbM=\r\n=8oEt\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230105192704-95f449e.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/3e750233ebace72d8e7110fde718e495/graphql-hive-client-0.22.0-alpha-20230105192704-95f449e.tgz","_integrity":"sha512-ldyc/ADvEFJYBr2uJqc21xgaBu9oMdmsCLV3BSRoQcDoz48fzgfswS++/Yvq7XIUt+C67unoEaoxzav/YO1/VA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230105192704-95f449e_1672946859438_0.048960521490469144","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230105193629-d71d47c":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230105193629-d71d47c","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230105193629-d71d47c","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"a24d877901aec664d3271824efc7f7540924923d","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230105193629-d71d47c.tgz","fileCount":60,"integrity":"sha512-ha+HNb7ziFP0KgRpk0KKvqFQyFREJKg96b36x/iQPUP+v7kF+IdmigfzPB7D2qGZl5HrE6UIBfbe9An/kZR7Rg==","signatures":[{"sig":"MEYCIQDxRF4Ygx2Y4VvYsPFXfOiU1IAwejdJwtixlKTi51m5kAIhAMqLvgt4z/ZtvQBUtP21/y7tFuK+iplKSazf/nwRsfeK","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166123,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtyboACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrKSRAAi998VHHPLgPyZUsZxwx4k6/1/PeXsQ2D5wsAYUP7GWBG+zUY\r\ndII1ZKHAEOGUDWZcuFl0+822xj1BuFGEB7XTtv3s7daxMn7pd6RsZfUI3A00\r\ncu71WQBT80eL0Ou7DjAJ2P1aAHjjzU0T202Tn7RYPCTOVEBreav/nbQ8twdG\r\n/0acJ2chx7wUNsqGn5TmZLwnISgV+P8YktkD7180bKh8didPE6EnguItxHPN\r\npA6ttAGz1wsMU767spaFYd6tYneBbh5m8u9EmBhFWDiI5lT72Gka8IEQZRBi\r\nXl/Kk2y8k4ZbKB274SNy/xSRvEPpMeQSF3Q5JIoU4vH2qDyOVWjMfL2IaVwc\r\nOIr4qRaPN3cS4XNWCwmFDurODIBICspiYpy1V6kpRdwE6EjSoArj4Xuh97cB\r\npwb4YYTJ1x+q2FxB9ysm/yehfR6vqtfB611y7R7Vvr8Sng8M8pku2gXWZcbE\r\nZSP/4wQ3i31oLiQeS2ugFYa2AYdnHf04LHNtao5ekYeu7lD1Rj2w4PUEFZ/N\r\nJum/s9/E6IATWJGW7vmDKktU6Np+fEIYYtpQWRrOX9eUuB/Dr5e92ib3FD/x\r\nxAMMmjVjEpho4rOdX+hCbLKUe9kirAUv/vo16xhxPCELQ8M5HNSqnI0oDFNM\r\nc0/ltjc7Y+ZnNfTAdERDvTnJYlraKgbDSFQ=\r\n=L953\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230105193629-d71d47c.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/74a0c8f7524a16835d70145a81250056/graphql-hive-client-0.22.0-alpha-20230105193629-d71d47c.tgz","_integrity":"sha512-ha+HNb7ziFP0KgRpk0KKvqFQyFREJKg96b36x/iQPUP+v7kF+IdmigfzPB7D2qGZl5HrE6UIBfbe9An/kZR7Rg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230105193629-d71d47c_1672947432314_0.6974220423856239","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230105193655-adbbebe":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230105193655-adbbebe","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230105193655-adbbebe","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"417c37904a0a5fe1755b83b39c49cdc47279a9e3","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230105193655-adbbebe.tgz","fileCount":60,"integrity":"sha512-Rf9EmJpefsGJytL0IkibMGCGXxeaFUYTs94Dd/WAn+0O39XSx8BpMJo0Iez7+kIJixrd2tFtVAYhaRg/rU6Uyg==","signatures":[{"sig":"MEUCIQCrdCFPMFwzIsZzG+Lanzah6p3L0Qi3FKsW4jyJX2RQfQIgWic31i11vcmjT9t58K7BtllDlxeB2h32j0tjtrPfPNA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtyb8ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrHMQ//f+wExEt2i6kCBKaEywWGDGiz8yOLkO7fEk3+UGLfPyupv7r/\r\n+opLOFAJTq33v08ajrpcqEnUDu9Umxa6Yhto6aE4YzkV8jltjGXOaVYt/ij4\r\nyTO6T0cPjzfY+XZFI68w0hk7ubPLfQRhMzVIZXnP4isy/bU13zDOXsJq1Sd7\r\nFnQkWAqs3t1vBGIIbZfTPIfnIaNK+0mGTPZ5b5FzO9Jl8yFIeYLg/E4uRAMm\r\nfvVHK3TeVdHjg9w/kwzrWAYqWYnmVqN4ksJJzyN+IiwR9lRzV6EEkVEguM3w\r\nbyTCU3fxVlV6Ygf555zFD5bHnVElTduRR+yvS96JNJDlwLO30vR/XLDll7rE\r\nJI7Iy6CxN1HIQHGp8H0zL0dHQls5Uu2cSiCjpWbsOAScZAML4BQM6hiRUufP\r\nySr4YZ42IjTkheimy1GWekpUXm/8jUCd0KoeuArVCobr7M+oUojekeGWBfi2\r\nhw87zspWxWQoIPPAseyyfzWM1D63d8c6ScckrDvQ6HqLALeFh0cV48TFFHxX\r\niUpIHmRsAQTaep/l5nAfMUMUtbuHdn3KQvvIGPe3wIeY7mo+r+A1RIChEH0R\r\nKwH3HVj3CuzKXccSwQs5m5nqXX5ZhDzf4v0sRDZOH7DPXg3jo7E8CzIA5pRl\r\nDgcojubtnCg0bh1Ghbu3x8apiFd1HXzrsJA=\r\n=V2mE\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230105193655-adbbebe.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/19d6460a08a693fba788e31f4e823877/graphql-hive-client-0.22.0-alpha-20230105193655-adbbebe.tgz","_integrity":"sha512-Rf9EmJpefsGJytL0IkibMGCGXxeaFUYTs94Dd/WAn+0O39XSx8BpMJo0Iez7+kIJixrd2tFtVAYhaRg/rU6Uyg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230105193655-adbbebe_1672947452164_0.7077377934351008","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230105193802-43f609e":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230105193802-43f609e","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230105193802-43f609e","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"8bddb40a840b6d75db34a3451cb8373789993b8d","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230105193802-43f609e.tgz","fileCount":60,"integrity":"sha512-AbFnYmYQe4w9Lq8kAzcz3B9vrmmWUyfrPEm8pbS6wfQ6yVOHtgBvE48qfehqvUXj9kCrNr4Gho5J/tprUrDXzQ==","signatures":[{"sig":"MEQCIAhPT7hVH3tBwI+Wj8xJkRaunr2cpzCESo7yxBKMMI9BAiBJVplBMo1FcF0ynd5TbnrPAe4HNH6Thh0wyTCSXPHKhg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtyc9ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmrx6Q/9E8SSQ68y3Mzz8vQC0igeMpKK4r5VioM82kh2Y0Q78/N7Tvw4\r\ngRLrb/R5Q/lF8+LGjbYoVdkegXtc3YhMU0GMfFOzqTwyONMNyxxwZPSJ5dCD\r\n8ogldE7+D99tlp5s7buCy6GQTWUmlIuR2Q+Fk0NDtQbOpUfbWV3JbxcYGpf+\r\nqHW67AgQD48sOpiwY35+2fk8d6xeu9ykXehTvcXTE4DDrVggA8aGun3jvMqv\r\n5IZf0nxathnoysooXgAc7Ei1UpNZc7rvTfD/ZZDp4T8l4/qy1SU774zTJvoS\r\nn1Nq59gpvI4l3xQXJaMM+AJX4dwBEji1gC3XQ16CiSUQ/zElkWh5k+9ZrT72\r\ncCyQsWuDiTEjyKgls9cR5B/fQ2meqsaY2QTHuh0WIZC8X+Xue2FN3wElMZNi\r\nykoIzWHxniMu5rBuGlKDQ1vFv8hZWaag9UXFGdwdUF8rqcxjXtVgcceHFHN2\r\nDPa/+zourvVz/v5UTy1xLOZOrsbjZTbOvrHf+vF5ssMxCAlw8yi+exfP+AHv\r\nbPc6M2BHRjUNUiy/DflVsCCMwJxbkAqh0zkmKKXm88TNju7m3nWwMHq17Phr\r\n5YmG1ap3AA06KOEj3n9vm+nlw3f2byWFAu3OljOt6NWQ3+gRrciggpMgoqko\r\nzSYGwaOAgi435mVU6muy3SNLCbuBD54NdK4=\r\n=bX63\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230105193802-43f609e.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/8bba42cbe68191aa9ef09e1483426ec4/graphql-hive-client-0.22.0-alpha-20230105193802-43f609e.tgz","_integrity":"sha512-AbFnYmYQe4w9Lq8kAzcz3B9vrmmWUyfrPEm8pbS6wfQ6yVOHtgBvE48qfehqvUXj9kCrNr4Gho5J/tprUrDXzQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230105193802-43f609e_1672947517742_0.7510311921377562","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230105194721-6643c74":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230105194721-6643c74","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230105194721-6643c74","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"80c235763c4bf15f2e9284f78fd9af790512253c","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230105194721-6643c74.tgz","fileCount":60,"integrity":"sha512-5ZF+DKaXmUDeJmignmVBRUKSdF1HXtSDTQnw1926sDMy+mXdVjwrrszVq7P5o9esn5PAPk77XtTa3mtwoA4vjQ==","signatures":[{"sig":"MEQCIHZ0UVFJYe449gKXV63h7yAdqsTlBjnfiH81Na9siC55AiBg+lhvPOeB9/jArMfurFpnSHXg0erzAh/eRv2szwpXwQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtylrACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo/PxAAg1Vptr3vn+0rxl3b478Tfm+omb6YezYxMyaSqbzsHH1Dfh7k\r\nVjQl5oG5uM2eyv/1aOXCnQRul92ymRtVaoF8BNkbh3b3bFj7mbn61iGGGumY\r\n6IGRbRolQGat4M/mt5L8PoIIi3t1fEVAqOdSGAI/XoRSBPoTJ82j2igT6F08\r\n6o/1f4rAN0/zIqRXhxoIVl6BsyHiiUPy6+dV/gpijAXuTqcOMgq7e9Yc9Zx/\r\noOapeS9/baZViyqY2IweYnCkryWX72gPbZC3miWCohrxTGOqZDZMkbGAYpVb\r\nTu2SNCUXnWlznucfsW70PnKXxk9OwFXGKNKV5Rvat9NMvuG+4vFLRf5BvA2H\r\nokGU8I8NBroEmVOu5Fk7W0rd2PYPN2FRCjfofNPsGgXCodw1S07smWehI7cT\r\nI2aVG0FyGfLZdbZHLwltYPER9IZxULszE61r9BbqQUNavGhf49gdJ7eHYqu4\r\nQmmuFKFun0PJRfHLS94f9Wegym8INAA5s26TYrTFxJyOqiPPxVkpQyGyvhrd\r\nNCmCVTQuaVecV57a2xF6NSS4bF2xp4hpl8EK8IllE1sbJlXPPbIUjl1UBmR3\r\nMa/xiekHNpzhfe76TTt+icFS02NoR5yiuOF0NiYVTzSiH1reJlWAeJDD8UUw\r\nyvyTTF1fUfyTDmhXEnQiU2ngqOKAbFPkLps=\r\n=tjeC\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230105194721-6643c74.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/368b7db2b7403eea3608a61a51fdb610/graphql-hive-client-0.22.0-alpha-20230105194721-6643c74.tgz","_integrity":"sha512-5ZF+DKaXmUDeJmignmVBRUKSdF1HXtSDTQnw1926sDMy+mXdVjwrrszVq7P5o9esn5PAPk77XtTa3mtwoA4vjQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230105194721-6643c74_1672948075502_0.8458973142475339","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230105194757-0cfd6a2":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230105194757-0cfd6a2","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230105194757-0cfd6a2","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"0a4fbcfc9f2d10e6bbc277046ea6854dda093350","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230105194757-0cfd6a2.tgz","fileCount":60,"integrity":"sha512-gGBttou85c13hO9aI/Atv4yXJqcJ2iU9gmj4u45QNFbao3afz4562xT1M7ac4kQepmab0Z4Z8seZua13Rja8cg==","signatures":[{"sig":"MEQCIDryvAFBgntBHd17Rttgp2lBjXVDMAkWK0kEBh9ZmYrAAiA+B9hEhcOnwfb08rhXSJPcclNJCLYL16YTCfahr3f3Ag==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtymPACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmosMxAAj+TvoobUjxW4hJcv2jCnsoKvxnoDBwpcYes9nLqcoovl7/OF\r\n8WqN24Yob6DDc1cV+PiiPEjg7Pm9erTDsiU3bYpCtcbchGbCLYXVb+D8zH1I\r\nmO3A1Lyt2tnSvfPBPhXoVx9tkTP9tGlLtXKvIfp1iJFWUUn8Ai/RJFHpJZvZ\r\n+soit5zTDeKtvN+NAnUY7is1IYwFSxw39VLZpDsBm3n33H7sg5qCQqkNI4y2\r\ncTT0zdp8OmN0GRIxVtvmD3O3REUZsM1w9FzM/MeGU3El0estBAOazbCzd4Z8\r\nNWSoZu/nCgDnZfuEg7KVwuAsP3YSqDwIKM4LMkL+hOx6Qxhnr+yOIojRi0H8\r\nrDQAQOFA0bL9Ij79I8YyoeJ1CyOFY+A+4aBHaTzEYQjWTchzrlkJK3l2lNN/\r\n6f4Dboc2C51AVmsdbWKhwqjBdcpzB+yJrxM+9pGgDO6ZwnAWT/IJqiFVR6vP\r\npaP2oGCq4jVZjj1bjgj2JZZH8As6UseY2/nLvDu33OgKi9wq6exk+QEArWgW\r\nJr+MTv8GFLy4KOUaeFgAP+xSDi/K9iN3Yzp+2/8f14g3p3Kkpo8JltMTvE2Y\r\n7MGdiKuAlOov0PC/tdFUnHGTtRP4BV4AUj8SWNH5APpJcUEd9aGTHwRkafS0\r\nAIV3HrO4BEvQs+fZ2lzeALUJL1ByPX22V50=\r\n=n525\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230105194757-0cfd6a2.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/aec5270e7f6f7413cedf315b1e0ceffc/graphql-hive-client-0.22.0-alpha-20230105194757-0cfd6a2.tgz","_integrity":"sha512-gGBttou85c13hO9aI/Atv4yXJqcJ2iU9gmj4u45QNFbao3afz4562xT1M7ac4kQepmab0Z4Z8seZua13Rja8cg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230105194757-0cfd6a2_1672948111329_0.9071294002995698","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230105195341-75aba08":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230105195341-75aba08","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230105195341-75aba08","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"7faac528cc76fbff5583fcbb763546a7840450b1","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230105195341-75aba08.tgz","fileCount":60,"integrity":"sha512-CXUWjqReLVZYXt50hefvt/oatr83qnd3BMifJwvZaBYdKFGOipM2LGAZ+9VzNbTOlCjZodEOTviXlqgiCcoMkw==","signatures":[{"sig":"MEYCIQDe+JP/tKMsyArJYvi0gU6BtUmsx/YJYkKNzdUAMRmX9gIhAKgw6yx+d+4PAIq1hzMIDX+bpBrOGYyMNZikZ/WOIf/h","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtyruACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpmMQ/8CcHZSWqoOHVyI6atXq2qthJqF5ifHPJmOPc6i3r+XXVXkS/9\r\nchpwCJGsZGgqcQtzfyO4AKSVemhIC0BBUl+xskcJQ8HkdRM3szJXL8cfNs+d\r\nX5uCtrxKHQW/4zabgjz0LDDNr+0TnkJHSEoLr/ikYe1/V6ne8AYDu7OsOCHd\r\nEozfd9SZ8sNfCsndwS+jM3xR8R4XG2k8kDaUP1Zcf2utBhMfGWuvobXgOg+W\r\nGr5i3fsyT2FsMQZxm/DS/4PS7y8WDFhDP5uwNl1Idy20cIAQpln1lT0paaXw\r\n8uND1hPoW9nRUKGQmEwfvsfzWHOVdqagINlyqWcrK0qL47Xjh57cp9RmNBN9\r\n2wAJOLSxmmIaCsoHnDqpM606LguddzJ5ZKMN1Exl9JIUafauKhGfyUANc0DZ\r\nEIPxWOxHfZK1GjWw1I+8UToWM7RZPmLYv6xpOn9nZzUlf2lQ7e18ek51AIcc\r\n57yV9dFLL8zboMkl9yiHMX80JaU2PJ8ErOOj36PZPN2hKb0a0CZpaY6vmmNL\r\nAZLZZxPZAoutmhu2hexvUYGGzidpngZDAljCFP3wOHfhxsYC3G5D8Cjw8+Ru\r\nY5EQ3Dp1p34xOgF/006ruKPNuWQwn7o5YojZfzW7R0at6crSiW2dY9X0L0vK\r\nqMj+xB7peacVCGz3MgahD9HzFZV1XCJkeEI=\r\n=xxYj\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230105195341-75aba08.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/77cda62eb37cfd7a8a7594ee92bbf979/graphql-hive-client-0.22.0-alpha-20230105195341-75aba08.tgz","_integrity":"sha512-CXUWjqReLVZYXt50hefvt/oatr83qnd3BMifJwvZaBYdKFGOipM2LGAZ+9VzNbTOlCjZodEOTviXlqgiCcoMkw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230105195341-75aba08_1672948462720_0.7869173803667653","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230105195814-93d34fd":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230105195814-93d34fd","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230105195814-93d34fd","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"26836b2df389c50d54037c0901e6e8312c47154a","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230105195814-93d34fd.tgz","fileCount":60,"integrity":"sha512-XgfCv0PHeCorpRRoA90oPdi/rh75Y/ghHwCcaWIwtXAY5WbuGDoT8qhNkQFoEYhK2Zi0lj7iaksseHl7lYp6PQ==","signatures":[{"sig":"MEQCIEP/1gClHWdDg5ILK7YANm95zNsndj76soXGNqoFkAGPAiBLx3FhzhUpOCI82yZ+0J1GjlY57dljG6GZH5ED9PPPBA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165581,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtyv5ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpDehAAin4aswiB8YEpze81+FDxhVx2apJzgUl5PuBqsDgqHHXalEIx\r\nLVzYxjqlBkfdDihT2Z//g4IVkFy1nrPoDJsipOk9LTvGt7SMRVCgr4kGVomQ\r\nt3oC+LAocSK9F+7qm2zA1yF/y6z7jstW6m0juTzTiJHxEPEQSVdIDa2S42am\r\nykp6VNXbE9Sm7t3H/Pjkr8C6xPw2qgJDOLWpjqerU8j/6eOneySyIaCMGIhL\r\n69ZAP3e+/3+3fA/TgTSiNlGEUXfGPVoLs1xW4hBQhR2k00g1NRgtbepao6Df\r\nkoU3XFSKUXXyDspOQAhMRQzkO308s6y4v8k/Pj8g5cU6/vlGlvS6zN1nKxB6\r\n11Jj7DauKriXdSIJOlSFwSuZNuwPoLMQdpezhunUAMMnHID0NQHYH2CAiixP\r\nwiG/07JiY76JNJGvIygyZq1sV2SF771QHmLXe3prY6/N/hd5YfbV5pwSYCEr\r\nozdPNqxEXQP6cmCKQD54TMSoZ7TXLGWSjnjCRWiLFvvodv9W8F67gA6uRQUF\r\n8iNH3Le+bU2EPh3Dy8lK0OtTpHxXXQa4JNAmjRu7lkoZ3gPfy71nI38ANHq8\r\n1TATRR7NZ75l0b5H40JOTPrJGOEtco6niHX0DQbaVj8C2Q3fBLEd2cNZjm8O\r\nO9yZkPy1HqK1+0yiHf4SXDInmyfieglElgI=\r\n=T+5I\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230105195814-93d34fd.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/14a6325eb35221338d344ba746ba85a9/graphql-hive-client-0.22.0-alpha-20230105195814-93d34fd.tgz","_integrity":"sha512-XgfCv0PHeCorpRRoA90oPdi/rh75Y/ghHwCcaWIwtXAY5WbuGDoT8qhNkQFoEYhK2Zi0lj7iaksseHl7lYp6PQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^9.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230105195814-93d34fd_1672948729453_0.36757680749834676","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230105200300-6e28ac5":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230105200300-6e28ac5","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230105200300-6e28ac5","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"09c1e87708d88f97185f05756b311a06fd116cd2","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230105200300-6e28ac5.tgz","fileCount":60,"integrity":"sha512-3pq+aYl1zVpBBUjPa59XpN4d9RzUbeRoN9Zt69VP8yiLYkDlCiskE3sUU45uYJ4irWjgQ+MGgEjsQccI1feQhg==","signatures":[{"sig":"MEUCIEYhswJ1TnQYKrgZ1GqrAi3lbHGWSWIKQK1Q666O7TODAiEA99X9bZS91l/w7l94GlHwa33hgaZAxK5y1E1X1LHPTGA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjty0XACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoWfg/+PtBsECSsE0Q0tLkbyWhKhNa9vaRYjuveZ0TJ+IA/6hKiREm6\r\n5LEUXUrzWq7QeTOFrOUGJzHf2NmDJTkXhKqU49UvZH9IYezSBjY150t0201j\r\n0NmR9+F/jUhVfoUR5izrGMqNY8UNkwTSKXWO+TrWVNPvcKWy8bwb3l2s3IsI\r\nC3b2bvpsV616+2gwxPWThhkTygFvDtRkLN45364+v6IEgf6MaBQC2vXP+srj\r\ncJCxo1J0MjmZA4bQlD8jbmuqi26aJ0f2X1zm7zSZdE0QekTQj5AQA85djM8i\r\nFB1/+ObEC0X0hg1ggahGDXHZp6hUJyKnioAutlZX5DJm8MAYi1UNvF6R8WQr\r\nnpOVLpPG/TgyQv+01RdK79ykFZLvjZPT6XczF1dIqslx1eQuifDWQWKHSjrj\r\nJ/m5mO2EWlFO9KMoT7wDbcgJSQj/Fo5x0Vz5l5iHZdifMOIrRQ6BLwhSJRtF\r\nncDg1ElLN9sybdpq7C/7AhA5np9Y1SesFJfkJJkgZGjnzlg4FxNVb/NjLpNs\r\nAewSyI0gLjtxp5nkMveKF2EA1nnQap/E3Rn1YmAHoxDC0vUpqJxaWjvXgDhn\r\nQxcbJbaJAjRky/TDpPdx+1S5vZUoWX5G39nSrgHQFZCAl+H80hpnv8+EZyvR\r\nvnPOnUYmsP2+X2bC0ky9WrBy+HRnAb6fAKA=\r\n=9SWm\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230105200300-6e28ac5.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/d7ecbab002ca4c54b512b74cba86a64f/graphql-hive-client-0.22.0-alpha-20230105200300-6e28ac5.tgz","_integrity":"sha512-3pq+aYl1zVpBBUjPa59XpN4d9RzUbeRoN9Zt69VP8yiLYkDlCiskE3sUU45uYJ4irWjgQ+MGgEjsQccI1feQhg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230105200300-6e28ac5_1672949015289_0.10766066926812234","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230105200803-3e5bcb5":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230105200803-3e5bcb5","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230105200803-3e5bcb5","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"604e9b789ad6a3bbafe24774e032b887b02ffd84","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230105200803-3e5bcb5.tgz","fileCount":60,"integrity":"sha512-E1nGvCFGYpQ3RT9zXTFJHuI16R+vku+GWkMXx71C3w2gQ6W/BRulsTbvHjfiIfM+tjCwej1N8946vd48Axlctg==","signatures":[{"sig":"MEUCIQDggMd3f/PPQpBMxGiQj0BBvJ5/5fZ9OURCvF+V5ONsGwIgFMuc9A5ajON5hvsFMYSPFp72WWS+p3nm9nKmRGzuo38=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjty5GACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoPiA/+Lltpj3EyO3BJ/c+ag3S150Fr2NgDYNeyzW9hINRAEPFSxlDz\r\nM1W9hsi6CUxoCy3dfJnObY6LVLPnIJH0bzlmw0zG5heGwm1YcHF7L3SSHa+N\r\nQSVuB7EMNdHNj2WV9/2gDGznuZDUKgXEc3drOwbhSdc9r0QWWaF2JZiVZLem\r\nM49/W7DW2s60Kj8+zc5e4+uu89eIw39VLptU3Qk3mqcegGmfgla+4iduyDZD\r\nfRxyYUm0A+iHVSoL89CYboMqsBNxhusbzFpWFg1TBV/Ewwg5bcsEPKVyKahX\r\nuM25JBGXJIqMt+20idN2PYVyKDLIPsDG7XN+fGRUa5jKhYHFDI807+/GY1tT\r\nN5QcH9WiwdEaxUUNmo9uGSwUDSocYWTCN6lPGE+8dr0VUDyXSG0IPvGKxPKv\r\nx3N6BvPCKbCwBPmTRt73GTdis4UyU3zFvihDxFEBZQG7P7xhbOHPLs/n7SAx\r\nKjdbT6g9Z0/3BB4LEqN0AACZ6y3nnbwqrPDWyu6hHFcLIWVq7sJzJg8CCoro\r\n24n9aT+9siEgQMr2lQlfO08YEXFG7dKlJ2QCqkE0E03QEJIPcXCenmv11U7R\r\nHL0Dca5BcQBMt6QpKjy3aJ+1elQQX0zgSM8V8jv5OAg6NFCx9Bnahm7IMzA7\r\nvLvT2oR0mpZbO3bulQ8DaXD/HgRA4KJqjZE=\r\n=2eyp\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230105200803-3e5bcb5.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/94f80e92bdbd6e2939acf9a77e564200/graphql-hive-client-0.22.0-alpha-20230105200803-3e5bcb5.tgz","_integrity":"sha512-E1nGvCFGYpQ3RT9zXTFJHuI16R+vku+GWkMXx71C3w2gQ6W/BRulsTbvHjfiIfM+tjCwej1N8946vd48Axlctg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230105200803-3e5bcb5_1672949318486_0.9075954962478663","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230105215320-fa09cec":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230105215320-fa09cec","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230105215320-fa09cec","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"f8e36951a6b864fd633b8aac645f9ae35a5a38db","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230105215320-fa09cec.tgz","fileCount":60,"integrity":"sha512-xJX3f0vP9fOOJWi8nkZ3w6DcvFxM0eUQvsVYqOASvvy6v9dZeWgsaoyITT8mX60x1HD4czxK0DNrgxE8YT98hQ==","signatures":[{"sig":"MEQCIBFN+CanZj9lXtZNpYFjx5ePMtQ6bWkJ+qEuyNlBxvmsAiA9ibTWRti9j3/35/6cS/O+8/ptDy5IS42TZd2n++Uy/Q==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjt0b6ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmouKxAAjn9iWHiVv8M+uUOaBKGc9MAFwqgP89q3UHkAXq4qaaQNRZqK\r\nP/WyGba18hYfrsojc2iUX22R10nBzOEh8Q6ahb/nTAIlc32Z7S/FiTavTSav\r\ncz0OuEqdEGoVpI4LKDCIVdx7srh5kKFBkxmturx9hgUPZsRvWYiFftnDyegE\r\nlMyjMP6bnPC9I1DTxyiL9bAvWu6f4tnekd/N2YmNPnmiw0L7+nD+dDoFtO64\r\n8+qe2f+lAWLXCmK0oS5igIpaZZbBV59lh7gUqzeZNgrcD+/SOvC8gtay7W+d\r\nFdIEY5s0kFY/voc7a1vGKkE219MNNVryY7cenJa8q1xw0Dl5BdJZeFIymVB1\r\nLonJI33dCjswDLyrj1Gday6p8YT1Eb/QDxTFjIBrjmFkRo29dG8949QUbcR0\r\nZBZNi87D30IrjCrVDNsLOxGJpxuHGxkBAUkbg3FEB+kYUWywBeMB/6Xc1s5g\r\nafB+H04Q0LBUD2bniT0NVMxI8tSfuyRzn7tQG4MSNb7HHXibQ34xPsvS9lal\r\n+9LHOQuALjlspDVe/6vEx2TlFBwuXQb8XGD0BUJYYTUMPgSYzWsZNkpTk3Y1\r\nDb953thygDI4lJ9L8nW5cR1uWgTGliqSDrVfrvOeElYx8b6z5qnUAAUfUDQZ\r\nhW9QFdBYOFbsHXUYavSH803nhdiKtrgH6to=\r\n=3BGm\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230105215320-fa09cec.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/f432f1dc7af97ce3ee0fa31a5ab8ce2d/graphql-hive-client-0.22.0-alpha-20230105215320-fa09cec.tgz","_integrity":"sha512-xJX3f0vP9fOOJWi8nkZ3w6DcvFxM0eUQvsVYqOASvvy6v9dZeWgsaoyITT8mX60x1HD4czxK0DNrgxE8YT98hQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230105215320-fa09cec_1672955642507_0.9067970301941246","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230105220153-4d1a4aa":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230105220153-4d1a4aa","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230105220153-4d1a4aa","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"31670928dc01a93c9164e2fa96d5c706d45523dc","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230105220153-4d1a4aa.tgz","fileCount":60,"integrity":"sha512-2MwPTXgYrhkz0/AFM0A1OyhOj5MDqPx+kUUyvUYO7pUIzkpEttSPZlW1RlBqrdZ+5Jbpl84cfg/uMmU0obhhXQ==","signatures":[{"sig":"MEQCIAi3HAlz8qeVXH4d2CTsRjgbTuIMffKq3X8ro2bPJ2pkAiByeDXMeHV6Of+NlPMAfSAlqeethdb4bi984TrGaMTT6A==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjt0kBACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqAFA//fmI8lfembavKkk2TLok+HjJEeRaqiq5tavIQgvMZXavVUdZN\r\nv+ebfJaI+Lp+OLSKSPM0ZSrh4oocDCjS8zSxUuZ6HPlavNW7ozLsHbz4I0zq\r\n1AtN6N/cqOtLlTDA4U1Zd2fD/8DLjI2y/73y0sE6++YuLTT8tuL6McRsfq7O\r\nY3PCCJvizaFCVZcltGfekBhlqCD9F/C2sSeI2vsS9BOLzWSkP2IrIQ+gS2Tf\r\nwRvkaETDQQI3q2O2qOcQev1wXzWi9A0mp3UBRQecyKFBbiaCdWaO3cYJGzhK\r\ndW+RABN36910v+8kzSQaCQLUX+ZWh/mlE4qgLtKSjQHB7NTzKan4rxVdzE8r\r\n5LxSZMoCYzm2ih5slGYr+Kj8x1Kaf3fiCW30nYeM8tm6SuGqMgL0U+P0i/pj\r\nwVywg95w9nEpr3c7HaXtZuLr2wirBJxPpzcU3PJY+9IBKraQikSUPnJO9QPl\r\nTN1n6EmDJZyF8UYzL2El4zqqXq2Q8ICnpi+uQcNIUdPdQ4oJ3qKlhEMHvFKb\r\nGwm35PLkPmMgo983qRj2HKLaE4S6Ot6mrux6l1U2zVEK9buNbqgNZ022spIn\r\nCsv+l3IGzTo8pUz1FjN8SfAbo90tOkQ3JGmBeM7xpyKR5VUjtwd/m76bNGwm\r\nBjuN5YbUZ2gxzhtjbE1jIC6nY5ruC5cv9J8=\r\n=Ctku\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230105220153-4d1a4aa.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/c4cc440cadc3586d9597bd7502b8a355/graphql-hive-client-0.22.0-alpha-20230105220153-4d1a4aa.tgz","_integrity":"sha512-2MwPTXgYrhkz0/AFM0A1OyhOj5MDqPx+kUUyvUYO7pUIzkpEttSPZlW1RlBqrdZ+5Jbpl84cfg/uMmU0obhhXQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230105220153-4d1a4aa_1672956161044_0.3960120671526115","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230105221119-405ec7a":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230105221119-405ec7a","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230105221119-405ec7a","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"e28c5ecbe4c6fcd5f37d46ae178534147947eb65","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230105221119-405ec7a.tgz","fileCount":60,"integrity":"sha512-IBdr58ZAklgmgEFD9TaSL0jvFwfvKAb8DS1EevB8EltrLUoD/pRYjHH5/ReZUiKfXwE7CoIr+h05yDNjmZB+4g==","signatures":[{"sig":"MEQCIHbYx4/Qspx66KmJEtE0ZxCScj6zblNPqes/vc5slCE6AiBx3Jj5NhwZ/Fe+mr3TzBcrpsWHf9Insi+Sm7eCXeRtdQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjt0sqACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqyLA/8D3pzVlFamSFJ1IJjXRcGVMq7dlkW/6aY3RSYDmkQeZAl8JLB\r\nBf+jm9WpB2XWcN0GgWREBfwmPUKP139d3QlS6hzUyevT5NU1cJoapOgDRp7i\r\nR+6Y7u+Fs8te5Nvk5ArbKWAPgSR5WZylhh8acLAopPYFjShh0Db8swCjz/8F\r\nKI8q2/E1CvKkRA1eyX60uIadwTBUp23bRqSdjLgPrIzoe1mt8vMIPyx7BhuR\r\nuAM/DEmU1u+feyvhCjuKxhxcmdA3h/DI8bizfAOQCt+YP16gsf9Ar9+bbdaj\r\nMJe3U/+4rs8USAnBl+7XD8c06asgDfbDwe/T85xZ6LBHBcHlJWcJr2y7N0UW\r\nQaOPCMDR4SUsLVs37P1hk1N6SMMiK/0qLoDCb889tLVExy9glxpMouYbm8kO\r\nDgcWYODY9eogqS89ZHMnkeTPtfh22pKxDuf72x/sbGxA+sNJ5wO9miTvQkMG\r\nBDkdx978CiGZSgcJ6evIsUG+Tw5G/fVESoD2KWfMqDVVEiuL9sL16YDmTQz6\r\n2+XSz5LcfGe3wrNhuwjE6w9UXqwl3mhujuGHv69Hkhu4zf+I2RHJkWsClJIT\r\n2hyx5DoUtuk035rroASnfNluVdAr+XIwzsbeO3Rpf/qmC3rn0zVL/rfYZMpF\r\nBuFYpeFZtEf8exvqra3nUIrsDFpb0BLFA00=\r\n=bXYG\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230105221119-405ec7a.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/56f52c2a0134becff0b4c2f23d203498/graphql-hive-client-0.22.0-alpha-20230105221119-405ec7a.tgz","_integrity":"sha512-IBdr58ZAklgmgEFD9TaSL0jvFwfvKAb8DS1EevB8EltrLUoD/pRYjHH5/ReZUiKfXwE7CoIr+h05yDNjmZB+4g==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230105221119-405ec7a_1672956714598_0.5015217371303562","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230105221733-5a7c479":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230105221733-5a7c479","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230105221733-5a7c479","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"98d425546cec2880c4ca57dd69028b6d3f04e532","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230105221733-5a7c479.tgz","fileCount":60,"integrity":"sha512-fnYyUnZ+8UjY1/e1zstycn0aDjUhv6wHJy+CSfuASiTyfSG6BzgmR97qJUNYlFbMBLzzkqxJLBFbYc3pEZxOMA==","signatures":[{"sig":"MEYCIQC/yQrSekq67PvjXeSB1vC0oCScteRj7+iqcRqh4QWbGAIhAIKUb87QuPikWnE10dijvhpysxfZv9FSOYiRZhG240pw","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjt0yjACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmoq0Q/9GkthM0lESXW6s/5e60ZtrMgxifonHy/jqz87cx5GKn3teIS0\r\naRVwCMKqSWVAVRk22n4rvjoAH2ueqBGQVJx4gYRlItuiPx8DXQLZ6NqeQZwE\r\nfjWdFTDTJLMPhs04tv4fo1nSeS4BTpkil7VmfCHoRr57HiT1432k3Lrs2T9m\r\n76ViDlncbUiw6EAC7vMfDodAe3px5TEMKG7QwgRGQS4AQPVe7of999ZhodvA\r\noyTyIuWPfPAJ+kIlDl2QFMWX79fErqCiirLbX1CRTg6iU4mjleXYtsexU8Kn\r\nI4k3rkNgUbuwCuQLNF80bGerJxa0kQm/Tmf0Z8hUW1lhznbeZ6/zpUxddWNF\r\nhl/tD67Wf9y+MIoU2HgdZydbfNAXmLnH/rFObSnp+9HsJ7NorrvFR2RVZgAQ\r\nHS4w2Uf8EmpEYJIcyzmNmrUDcmEY7MsJcupEb3lLhfVnQXoHkBqhxMNIgVQd\r\nXpp/0dasY8IC4dR+tt9RYRY5ikTMg3aP/bO1abene6uxUlvWcm8xxMx07INa\r\nnk0C8EGoI53zc5Gm8f0BgCPK8vNXpwStDJwawwXl5DvtPuhMHfs7u9UVB9du\r\npOPdeECx4PZsPl4zr0/gFT3AnFN8DuomhzPWaDFFgJ84wDn1BjfRKXmJTVjL\r\nC8DdZTQ3Cnv05Ek/sgN2AkZs8Id7yrI2wJU=\r\n=H/Qd\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230105221733-5a7c479.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/5c49588cb166368018df82fc02d377f8/graphql-hive-client-0.22.0-alpha-20230105221733-5a7c479.tgz","_integrity":"sha512-fnYyUnZ+8UjY1/e1zstycn0aDjUhv6wHJy+CSfuASiTyfSG6BzgmR97qJUNYlFbMBLzzkqxJLBFbYc3pEZxOMA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230105221733-5a7c479_1672957091059_0.049345782350903145","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230105222310-e4efd2b":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230105222310-e4efd2b","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230105222310-e4efd2b","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"353ecb1d6fe359d444187cc3d8b100775aa10b7b","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230105222310-e4efd2b.tgz","fileCount":60,"integrity":"sha512-vG706VtvpWaAPt8vikJmHH0wIpElxkQ7/ffe+03qeqRT3h2iTJfabF/JBf+CifybMZYvnFtn6npcHdkd42PVaQ==","signatures":[{"sig":"MEYCIQCFvynTlEwfPtcnzerHAaGm4HUlBu0EBStoU1ujj9jdkAIhAOgzqn+mmi/1pl7/TTsBTG5unbUQd+3uyoOQXUbCGdIa","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjt03yACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqktBAAoAJ5iLA5ZIHK7+hycEn2X6SSklEZ4KBFfenaamQrWcjLbYfm\r\nKya5b/tzs/TxvxnXto2gLSu2WakfIRonbHpi2636sd861cZczxFltr/lxUXB\r\nDEsjbqbr7qyeiPYRIYB+JAjSSudlQXK17rQ26sQ2+ltmmte9B5l8/Y1b6vlR\r\nDnqvcDES6F2LRNXS/KnYtzejYZSB6hzNjywAy9PnxNEpi67dVKx5VFYQIAQx\r\nGLY1IN5vMTeP+toC/8M7G7PrW0MNgD3h4FsV3LloVc78/NpjB10gXopX/KWq\r\nEoA+aHzbHQQGitIeNZoFXjVnfRli94izpagHXuypQS/NM0eLB6a/vNaku2rA\r\noKYxPn8RnhwQIoeejdPBkiWnlVcDnkhDbmxIfc2iYATD2E6+2//LfcJPrhoH\r\ngdB5tYvh1AtQSdJ6FKgwPGz4L994MUnTA5TD0saEa2b1mtN9pbkIUGCUGAu3\r\ngB6jtF94G5DN1nDsMjXucMVHc41I0RjG6sP/nPjQNxgEF7lCJNI0Dgcjh6WL\r\naspCw3YZvtWtIyjuk2t4W+93iW8/57QgmoUUDA63431M2hghl3LeyIxpDcyt\r\nFx1eDTO+DBS+w4EzriQNDNf+O6/NqnIgpANjy7LHa14Y32MaW30+eoPk0P12\r\nmbwugf8GHJr2zN4Aml8nVNFz82k+wo0wYBc=\r\n=mRe3\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230105222310-e4efd2b.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/d0c7a15d32e24cb9a7cf29e6c53efcd6/graphql-hive-client-0.22.0-alpha-20230105222310-e4efd2b.tgz","_integrity":"sha512-vG706VtvpWaAPt8vikJmHH0wIpElxkQ7/ffe+03qeqRT3h2iTJfabF/JBf+CifybMZYvnFtn6npcHdkd42PVaQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230105222310-e4efd2b_1672957426515_0.41868668697451494","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230105222829-f6a92c1":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230105222829-f6a92c1","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230105222829-f6a92c1","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"986a4d9c6cb7d88856789468645c09bb89f50cc7","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230105222829-f6a92c1.tgz","fileCount":60,"integrity":"sha512-cBqQaObcq9IF+AHzEk8gUWeGcQrEyHbOr1Qhmky+MED35FY8OnC1qlCskIj0wjkK/GvhkV1lTboZtTnfKsic3g==","signatures":[{"sig":"MEUCIQClf3qc+7pheXFE/8d9y3+qo6QD0snrVCdZ/9lTXWHSUgIgJrq52k1JvEooFckwxfnVp4W8DMg7/NnsXLkZ4kaXFeY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjt08wACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrReg//UzLyW54rsac0W7Aqdi+ET6ddqTxexlvVK/21jHOHYsqrN3ei\r\nPJk/TWF9QwgAuTvjN0fy06xaUe0oeTkfaKR5zRk8JwihWeZEC+7p4k4NNo72\r\nxbGgZ91tJmhxjGTw4ntPzJv9qmYOyzNF+WAfCXcI+1FVxnfNjgDFWnJTDkDL\r\nnejLAiTsov9B6ecifa5A5XdP4O2RYfxpz6dUGewUKAYA/2OXtlWV3/zy+t3e\r\nW5VjNyFfCGgNGGG12ix9254FC3rMyLJ5uZrlNAOAg3Jyo02K+ngUVEzYyORd\r\n6o4DnccxEmt7UOQQNUUcZNDJStEhytv03sZzvDlD8xTUBMe205EzdsLiEdR7\r\nyg9uRpqanSo2W38DtGAJOAeIsjJkn6aPxZzcw6pyevP1o9SpQD2OZskbqeX1\r\nwhkl262WjOUj4iwEecWztYii3sfmwrdrwJCWCh/XtCu7HViHeXS+lLqiYUT7\r\nrDNdrzN1RCI4fWEGBX9DZiFBT3h/2lfITQnUukud5CEMCoDwCqStGqBQsB4w\r\npR9iAVEjgDMKlbZCwihXYSHmVjIioxEE0FGWENHJ58ywYy8/MifG7TbfAdL+\r\nCWhwcqQK0gicCnNbOpo+r4I8GynZnyvkar23W2xgIJqV+xFQZrzil+CHfGlZ\r\nP++E7BA6Pg8yQZCMMJwKbkJqux6JYQuC00Y=\r\n=U911\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230105222829-f6a92c1.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/19220be3494379808eed40ebd023b87f/graphql-hive-client-0.22.0-alpha-20230105222829-f6a92c1.tgz","_integrity":"sha512-cBqQaObcq9IF+AHzEk8gUWeGcQrEyHbOr1Qhmky+MED35FY8OnC1qlCskIj0wjkK/GvhkV1lTboZtTnfKsic3g==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230105222829-f6a92c1_1672957744244_0.946563613808203","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230105223923-2c4f48d":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230105223923-2c4f48d","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230105223923-2c4f48d","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"ae607d5887469c833d6c52a488f3ffdf404da0ef","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230105223923-2c4f48d.tgz","fileCount":60,"integrity":"sha512-euP6XAibdeSXSOBjzDTG6D36GInhgEDJIkQraDKD3qEcYCNK/1jb1ECr6tScwD9Sg343rS3WxbqhbX8R6vd8kA==","signatures":[{"sig":"MEYCIQDZyetstzWxMOZ/IhZNd7pjSW3DIEqZECGHq41ryrkfIAIhALz/YckibhxZneAjltHqbI0JDfWxBcHD6FUDe0rhiRPX","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjt1G+ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqZTg//SI7i96ht9wiYhhN1+oJnloggcA9h67fyU2+QFcKnvOkc4R4B\r\nQOBkVF3IY+JZts1sSFOnV9lOk9siJWRxyMQv5ehmXm67dFTdmuf5Tri8Wb4a\r\nJ9chdxGNY8oBD1nVM1PZrsO3tjHx7sTbtUy3mX/3STdk/T7VOGupwoIqO8uZ\r\nb+wdO5VuZXEy+5eGnGgV2u0mQj8DgqYiWvFtGJsbgV9PtrWbVI+xqdVb7r5t\r\nPDeulNnwCpXTjU4ZOEKMdHu8IMDRpDNzvnyZA+DrFVjy/O9H6RjP7x6uDYAh\r\nKu5RjYkkApHqUySQdrmzstjA08fqk2y8yNJiy5o0+l1G0bN2eIz2/E3GcW85\r\n1WSoqX2y6KWCpyLKkebZa6BBsJTPgx8AQGDdsKtEjZz/fSVMLwcU5H0/65nJ\r\nRmeLEmhkhhsq0bWclihxGVljEdm8VBf2+KC/DUeNXokpOzzZQcqeY/UXmeg3\r\nW84wgc3gQJUJo5MgOigi0XQIgTwxbdqWHKTjXA9Txx4vnaay0jGuaxBx7tHy\r\nFRaiWBYTQOicfnzOrL+LisdzaVT+I/zotKBLh75wjzwpPF6IAxWV+2rZZpgm\r\n65HOjYq7UVzjSeqkDN7lRzIjbCMBA676kGn87WhEGkuYfEXBcTzNR3Pa5p0Z\r\nH7JAI3pDrZb4Rv5Zh/y1fUg/lIsmU6NK9x4=\r\n=yV0D\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230105223923-2c4f48d.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/1518ef3805924619750f3f8dac6454e0/graphql-hive-client-0.22.0-alpha-20230105223923-2c4f48d.tgz","_integrity":"sha512-euP6XAibdeSXSOBjzDTG6D36GInhgEDJIkQraDKD3qEcYCNK/1jb1ECr6tScwD9Sg343rS3WxbqhbX8R6vd8kA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230105223923-2c4f48d_1672958398232_0.5474526759432738","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230105224451-1d1a8fd":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230105224451-1d1a8fd","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230105224451-1d1a8fd","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"a13c34eb17ae8b10864b47bffe50ee9f9e233abb","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230105224451-1d1a8fd.tgz","fileCount":60,"integrity":"sha512-ofmzDRT5T0lGfAC447qED605skR3b0059LE4tm7GYJ1RYy1yMvK/zQGd5JAK7stvqIBgLAx9kzy3vcaFWBouSA==","signatures":[{"sig":"MEUCIQCEfFl9/R7pkcwwVxsr87IFkylAZ8xyzXlvUwOJWbQFFAIgfWM+RvNf3LIEjlDj4JoYdg302TvewsUI7CHW2PLQiSs=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjt1MGACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqgDg//adZshFZdtjzUBPu3YAYKvsE/qchGSpVULD35Wb9cd490Ng2N\r\nVDl6HnOGYQwiNsXggzTvlHGPwcGR7M7xCQNxTGyxuxFbg28YwfAhbKsnlOuQ\r\n8u3/hAtWFfBgNrPTuuaA3udJiF6fK0luwSMjSWZ8L7BjOSqA3AywRcwU1/w3\r\neorSb/h2+dVrrRKQIMYADXc9VzOWgbJ9eLLYOS2IvlP/6d/6J2OCkObCf+JV\r\nHjUvzny3FdXWxPHQRfIatKTkpA1XYj7rn+My2lC7ImjXfgKZyfNUpnS5B190\r\nz9H17CueC4sFxup0HkP+rx+p/bLE8s3nJlaBo40cmzgEdEBUh3iBafLErXcV\r\nueWk+/4CRpXGCrSGPlCDeuchAv6TwU1O1I5Xf8x8LSIvN0wImnkWbxOEgbGp\r\nxo6rJeRrhMggIf2XxoyaAq7AYqb4+zxYb88we5B90eEn3Iq+I7kMZJwowX5j\r\n4UbMmB92FLnRK8wrgsmePr51jC+DzeT7h0UddnvmByFux3b22X1vZtHcgexR\r\nK0yOtLh4OLbOiHbSmtFnF5vZfTtGsa5X9sV/trT01AGIFrdtPLD7xSbYX3t7\r\nAoQ7vLirGG9tDGv28dJLu9VI9BwGOcKU7XjiLNJ0TxBHvmXEu95PS7udV1SV\r\n9Oe15MLgFAaIkbjvh2ejIAWJcmXE00HKmwM=\r\n=hjbN\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230105224451-1d1a8fd.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/8af526822a4dca666fea259627c54fe3/graphql-hive-client-0.22.0-alpha-20230105224451-1d1a8fd.tgz","_integrity":"sha512-ofmzDRT5T0lGfAC447qED605skR3b0059LE4tm7GYJ1RYy1yMvK/zQGd5JAK7stvqIBgLAx9kzy3vcaFWBouSA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230105224451-1d1a8fd_1672958725727_0.2327880678977583","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230106134402-1279fd0":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230106134402-1279fd0","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230106134402-1279fd0","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"56fd0a99cd48a7b93bf473287a804054f4c49678","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230106134402-1279fd0.tgz","fileCount":60,"integrity":"sha512-2peG0WvtuwYpPrytHEtNqJ/O7W4k1tJgw0CX1UU5AKBQGl6t3JLLA4iu7ZzH/uGgYVkQg7DPv1WxJJbx3L+2LA==","signatures":[{"sig":"MEUCIQD2vwyxx2IE8UGZc5Jf60eUyHwydFvq48Lb5Y/rKfMiKQIgGkZCflzDq2PRVks8n0jy8ALeUPLP736Pf4vKpZhrNPI=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjuCXVACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqAtw//WVMI/eZc4Am0yQt8uM+UOwlVIgKa52wNIPkRV+poJ4Wc4yUw\r\n/T5f+Bq3PlgmXQ+0p87iN/ah/5pujyLnG2sYOofS+8IoS7/uwNS6i13iGAmk\r\np/OtoRlY/KjqwRmpyx/Um2NVSpwWPFnlPfgtNZhaQifmKEERrkAO+u4nyYDX\r\nXxJNoflS55zirhhi6PHS+68Ri8S+51X6LeqBHG3wI8Z9JJv+gVgLSew8SYYb\r\nXfB5toSN7gDa0rxWSDXF8bkrtiW9JyWyBjJ6mpxnYAMrW+oblW56nRPPyf47\r\nW3AbJy6J7ka7NTUYGBIGySrob6rf+C47n2mzmz09PaZmKBfCM+dnLluOyQ36\r\nHGuiGG/4OB2qSQ2JlYy8paEErYxhGNsE2ZDAxsQH+2buFSOXzttt0CqHUc1r\r\n8DmP2nrmABYErwkXb5nEqMP8Bb28FwNCpWnSPVGFHnhrMlceF0WlXnxVDJWP\r\nzc5Z+9hFHlbBP2HTlr7qTjeIRhLd+DsK71IYwGwvSwqWrIVGOVlmsdrf3+Ec\r\n94lHwFlLEm7iBahce+I8ndD9AqW6EG5+LAAM3duZt1uKpii3i8xx69vFOxDK\r\n1hBhSYnKS/IfQ0hCwEqTQAWdrMajI1Q4AmrrmB08DQxTWjGnpJv1M5Jj7c2K\r\n2dj+QPQRQN/ozLOEY1wMrfvDpZDoYGo+p9s=\r\n=kv2D\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230106134402-1279fd0.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/0a08ad65b6dea100f051ac92ccd90c34/graphql-hive-client-0.22.0-alpha-20230106134402-1279fd0.tgz","_integrity":"sha512-2peG0WvtuwYpPrytHEtNqJ/O7W4k1tJgw0CX1UU5AKBQGl6t3JLLA4iu7ZzH/uGgYVkQg7DPv1WxJJbx3L+2LA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230106134402-1279fd0_1673012693321_0.24245858922140373","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230106163800-74c2d71":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230106163800-74c2d71","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230106163800-74c2d71","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"d14feae961cbc827e401c1ec74655a02c62b47a9","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230106163800-74c2d71.tgz","fileCount":60,"integrity":"sha512-Guip0ORIfZSO7ROft/3THJRUWx3y5V0JyplmaMgxKzBOtRs1/sDL3a1CW6dOk4a+mUJD4wDqg+p+93pFsK99fw==","signatures":[{"sig":"MEUCIQDHOujimhXggP2iGwVniHV8qZXhPkMknBEdgKP9TkZHAQIgCNc831xaswhvYNnNpAeq8zdCrqU8ktTRLWFqBBAJgmE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjuE6OACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmpu3g//dN+LH/rkgbqBQyv8t/6L9T4jJg6eCf1XmBpSPBRp3nAXleMX\r\nsBScoP4dqOdZx/yfNu8gS2ZIJx6JZFPfeiPrHikx8xZGwvoxg8W/OWJlmVPM\r\nhD6SmzQ1UgRKnJnc9Svy9K1yB0ny8HCnrO8jI2G4NmVmxuTirvJGRaHRodjc\r\nsYZFGs3Ig2o53DG/7+WGtpzfOV5JIyNRqWYB+RXAaa52nnbjsecSG+1q1KUT\r\nB4wsRDEkokDWyQ7YdNYWbXRoX8OHm8q32zr9SwvH1inZXUPItTD7e/phHyyr\r\nGmApKD0QmBB6dXMPbqY+YFrTTrMZ4gL9IF4sLU8MDLRAYtI7C0grcbAM9YGF\r\nU/CHKKVzoDQehgq9hJI5tc4QE3Hxh0d92bfJnOaS8ovbGJFaSJnkZnwxvzmJ\r\nDwrHVEBjbrru8YGORT9StWbm1SB5iea5hORBHGQxy6GauIh4YaKaZnpsmJB1\r\nfdGv9GaDUC71O1zD9WmYTijdd+T0JunFg5j0SgUK4873Whc1t2LxkXexN175\r\nHVKCvEDaYzvwM3P95Bu3pPLMdT7mMIsOwf++MjZFrtuvenRIY8gW3GHWgiEv\r\n8vg9OckB8kp95kNTiZHwTdIalzslnBrQIR/UzPpySlmCqLb2ri9oUCTxae6r\r\nsxd2cSNMlERl0jffniTvfjR3eaZCqYWu1oc=\r\n=b84w\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230106163800-74c2d71.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/d53d90d7c3527729f1e6f4824ebfc00c/graphql-hive-client-0.22.0-alpha-20230106163800-74c2d71.tgz","_integrity":"sha512-Guip0ORIfZSO7ROft/3THJRUWx3y5V0JyplmaMgxKzBOtRs1/sDL3a1CW6dOk4a+mUJD4wDqg+p+93pFsK99fw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230106163800-74c2d71_1673023118553_0.6957280474050476","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230106195359-1e14c89":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230106195359-1e14c89","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230106195359-1e14c89","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"409688f75b44501c171e57b8cfc582af80bef132","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230106195359-1e14c89.tgz","fileCount":60,"integrity":"sha512-muuAYcNP8uWC6PHGBUkFSF0K/c81kAdnnbnZlpJjRMPHbGBY9KcnkSDBj0NyogENUjjudS7NgVE+kn6BogJP6w==","signatures":[{"sig":"MEYCIQC/SIs4FK6oCxHwQ7Dd3Xoq16/ajV4FlOwJutx94X9TjAIhAPyKBOaU8gNsJhoXpTSIFTMR7C37sHvJDmRyvLqnzKP4","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjuHx8ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqPbhAAkTbMvGHRr2kIBcJSE11t3eBfS+lU2xTHL66vOfiqlDSjJVBB\r\n5SpvdwGBRoXf3WcEvYh4BSVi+1jdQkG8lHk6kyhK+5PyfwSOA9bbfMRRd89E\r\nBHMpKOypJMWOLTs59kO6p4L393TnNfoZu1Joe80Shup2/LyxOkZAadF8y83h\r\n7V5xm1Q3L64JbUOzwZbeGr+r6VZDEjicSFgk24/jZO3TBVOkDhXpa7G5P2HT\r\nhKrrUxdUTAdO4GsVMlBUeBF/HEWG/ZrNhbUrnLw1iaW095F42RnKKX09wbD5\r\nJ6hUNqOB6f5uv0+7rrJJLX4jVQZktrdXVdlRxeWFailfCSJ+5h0RwQ5WQS7I\r\nV9rZrBPWB+2C5hoxlADZqNNRAyCpEkWlPb8JsaK3LaEjGaKpu2iaFMpD/41i\r\nhv1ria/a4FV/cL0H7qnf3AgEBLScWT50ZOk10Q2FeM3Bmow96FmiAHS6AbZD\r\nHFZQNFcAitARpA3HkTVUlI7tZjeXPH5e/G1G3FetJgaRExFR3vNZf5rTHCns\r\nncjqgOTOGpA1ojK2nN1WT8OAjVUWIzuzdhvkVQvE2rt/GVVw8BM+3a6UTpLr\r\nhB3MG44ONzHfCxQw1MEg0AsC406frV4Ce1WfG3g34Tu3fdBRVvNaOeU/EquK\r\nWPQEw2/71XIzVpUYXpeU5Kg0S4OlkDVUV7U=\r\n=e7Zx\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230106195359-1e14c89.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/549bffbc11d9ffe7a1c7d1031d83791a/graphql-hive-client-0.22.0-alpha-20230106195359-1e14c89.tgz","_integrity":"sha512-muuAYcNP8uWC6PHGBUkFSF0K/c81kAdnnbnZlpJjRMPHbGBY9KcnkSDBj0NyogENUjjudS7NgVE+kn6BogJP6w==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230106195359-1e14c89_1673034876760_0.7778706277426233","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230107095044-1da093d":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230107095044-1da093d","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230107095044-1da093d","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"44ab7572417f14c2e80d0b9021a32671156bbe45","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230107095044-1da093d.tgz","fileCount":60,"integrity":"sha512-xuDfMDcbiuIcIfIE6/4trn7yHFbjguMvlWsfXnQWylilL5u+5d9HWY5FVpQIX0saHf6MdZJG1Lo6A1k0MVsC1g==","signatures":[{"sig":"MEQCIDXODIW7vsjl+HHlymWJBEEY2bZ5/g8CvadFC8V23gcqAiB1RP6waSi3EzQ2/20jO9kW0EGA6QisMlZCz2l3oF9UlA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjuUCXACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrFfA//XThSnwa9wHIUbjG+UexFwaKqy8VThr91aDsv0wf3YGiX0QIx\r\n0AHy8Mj5deANFc5BWe7inzoEjCla3lrk/6IIFwu6cRRF6MOAn1cPWYRC3xCx\r\n1NJGYsOr2jU+wnnniEF1NDlMn+n0HM8aZ4iTwdbVl1LyJK8KVY3FoRxE79Ed\r\nsOoQeock1FMJvHVfLjIkgs6N7q+41IDwg5nYyH3pdc0OTVQ25TfAPvW97w7w\r\noazJ0zHz2bYH66R6CZClUsBWXBJTUORGX601L/4coLV3UW0e3ViKzmQX1Z7a\r\ntrfm/Q8n1Ri3PYnW8xDCz4r70zoNwGgKSYhZIqJVPX/Q7HIfTbysWy0vG8Lb\r\nQW6s14HgJCWdQ1fcsMRkYG8/tA8WecWzx/C/aheEo62hC34JJrVZOcEzCJlU\r\nQQdUOQPqa2KlomKdp9GZQPDSXPztebSYLLGE7UtBpyttLv4ip1hR1gUmCU+y\r\nYIbr278beaSqdcZPN6tbVStaVhZAp38StFvlyglyCyDZVdt9l7eSzyRbD7K+\r\ni5A13EZvh+nrVVMi7ijbN5JwNalg9OMKrhEs+7vsuySsNND1wz8faYrb3mgf\r\nkxWeSeKIVwOx3/EdvgIUGT3SU0KQrl9RTZf6wXNUpu5Jb20oablrJsyqsBwQ\r\nkVo/KlKvuLKnufRfXCxBZ3mSjcpdG9AKzWI=\r\n=8nHw\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230107095044-1da093d.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/a96522b353eba53bad3acb02d08af4b5/graphql-hive-client-0.22.0-alpha-20230107095044-1da093d.tgz","_integrity":"sha512-xuDfMDcbiuIcIfIE6/4trn7yHFbjguMvlWsfXnQWylilL5u+5d9HWY5FVpQIX0saHf6MdZJG1Lo6A1k0MVsC1g==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230107095044-1da093d_1673085078999_0.1918393705115311","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230107101641-6fb827e":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230107101641-6fb827e","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230107101641-6fb827e","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"7fdd00e710a711eef98437fe34cfb64d328cb960","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230107101641-6fb827e.tgz","fileCount":60,"integrity":"sha512-yQ4Nzq/NIm00M84F1phAnkIR4amPhqXOonc7CIbtTE3/8fXyAVHiYwzEd4v+uH9bFycXKdvu+wq3vZE4K/6TGQ==","signatures":[{"sig":"MEQCIBJYLjK91jI1t/jlxb0HxvDRhaGNtOPb9WoLJsHl/8IrAiB/ZwnJbet2miZNlsIJLzHMy2NhIRfgoXFb6sRaelRjfQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjuUarACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmrb6Q/+JTg12rdXfNyyEXqJiYh5aRgoFRmWbVLHrNKFXpNPmU19/jnX\r\nQ46T32ky53SMfm0xqXt3J4U8cAfUiJ9pTI4TrZasipBkDiV5I8qF06aZIHkJ\r\n0dP0dC4kKD6znJZpt+6CzkYTjoBJu7MWHCkp6c1ZtWMz44IqVRhkTJHG4/DV\r\nq37tV3xHn6B1wMQrWT7KGBOAJBgXTHYF1gHdyJkZCT7YmyMD3SaXnh5CzwRz\r\n4PPvanNHBn0VEZUT0UIHd4zPXWnK0a0Lq2KWKTfBT+2QB6sJjiSyoIkMVtSz\r\noFlvBmWuvQnWLJv7TlNvqbsqMv2xgKg0lAf3ndFpPhQG2iyW0SS1Lr914mp0\r\nB1GLBWPkJc7gj85w8TxMLb3GAe9pjgsD/igP46srZHG4rRM/ImcKcPgr3kp9\r\nNM+PqSsqQmxmOjM2FAsNu1AHcJoXdorW2rC/Y5t0WE3MAslebEoVnpxkzd1i\r\nfkD1FPN/S8gKf6kTPqFhEDNeDeRpCuhgITfrXJdCXie3XrPyt6knNPwVv6eE\r\nPvecO3IPhky9tE/WaLuwaoxguvH0Qhya6DYBQjZNLaWIaQEPNturPyHjp1fA\r\nEQL2Sqn/Am4kALE5s0dZ3LfSsy4DSJPJ6GmAFeVT2pSrT9YbFLgNpXglWsG3\r\n71A/OQpL1bYBbSenSaur5UIfujOf1i1lpCw=\r\n=HGaJ\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230107101641-6fb827e.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/06f611ee4617ef00d1d3ad9c645ad40d/graphql-hive-client-0.22.0-alpha-20230107101641-6fb827e.tgz","_integrity":"sha512-yQ4Nzq/NIm00M84F1phAnkIR4amPhqXOonc7CIbtTE3/8fXyAVHiYwzEd4v+uH9bFycXKdvu+wq3vZE4K/6TGQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230107101641-6fb827e_1673086634769_0.41420193730880217","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230107102251-4bbd470":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230107102251-4bbd470","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230107102251-4bbd470","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"7868d107201720a176473ccd936c9ba5dab9d8cc","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230107102251-4bbd470.tgz","fileCount":60,"integrity":"sha512-LOPRBQHwTZr7n8eQP+trynnLzCiOBKphDqEG9oQn9S0KfNqgs6NocgH0MDO59vr887JJBY0YBIIjDieaz8iSfg==","signatures":[{"sig":"MEYCIQD9eZLRoC+jpzrlTxcQ5p5CbZVDROZkFVUa35TuowUAEQIhALgmj6yH63S1OhGIfynSEBR7n9XGEBPLj8JsunM7kXIH","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjuUgqACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmodFA/+NCLnwfOS2oeR4mFKy7CgGcZqDeqNXNN313DlEQvR8Jt08xOW\r\nGc2uYXKpGT+FaaZLsPv/4A+771/FgndYh9VbDBREPNK6PK9Ybkq94Uigl/8F\r\nJj5VfkEK4LW3CuVMXqOhqteeGQZD08xcmo8nZUchoOL2kCFpqOf4/WaXz6xz\r\nOeloiLda6kDuEYXm8j+sDqUobF6vTZmIMfpgauFzv2Y+RrXmrnGGrln0JtKJ\r\nWHnZFOrPGXUV+8QUBljWpcxO2WK7nT4Ykh+6XXiU2XngfY/QcQ8ETZeB/MU6\r\n+uo5hXitXlGidFx1+DI5dmVSwtyRyql2m4e9EZxO29Wd0AEssjhGKHO4P9mw\r\nRUFVJpDS7UFuoLcAW6X3sOZ1YZzEmXMwCqkqdE0mgtbX8J/7jF1KsD6FZ5qv\r\n0blywdy4uJSLdL3/yyllsN5stVIeJSD36st3LXAikq0ZpoyloAECSBwoRuKs\r\nayqaOnkHAnT79C2I7/5ylBU+GgjUD/ISt5RVj703aU3qPW+a7SOTKz3542xY\r\np3oTQrqbWiML8/thJCIXufVH8vMflGb/Ngps7TZHPtUp+wBofEzbixt6izup\r\n7etmTPu6rcNXgS0RSbEH9kI/zyCPPiNc3VE0OWVY92WMdpAYtIBqPDhczbIp\r\n75M6fX0Kev9IeeA50NPyoCcEyALrwSK5SR4=\r\n=iBQ2\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230107102251-4bbd470.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/1d28edc4064ed861f08a5b82441ab83d/graphql-hive-client-0.22.0-alpha-20230107102251-4bbd470.tgz","_integrity":"sha512-LOPRBQHwTZr7n8eQP+trynnLzCiOBKphDqEG9oQn9S0KfNqgs6NocgH0MDO59vr887JJBY0YBIIjDieaz8iSfg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230107102251-4bbd470_1673087018269_0.26815152308160717","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230107102811-d27ba6c":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230107102811-d27ba6c","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230107102811-d27ba6c","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"3c5fc4a3f604cdabfbf3eb1839d04a67c0144e90","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230107102811-d27ba6c.tgz","fileCount":60,"integrity":"sha512-bs0z7ZuosudkHCktFuNHQHqsYDSVR0+2ZDBEVHvixxSHaFIVaAKTJMz7fdwMF/s/7/vVMq04FFW6y2nf1X+rTA==","signatures":[{"sig":"MEQCIH8DUhpC3VQX5iqZAQZ+rO6kg5stA12p3HA8FM9a4lxzAiBLUQ8KS6q25oarnZEx7jcXzTIqTrKf/OtdhqEK8RqLkQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjuUlmACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpZqQ//ddfNsEl6K3Sa9bFWDy0DzBmuECD3h4V1V3SJp/oYJPIWqCyU\r\nF70gS4xOMwqLy66iimu2n5UetQk6wbm9lic9GjSVNZLzkRDTZp9O7A1DnXCp\r\nvoFdUe77cE8tt8ZYG/73khfpYhg73IebL1XS3M8p9MHT8sVRQt6ZnW/8OAXD\r\nzOnw/i95xDjzqSm+gKIluhDv2xo+zhRo1+XNhVSeZaS585ypCyEm4lm34n8H\r\nIN+l4Bz+GsDgYvcClBZBOjkRnIzpmIgLHjUnr/kafdtIpirXbrf2z7c5DfNN\r\nMzVaTLMM1yB+5Couqk6NLDn/L6NYbRBrPNgUZhPA5EaHQwvPJagulbstRKqV\r\n0CA2vrfPTqimUMX92gdavuvR2t/PaGpczpFpufEkrDFNYcB1uawnPyFAdr3r\r\njuS/RZ5NZKRe8me2RMfARSrJk4QYn4IQvhFH5ylh97o01wPa4iGgTSKLYw06\r\nQjjuY1yIGStsxOSnHjOvyYltMpbc2qXBSQUZ89rgIolLJf5dVfRN0TW8pSlW\r\nCfTmUMY5ZKRoiTS8IY10SUiJQwY3CtVpo/xkHXpWSd63jD3W8Dk/ptAH9DjM\r\n4je09tfTY4lv+d6b1P+Q/nbaaKNPRfRrnBs24b69d7nCIE4CF87nfly9WEzh\r\nm90CL83Py/f4QIjYaVt5O7QMcudPn+myl7k=\r\n=wOql\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230107102811-d27ba6c.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/24a129c996895755c4308f0be183acd4/graphql-hive-client-0.22.0-alpha-20230107102811-d27ba6c.tgz","_integrity":"sha512-bs0z7ZuosudkHCktFuNHQHqsYDSVR0+2ZDBEVHvixxSHaFIVaAKTJMz7fdwMF/s/7/vVMq04FFW6y2nf1X+rTA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230107102811-d27ba6c_1673087334374_0.7106009897811456","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230107103304-a62be7e":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230107103304-a62be7e","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230107103304-a62be7e","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"2a36d617aea75b5a27c3a4befe2e9f15ebf08b74","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230107103304-a62be7e.tgz","fileCount":60,"integrity":"sha512-5QeF14NkUEUNjVHAA3w/n4Vbj5NNunmO6WTnWDLS7d8vW2FPCNWiubZ4wv0yLzjXrZqaYZGVTQed/JeT7B8JEw==","signatures":[{"sig":"MEUCIF3Cu25Jbo9f3ZYqARPEgpzQm3r7tfJGL8YaHx+GdoeBAiEAuf4bH+TwRWLL2DzVmm9uH83rpovGP5aWjRza7xJPRO8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjuUqGACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqHZQ/8D0BpjdhJN/CljT3HUqdPSNasDI6Ku8pTV6erVG7WXtsjNXxT\r\nIRVj/f5qR2ayAmZPtitJr2j5E37c/xGG9EhFEmhh+WC6Hxswgdvf2pRPSJJ+\r\nhC3B+l1FLQTGSKa3GHgrfPQZjNTvYDn75DtJTtz/46WHJzFgp45pA8HvF2L3\r\nA59b6TRV//TWz/zK7s6xLTs5kM4nW2YsOKkXRAZ9+FfuISXnoqnPM+YOtP6V\r\nGqs2IsMOn/mpQd8jf6QPb96fYfjf8YpK56tWLsfRw6A5ljKKXZeJg/mdZw/O\r\nXPDFWtcxU9+vYAr1YcuRz0Y24hg2qinrDrJv5OKYFHHvuhBPeundHEaMeqd+\r\n64fgAi5NCjG8kpS/qSbhThlA3HuRlhts3I3+9kgTUFE/OhxZZywFMUTW33f9\r\nIxoxlfDxaK2LaqqJzWQ0JLbELnPdPCoJVaVazjIWv5MTT/tv1VvQgdF8RIEX\r\nSZuGnD6bq8e1QDfkp/Ognl9+AP64O6TYEbEdYyD8QN6zlmzqju880lA7Ix6m\r\nA97GV3QOPCRBPEP/TUa2y8ldup7cqaNLxzIrR1hZWPs5pdGYZ2ndyZ3DgU/Q\r\nCEwE5RQp3njyJMJcZfCmftRpmhvzOso/VM5P6qdEQfRy6dQMmMby2tscrUf6\r\nUBrpBEI515bXF9uv7LdRh+C5Q5GF9GlFNPI=\r\n=i5Nq\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230107103304-a62be7e.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/5256c12030c00ba40fcb686c30346475/graphql-hive-client-0.22.0-alpha-20230107103304-a62be7e.tgz","_integrity":"sha512-5QeF14NkUEUNjVHAA3w/n4Vbj5NNunmO6WTnWDLS7d8vW2FPCNWiubZ4wv0yLzjXrZqaYZGVTQed/JeT7B8JEw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230107103304-a62be7e_1673087621881_0.9245481189881954","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230107103509-64b627e":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230107103509-64b627e","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230107103509-64b627e","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"eb5af8c6a1e24778dd693dc1ee7f3d687d400999","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230107103509-64b627e.tgz","fileCount":60,"integrity":"sha512-9Kul0VH0x1lKEOpDyceA5kU2RKyzhtkG5LUxav7LLdst6Nk2eZGXzzQkg6Yo0BmBXhIc9Fs3mjgZBQ/52j1E7g==","signatures":[{"sig":"MEYCIQD25L3fHwCpUXGXo4oC7GBuZ1G6ll+473PIjBMvHVhfUgIhALc9pOnrnasAdnDEilifSLY5HpUy2muMtwQdkUTPlb2o","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjuUr/ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoDqw//fvJLnEtjtY9CgCrDJqoQRcpt1/V6oj8QQwCTQmnOdwDMhaAB\r\nF5H8fEO0rUdy8TzUpIO31fBKwH2PvvnlgaqvY1qo8ZIuFNxWgbNOb1ZSMl8F\r\n36s68cc/IKYK0/QZ+4tAlrYxwcUlxVRo+n7jXTt8xUwTuWP+NtAHbTRVfcC9\r\nhkJpTK2fzJNrAjxT8j7ueAGl3F7XDzJjwONa5ToR21a7B8yCIRkT0RnmWNAn\r\n4tkW4oOJlT1sRYlJITUH6xHmazRtV/PXrorCUhJNfmXI8bH2eWiuVYRakQ+v\r\nST6wW7ct9duBtgXJlFgsIT7gbFZWv8ue41uV+gTnNhzlRR6e19alWk6ptepZ\r\nM4gM7Lkgjx3wqVVqCZFFaLf3JnKRzWPN1t3YGyyUdIbjyuBAE7u/UVdZEbKh\r\nlUlRvgmwzQImC9maxbu5mtXXa/UW8cR/85VmXUHLrPtknfB1fJJdhkOxT6Th\r\nouUyWrQeQmaL9tfFGIMAtV80f/LjK/O2XvPqKrDYh1NbW96WT3QiMTJ5VGZx\r\nr0BjyIWFjCUYbemHSHUU25npxzQ8przl18SB5XDF9+RAhHoJcGIC7R08awcn\r\nigUwO+BzR7o9lMDYpTxJOlZ7VGQ4KvT+9ti0dTf6ACpsKqe5j8UFNUQX53kj\r\nhoYRMJXE9aWdgtzFKTbTp0/387oOuiJh5KQ=\r\n=pIBk\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230107103509-64b627e.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/a4c51a5974bbc5996b8302500040aa29/graphql-hive-client-0.22.0-alpha-20230107103509-64b627e.tgz","_integrity":"sha512-9Kul0VH0x1lKEOpDyceA5kU2RKyzhtkG5LUxav7LLdst6Nk2eZGXzzQkg6Yo0BmBXhIc9Fs3mjgZBQ/52j1E7g==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230107103509-64b627e_1673087743207_0.827838091477819","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230107104532-44ed3f1":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230107104532-44ed3f1","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230107104532-44ed3f1","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"cd24020ed1c43d43cfb69663233fafbab34e6a22","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230107104532-44ed3f1.tgz","fileCount":60,"integrity":"sha512-uRRlrQzZQzI4VKhmdhq44U96zMxgRsrHm1Z+vy7YFfpquxbd2HK6phXbpvsx4CcLEdhDw1o+7U23uOzFtc6jDg==","signatures":[{"sig":"MEUCICOYcqkAjCCHNXYQM/HZhnSoLNwjXv1qpe/DjdArWACNAiEAp9kM8qAmGxV012bpfGHcDN7ylcYawHe7UWbwlwaV6w8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjuU1uACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmof5A/8CSB8UIqcsLDQSf+mgRvJLkdKAUangFAGcU+gyAy4Y1vtFjYZ\r\nzM2lYYxbnuhddAW4xUZSh8u+FeoVdOPRr6qrzXIvq5mR0dFHsLeKGfDO0uI7\r\nKJOEPJrPG3AB/uJWRYqC2NiYYLbKVld+1xcpQ8K68Z19ETVCMfe5zf/MC0Rn\r\ni2r1EI08FMW2rBm4rKBhf2tdiPaF7vvESDvd96ZrhG6V4tHhurdZvKrhtN0q\r\npTEYHXG7QGTgyeSJ9l4VkOMnuMe9UJsFIUVfbygdYtn0TPbDgCfQn8FCcner\r\nGSJIfm+y8IKXrj/NVALwJ8438S3ZgO8lTN6K7PybyB7xVz9H+9Nb1isBAuse\r\n2PZbJerNcpyo7FGPPAyppNDuTY98dWjpSJNP/Rg+lyJSTtCovoZShI+3nl5r\r\nfrVmk1pCTKuhnQ6JB5u5Yl6Y1b+HF0Qx2YEL3fLGiqZEB4cyGRxi3wFZCTYt\r\n2gUxt17Hi51B5sgSGlcUUKlZwFnPNr46tdugi/SCT4jhs5R15Tpwdo5rridB\r\nD3NJFc8d6o0OiMViBxDsdC6s2BehktJlGVzl3WRKRz7mrZJjI0RRVJsI3SsF\r\nWHViy9PpYKtwrvibabq9uqbnYmixUXptvlDnOYKSOXYTPJj7RONoVnoJy8XK\r\nVMPQkN6zGqU0fwrc25NUIinksZiciodVGxA=\r\n=Kzy0\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230107104532-44ed3f1.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/0c6576aaf435f665b8a30ac99689d1d9/graphql-hive-client-0.22.0-alpha-20230107104532-44ed3f1.tgz","_integrity":"sha512-uRRlrQzZQzI4VKhmdhq44U96zMxgRsrHm1Z+vy7YFfpquxbd2HK6phXbpvsx4CcLEdhDw1o+7U23uOzFtc6jDg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230107104532-44ed3f1_1673088365889_0.829490231881471","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230107104539-92ac783":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230107104539-92ac783","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230107104539-92ac783","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"e09f96fc7403ffa95d8fa53af971ff4ab3d445fe","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230107104539-92ac783.tgz","fileCount":60,"integrity":"sha512-8VtPEAKRhzYgvpFrYrqcV+ZUwafPhoX8PqvKxVAPAt/AKGUNHAs03clvsdflC70+3VJPqQ7W8ZqQL/BxegvIuQ==","signatures":[{"sig":"MEUCIAtWn6GBO1tarmRe0POsYUDtwAe+CLkR6v5T3UnqJHW1AiEAvecME9YEl8w5WhVJhFQHQVi9CojLQwwhZu1LC+W+Wzk=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjuU12ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmqtbg//ey7h2OnMYgcsshSwXABjraEz2DP1skav76z0Ljlrr+zeniGn\r\n2kHYMImTCshFNnekZSa4I7GsbuegAyE7FptxKsZUdHVDCYqB+ULrEpHlIO17\r\nuq8uZM48OgCUUM94xXfK/7RBuNqUKOmtk5BO5ohqApiQpWZIRRQ9FihgqzyL\r\nEvBrkkgee3mH7nu9OTzdjTqzl00CeW7vBjt/qz2CRQxkNtRlM/TG4iKc88jC\r\niNdX8a6PhTN5GCfWZtLg4smHG4MZ3MoOeogZ9+V2mbqwpVmxN3FI/8DuNq9I\r\nSO3OHYGLHFKAB8sX5u7Pg480qM4ZknY+kiA/I78+f1Vw0cTOZa4ngS6SAUmv\r\ndvKbMMEavX1wo1x8SfN44tWM2LcCxJbxKmj0I/NFcaIjLUqg6wPDSeIxIA5n\r\nIA/9705XsWEB3Wat1bQdyQxI7fYGVyDi1pwm60Qq8o5BQm11xVjsU9zlx8sW\r\ngCN0mP6qRddxM+u5xiNzyy2tFAne/hUumpd5XO77lL8XowR/P2cOkOVfeTmY\r\nhrJ5IXxE/XcWXxu8Hm4YTACE5G77fheJT6CvBlBnn8M3DcqFuuYTrlCGCove\r\nnOybWxqQu4qDvTneP6sKlV2mZS/BvIII/muy1xq/ihwHZNYy3eTUP8xjOjjS\r\nn+a4dCt5SxmYOySfsNu5Ft077QNXIq5wIdU=\r\n=7h3t\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230107104539-92ac783.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/87042461588ae92b5a15a1bbfa66c20c/graphql-hive-client-0.22.0-alpha-20230107104539-92ac783.tgz","_integrity":"sha512-8VtPEAKRhzYgvpFrYrqcV+ZUwafPhoX8PqvKxVAPAt/AKGUNHAs03clvsdflC70+3VJPqQ7W8ZqQL/BxegvIuQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230107104539-92ac783_1673088374665_0.47156957825302004","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230107123211-5601f75":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230107123211-5601f75","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230107123211-5601f75","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"896213ca22b0128395e4d49350ecb9ef2e7560ac","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230107123211-5601f75.tgz","fileCount":60,"integrity":"sha512-oRN/uK05Mpsu1ze12SfUWeX+tPoy9NyZCEITm8oG+H/YxKm3cPLtgr2qXBKBmJnW7Qi0arVy45z1nHHWYj/qTA==","signatures":[{"sig":"MEUCIFMaLQ+TqrmmcXf6Y1m39P7LV7Wd8haka3MUlyLlk/wfAiEAjfRMmGw6PQjs/Qtjz8nLu3MyqBoyA+MI8fcKvk3XFFw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjuWZuACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmqxqw/9F+vD1tg1jxyGAXYpUBXkvuHsqbcjcraFfeeRA21ny2lLuvua\r\n/kCB2BAtjRT1RdJONYhLQtbubY1IF3XUTwlZJ19+1wLAgiNpREsh9HSyCMYN\r\nM/JAPliOnJt7ySLa6ml4m05wByvlUHUkaSQqShcdYk19qr2IcFl17IxJnx4Y\r\nJ4osvHj3q3mg1Nptkr4svXVc5v5AZEWoDEAFQXnLRUXw3D9iUgTU3Vr8MryE\r\nlzuMKV4AsSq7mI02+tSFKKSsgcIZUC8oX9t7Gk5SqpVY7yUxMfA6SMvpy2FQ\r\nG45lbfqvQ/GWvLucVcM/dGBY10J8pSdoa4twEeHtIZGXSq3e/u7ZHtI2nX4h\r\nqTd0+rjicuFqcB8k+HX0SStga0EQUNgJbKQAGETM7fmW12Zpr53wXXIcgCG4\r\njYICtp4WfzSqL/bUwWmARmBZJq1Opdg+xCmbxfIM/EboAJkGwV5HlSeTtAfr\r\n7gVb+JYwB/ydE55lDQRQCJQGV2fnAXVZRnhdg7t4meTzIzirygtlWqHH4XWL\r\nFT94CfJOj7uxBudWoTYKfrP+cRleQiSUD552rqxNXzaZl4PNe3olY8nvrCao\r\nqLuDPJtGAC/q44ce+Zw2bJJrPPdIftLG0HcoC/7rRYKg6zgZqMNaNt1RVt3H\r\n1U0UUIVVfrMpd/Q8VSwpLUZZMjoz3wfkKxs=\r\n=/PzA\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230107123211-5601f75.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/099124cc2656ba91362a0e627af866bd/graphql-hive-client-0.22.0-alpha-20230107123211-5601f75.tgz","_integrity":"sha512-oRN/uK05Mpsu1ze12SfUWeX+tPoy9NyZCEITm8oG+H/YxKm3cPLtgr2qXBKBmJnW7Qi0arVy45z1nHHWYj/qTA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230107123211-5601f75_1673094766405_0.23828766200247808","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230107123823-a386a80":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230107123823-a386a80","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230107123823-a386a80","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"90f673a1703994dd755c027b556fb53a2bd2856b","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230107123823-a386a80.tgz","fileCount":60,"integrity":"sha512-Y2RWIpFPPuNz/mgG82oBQ4e2R4B7VcGhW6JWFaytsSGz79Qf3dqh/vIXbDuIh/UhV8nxuUfTdapyrguCoAyU7A==","signatures":[{"sig":"MEQCIBTvrNztMK/J22Hqzw8U8yWl2t01+CWf/ccKdbAIkxL7AiA+7OC3ZRMEvbDI4mPmT/HYmHK7qnntwTI2f3B/M0MK+g==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165581,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjuWfvACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmqyyg//YM8OuKyNw3cHMctJL1nDdkTxVH9YMjiuyxkLx4cGmzMesoWP\r\nQzUMM+bxZ/3I/KGAqsQDyr/2bnCxPzJcp6e+KkqcR3ZoOOx915/rlT0FMx6p\r\nqJVzYVVXlh/+tL3+DEXMuMiCG08DtNHsqhY5CwxwXYyfUf7j606HZm6O0Re8\r\nsypoV4NMfWOMmBEf6P498Z7xeepXq+ak3k1FEa3G94B5gFludMUghYVNKdsu\r\n+4pvF1A52rrv9Ms7oSgiSDljhYUhmxzKXX4dLjoOLCAYcfxW53LYnp9NF62S\r\ny/+LJX1OKRp0ctBcFkxYi+tI9rMYU447uROzRbsJhDP7DW01ZyB1SuIsjkYI\r\n4LG9UzvM+k6boQSA697GOe07gc+nkW3HPTkkH05xj6QzWEb3OhDdpUOL6Jeu\r\nfebXJhr8jHxkLGpp0NbxpwMnkiiHP1ffDFMDu3xQY7TUbD4+zEAZFRvtvu1O\r\nZE/uLYok0cPQmxj106AM7H2VbfyY5CsoJAczlqkTiiM1cF33i+eJztRX39qu\r\na+WufpveTYz9Jfc+2o9x0wUL34IXaDHj9uxcb7HZVW7zeIkkr7wwzamDTd6+\r\n+TBBB6ZgJ6BoI6IzURPzEMicN0W10hhyrL1KO+ppUzJ6opSVSnQH1Mc0Uali\r\nr9m8LCEK0wGE99RewJ1/fvkxG3v0xGMRC5w=\r\n=t/jH\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230107123823-a386a80.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/9cbe0bee5e81b1a13b753ce7463e4ad2/graphql-hive-client-0.22.0-alpha-20230107123823-a386a80.tgz","_integrity":"sha512-Y2RWIpFPPuNz/mgG82oBQ4e2R4B7VcGhW6JWFaytsSGz79Qf3dqh/vIXbDuIh/UhV8nxuUfTdapyrguCoAyU7A==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^9.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230107123823-a386a80_1673095151720_0.5018445712769177","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230107124249-d5b8376":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230107124249-d5b8376","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230107124249-d5b8376","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"43f5022ad8560b2072be892e668cf6977d1f361b","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230107124249-d5b8376.tgz","fileCount":60,"integrity":"sha512-kxa69lEI2lzdU4Lc8Qvm9W3scBKCdo1Nvaf2AxkSefz8i7JDD/f6Fh2SJR8Kk0hcbgTeoyZI22Z+UflwlqVjZg==","signatures":[{"sig":"MEYCIQCh7uCByiqfTA2lNwq7iyX0GO4symnpCsDSrWiN8FyC4wIhAPjdvgoCIzcRwqX0pBMAONVRAbu4v9EHRrmYhVL/uPSk","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjuWjsACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoDGQ/+JbAxU6suyGAGX4xpLGvO3Tf0/OrRB/e0v4rSa54hmk+6+E3J\r\nVMNx44ntOCYOPz7YMCgddgHDDwJveFHB8geOqZ0CIqyvHTF7UOa2phdk04Fj\r\nEHAksENYP0s/zGFZoggm2h9ZzEM2cvDn47vh0ptEuwBZ6N0wU1U7r3/Dgfp2\r\nMBreuGoQgFM8VTuQzWRrGJrUOMQq7g2d1gCYgNvIfxeChUZcz3TfhwF1FPUL\r\ndLwH9eqmYyXk6ZYTRBhmfCuF7eBgkqqDHwixRtH6oEg5rzKJEfYZ9rDOCcr9\r\nIv0eU+CIOVlhkzLQ5ZwTIwXJOWKTi7FXb+Su4cacgmgiNPPVPcqj8NQOQLzX\r\nUA3BY9vK0HpmSm899886IPJ6qDEzzjQBWgxrOOxJsftKqeGsDdSFYNXJuRCT\r\nV1KoHoRyT3vX5SM2XDKSIuXYDq4f5dKJH3X3c/8KU9t9Aza3yStSrS9tID3i\r\nmT0tq23oHtCp89ILofgLZCcD+s4kl7XgaxCOEq80k47HYrEHFIm5WljMVzIG\r\nNTknxs28q2BmLxpILtkPtvm+2a7HTC8cLqp10ZDHmTg3Pf3s88/EAI8TnzMw\r\nOzi06CY/l9F+34Yo0041HJ9hILUxELSVnR/Ah3G+3tjzEQrVdsjdHlFjyChU\r\nEAMJnCJYxedf5eSVrVfMtLpigADJQb4a2f8=\r\n=RXb1\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230107124249-d5b8376.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/fadaefe5a7da0a4f474e64bf7585124b/graphql-hive-client-0.22.0-alpha-20230107124249-d5b8376.tgz","_integrity":"sha512-kxa69lEI2lzdU4Lc8Qvm9W3scBKCdo1Nvaf2AxkSefz8i7JDD/f6Fh2SJR8Kk0hcbgTeoyZI22Z+UflwlqVjZg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230107124249-d5b8376_1673095404592_0.7946669568642897","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230107124814-9e737d0":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230107124814-9e737d0","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230107124814-9e737d0","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"f79811df96259ec579784933ee81f7a04a87b360","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230107124814-9e737d0.tgz","fileCount":60,"integrity":"sha512-BG6RYGZQ9p9rZjIBB1OznJTx23SyDiiEey9IUe2vlxh/9cO+kybIDUtyKrWS5ToOD0QMHVvrlupGorMFSSC0bw==","signatures":[{"sig":"MEUCIQCwKAE3TjEDjCOXIdjStCLCsVf2O5d6uQ7+PtH5UUOSIwIgHC/RDnlNe0TtMpDNjoHxERDPxvA74KAVANfsBDOh6IA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjuWo4ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmq04xAAlOZiFsyzzhFPWUzWOkSPL7CHUGKgNreT8G2h9sqJD4iyblD8\r\nx8GrL081ASn98U9xuYn0atJRYLQ78VDjRXKtHE6UD3fN8TpdLAm1KS6Vgmtv\r\nohwhnNsb1Pca3X7GqH4m1+uyxqGID+r6lnL4GNrAeHtsbAUr5z35YWygQMOn\r\n9o9L/i+MAgZG878SrNcUnrkil+Awg1pHiB8gw69IxchVx3Zz3lT/kK/C7PXB\r\nM8JUd+ZfxT+882O3POjk0hTJsuRIH8NXce5Dox1fcDTKLDYuuiVLkgcIwxEv\r\nirXKSLHLxTOy0tqlnkbIIhJyCb+FfbZpAbQqel7q4mTRsd6PwjZF2OXFcTD9\r\nZGXrdJakLAEWCZbybphls1X5ljUwg5HSElBLj1s8zYVXJYIjqkuOpVct/Neh\r\nFzT7qJ+XxtXbFLC5Zhg3jxV+/NBbnZha+ebTJi9L4IMZzDZNCi5iI7tzzu46\r\n1pC2/tPvfM0xIdP9ZbUw85TqvxAz5vbTnfIZH35Be7roJNtVdYfvMOLDzzDo\r\nWU1NfMLzo24V1PSUjuw0D45LcHuskaN1zi4SCCz5vkQh4LCoqXVQ3bSgmX5u\r\nbxLJbBztPFib2yBK+r5U4fNliUzqblgeFxkmFHsEl9SEts+qMJ0z/T7+0aoD\r\ndqyCElitbkvrWljQD0ceSwAN07izAKek2Rk=\r\n=KoI7\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230107124814-9e737d0.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/425141f6eca8ff6ddc18d5be7883c160/graphql-hive-client-0.22.0-alpha-20230107124814-9e737d0.tgz","_integrity":"sha512-BG6RYGZQ9p9rZjIBB1OznJTx23SyDiiEey9IUe2vlxh/9cO+kybIDUtyKrWS5ToOD0QMHVvrlupGorMFSSC0bw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230107124814-9e737d0_1673095736338_0.24742870072288636","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230107125316-cb4d6be":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230107125316-cb4d6be","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230107125316-cb4d6be","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"c0c63c5ac79ca32db5d31c1a166db2474820e5fb","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230107125316-cb4d6be.tgz","fileCount":60,"integrity":"sha512-f3yNxyYQzqdu0Iy3wVGRcPBjSLdpnhSluHcJuGJUtB8X/9s2GBrCDnJ6YT0pmwquyzqoUIlzf9b067whNiOedw==","signatures":[{"sig":"MEUCIF72jhUPOpfDmILhbqmchepgPu/CidINkbApY73ae2teAiEArDqQKP17NlCItqD0xzwmBqYIwXx4kc8RNpc3o2kFLdo=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjuWteACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrHFQ/8CXgHUMeHWOLUhUaqAqpm7E314vfDALY87LWyHvLlhud5mmP2\r\n19ex2T8HXbHhbxxTyiylcgt7TTq1TrtihpLJvGJSau4Qv6RNGy9GEL5UqAGS\r\nww7vX2U+iFIgCKmjq2fb6Rq4fhx+I+8VD9WoO8BEFmQMlLN3a8mnVB88Osan\r\nf5x9nohKfVkSZq9aChl5meVI+sCXkwV5CxwSg9Gu8HuwbOQofkdvhyiJZ2/8\r\n3f2rL8xYnVks08wuFOAB7RMyDXwH4CpddKyBD0qEX5JFs7ZAY09vvRRk1QRH\r\n/CbwfPjz1s4SkNoMrYssf16nJW+V2c4Ddjq3bsGEA+g6CB7WrGc+K1otziwk\r\n03RzvzxG95TXleIxgDeDyoXKKkqsZUZInr9+DxPOvKnP+2ko8YXIJ3wesNPi\r\nMSRN8p7tRt+KrXspfoizFoYY6WGV5Teu0pVX7vuW0jmCnkDnHZCDPDQDPqkA\r\nwBJPFOPuOlPc6DDYGm8PyGyxDZAQvcqU2n+z+jOqNRAa2XMMa7e4QReqLZEx\r\nbOWT8xnYWOoGbk0mY7rsuYf7gd34ADb5LVvx5pYJ6WefB4lOgEe+KTiDz1su\r\nJbVjwhPkKSdDeITuoFXhZeKD9q4wLLz0rdSHSXgEodvOd02uniO+dqwZbe/a\r\nP8hy9FTKDkuvnLnRBlk4aUhq8lj3NOTmLLc=\r\n=usax\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230107125316-cb4d6be.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/819d3c95f6cfb1b991662438b59c79a7/graphql-hive-client-0.22.0-alpha-20230107125316-cb4d6be.tgz","_integrity":"sha512-f3yNxyYQzqdu0Iy3wVGRcPBjSLdpnhSluHcJuGJUtB8X/9s2GBrCDnJ6YT0pmwquyzqoUIlzf9b067whNiOedw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230107125316-cb4d6be_1673096030576_0.4873194267258314","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230107125834-03c4a6f":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230107125834-03c4a6f","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230107125834-03c4a6f","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"76ecb57aa0c4086962b559168ab9d5d87d8e4de6","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230107125834-03c4a6f.tgz","fileCount":60,"integrity":"sha512-Hh4fbpoOkIkexbaKj+vtAESKogfH/EMVzXHkPrWxb9z9gnuuO/SX9LwyongBr7cRjk/hVQ0dJ89C0KMmKauw2Q==","signatures":[{"sig":"MEQCIDgRgHyeKMfk87m0KECGIi8pCArNRltXaESfh22yE2xKAiBaDzPp6vDZ0O4xquTANQVIcDpgUHH7nAK7TVBB5qt6rA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjuWycACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmq01w/7BaBHwF4JqKy3qQjs6CGiTy2A6ivpz3QfEm9weMAjtqsm7q9A\r\nWwpGkp/Yv3H4CdOSY+K9rHWhiqEUrnOIIRS4ibGAXumJh+hrl8CSrJUXapU4\r\nCtAD02F/EOOOxEu6568UYQyCkXH1US89CLPA5pUYuDp6YiHb/zI8vnwhZug7\r\njVTK3F04Z0KoG32ry4OCDtxmdwcyrbFmZ7g0cUlFG4TLdes5aAVWQuuzn5/w\r\ncgIoVbc0n9Uub6uG0m6KdT1hyoZP4gL/8gvWzLXPU7EbBS0l49uOq5tHXS7p\r\nGAefiEEQjlquclI25MXwV54niOeZg/SkBO+LKfDzpnOwAiqUU8io/P2H89yB\r\njHMh/Q0igQXWSglNAKouhDCvcnzYUQBYmfZwr18keJV6NVXqeoDYYbvzgIi5\r\npaG//Xu+RndnzBVcli6hEjmNqYi14hCgbwsYG9uCSPb28YDwyNkgZCO10I+F\r\nnx/pdD7BqCU5sRmYkT3uQUy1LgM85PlxXfrXbAP2lICPtxmHSWr9Sz7YRMlt\r\nnCjiX6aukFM5Puk106Qn+MbKnrf0JmoSMPH7cac7HbYXJllDYorIhPnrxKEM\r\nlPayrXEcZc1HBHbbEBulGKKpocZZa+XvWsP6KIrw5q9FVMKr33P0UnnIxpS+\r\nOfIRkSzrzijui9MKffjCstkJCAlWEE3JN70=\r\n=PHu9\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230107125834-03c4a6f.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/035013438f47fe70672fc87a340df974/graphql-hive-client-0.22.0-alpha-20230107125834-03c4a6f.tgz","_integrity":"sha512-Hh4fbpoOkIkexbaKj+vtAESKogfH/EMVzXHkPrWxb9z9gnuuO/SX9LwyongBr7cRjk/hVQ0dJ89C0KMmKauw2Q==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230107125834-03c4a6f_1673096348516_0.4524031269430535","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230107130402-45eef93":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230107130402-45eef93","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230107130402-45eef93","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"086295913e639c2b07cbece56ac8a09897422a25","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230107130402-45eef93.tgz","fileCount":60,"integrity":"sha512-WpuokHcE+NbC2gG/c4f0AFcyP6Tf3oj9hlhJkJBWVX8f0ree7FScK5fVr6C2g1BmZFiMMjfNuwOh3eiIkQvGNQ==","signatures":[{"sig":"MEUCIQCDu2OysX17kWzWRk0UB1P4UGvCvs8SQH7wgVUFFNZE2wIgN7ano1iHmlJHbD/bHslpuNDiHxQpvVHbquKtcaN0+Qo=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjuW3lACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoLTxAAgsgaClJzr9WmdqUhUDbGMakbFabaZwZ0ezl17++C5qC7E+Ma\r\nmORoTS+Usriwf50sUmycDmMKLwoUC0Mkr7Vmk0wHNy/TyhGmzIgbZA4Pwcaq\r\nvlEMdNilHoGHqLvE7Bd88T4dHMLfulwqtPogSZ1D320FAHYUPNysaNDlZq5N\r\nxn4mzDSCN0WiS/dmrNNLs00M/byo4/8iFpvXXVjKnGliaucUWy+i9eFM6DND\r\nM3lVFqKoBMZyem0kQvOXfyhi4OzDGW/fZdZ90p0w2rs69EpuWtLMaz8q62L1\r\nSaGWaD0KrxN+H37WurE5qW+iRZHH00Zf6AW7J3B+Ny25AIR6aPVQVFxSEtW5\r\nRpZSSta1m7BFF3lpy/buD6x1CF5EA8Http5JQTGXXIGvJi7yhSLgJgWGK6E2\r\n7frr7NPD2hcXtDPFYCbaofv86S0B3PvagikwigNj5XkiN5qvCUQKtthzslob\r\naYN4lANwAUGIbQTfV0IVpR7iKyDDZuN7M16xrdQ4T6S7xbmb7TZg0+FwM9AA\r\nosJTYY2N5EZI2wm6wEPctOzcZFRwWQ3HqZMi2sNiJTp1yzY0bCsWN1W4vqfN\r\nctSPUsTHbf0+z5eNwtrfwo/pA+Ie4SoRj5u4nhtLO/ESCIlGqN1nI1b4nsPC\r\niXKI8BejidsPnsmRTFHwQTSDWhrtJac/QGE=\r\n=qbc5\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230107130402-45eef93.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/1a47b305a83ca85b10f62d489c8ca73c/graphql-hive-client-0.22.0-alpha-20230107130402-45eef93.tgz","_integrity":"sha512-WpuokHcE+NbC2gG/c4f0AFcyP6Tf3oj9hlhJkJBWVX8f0ree7FScK5fVr6C2g1BmZFiMMjfNuwOh3eiIkQvGNQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230107130402-45eef93_1673096677400_0.006099713281203734","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230107131447-b935fc2":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230107131447-b935fc2","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230107131447-b935fc2","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"ba33a773d7c9a17864134f47320e72cd53f8201b","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230107131447-b935fc2.tgz","fileCount":60,"integrity":"sha512-fWa+Hi4Nynixgxbz2vxc1UUnvZI1FhLmer2IiFWWVNUqrToz1M3kbgpLcxWJ/Y3o9WS4r0eV8GlcNJ18B46EOw==","signatures":[{"sig":"MEQCIE2HP//1ORqEB4hH33DuIt50GZdNGgbioLKwAgINb79DAiBrQk9sQaJnbGh4ZzAy9Ssj7pDLTMyLlcHVSVva1u1ANw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjuXBzACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrVqBAAjgyzxxqQVXvRLnarv75afNyLTbbufyv1Fo2rqnLOUgr0PpPO\r\nZEA5GGj4w9ubyajTEcPjNeZuv0rrwCBS4eMSc4+aiYC7LllL19dIzzsfkmNa\r\ncC3R819cEOYK8cesFIfdThBhOBxwzpDCb6FVPRyPMIbve5L4uNljYK8U3+6J\r\nnjZQBk3SXu0fZSi2tOcBZ2SQKZwXiTJpvKOIf+atIINOqq6dysqFF3uZEjG3\r\nSsjQZnaJfsJaapUaiFWLxhecXV8APif4UYpqBUYH34IWLY+5r9PWymgUPDZn\r\n2zQOqykQh3jrh8h/NYrmmi2HwsKcYqG0RAF79kBJ9P+JDX0IbdoABMA38R+v\r\n5BMlei21hBWZOKf3CHVJiWQbBGD+7Hq8MgigtSDGIj69prgol1BUb5NxgxNj\r\nzs6EAM8Ca6gdQ2ZGALSc8tHazuqpxMNMMkR6l7/FFvXHzRtJvAlyX5K0+ByJ\r\nXZsIj+1vM3a4r/kZSJTOyPC3VD3BrfudqWBYCtifgzKLXW1LXpokXxImh/4D\r\n3WhyDssN9DJX9q6BiiIwY0t8nZ23icm2D4Qlm6iu7ZqEfr3753NzCxPSLYxp\r\n419fuYnAP0aj4xHwbDXhL0xqeXsRO9iIke3Bhrxg53FuucoMIAn1EmtLI3LB\r\nOKW/Hw8l5bm3j5Os58PLMHYwsQc+FS3/tNA=\r\n=A0IV\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230107131447-b935fc2.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/c99936576c6b6da28fb5a6da2dfa9d0e/graphql-hive-client-0.22.0-alpha-20230107131447-b935fc2.tgz","_integrity":"sha512-fWa+Hi4Nynixgxbz2vxc1UUnvZI1FhLmer2IiFWWVNUqrToz1M3kbgpLcxWJ/Y3o9WS4r0eV8GlcNJ18B46EOw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230107131447-b935fc2_1673097331517_0.6880471731468731","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230107155601-233ff4a":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230107155601-233ff4a","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230107155601-233ff4a","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"986ca10c8eb72700914998fd2ee18c6538d3ab45","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230107155601-233ff4a.tgz","fileCount":60,"integrity":"sha512-QgUjhMuLrKN1scigdvrbAQ2CvNgWoeqjP1QvZ7VFfPewm3LqFNuTEScUpVfh8zXb0sjB4vDc/FhZXGmmJ+azOw==","signatures":[{"sig":"MEUCIG9cv/JUbsx5wSizqaLYvQDEj4VaKMXZunclIx6TtCOPAiEAuOkOg09j9FxzhnBgeXFmGJV/J1sZnwGWPxzLzCJllpA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjuZY3ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqBTQ//RxlEaEgel5K79kE8Zr+zGVVZTXUBYtXEdKQ2wrC8wihmkuco\r\nRcaE/aUpyyUtUjBqoW7eYNH3cOHWs1T1gt/BpLl1RqSiKcZU/QQvc/gQme5H\r\nhmeUtYlShUcQxn852ztM38RzON4km8n7lMUxj81sMEX+JU6o0WHoB6Z7OhZ7\r\n+GwH6YpCf4VmddOkXl6ie8GdQuUHpr1uLm8Dboutwbg2VLbwh+oS+1jsvGrk\r\nj0kbVV3dOBIaLwo2iK3AbtitMFk2SUT4ywUNmuCKA45NH2aC7q6JuHAbJJXP\r\n11rBk7O5sEzHKmk9RrZCaqO26bnOx+Cnw70HG78SXd6Tr7MURpyAEbroxSdU\r\nOEowhVmOGusRXa5mttph8d1XFvEpUJx2DEmp6klWXrEklHxvk3zzZbLDvfSU\r\nxb11iZFEPYohxI4FrjixXF+6szo/EMpN+4MsqTTbyfdd+vBByFf/oFj8d5y1\r\n7+uOuqJmZKXhcqxH28BiuH4IvFBenGDqupK/9frYvCCc0vdpKzdL9KKy5kCA\r\nQ64vHXcJv446/nATg6h/mjrj9S43rDsu0SgmF8RAG0sSjU71SzgBWeIo1elc\r\nfXS//BcD1nxotgwbDKNcdHh6rGqagOi05oNqqaz+hUuRO1mCiuybcT+yAkmj\r\nREX7aKI6vgvJ7SWrTUETsTiBUA1KI4zLzRo=\r\n=/c4v\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230107155601-233ff4a.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/40138b1348cf49bbca1bcd0448138703/graphql-hive-client-0.22.0-alpha-20230107155601-233ff4a.tgz","_integrity":"sha512-QgUjhMuLrKN1scigdvrbAQ2CvNgWoeqjP1QvZ7VFfPewm3LqFNuTEScUpVfh8zXb0sjB4vDc/FhZXGmmJ+azOw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230107155601-233ff4a_1673106999063_0.9263853216251692","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230107162959-3cb28dd":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230107162959-3cb28dd","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230107162959-3cb28dd","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"77825d94a1f305a9cf736b489830805847339158","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230107162959-3cb28dd.tgz","fileCount":60,"integrity":"sha512-xKBswN7IFn7vlmGDOKPNj9JQRb8qnw5MF42iNCZMctJBhrQfKJxNyshQX4xZKwmXPKearPhPXrWLdPAtCBCOlg==","signatures":[{"sig":"MEUCIETsQKTORQ7tT/7apmkODK7aJ3nHHL1Urce2QOnZR0uSAiEA8SgwvTZrgb33r+USwxPrx96b/Qx6PxvRNgl4yvctLlI=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjuZ4rACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmqbtw/+K9yxRCdX9rT/nsmODHcIXuD94NiN0Cg1snhR/QmwTMcvQcxW\r\nvM5ilvRgxYG6mm0gv+oKIbvfbNBvEoAy/VpFPZ12C8oHQpXSH6bk7+KBfCJg\r\n4zd1YvwabX8G/hi94MylPjm3tzKVSFhxrLRfhtGYKR9iBvcuG9D2h/7jLS34\r\ngykXdk4iYH9HC6yDBotrGKPAq0BL+bp26+zDvharD9GI07DngiEZcGqxVMZ5\r\nGeIDg03OEX1d5x1UgP0+TbeyVz5ZIjgnpDs+mQKe0xaaBRON1rww49Vdg/A1\r\nItaccU6vEcf0Rktn68oEw+jT1QvU0RMsW65H62t1d4gu8mM+ngB4HJ/a8gjg\r\nmncTQiYIMagM5eOi4zqBd0p4v/dhEfMLj5pmk89n6a9OTvM4PunrBmDBqvvd\r\nLceXwUwr7wRx0UQX/u7GEAB+y/ktu46Jy1I+eC3+UmazoTuk8wG0qd3ebj4f\r\nAWPhFm1sZl1F4McgRm0a/QPxzA6G1CZU2O8DFC/AtOkJVK97z3O+Frkp3zf5\r\nshlPc1kUhEwZ2FVDcsX0KGlMSm8yMOy7c2UcJjeBUkcM4K68cvnfzPJGaPoy\r\n2IpiYZnFJB+ejLG1ExjizMtqqf4I9B4FPZiv35bJuTIC1oQ7XkdX5Yo3584f\r\n/Ym6IuOixFFjB48K+qtPp01QwBIyf8O/5Rk=\r\n=SZLg\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230107162959-3cb28dd.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/92585fa3f81541cfdaff37001196c13d/graphql-hive-client-0.22.0-alpha-20230107162959-3cb28dd.tgz","_integrity":"sha512-xKBswN7IFn7vlmGDOKPNj9JQRb8qnw5MF42iNCZMctJBhrQfKJxNyshQX4xZKwmXPKearPhPXrWLdPAtCBCOlg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230107162959-3cb28dd_1673109035731_0.6547036543267541","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230107163512-4bf9150":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230107163512-4bf9150","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230107163512-4bf9150","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"005e24939f847b28bcf0f3aaa76bbdc8216ce790","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230107163512-4bf9150.tgz","fileCount":60,"integrity":"sha512-cHA4wfd3BkEV4u8Q0V6Qg/fM0oIqgYIVTyolC3x4JhtJQMPGLoO0BNevUh/hDQ7MVjys/lIxTT8U1BW7TsjgXQ==","signatures":[{"sig":"MEQCIEmdrQE899j17KE+gNp779OcQlz/9g7OqObcYWuZp5woAiAReTZlqUh4rH0ndf69jdbnJxw44gx02pdM0oC+gplFAg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjuZ9pACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmqj3A/8D6ume/4+SVtfvikohS/OqKuVIe6bWeP9jUiRw3DHGS3hzrOc\r\nJwXZW2Tf0HTf9I5DlhHiXQpLhqIkeaZGDgmhCa39kVYcvRRYKi4e0zLYdysD\r\n2M091FzsCAcmziUV4hz3EaNnhy6nKpY7bWn+O8cmTSVdtBCgCne3VHVtmB5w\r\n/nwWFr3t7ngscLhYiBNiviTrDfDMJghcN5MKGl68HPwfYBcbYIFCIrXVKE7J\r\nH9RI4ezJhDSUWsED/AezXF2sU0jEOYAgii8+G8sTf8+2wpznY0tRu9x0p5Et\r\n9n3QtPRxzzVW3ITYEGBPlawwL1LREK35urkgNQmEiwHGPkOTOpU7o0fMdLF1\r\nDgRQ3uGhLS1ZCL+r+yLcIRP4iWJIboNJnr7HKWWCq96FOf01yj6WF0DVtm1x\r\nHO6fZax7dYsywE4zU01O8rBMIOwf8IaexLekeD7C2lVeCF1WDaPmzhH1HBCx\r\neJ/LHnUF0W16DDT+Sn4UrJ+0Ud/xwaOWDeuRxvH3paobhuI6GnxddhjKlgsN\r\nJhfyDPXa5tg+yVdR8XirPyC8yVNPA45onWOSqqeHKZyNg0QtyqquUzG95gZZ\r\n2tM1behQuFHkNPHxlSVLCtchsmstzTkQ6tFTKbyh5JLgDiDSXpn1qO1U2dAu\r\n5QMToQTWEyluT7hiMYEvuFOIQ7atZVuZf7k=\r\n=1KHk\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230107163512-4bf9150.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/8932d9c426642cbdf9f2d8308ced536c/graphql-hive-client-0.22.0-alpha-20230107163512-4bf9150.tgz","_integrity":"sha512-cHA4wfd3BkEV4u8Q0V6Qg/fM0oIqgYIVTyolC3x4JhtJQMPGLoO0BNevUh/hDQ7MVjys/lIxTT8U1BW7TsjgXQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230107163512-4bf9150_1673109353776_0.16870496326876694","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230107164032-1de7278":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230107164032-1de7278","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230107164032-1de7278","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"2ee5206c76a005d1b5e407032c0e37ca9fa317ff","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230107164032-1de7278.tgz","fileCount":60,"integrity":"sha512-98z3906yIZJLo1kJmzuQ5SVU3lRaqvoc5w+W3kvcAVwvgXgI25rnVX3nNj8dRHhHlUbsedkDk+A0MYBXAz+lBw==","signatures":[{"sig":"MEYCIQDpMSD6E8FGOm5jXHSeqG8WSFZ7005zoD26MNwahSSn4gIhALIf/g3swUXI1aUxRYr2hqcsUmeWTfttZoWe/ZjoxYOr","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjuaCqACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqQrBAAoYGzg5+SwlX7MHgPyiul1+e4v03tumKFrS4tC34YAiAYt4Np\r\nXqg7Q/xyX4HVIC186YLY+zecqLMkkNiek12lEpQwTm3ZsS5gvZdrJqS6G4X3\r\nSVhFUG5ufwynPSyZnY/tqf+i0uO4cct859iwunRqKTaLDnvB2sftcV0/jra1\r\nu/L5lIVnMcUoc+T0e9UxmhK+sOY5CWmc6LA21bwxqks5TLVMSBEqfqVKLX8l\r\nZHmOiayQEBNbZXjb3ZXyV3oleERra99y5qsh6/50Q5xYgSR0kR3hlbwgJAqK\r\nt1z+EcqdUDF8Ve3g3o5rHf/yI1KINthb0OQ/VuFTvqcQQpfj3jeuhCzCYZ0J\r\n4tFQB/R/XyQh8B4+PM/CWBsRx8R5F9ul66vec99FbXy5zXc34s4S53hqU6R5\r\nRi4AJE00qg+AdNPTrrPCrFrPG/p5gbiHWWRWPy16csZCC+GIn8WeCNqttRvi\r\n35cB8yhsunXliYQVdMQ5sAvw0I7x3Iyjho8vW2kiW4v9n0tvLkv0+TdJ3/rw\r\n811nTEiQCcJglqmgJW1KoCOY6bWjp8CT7nY8ECyaXgpKgscKZPg3n/beNFaZ\r\noWTrhwBvSam2Sry8offJeOp6YbY/M6aSZqlAD3c7GsrMFqkqawx0fJuswa9T\r\n0Oq6e+zQOEHDQMtSaxLt7hSXSgGgcI2UQVU=\r\n=STBy\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230107164032-1de7278.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/90aaf8155e67773256d9c7429bc400c0/graphql-hive-client-0.22.0-alpha-20230107164032-1de7278.tgz","_integrity":"sha512-98z3906yIZJLo1kJmzuQ5SVU3lRaqvoc5w+W3kvcAVwvgXgI25rnVX3nNj8dRHhHlUbsedkDk+A0MYBXAz+lBw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230107164032-1de7278_1673109674018_0.43806104615446806","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230107164617-1ba30f4":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230107164617-1ba30f4","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230107164617-1ba30f4","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"bc1c0bb4643d3c808521e2fb7bed6704de22a5ec","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230107164617-1ba30f4.tgz","fileCount":60,"integrity":"sha512-1iuOW6jbmY/IRstA81gEldMNWY/VMDSnAyEeHHq1bQna+l+Mxz3CUCGsy7lr4uTMHyFRUL0DHCh10JqkKgvJNA==","signatures":[{"sig":"MEQCIHRDhHBkfo8vsgm8ZOLZGZNGA+FJPlpabv+bxebaN8xJAiA8pcA1yqKb2eTwcQICEtdnzRZTKBldoAuW7RE16m4MMA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjuaIIACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp0SBAAjCuwbnT5K7bU0dE5wBM3mLVAdiI2sbWR1KOcyPTmJ9m5C/sq\r\nz/vzLCCsqdhOw8WqjqSfRexUKOF260AZ8HMiHk7Vq94wi2oFuuSmAyInQwtI\r\np3OByEsgER09nZQhbGeZ/Q9YX4RnwqOLzPoq9Gy4zogezk8+b7N4uun4Z0nt\r\n/h125mCIcoZN5zbZbtVaLbqRj1YRbOWEw+6um9sikn8labqCKU/Wpi23br9Y\r\nby6Q7IzKZuG1gOJ9dwXJ+uAbXfj1+NEjKPnFIqPoyk7MtGVoSJOoIvDK9Knk\r\nS2ZgGD7ITbdChYcX1w8rDCoOzdmo78gIt+llzKwUYWtlH1OCDvkjEV5muDr+\r\ns9mXBucuasIJL9s9kJBqerVHIJUJMZlbEdIQ6HpL36WQfvCg36YmKAMOp4Nr\r\n5BDiPUwRGESgnKQcJVjaJdwApFP7xiBHT+9wrVRbzHlOqNK+YbirAjsph8hq\r\ng1ABqv3xGYCXfElkaDGUUjt80J6t3/+kx8gvOs1KIgs64FoC13DyRwLfaroC\r\nVHc0cyvltAUM9Wy9fE5cwWubgIKK9yPtTny6fFWPQcrKURN42Y75y45e4OhD\r\nzSCWOd1guejnzuAPpVmT89UhrFI5legfhElYLfpKm/hqoz/+pdj5pd736WGJ\r\nsZloEc6B11AM6818BJCOenoXJnckpskQ2S8=\r\n=vWTn\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230107164617-1ba30f4.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/816c93a44829573de6146f9b1d2c5cb9/graphql-hive-client-0.22.0-alpha-20230107164617-1ba30f4.tgz","_integrity":"sha512-1iuOW6jbmY/IRstA81gEldMNWY/VMDSnAyEeHHq1bQna+l+Mxz3CUCGsy7lr4uTMHyFRUL0DHCh10JqkKgvJNA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230107164617-1ba30f4_1673110023986_0.00870014024496113","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230107193228-cb6ee72":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230107193228-cb6ee72","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230107193228-cb6ee72","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"2a8b705f6807a32b5f64b330643d740d6b3fefb5","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230107193228-cb6ee72.tgz","fileCount":60,"integrity":"sha512-Zgt5G/yM1B9SvebcxlygeQm6YEIXTWcwaZbC27QlqNQ44fnz1UruWMWOKke65iPv0pFVKdMj6xma5UNf07pcHA==","signatures":[{"sig":"MEQCIAuS5eKlxSv6rSpNSXe/r43rLHa5hm/iDu8bGsPs0zJtAiB2ZEMz2B3m888ZkruW4yZ/mRR7nrcusajdI4QhmlCXvA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjucjvACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrtGw//dRlFhkEnznh43HPFB7fPmBKw9LfVcW32rhBAYuiVJENebrPy\r\nuz8OFH5m1JVW9v42uTH4X8JlKZ9x+LuOWy6EUZM63jk/c0Qvs89lz9o/C2Dr\r\n1TMjWyG1C2N2Zk7a/W8obC1bh83gJoAzn8dl98q13DQh07sVjrF3yJT+r+/f\r\nD3aWTG/9XdiFu1DJekIXTkGctXBZHOqpWbAhyk/a9A82m4DuJwq3tF2wpYN9\r\n00z2EGxgZeDtNIo7+vKzslY621RH97mIsjpWkiVdIoyJTvd5DFGZNkBrJXyP\r\n6JjVuC+K0bkOta3MEmIxjLHTOL3op+iL1C2v6KYoHOEaORofzVixgCC2FmKJ\r\nIfNqQ+ato2Jkz+iKWYlQVkXREERVY1FpZ1WJvH2DMubkCoxd+LCS5SBMZ/Nr\r\n/xYes7XiIrQIK/L0QJ5nr7LvrlrZHczQRVcwp9wfgqY1poMHkm4JEw7x88Ab\r\nYfJTZph46ywlHnBGtWMFImqmrn+ee/+9VYQMUhicJcEjRTuLhV1nz8wd63J8\r\nLLXU6cAnFdyujFY7PkbW3Tbw7Y39yeoUlUR5CuGCtaSsMEYddRbkuvB2Cqry\r\nVnSILuOSywZuiAHIKMp5q93iV4rAUINErsNjeVRVpIUJT0I0ZbpkSuGyyInO\r\nZVgWGPUNsQk4iKC4w/7mSuCnyt4o9ioomII=\r\n=ibPv\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230107193228-cb6ee72.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/6b2c9ad5d94773a392ef81e8f73dfb55/graphql-hive-client-0.22.0-alpha-20230107193228-cb6ee72.tgz","_integrity":"sha512-Zgt5G/yM1B9SvebcxlygeQm6YEIXTWcwaZbC27QlqNQ44fnz1UruWMWOKke65iPv0pFVKdMj6xma5UNf07pcHA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230107193228-cb6ee72_1673119983518_0.42104296263335717","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230107193304-858dd01":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230107193304-858dd01","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230107193304-858dd01","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"6a41727fc96ec8ec64b52c34051d0f30eae3cfc6","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230107193304-858dd01.tgz","fileCount":60,"integrity":"sha512-qXqtV8M68HPeYe57VTYh7/hlFWKCIib6heBjpGXIzL9BxJCu36vhXh8XPnRsdMXfe7/Lq10FZg/CmWoImPzaIg==","signatures":[{"sig":"MEUCIDJh5+qtwr0M76a8FfuMvljTuqEUe0Gjk5ejOo32qR3rAiEAn34UC/8S5igX4xMk1j9PI6FRFK/xfQURrMctoXGtPSk=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjuckeACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpfwA//SJoUsOhLs8FKZfGLICbkVETPKNkHMDyMnUbxK5Ira8yEgT2q\r\n/t8EQ+M4v4r7l4b3Xu0vNxg9KBUvl8zn5t/juPfWyheBW+KUFgxnvdd2VlQk\r\nIfZQiPq/7wB1FXXO++nQ4kAdAZ13NBrj8RcmSmgL3C/mKcHlCjdLFvkH8Z4q\r\nB56QWC3nx2Q+HPLKaz30HJFfUfVSk0QOPHZ8NPCuEtlTuJ8/YMK7k2gjBuNh\r\nGssRncuuIu1tWUojUG9Jy29nK0EsZOPHMY5Kg6sbVt1v/oRhqfI9JIeIdwKM\r\n0gp6HXQok0I2WHPgA4wx8QiwRO9ecAaiyTCgvU71r31mKXGQEJOTMLBwuhHl\r\njxSFSOdSU+vy5s5JD82Ew7a103MfZuvQBQ0WzByZqCrC0JozMWW9WSci7EQf\r\nQRqAoh3ITA7frzb2lN5A58pRT0VTQzhqtt+WPDdHWR+NT9D6j2Pka5KISerY\r\nt8qYBaorAxR8Tuygo8N80UdeCPP6bdgc6y/WI6spcPdU3V/swQCnlkAn6Vwg\r\n7xM6iMThZMC2FJCV4txRpA8aGnSnlUva7E7oqgByezVRG9pRJR4oXI8+WVxK\r\nS8galU7q4BPIEd8PunXnNcw1DY8dEtQX/0FRCq0AFsnZVArnRL+EH02ymTDK\r\naR5MUu9A9VPo7RfDLHmirZ7BWauWVSMLy8M=\r\n=+SzH\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230107193304-858dd01.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/0c5f3988ccc990f0d0902a2333cbb64c/graphql-hive-client-0.22.0-alpha-20230107193304-858dd01.tgz","_integrity":"sha512-qXqtV8M68HPeYe57VTYh7/hlFWKCIib6heBjpGXIzL9BxJCu36vhXh8XPnRsdMXfe7/Lq10FZg/CmWoImPzaIg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230107193304-858dd01_1673120029864_0.19123117153610347","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230107193421-52466d0":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230107193421-52466d0","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230107193421-52466d0","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"f45cd688d05953e4d417ab997eb74ccdd7edf5f8","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230107193421-52466d0.tgz","fileCount":60,"integrity":"sha512-2tigK6BQ419sFzJNPozj5PLwfJVwx646CPrKbomqdv/B6ZLFQyRprx1H9dyiQY6LbGLlpradI32SEH3Cz34icQ==","signatures":[{"sig":"MEUCIGy3+7iIUDeOLhreX3+TszWRlDupYsBYjhruKIR8/4RWAiEAz7I6VVPym6X87Dj4iBR5YY+vtJw4M756h1rD3E8nNnQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjucleACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr3ng//WMkoQEW5s9kSdkV8PuZyOq2gsZFymFkHLzg4ElP5JULvw+JV\r\n+Y0/X7VM2FMMMrBG5SFYCXQQVMPp4ndu1JfWqudxdJkp6JcJs1JzcNerDFIc\r\nT/+JhxhiacOGVfzZXeFWVE7uyLK1S7oD3ZbqeJKBOpU9MlM/L+Nuy+XJGdJe\r\njpaWibahsHrZVpX4f/TvhECOUrybpHJEqMuUQBeLBM69W6BgGuLcudZWr5C0\r\nAIbQFnADdUukl006FEs6ph7wkWAz/05zsHN76wnE/QvJs0882oMOmFWt7O3B\r\noFYzjuL7IbPeHZQ3J6iQ1r6hLOO2JHWr+lS6taTtI5994LkndILB0v5eu3lN\r\nTZjzK8xlbqvyATbPvpOddZ4PREKuX1E9lKgUmHAqu54c6YxIZdu+wZdIgJqQ\r\nMlS0SP0R4oLAbTmJcQ8Zlq57ePHLhbyg9Ygnn8dZ4hvM4c8MU10yd3/JCRy4\r\nWB0f35SA2tS3HkHuw3BzMipzXRNIJaR+a1nu+HeG8n0IVNhC7fe3AsaUPfXk\r\ngYnz9wWBTCq0V1V1TKGbKh9FUlxOogN15gBTPrWmNSNlgk4XSuvlb6xTb6Hd\r\nrqL0a4WI1AFl2R1bF+bGD9ySIV8G0rMNvgaiJx+Qh8ZBfiCk56nIMfWJvbi4\r\nfvPX8etsH73GTkiA9l3t2LDgbACUqAloTqY=\r\n=qW2V\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230107193421-52466d0.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/cb991a088199d846c97e49c25f1cd5a5/graphql-hive-client-0.22.0-alpha-20230107193421-52466d0.tgz","_integrity":"sha512-2tigK6BQ419sFzJNPozj5PLwfJVwx646CPrKbomqdv/B6ZLFQyRprx1H9dyiQY6LbGLlpradI32SEH3Cz34icQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230107193421-52466d0_1673120094670_0.14244906200609275","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230107194257-4a6ba03":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230107194257-4a6ba03","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230107194257-4a6ba03","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"68f90a2974a348113c3998fb47eb1e94fd787237","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230107194257-4a6ba03.tgz","fileCount":60,"integrity":"sha512-rm8mBX2Gihx1y99lliO7hdP7FdWZwAyKSX31tJ+Ef4HEOc+UXwJ3wx1bu08tq2j8idVLR8fIrFBzFHEVbnro+g==","signatures":[{"sig":"MEQCIHg+uRlZJsHdla2xtM5ln10ei7luupVRbGQJk4t6Y0xMAiAvD/fK4ACms9u66JxKz9EJNbQ2Z30so4b3e7ktZsAt+g==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjuctjACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr5iQ//S2nLDR/VEUZf1hT+GTY4Rdopqk2xo5pNNt/RaP/XMCxm+y54\r\nCUazzfgelCJyVBVXMYKksDWzq3Cw2+e37nbLjZeftVamnSFshnQUcwvWAisJ\r\nKNRVqZCF8fn2xDD1gi8MnRRKmJUm1HR7K8M8snKIe/zwNtacAV96BTlFx3hG\r\nLV+kdC6jSbHTQ4Hn2QqMd+XL1TLMmbcHjFG1Lt2cy5Mpn+vYrjKUpo9gdGvD\r\nKheyMwfEJLfCTDYAAFj1yAoGln1doazLuz++Ye+TFRnSKAPBHkO6lve1rDWO\r\nhnlya/jDotcFI7OyRXhogwzzGgigFOB7syIcV80cd6bSBc6G/CpfD9uvZRQM\r\np50Msww9xrWXMrZC5uZczpaeV7XwW1TLlEeoXVrvwfquNELIdb8HO4CH60bh\r\nDDVGT+GZ8IMKhMDY0CVYMw/sNIqlyUT9U/Uy7+A9TcdSsrd778fqiBR9brHI\r\nlRRfcCzTmgxVUDEb9dBBb7TI4w57CAcn7ivTLISzMCglMVVPPK+ArjDD3tDw\r\nZ71HZ5OZOiP6itmpSUhemRijrDSY2NaFL0d69c3UbL7VCJiXKwR5iSy8Fmij\r\nVTUsV9ZD+RhpjubfV4apUX39CAb4aaDcHGJ0hS/90dJIIKlEj4+30UD0YAFT\r\n4PrlIPpYXzO5UzL/bzjfQJ8cI2UsYMKaHpw=\r\n=mXBg\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230107194257-4a6ba03.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/6d469504e627345219ca150bff722b27/graphql-hive-client-0.22.0-alpha-20230107194257-4a6ba03.tgz","_integrity":"sha512-rm8mBX2Gihx1y99lliO7hdP7FdWZwAyKSX31tJ+Ef4HEOc+UXwJ3wx1bu08tq2j8idVLR8fIrFBzFHEVbnro+g==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230107194257-4a6ba03_1673120611287_0.18965995255915336","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230107194313-588885e":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230107194313-588885e","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230107194313-588885e","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"c941eb63d94f4cabe42c25887d5ba3fbb07837b2","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230107194313-588885e.tgz","fileCount":60,"integrity":"sha512-tzNA/9dS3ppXB/A0o6D+X7iyf0PKs8AgurDQQ3HxnLNXYj2SmbjOBSV01SUvyy7/00XWWAfC1dYh5hpKQ63bhA==","signatures":[{"sig":"MEUCIHDvIYZUfVp/SyVLlwzE03ZfToYhKcaPFvoe5mhqlu73AiEA6TBRtuqDMKKZEbqSNwppAH303RoOzAvvEvkgL2jYFB4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjuct0ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpRXQ//TpF12+wCSmRiSaQgIaSjPl9c9AgX3yN6djqFsD2r/dwxrQne\r\nxi7t9MgrqO1aG9ZzM2acDY7nNHJz4zXw6ct9farDtGmZ0va1QuBC05L1X8Tq\r\nlqhgSsYBF2ltrYZ5+HwFcWrva9jQGged54DxQlUADL9P4EMm4FTrEJsFPQX+\r\nN4N320Xlu3A/tupXHuv2wU/jdBdCc7UDC4trM771kGs+nLZK/z5B9wk5u+Lw\r\n0g4gYYkbIBuZWbfYqWoX+SQLBm+AsIpg2dNDXX+80dBFJ628CmntdIR5DV1I\r\nsRhR4/bMarpPVElZhPB8BM9aqKgTh0PfcgIQ8ZriAAj5eoUyRWEzvmuS4Pyz\r\nBtinRH7IM5sR6i5onrDLrKtyJ48oSkN7sBV9/+eo6fQyatQlyZbAtane3HBE\r\nWLwvUm0+DZiVRfz4ImmFx9WjULFKwsZoyWfmPgXzdFwkWh22MeNTwRLsEeS1\r\nvIR0PE2cTpVfFOHtuhjseBChLosPp5yvqQoyINHWgdmnNg8OdVL7Z98pDiS0\r\nXemxf1azyN32YXqWyubHf0ZsQFTprbiiXHCuCuK5J5YSF8vfm75dze1cQbj1\r\nITr6LchL9cOkDLudBr25DRzCpUeEkxCjmY5eqFQurOqhg3w/NgyCsBi1U9/J\r\nVS+bDaLKec51Y4IsueDCZRXqBvbdjWAcRkY=\r\n=Ps5z\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230107194313-588885e.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/0fd0bf080b61bef8bd2f07e6a03cff7a/graphql-hive-client-0.22.0-alpha-20230107194313-588885e.tgz","_integrity":"sha512-tzNA/9dS3ppXB/A0o6D+X7iyf0PKs8AgurDQQ3HxnLNXYj2SmbjOBSV01SUvyy7/00XWWAfC1dYh5hpKQ63bhA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230107194313-588885e_1673120627779_0.9973025992705822","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230107194810-33070f0":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230107194810-33070f0","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230107194810-33070f0","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"c3ce527e6dbb9d2ac387f53d8d81de20e7159263","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230107194810-33070f0.tgz","fileCount":60,"integrity":"sha512-f3AJV9r/jFUeGFKYHzo9W/cDhRN9GicF0kD0qf/6TUNEzCReYvve+4juf/Wasf7U7uhMAGEWs5QQKf8dqF9TDg==","signatures":[{"sig":"MEUCIQCKeQK4xAFUQO7gvPzuHhdjGvZY7KXKi3SNF1ReLuwgcAIgRBGVLdErFUHLY7Cf9wD2CBDSsZAiyP/6tXiIBEZUvIA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjucyhACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr8KA//UU+xA3lrU/dgnv5JzbWI27W34PXMZfpIiDPzVN3EcCnnsniU\r\n93fIcc4gXFlEUCLUA76lZvDljm7Y2C5xLIkuWuWJ0JX6W0ed6qwuKFauzYNU\r\n52yEGsth1d2T3JR6s5Jb380LZ5v8jtea+LuQUOOFYiYUyIP8444yOuNV4u0t\r\n62Q/OwI8nb5hVhs9ubkia9U5sNfXQSTHcV4PWuaHMsBDAQhl/pBOuc/BrVmU\r\nP3UGBwNaDUBxlX54sSEeGamM2CbDguqYC48Yn5qFS2w/pmBZ6BGj/ll8MHbI\r\naeiU+gZIKWU4a0H8sorNDw0vfU+XOTNIYMPi8ssV+vyCDQB8I7jKDcJZx8bH\r\neyaI9E8vQIdT2/C+ZoeLa43oRl4QlQVee/wGX4H+6FZt1f5Ft6Oxe8S/Dz42\r\nZcX2lROhHTSuZRgz8cufqeRXlQPnPGmriJD7ZkfHJcZL4N1t2AvIzYFmR4UI\r\nxaX3pUviJwhm/IkuI5mMM/h9AMetCK8mSMqtIT8Oab13n0O8PD4JF0KT1nUW\r\nvnzSV2N86su3fzb4aYshh95a0TlXEy0n3EOsXiTZ8DQ4J6LQLqSorhO9i3ED\r\nEBw718R161b59KQShquX5p5xPr5JzExbXAkq0pTMmdbzt8lOfnCwwT7TDkd7\r\nO45ipbJ8UrlJyiiGeuMhSEgyrw6uq6/D4Jk=\r\n=jLgv\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230107194810-33070f0.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/41ba75fc31a26273aa7e805c620f7099/graphql-hive-client-0.22.0-alpha-20230107194810-33070f0.tgz","_integrity":"sha512-f3AJV9r/jFUeGFKYHzo9W/cDhRN9GicF0kD0qf/6TUNEzCReYvve+4juf/Wasf7U7uhMAGEWs5QQKf8dqF9TDg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230107194810-33070f0_1673120929377_0.3289980661105971","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230107195240-b217819":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230107195240-b217819","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230107195240-b217819","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"ac13b5ed63c12c7fe02e5359d083319663bbd54d","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230107195240-b217819.tgz","fileCount":60,"integrity":"sha512-whQzuYmQf9NMm3ftZfO/Ga98v/tI76vj1RKo5BMTXECND4sa9UZ2x463LQP5qcyZGIuWeXCgcnP9KDxwl3yg3g==","signatures":[{"sig":"MEUCIAg5H3uz9wAT+D5KeKNp2mb46B2Fcw52k5kQh6I8KAz2AiEA81ZTPiVWLNadS5XebR9oMLYAwIfnju9BVgocJpWX+z8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165581,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjuc2tACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpSSA/8CIvAkCqkTNytoVfIXdz2V5mJrQ5KeOogDrEFAM211zWB548g\r\n9GmGCeFUJgJHy/fm0R7kNXRdOeFGD5HB4Go9vBPSGIfzZa8UuaHYSqscWfvl\r\nloOVNPnhTVeqd9Sz19OKKqTZMzVQJAYp+WBez3wyWjQ9C96XqGlDalcV6T/5\r\nfXtP+Tu+Pd2NUXodcO2MgypL72+DBziK6vfkMGL4wqFfXkMZXxfP+vWEQzLC\r\nsrgC99rgPn3sAODl6w4HNuLdsppR4C45rfWgYKSlDiVzrma+pFizd1JHxEvu\r\n16AF6BbHEUdsONL00kYBiawxpffeN8Zgtre7NOgbKGTDOQX6yt228Kv8UZ1N\r\nV8vNnwCZyrBuA17d0Df4CsIQLOLteqJ7muGtpLGq0OEy0XA2FBw1YfZ1zcDO\r\nhgsJQES3jbS7y371pcnc/uJM76FH0uX0JTTG4zukdf0CZ8P/2GzOjrun/wMx\r\nOel9te3iygtos3MQ1JvwEcqEEMKinwWOW1NN1NEB5u0qPe+7nyiT8R4CiDXQ\r\nEcjr8ZhjHDterYfhvfjtfhczN9xnDiveyyWlVNkQxQ06ptsktHhxdkV41YY4\r\npvGq/1RCCeF88W/tfNb2ruu94R1dsuXRc5Wdr2qwlSIgAxelsa33JTgbF+mB\r\nEom6PoXNI9P9ikrIVX/Cr2th2pOJqn/Vy7k=\r\n=OYQu\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230107195240-b217819.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/8da17bdc12cc40239565fb483327ec07/graphql-hive-client-0.22.0-alpha-20230107195240-b217819.tgz","_integrity":"sha512-whQzuYmQf9NMm3ftZfO/Ga98v/tI76vj1RKo5BMTXECND4sa9UZ2x463LQP5qcyZGIuWeXCgcnP9KDxwl3yg3g==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^9.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230107195240-b217819_1673121197564_0.27081673485294266","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230107195701-29c5f9a":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230107195701-29c5f9a","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230107195701-29c5f9a","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"060c07aaa0cd36f6030bc6c4eec0a737bbee4a1f","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230107195701-29c5f9a.tgz","fileCount":60,"integrity":"sha512-VFzAenQzC7cKizGSKuoP2UFN83u4okf52aIoeS+fZpab76RCGqUvD44PcNawz0uW03v9DscfggT+7UGhbWqtiQ==","signatures":[{"sig":"MEUCIQCK8ArsgfhatXQTqM5DBSkbWY9w844bYfrLUdcXWbtP5QIgGcbes96HiLz9VvomtHBgOB6iNV0ST3w3zWjp8VWQnoc=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjuc6uACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpTog/+IPHuRTm0xBg8s4v5g4ux3rtIWNHDUG7nF4pB2H8HB19NHHOB\r\nwpZP1LUwu6+2BR2YS08rolQd0no47QdVEhGZMIr9Z66XbNn3CKTAdSp+yPYj\r\nIg8uCn/QxR0Sj3tyhwoo9sA3QqNZT7Nm2Y0jQuf+/UxRERdg3C0E8ScDms7/\r\nLhZBmIYzhddMnDJ6bYLd8Yx5o7MoWVb8kPyLjuxZZYbDTSr7wIy3eR6qCMyG\r\nnBRzWPP8Gm5CY4L5J3W1Wh0S+5rnrhFHncXP2sD6df2i4qYbPi0xtxTkRq/G\r\nxdwWp5CmEZ400jaVrFBE4wud2E8C6UXPTF16rpXLkfkMRo3fq9KOWcpDX1uz\r\nMbFdKzoOulxakVKt1y9B0PA3u4JIgktISFvWDb6TavZJe37bCWu8OAI1BDPt\r\n9BccvkuOWkbHp8LK79p5ZqNNOhjWcOS3z694goLuPuTkKDRXh2iB13vpQKd/\r\n/p63GEuV4z/GifmVRBVkkv5ne0Y1IyIZEgh3tPLUamsmZlOjyr6LZ6sMAEFE\r\nWpCZFfWBwIVcnv6cTbBQY8TWeTpxNNY2toK70Zm+9RIjhVjEeaBxjk6LlPqS\r\n7RQs7bMgbPvy2jBIM2tM7vEENv3MJtfG66cIpYc3/Tyh/l3Mue8zAdnSQHbd\r\nRezjjfZztBf5e1JaPdNyP20UccZG7iJJMu0=\r\n=Lt4S\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230107195701-29c5f9a.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/facc02f8d5e651991bf14daa3a726b0a/graphql-hive-client-0.22.0-alpha-20230107195701-29c5f9a.tgz","_integrity":"sha512-VFzAenQzC7cKizGSKuoP2UFN83u4okf52aIoeS+fZpab76RCGqUvD44PcNawz0uW03v9DscfggT+7UGhbWqtiQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230107195701-29c5f9a_1673121454650_0.6230853350239229","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230107200114-7ed249a":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230107200114-7ed249a","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230107200114-7ed249a","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"0ccaa3653ec2f8eb3ba4580d2c4d922c34e1c510","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230107200114-7ed249a.tgz","fileCount":60,"integrity":"sha512-0mJ4LCiL8UPsQNdrL9+g/i7CuzKOH2Ked+lbKQssQ0u9NG6BHzGEsMca+u2x2OjKMHm6JgmAYTG4sZGa8pIh6Q==","signatures":[{"sig":"MEQCIEzkMU4YseEWo1berBSxdNHJ3NwPVKKfqtQW+B4eCSPsAiB+O+vMT8aQyXxf2LC6EQ3TrUhfgJpS6j1Juc5UW9V9+g==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjuc+sACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmosGQ/9EqVxb/ENP+Nwc9JIKsdUy/HF24mLNDELDLrZzfE6gm9tulHi\r\nkqO6QmZTKpPliOvh6I71OqBu1RPKY6H9chmNpYUlsvgSDd6jjHaON6Lqf4JV\r\nW/Wx9AtAd+rPYVVBHfeq8hMP1Hvp5UDuCcDv/xt2VeBCHM7379AfLNzRpft5\r\ndnat+Lpcc2JYMyIw2/AruvIr9IUvSnJQwk04WUD+sirwQAc/WM8e2uyW0m94\r\nS+gBstl3R/wFvtN4a9KAFHUn/nyRsQwF2yr0HhJk+hpusqGldkqaxSWXUUG+\r\nWo/IWm1j5ZyAoc1XGFvqswG1g9ku/FXnQeMj4KUHxUxZyEEnPz2hFD9ud+F8\r\n5d25Kj5D3VcqcP1ndyqUXWUeB6hEwbN/y3ECiXRE9P9ZtdZrCbDzYhrYjrPO\r\nih3ka5WekftakdGa8emFa/WrjXBLrR2JIU1r5UhnD4GPco/4g9gbjgOP1At8\r\nTjuYSM9qSviTsUeghSaf63BMZldvbAPeRCKWZ7rSRV1xVfc1Oj6PbouLGQ5G\r\nzrqPBEQ2gRNKxKTalU5q4YkCIxcbcaCsT2BN4vu11SYmIBexNPM/Yj2c6cYr\r\nhfV1UPTb6LQEnVHAGpN6P5i8zbRK4DZ3Sgj550jm6ajgy9AZkcNVC95aszFj\r\nfZDIXKuvNusL6a487SwFOiy/Ldvo6Yzrs5A=\r\n=of7J\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230107200114-7ed249a.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/a4720da1fd984793835dc73a885546c7/graphql-hive-client-0.22.0-alpha-20230107200114-7ed249a.tgz","_integrity":"sha512-0mJ4LCiL8UPsQNdrL9+g/i7CuzKOH2Ked+lbKQssQ0u9NG6BHzGEsMca+u2x2OjKMHm6JgmAYTG4sZGa8pIh6Q==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230107200114-7ed249a_1673121708183_0.8903181847499924","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230107200612-b4f4685":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230107200612-b4f4685","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230107200612-b4f4685","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"41ce51581854c79778585937a01727959708819d","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230107200612-b4f4685.tgz","fileCount":60,"integrity":"sha512-osqYG+b2M0sCVurnb5uNCdnSMm7BjOddQUl70xvmxAakLdzr+YByG3psV/iZk9m7GcsPwHt8CKq2WF2J6lG4zg==","signatures":[{"sig":"MEUCIDUs14JY6fTWxEQojtdm3/V4prv6fX+2MlWKvaJ0XCnEAiEA1xoBBtrABJ6RQh58tzPcwADJoAkX/CcHy8rWak7RlJQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjudDWACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqHiw/+IuuONdSV2C7zuibwYrQkogZiY+5nZJYcgp2JHRQ/mU6wQuBE\r\n24cJ1/zeTciFulr7jrnirRA+R72VEo8hkgQjCW73JIbre0Q7J2YaY2qN+oTg\r\nUVV4jl/Jo/Yy68+SVfIqkMEe64cCw3SaMACjrLBZytfryjnVGZugTUpMvDHV\r\nu+zMBSGzFjwrcFkH5RSCWSxYeKYT/54G5fwJomUg4GTkFGc+eLnd4JHS3utn\r\nj3xfDALjv/fsNSxBlT0s7f70LYy4QSkuPI9TyXpIvxqM9RvVTtjRBWe4ynJc\r\n4SWdSU0R6XHTo3DOZKtSn89tPp2CWoQgtlK6up/NIoGSYjyJN5mWo7xoJsiS\r\nKahvl3iJlFhR7hGXfOTIlYZV5TxTdznsfBcc69qLHAnovdW5D30MhG9KlI/S\r\nGY9nNtJHQpcpQ+ivbXvM8+1LNjh2ULktR2R+iyai49xPsOS4h4mCMVJqsHhD\r\nGuyFFCA7cJ8ij4wPyCCSidu8XbRaBT0myKLliJkm52v5wrM6JrfFcsMJtyCo\r\naOSLTubb7oYN71gwetVHWqfxPuHRNNTfdHm9fMTEqRijooEq9D6nxNRIiR5H\r\nMJrGNOO5CI2iCQSplYBZQBBPu4onL4Y2Y+RShoe1TgqY8JeSp3C10RbyuIUE\r\niZuqA6eXfup8hqiZ+AkfynKiU2+V16xyXlI=\r\n=50yJ\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230107200612-b4f4685.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/8d9b8ed3c67a5c8c6787c170303b969b/graphql-hive-client-0.22.0-alpha-20230107200612-b4f4685.tgz","_integrity":"sha512-osqYG+b2M0sCVurnb5uNCdnSMm7BjOddQUl70xvmxAakLdzr+YByG3psV/iZk9m7GcsPwHt8CKq2WF2J6lG4zg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230107200612-b4f4685_1673122006464_0.7916153703021875","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230107201014-6c261e9":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230107201014-6c261e9","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230107201014-6c261e9","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"e58debbc12edd4cad4bef37aa93df08fe526a741","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230107201014-6c261e9.tgz","fileCount":60,"integrity":"sha512-ws1VBc8KcRyeNrMEErsy+gwUL2nkpHbT9ad/XE6fzOIAmpgVsPwWdHDlUJXGo+4Rv9ZGdd7RWbSDWvH8FbrkKQ==","signatures":[{"sig":"MEUCIHUuR8eQ3j1+FeBEVCr8uGiDXxO9L9qFj1LfDYC9UxbdAiEAvxSBPkKZV/CHm79wwHaUhUPUP2GwetFj6z8Ow4O/KAs=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjudHIACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmovCw//Z9W62qEgu4v7lVAGWhCoCTVOR+d84iiGp7INDRsdDFH4FNA8\r\nLBQabMYasZPLG2CogA+eeFfbRnSzEKPAbQ7BD92lIvW17SXBU1qEnRFSbxiG\r\nYc4hwwMBZ1PZKu0VphNq4hBz9PSpl0xFoIYoxNb5vH6Ebr7nvqmt4O9HdhOc\r\nALyNofYxQdc9CYV3l7WXnZ0+0rfgwqzQM75JR+51F7rjI5QjreBnthUI/pUk\r\ndWqKAlQ0GAtUO6vOXQDHSVFQOuw6zdlu3r4qoE+0o1ZKwXmuYPLTALxGEVbA\r\nOChaLV06o3XbeqIhjhCDstPMFh9Q+5isrlE7Lkh/lGKnI7T4W9jeEVPc2leo\r\nHQZkBMPNGb617DP6Nwv5Hszo25t8CzW/cZpneqDqw0YTwjTu9ptYFhPYjwXO\r\nxWpu5Y/JUg/r30ITlLZwmNkVz01oqh0n6Qx9k3qec7zSx5IBWtE6ERlf9h/Z\r\nN7mnJbZLzzfuRIfxvsYtuPxWKGdtQ7X9pDqB8P9sX5GJyJUMPt5AmgWYM8dN\r\nOtkJ0HQ+E1iEtnZYlcl96rDjBFGCtHHKUSFi5teM6jLYSgYN/qCVcbJLvgmn\r\nBBZrqYg4CVP1fo3pnv2VucHOIqqJVKatu6B8QnAs1Qejt8V5QdrNkXxsHFMZ\r\n6XRJkuT4Wun8oyZRuVYYHUCTaM4mbhMiohI=\r\n=g32q\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230107201014-6c261e9.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/44b7604abc6e38af60734890c270caea/graphql-hive-client-0.22.0-alpha-20230107201014-6c261e9.tgz","_integrity":"sha512-ws1VBc8KcRyeNrMEErsy+gwUL2nkpHbT9ad/XE6fzOIAmpgVsPwWdHDlUJXGo+4Rv9ZGdd7RWbSDWvH8FbrkKQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230107201014-6c261e9_1673122248630_0.517819430784676","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230107201516-a9710ee":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230107201516-a9710ee","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230107201516-a9710ee","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"95b86ea62014c11211e30d3afedfeebc27f42998","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230107201516-a9710ee.tgz","fileCount":60,"integrity":"sha512-uJdeImSZoyglPdb0xZffGTpM+QqtDvuHgvhWR3+XEudurA3e7TQMCBrGpdU42XOcf6+9A7xf2dvWXzM6q3UApw==","signatures":[{"sig":"MEUCIQCXJP9S7HTfPaJKGQIFJgfpqbY++nsfggroZQgTRwAe5QIgCcQTABMr6zUjyW17PU7WUY3fu4sNesJSrfOCJSulQjM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjudMAACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrIug/5AfHb6rWIuBggl331AERxITEq8AHwG1RjBou2sBaGrv25tQIy\r\n53n+/qZbB5BZ9J+ozT6MC3Y68s4wUr0ozgHjEhZyR3lwEXOQFS0P9cqAVBbv\r\nNRWJ6s79qpdfE44AkIWdUPD/QQJbd4/QVZqicsb0nrjhZTf0l+VLQCFZiTU9\r\n2GmMpjcY5b+leimB6BkZ406iDSaEYnABFhaEtaqu2fLDGO62rpT0BBd1lojB\r\n6OIUNTD6/vM9TltmxJQ5WFlpWbdiGc02qjdGahL982jE2VZaWQQr2hCtjS9t\r\nil4LBgrgKOsUuR/t4ULbSu3vBPfLMvXPrtMJGIpBjQTc9+n7T9fLqB3Wp14t\r\nLWTFjGAArIbpFF0Ht8WFXC0xhTbovAhTngUZRP0Akpe7Px3HN5SfX++vJlcE\r\nuTEN2GrSo3X+cCJUpIBM3aVEuaQ92j/YsH5Ln1i87Ul+5pSxtdP5cHWKb0+G\r\n5ehCkRQnNBweLSWos9G+PhrFBzNdVNL3OyBqurVUThHhfQ8lH5upnZWLh2uQ\r\nYsmlITywn7CsQDJoW9N8VM4oJbqqNQcJnC5vZnnaNa9jg19Mt4R6rkzfoZ32\r\n+9Ev9VLprBhuCq93MebQ/QF4/Iif7MNIuFX2U6yZA81DLSOJ9WvdaYKvXOOM\r\nK52h1NZnZyameDnNWInhlJD4/NSuYgaMovk=\r\n=rx5q\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230107201516-a9710ee.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/1590c8e3d1e02490672899f46f26bc88/graphql-hive-client-0.22.0-alpha-20230107201516-a9710ee.tgz","_integrity":"sha512-uJdeImSZoyglPdb0xZffGTpM+QqtDvuHgvhWR3+XEudurA3e7TQMCBrGpdU42XOcf6+9A7xf2dvWXzM6q3UApw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230107201516-a9710ee_1673122559921_0.7976217486003523","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230107220029-f240181":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230107220029-f240181","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230107220029-f240181","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"0875e44d9dbc4aa1feacb55af8ef4228ab5847d1","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230107220029-f240181.tgz","fileCount":60,"integrity":"sha512-eYQ1ypekKPfutqYoxHAN5ilMeoqCX2uzfxlnRIdIZ5rSc0zkspkRPQOAl2LpvyIDa32RvKG9L+ccGbSu60HrtQ==","signatures":[{"sig":"MEUCIA3MkXWzMQZR6GD7DlYg6tpT2SO6j+KZZR3n4Wy6xdf/AiEAohJkscwteV5ORG2lR7sGKu55ET4XyT1f+h5QNakTXyk=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjueuhACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp0sg/+Jlm54iOhD5WfPE9/2WKuETABpoqmt9OWPpOWBL0od9JFPqdm\r\nmwd43NKQ90QVGdSmX8Oi99rwrf893DADKlRV0vPdZZRC3foxvIRk4/0yWeAz\r\nHRYRS7iiEREgyTkQFUYHDFVMrv4TI9/Dzs87LS3sl2I288akLwEXxB6VH4Th\r\nl4AZ2t0QpjkTZm5Y0r+4+cePSQiU1Td03w+hGDaxgUykMUIHRWPqO95rGTQR\r\nozm50FwVPTlyfYcXKputHqgfmKaCgN9NEC6YSbTIHsxFFPmqLclAGDRQZq9r\r\nA56RrdGxxwmKopD/xShb7Jb3Spqdcm+f8zzD5aVzOBZnDuelsFqgfyZAWXeY\r\nvSADECYydL4b9mpSow3skBUakadHqg/0AA7yvpoGdvzK8wAlHI7R8m60jeqH\r\n5EBhpTj8m79GPUi9rvF5QVAuQPjjnPryK/CZRUTrSu/WHQECQK2TR2bGwcAI\r\nKD5wyjXMk6Q0kZ9G+WjnrDFZKkgNBtSxFHDQrJs2n/oKNjyV+V9Kaum+IGb3\r\njIznCgm1V62T94BsyCkgxH7MiX1oaQ8ODCTuA74lyOI/0Tp/+9N7TXO1E5d2\r\nYhjoDOU8VBw8K6B2JMFEq8HCbgIOeL4+bRWvSRx5m022pCbBSXujRkwgGWfD\r\n0fDVV0uuRdwbqaAfEnuhwGdhlJOhq79sfAo=\r\n=ut5n\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230107220029-f240181.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/d890e079c509e72a1de627b2dbbdee28/graphql-hive-client-0.22.0-alpha-20230107220029-f240181.tgz","_integrity":"sha512-eYQ1ypekKPfutqYoxHAN5ilMeoqCX2uzfxlnRIdIZ5rSc0zkspkRPQOAl2LpvyIDa32RvKG9L+ccGbSu60HrtQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230107220029-f240181_1673128865716_0.12753682146496348","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230107220657-a0206c2":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230107220657-a0206c2","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230107220657-a0206c2","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"3f61b939e5919b70c2e77cfa47c078aeee73f92f","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230107220657-a0206c2.tgz","fileCount":60,"integrity":"sha512-pX5EhwKC1P/ES+0ea2WYTnN4dIxJzXl9B6ejNOXocce2qr1y5nmI+fAFRwMp0AJHet4u/d5S/7U0p6B9JsBhhA==","signatures":[{"sig":"MEUCIC+Mx5hiim5PiCAVx9bzK+GctiIDPijtNOzhjbRq5xw/AiEAm1p/1d+ORo+xDuonrHMkKZMF6AqQb2N6AthblMami0M=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjue0rACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpQag//fXuyQbIWRBMXS35Rvh4cBFTQPWyl68/oP8uscnCqZ3CbTvxM\r\nVaVAIN3SoxxYIiOPdH5tuosBWRoY37CbtWM4acS+PHkbXaBwHwTc5LJdHEmL\r\ntog90dGJYlRhgSy3XJwsA9wPeA9lhWoQfkGObbfmGofEtl3dWKIOjJD1u4fF\r\nGipv1BSFCFiE+LLVdTQ1LG2LbPJv+hu7InPynuLvd9IYwZ4HdpIUN94+hXH9\r\noDac4oYhCBBpDtZYWY6dBOOCrh/qibyBxSO+opNYiro8eHBHDNVR88MbdHLk\r\nHWUkQI5xzhwCIZC1jd5TdjgOrATVjYDawrBPrekRdzRrsJ7x/czFmN2zJnjz\r\nnBGWgdbMbn2oN1YRf2T9tA2gBfZJilr2g694SiIcyZP5rHaqFATp3w0i2qCA\r\nkjsDEWrmFBThCMfH9U8QP4dI2yIq0/m94t6XQidafO7rLQVhoTzdv8qng/oi\r\nvwWrcUzpf6WC6eJ5uxgapMgWLvVPI4VHXn/VOhS6wYMXZNGy4HSjUlgZKD4a\r\nqWvo6UIIOSCBRvqVIxK+1bV4clxiFLr9nTj06lwlIys3WGWLHLIDXZW2icSZ\r\n7EXYuqU9aGIty8oRwMF4/tCWhaBa5dPEzWGMfACFooSPM9PJ068/EnE+98TM\r\nYOSJhHfb4RkthZvnJS86rizTWTSb7VSUhIo=\r\n=2icX\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230107220657-a0206c2.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/e6a7761caf50c120e98a4fc9c922a074/graphql-hive-client-0.22.0-alpha-20230107220657-a0206c2.tgz","_integrity":"sha512-pX5EhwKC1P/ES+0ea2WYTnN4dIxJzXl9B6ejNOXocce2qr1y5nmI+fAFRwMp0AJHet4u/d5S/7U0p6B9JsBhhA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230107220657-a0206c2_1673129259023_0.765811867042236","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230107221144-482f569":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230107221144-482f569","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230107221144-482f569","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"1fe710f5e4e8e82e09b48f28a919984640a454b4","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230107221144-482f569.tgz","fileCount":60,"integrity":"sha512-y5XU+l0a4cJNSbOxBu8wI4xOwp0v+1UMAFcch3VarLGq35t56imZ45qccD6RnDsWbFHpLiPwUt530DpzQVm70w==","signatures":[{"sig":"MEUCIQD3o+9TVZ1Bdiit4zImboV2GDpspbvyTi13guwYmGPuUwIgOjd3wqHwk6yxZZye09XI4lecTj4cH7hY+Y93AFd+sZ0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjue5JACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp1PhAAiz+BSfPtzCu3hMBNBcRzVlekGi42MOLqb4C1m6cjJmYkK4ko\r\nM19ntw9OH6is60n03O9a78LWDl1eu2cjyUelQUHxkdizg0xAC9T4W2hmOAKH\r\nfD0V2Cc2zlW/L1RcYCKOeMY8xgGUMMwZRvT+H1IasnMZ56INYXBiM9SqN4Fl\r\n/FgNA+IUtUQ7dwEep6rSuRdbSalujqKza6eBjAXk+kRvCcXnmYvbsceJ676d\r\nZ3ep/hJu3oBP5DswyxjRP26+2e2ORJqvGtXlaBHml++PF5VO15iQJx89qX4F\r\nQgQ9kPtbKUxfEA10uN+vCZ6m4q5bmQ6q0/4qzZVpId9MpOd9X0xRX/lbuiG8\r\nePXdaxBrsDRv+M7BuThPvJvBCd63FYVN6zvrirz5wa2kS/L77HsFdO0kqn4X\r\npaPC/DDe/s9kkiRq547XERDQ6Zuozd1PgRKudw8X7d9awnqbUglzGGJbvWyj\r\ndO5cqTfWEM5bFIiZX5blMKYQYnaVxeH6oyoWXSGg6uI+iJSG/QgnoFfMIu1x\r\n1TDMLxcF5wEXF1a13wp6ONGxDOmvDW/1PMUcmShu5866b8OoixwML93jfdEj\r\nj8PAc3ljGeOXTKunaYoXTWYWrHNjM5FeS2HtnXKGS/q7OUUbKoW34Jl95j9D\r\nEzKxTRocGO8GMCcfzIQp3isSmdk0hCN9cA0=\r\n=yrWy\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230107221144-482f569.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/47a55a5797ded811553f1c291c393549/graphql-hive-client-0.22.0-alpha-20230107221144-482f569.tgz","_integrity":"sha512-y5XU+l0a4cJNSbOxBu8wI4xOwp0v+1UMAFcch3VarLGq35t56imZ45qccD6RnDsWbFHpLiPwUt530DpzQVm70w==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230107221144-482f569_1673129545779_0.47802742371025864","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230108091705-314a5b3":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230108091705-314a5b3","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230108091705-314a5b3","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"ca0ec5ad6558385ccc0f75e1f7a2efba6c04b52a","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230108091705-314a5b3.tgz","fileCount":60,"integrity":"sha512-igYY4GJv8M8/MTEXHqraQezDJr0nkGr/RNpimdU+mUAKZuaktX3Kbwy8HHahXxx6rKVkFNOTazyDWShI0DPOPg==","signatures":[{"sig":"MEQCIFHa5Pn2uWexdBRzH2fANQX7a3fIhxzeXfYa9FQ9Y5EXAiADHMMQN9Xbr2aw0xTjqnm5VvpKiixKIYsOO/eE33Rk8w==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjuoozACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpzgA//aTZrRNDWvmzbeMsoTgQu19pyWfXbOLDxbD+IdSo0Yd291Bhx\r\nmHDqkGLd9IE2fW4ghjX4b/erNXgLnEM+bGwsK7h2522y1rGUtRrS+oAibeQS\r\n5ZdwlJQWzxTkpKBg61qEVs1sspO8/qYKKGQebMbrxgmSH3dy8USykYrwoo3s\r\nALjSAUyJflqZU+TXKl0YOEdLEP58Xj7nWvS9e56vHaH78lwC7B2Z8TBIuqNm\r\nPgBkIqQs3rV2cekC0j/OXEr8sUXCz0QUsjMhuC0Rn1ZtdW1lPXiv0uvrFIxG\r\niX6HqrxIX9QXhch5HTJc97T4Dqmn5oAiUTqcgvxfZx1vvZ+Rt7KbSQjD5tx+\r\n8dNv4Schtl7XEZiN09Dzl3Y/i11DSo/TvLHBLtJUpPIyZ4O7DHIWWDqiF/Wj\r\nSlVuY8KBMrBKJLzlKK6oxMBKqIMBaBAAK3pE+dlzaqh9BtuBAS5W7XRlbLNd\r\nkxwQEZ4hFME9zjoEkGhW4COvyIy/KmDAeYT/8cWpzrDje2deGBb7P4QYjlmr\r\naPyZ4uhEKTSMzOvKnDkHj6AeImvn8G0fX4POzmxGWzfnUhIAXqyA/nGRYvbZ\r\nxiGFwB/Hik9jHB3VE2lSeWEucQzxgDn/25V7rFDeu0V1eb7dsxXdf4eiEP6G\r\n/Va+oFjVeAINZ8sQTYtMHfbUYwi42gmHHoI=\r\n=Nd0A\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230108091705-314a5b3.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/c37820c8f55cdeb2fc173e331fb71dd0/graphql-hive-client-0.22.0-alpha-20230108091705-314a5b3.tgz","_integrity":"sha512-igYY4GJv8M8/MTEXHqraQezDJr0nkGr/RNpimdU+mUAKZuaktX3Kbwy8HHahXxx6rKVkFNOTazyDWShI0DPOPg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230108091705-314a5b3_1673169459555_0.2934590494689484","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230108092216-ae19914":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230108092216-ae19914","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230108092216-ae19914","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"e974156d835e1a333b85e5ee082c3774412c93aa","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230108092216-ae19914.tgz","fileCount":60,"integrity":"sha512-8wtwHQOCwBApIUwty06BMAmiqmbMGBX+aCa2RniBVzlc0IfBcL+BOHNnaNKK/o5oW1xpyVnZFm9K5tee0nr4ig==","signatures":[{"sig":"MEYCIQCjpeDJvz7woUvUgx0E2DrXxWJKR2FYjlMQ/uAfJcG/1AIhAKiIk6HoHAzTwCUiSIC2expMV3n5820hKv1EMeor0i9n","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjuotrACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmqjrg/6AkMfdNnDwmgJKoWVdAAYpgavjUgYk4pDOLnNsaRvG3vuz1/t\r\nI+AyOqlIRTn4VxaQFivMMZ+xnK6Ge98EFGopCrRz/xw7qyGg1rDTLezuwZBD\r\nr8yDT+vxIcRPH7h6Wp95YWetSM2+Lt9MGT+lzPjue9krJaj4dLtop2YyY0oR\r\nVY+jABqBqAG64n6rACctbSckOqLGRoGMKKP7ksgbnOs8KdBCzOMdqnRkZAAL\r\nwM+uPes4kkfiy03iae3whclcQal4do1HYwlnsEUkR63MXNeiF/mCr2IpuGsB\r\nTi6A/EKAtLmEs8MvCDylcWv+vBvGQifBPqYrOsP1FliYzayvRE3CFXehE7Gq\r\nb+ql3N2pjefwezgIoNWI282G0pHn2CikjuK9rmExLEzVzs6bEntDdxEFBBMj\r\n7/O99eszQbijEWVAp5z9mYrx9Y9ySiPXQZsJJv0jtIkwg35aJALa80+iM/nC\r\n1GV87oZ1JlugVQKHgVLQwF9r19Uf4UajI59MqJlvQI7WhsgmE7/Lt0ijRegR\r\nE9rK0xv+DYtZ+SRn1j/FBr744K8mZs6L7d2YdvUx5+kHQjgfecgUMu2IPw7i\r\nfyC5weKei1HVPYErvzuUrBqmvNhVB61kMLmy7C4MUylTqlPjgs1lPaB+PWZ6\r\nKuQiQK75d+Kk9A8GixPGRbtoX8x2Tz9qvcA=\r\n=xmP8\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230108092216-ae19914.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/4724440e703819db9b7fa67a2221c597/graphql-hive-client-0.22.0-alpha-20230108092216-ae19914.tgz","_integrity":"sha512-8wtwHQOCwBApIUwty06BMAmiqmbMGBX+aCa2RniBVzlc0IfBcL+BOHNnaNKK/o5oW1xpyVnZFm9K5tee0nr4ig==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230108092216-ae19914_1673169770932_0.25132833961438794","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230108092736-cfb846e":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230108092736-cfb846e","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230108092736-cfb846e","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"cf75562eb25e6a7f0897240dd177a1cd3809c45f","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230108092736-cfb846e.tgz","fileCount":60,"integrity":"sha512-gKeUqkZafAiQeG2tkU2tATeeIuwXNLPDEsEC4SziUcdMtTa7jJQHxNP6oEBvYCpdEAdOUF84e3d/n/JzVQTgjQ==","signatures":[{"sig":"MEYCIQDlfM5Nq0dqZNtmH0GaGMNr74Yu2rXE2+HCCf/5hcUQtgIhAOXy85KZnLykJzlMIdHTr/ENb9AX3Ob/qbTGd7W+yUAk","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjuoypACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmrx6hAAlIqBhWPjVjZZIjRXWvbkvzWHKntJxbyYHvVa6xBv1kZyiLsF\r\nJmQ1f1FhjwGhdYTqHJmwd+XSRKUnabJzKPD18tR0DEiqfBL61Mkhg1pdtI36\r\nxCZtGxON3oFL1mq+K3FO1X4SV5+37l3B+1ApYm1XkVurfjugH3eoZVx1ol+b\r\nSOaP9p/qkbksSmN7fIjDda0gMnB289szEicjUQQBzwpnyCHS76D3mdjAwTOl\r\no531hi/amKqD3hGyZNSp7o6bcvcXT+a191WWa4EpGV3UZ2QIBPy2LKyfi5JE\r\nMyB3/8iS9C9ZcGQKLzmQ1XKhcff8tS0nmxCZsOJBY7LvxAbSEMBbjzp8WFMt\r\ntTLQxWzuM9igQJ2Eevn/VUWiXUZMGVQ1X/RmNQyXs4XVXVghDRVWU5aYz6Va\r\ngIvyFZkOa669kW/inQcj4DPErLJ9vUVXs/zHWY15SttjOhEr2tnCDQjusrlq\r\nvsablG04v5HRjCl4gnr1FmlFtZDVD/BIxbQDnboFMUQoORQUHoSlRQXVrmBH\r\nKZQtItfOv3bz/2BBFft51WFjnRK4fbBVD/ZykclJLbqXK/zLalp/GqMYXNKq\r\nvsrpjGMX9J6P5dm6/YwDVNaKcc9y0CpKKJKK+GE5Hw3AMhf6kfiwmnwnt3A2\r\n4JGNTo0BMRzCpOUk3mJWr0yiuH3oWS6QxOw=\r\n=iFzM\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230108092736-cfb846e.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/0e4b91ebf2cf1a071bf62d560d8ab26e/graphql-hive-client-0.22.0-alpha-20230108092736-cfb846e.tgz","_integrity":"sha512-gKeUqkZafAiQeG2tkU2tATeeIuwXNLPDEsEC4SziUcdMtTa7jJQHxNP6oEBvYCpdEAdOUF84e3d/n/JzVQTgjQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230108092736-cfb846e_1673170089134_0.27751557066441634","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230108093331-a6ebfbf":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230108093331-a6ebfbf","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230108093331-a6ebfbf","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"8d2e4327661c2bba7a362498997eaa5e4e80ab15","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230108093331-a6ebfbf.tgz","fileCount":60,"integrity":"sha512-h3+PQ5LEgpSg7Jg5O41Hrw9ykaSpAsWKRfhKDprr+ns73PC95BwnK1JQ+tEZmjqp/XJSq/5TUvW+veikUHqC1g==","signatures":[{"sig":"MEYCIQDHquPSUiKVyjDw7u2N0FUhnnEAY7kdHSwNZn/rOVhoAwIhAOg9A5cIRY8FMAKxwCtLbWMmHuZ8x0mUdai5CNrBxMOC","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjuo4WACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoHqA//f4E0iFfDiE6zqaSoolIRJ0McPBWZyG7H+HH0VS03M9dGpg30\r\nM9ReC8ZPkrRY8ZYZIT4RYc1d/vILAB9IOEp/dB091wonafwR4FBq+nl97CE5\r\nTBRGEDEcKvSmKiWwIgK+iKPKwZDNbKw4KilIRS5DzhMkAsCokM90PVkwpQO5\r\neyoSpR2BFameuYUYo+8gTER94es6ZByAqh0aj9ExFsJ1I7MYJ5lYyjcmZg0/\r\nVo08JG5ewEOhZHKK7q/8ovgn1loF2y2PgKXJe0nhD254/XdQ3dCPjQus0T49\r\nyBQr8IfukybEwtsCpKqTwsRndfKrVvrww+HkTSPJub3XBp18ZsWHviwxpkwX\r\nqEq4ZZF1sXgipe3hE4gUyqFwxy9zZaqjAl+U+fF/Bdi6+Pe89/ZG+8/fInDb\r\nHhjKJiBYiwqGaEaypMR3rQplLLvn9U1a6WKtsguEjwGAfAd0SXQtFr8JDAU6\r\nygtyie33FTApwDhkDHmvBbK32MUbQ9CAP8szdDLp1TC3PCCbVT+6ZfGh21te\r\nHtWnCueeHkh7QrMLIV0qKDeak0Bx2k+EDFSVcDw5uFYCxEkTPlgz043gXxA/\r\nrrtktQ23553sNGPCL2wTQJXzezLxoCzcw/lgcrLUiv4LliuMn3KivuT6Mk2p\r\noBSZP80rs3zOkY4x4wHMrfemuiVMQaA/uKs=\r\n=5KbF\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230108093331-a6ebfbf.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/b2654afc51223ba43cc7d944a3bb5ade/graphql-hive-client-0.22.0-alpha-20230108093331-a6ebfbf.tgz","_integrity":"sha512-h3+PQ5LEgpSg7Jg5O41Hrw9ykaSpAsWKRfhKDprr+ns73PC95BwnK1JQ+tEZmjqp/XJSq/5TUvW+veikUHqC1g==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230108093331-a6ebfbf_1673170454109_0.10735737028119519","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230108093512-d5aded9":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230108093512-d5aded9","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230108093512-d5aded9","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"b5f75276570829abc6f3d80be89b2d23a55cff51","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230108093512-d5aded9.tgz","fileCount":60,"integrity":"sha512-rdfcigtivloxSPj2y/UAvuWD5OPcPaNo6+DRz/ax9UsIWVrEERrB+E8bsFFmx8uCoA/bxh/kxfpaiL5EhlJ66w==","signatures":[{"sig":"MEYCIQDB0XVlUZmYZE1B4w7Z499dgB/yvLstcSWQAtXV8W4qEwIhAMbKZ0Ln4Grszplf6kxg3Kuud94qUg0Ms1IdDhtKPJSP","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjuo50ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrYbxAAoIivj1AocdlnsVJp9YLYoQfO8EqnpI/xJa51rIfnCH5dpczH\r\nV6oEn8ZRacvY+J2J4pLr8hsTLQWXWQftboqT4d0Te7iC2ux+F6OJd13qIScz\r\nLgwFnhryD5L3evN3UwivdAqAPggmdobpJAgQP/VRzAlt62V1E4WJHR2oiOA7\r\nGwh6aIoryZvmoIerKVmGvR+ETp9i6mzmZ16nW+FvI8cOcskmCuKKdxwM5FDP\r\nrbQejmBkstaO2hhdPqDRLVi426cIRIL3Mp97QtxwDfCvLZyPPZbGZutnNWu4\r\nBzwHmfT42rPgSzFhz2z4SisNQaYcXkIVB37JcWLH9RXMgAXbdFwG1I0eFArv\r\ng1oB4QsFqx1fsSe6vqkXYgj7sWq6v++q5Cf5yXmNkas/Z99MdPzf8QPCuaNM\r\ncRsamCj5kg9VKXg0oS0VzUDQmPQYTfiUrj+/mY6lVYptGfRda55Mq6p1LxI9\r\ngM+UShSoTR9jUu+fL/N41N47iOnFVmUMWEAdHuoGdoa0CFtk2WZ5OanmUYLU\r\n+DjnX97mk1mPoxZ//NsH6I0XhvgANc/mS5EhXHHnscY6yDeLqyEdhMxwREHo\r\nERVMkjMtt9gmnbKoCVSFli8ck3oeBZXaKlxHgW5iSsZzEwnpNrov2zvNJon5\r\nArvXmlTPFztjatLB6JwhY5HJd3LH7GVTLc0=\r\n=87sr\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230108093512-d5aded9.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/1fa8101b88f51a19ed2d68a1fb178b0b/graphql-hive-client-0.22.0-alpha-20230108093512-d5aded9.tgz","_integrity":"sha512-rdfcigtivloxSPj2y/UAvuWD5OPcPaNo6+DRz/ax9UsIWVrEERrB+E8bsFFmx8uCoA/bxh/kxfpaiL5EhlJ66w==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230108093512-d5aded9_1673170548191_0.44971129248924724","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230108094512-43af951":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230108094512-43af951","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230108094512-43af951","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"9cab02486f6ccf37be02614fb83b1a584e8db2ff","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230108094512-43af951.tgz","fileCount":60,"integrity":"sha512-9aVJsN+4YEoo8pzUmKkOz6q+Uz6JWnKGn4QWRaqgTCQaM5GrTvpN8nLBy466v1/CeGTNOIWuDyXLvnEJ2BJT2A==","signatures":[{"sig":"MEYCIQDkcMSa2145QBkccAU2JAbb64haVOoAwwnKP5fAugSFwAIhAJ5ihD87sBxfyLqaO3OuTNqE7LRrWGGw5TjumBPp6+eK","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjupDLACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrYQg//b1GVho6HzXVsZCayhppchoFQ98xpRh/QupX21LKhKusCTwE8\r\nDz/jyQl+kt+dMPjwjlVnWbhH1XZwi0oSLJNh9J3d0t9W1y8Xi/CJVP42FOnq\r\n6KNtdDSB2809eZCM3XzkQhdfiM1ns76h0ufssQwlkw986vs5peWupI3oUXue\r\nSm9Qm6ymHU1xF60l+zn611hDETSmfSSwNiDyJ5PsWcrU1ZndfM9IbnkK/1/W\r\nIKdCBABb3kAzUaR0NHdatBINaaj1ciHrqXaIYouPpY0IcokIO7C7P0bIi7fS\r\nvzKXcDxNqORSVWnv1lS70mMAMhzK/XKK10DnFIxGCfn7cEoQbcrURHZQa7wQ\r\nq1npIlTwo1kImDT7uO6XYQwnUkY5u0+G8+kYAcGRp4Zmq9ttpE/pbiU5J0at\r\nHDhc9ASdj7LPN8lOR6+ZLvZuTeRjDeHnRJ8fsU5d2jN589TItjJSYKsDFVQY\r\nxzvXxkqAheoS7T6+HD0bK3f2eUdQm8BKRZbOWm3/TGaC2nsdUNd17l+yiN5P\r\nMei9HnEdSnbWAroY4iUed4Kwo7mhxq6Ldm8tgmrPRuD8eE7WDq//xj6e5DkA\r\nzRD1GY8H86oqrxWC0fOfZj39UqG2O5TAlZGwYGwJyutCAH/8hnV7JfEwJ6o9\r\nSWTz417wUeqDaBZNKhZSzRSuTg076aJ/n04=\r\n=LPDP\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230108094512-43af951.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/3ac8882cec09f63050530930d383b3f1/graphql-hive-client-0.22.0-alpha-20230108094512-43af951.tgz","_integrity":"sha512-9aVJsN+4YEoo8pzUmKkOz6q+Uz6JWnKGn4QWRaqgTCQaM5GrTvpN8nLBy466v1/CeGTNOIWuDyXLvnEJ2BJT2A==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230108094512-43af951_1673171147085_0.7447104815486056","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230108094534-6a10a29":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230108094534-6a10a29","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230108094534-6a10a29","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"5747c5d4a8fd0e4f6fd4b7aebc193508cfc54220","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230108094534-6a10a29.tgz","fileCount":60,"integrity":"sha512-MTbY65RQPoO1oVe3VVmVC1KIhUO0vyCzghaWJIM03DDp4wHjF5O244LAX+pJcouyuG8hlRGqxhii6DwKwquYCw==","signatures":[{"sig":"MEYCIQC24l70h1a9co3AcboDmqwxgxHY9OllhkMX8D0Ind0UxgIhALq1RXHtvFL6JBwegrf7lrjTxh4DieICtnb1R/CicLhW","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjupDpACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpVJg//YQjkNBG4dXBIsozv+zD7xOQ6Ua6Sq+Na0VBwPqDsK0EKYrz5\r\nlc1R1qUwVvg0D7yc9YBo0DfSfwY/BDWp3KkCHNPCU726wmepnQNHevN+bHZd\r\nvd0UOP5AiOKBR6Z69ABaMkGbc526w6LaGDT0hkb6Ro4XsMwXIIxtVXjXUg3h\r\ndi+OHr2WfwoaJb6zge8/DO91X/zVCOJS0J7PTRZeR6CaHU3Xc/Y/stN8bcc/\r\nVQznJ145DY24a6XNlgtMP5NgeSbAxoorCXhc7TUaFXDf/NWxkLZ6xx+fg7bF\r\nye/WRI1EOaIO1MQAHsvu2IFTF/4WFMJE2Yk0EnGX3vsin9y09ELh/iRTMzAv\r\nOCW5cg8rd665H3Z4Kc8XW8hCpD8rSFOgnsHDSKgs9hjqGnp8dFPKCI8+5ypZ\r\nH0Pw+T1zxV/AtrcnMPhK01gYnvHBfpSb/9RX2WJozWbPtsjDqw+w/hCMQeUa\r\nT8AoUq8DVDtLejjeiJI4i9U6KHX0VhBKZk9uNTbjAcqPzCIpvmIp/YLA0hLb\r\nhZQXGe5JAN+eslSUUByvb7/WoFL70DczG+qAd3Zv9JSl+sZV007QNGdk++uY\r\ntWV3EDgrK2C/czoiukxAx5VL5TRnalQ0+xqSTklwqa37AUL9YBL96vQ0iq5I\r\nDX69Klxecm3yo32wJcfwMASohhq9OnnexgI=\r\n=bFp8\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230108094534-6a10a29.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/06837666502fecfd188079b7a4df2896/graphql-hive-client-0.22.0-alpha-20230108094534-6a10a29.tgz","_integrity":"sha512-MTbY65RQPoO1oVe3VVmVC1KIhUO0vyCzghaWJIM03DDp4wHjF5O244LAX+pJcouyuG8hlRGqxhii6DwKwquYCw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230108094534-6a10a29_1673171177286_0.9153945037559803","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230108095101-ff04219":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230108095101-ff04219","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230108095101-ff04219","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"cbc92af90951203fef6ce036990313dd6518b507","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230108095101-ff04219.tgz","fileCount":60,"integrity":"sha512-pthmNaZePjcnsB4GQbxFl3Hb0OntTzagLKubtYNg8/zBE09UBLzBG4Re3kv0iRT0MqzsBaEjsFAXfc5+K0cjbA==","signatures":[{"sig":"MEQCIAPLjthBuYmxyj96F/7Ogg0uLS92k7f6nfSAxZV6QrarAiBfPR89iUGf4y8p6jCeFi9qf//eKyM7RC9U+L6r1G799w==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjupIoACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr32xAAj0pyKk0V+LsP0eq8GO+aTjFCQX1da/q5OKYfw5GtMnPB39XG\r\nzv4/zqQurorghlo/kF1lC4mJf8KnRsko1tuQM1etvsT5+qNd4xGft4WMLjNC\r\nErs9JgykVXH305SKPXlFIhl7WW5NeYuEn3VDSobmKEDSm9vgjb6O6Ox11z/I\r\nm+Z9o/uG2jVm6qjB47UtQae+RspWKqLIb/ZjOYCttbJeXilFciTEXG1B4/fN\r\nsa/w/uQ6wyn9s3eq6dVTwrZKrjghU4Vk1Rpa68iByCe1MkA734nmkH3Mh17M\r\nsxh60+ciDS/fJPxOelOC1bq3GmhfRVTHgOh6vKAZCUdTTMEgxoetbvyZApCd\r\noHBFbCJJ+JDMIrgKW10EImbEeQmqMfs5/+i5wkiU3wGRfGHw4D6Y+MRan66V\r\nrjhSFNUFlPhbMp6ZQ2FZuonPHo+JYxZ09TEQDh1Z8bCmnTWZ8hYPto7pUR+l\r\nP6+kQGovpk1N59maLISCUdUpqh/i8WHWB+gN6vx7A6oiVav7QREUOc2CTyFd\r\n6/2oYfKDKpkq7ieZGc4wa5sZh+hB9X9kYlw+1v9/p77QRsjqqYqGjMwAsZ7c\r\nleEeNg5q29pSjxEvc/Z5OHi4v5fM8lr8/Z4OhDrIpr27h34cLN5s2Tjb/p+J\r\nT2HRRGSAoXmntID5ehJFt2B4oqUGPNFSPKw=\r\n=Z3tc\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230108095101-ff04219.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/2a75ceed85cb53f88183c66e2d1eaa21/graphql-hive-client-0.22.0-alpha-20230108095101-ff04219.tgz","_integrity":"sha512-pthmNaZePjcnsB4GQbxFl3Hb0OntTzagLKubtYNg8/zBE09UBLzBG4Re3kv0iRT0MqzsBaEjsFAXfc5+K0cjbA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230108095101-ff04219_1673171496057_0.979822317693428","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230108095613-2e8ce25":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230108095613-2e8ce25","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230108095613-2e8ce25","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"a3d885c8d5aa9833b5fa4084832ca43bc2eba889","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230108095613-2e8ce25.tgz","fileCount":60,"integrity":"sha512-0y64m/ry3/I9BNsDoK0x4PIyN8k3gKv7khpFuOteT7DaEtZjZlXWim/uaVG1G1wLg8IbTYtNla35se519MXeeg==","signatures":[{"sig":"MEQCID+n7ioK9dTuwnfFq1YqSoW+a6X0UrvPpFYzf7mSa3LwAiAcENigyo2AOLMcZMRLGYYGzQi2VQIUi90dRmYYiOiiBg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165581,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjupNeACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmpwyg//U9US101u0tUEmH55UruDtE4HUaUgSvamzVxxExZin3af6Xl2\r\nrs/Ic5fp6CDYyl4Wi3pJoTmpMD71K19AuBqEdG24VCDtnKofX4I86BC/Il0d\r\n/ulT0cjR05b3hbjzYF4NDzcNphO2cyaCfQi2T6WM2qbcrNduT9W7cvgf5CTv\r\nocZ74GVr41/Tp7y2zufspL3r7CDpmIEKby66y1Njk5nYLceI99CNc7qM8Ln7\r\nwfwqI6hYsddMSPlIGZH7WC+iwGaRLFiFfcerNtWGzpr23LSFkqO26xe6UaFo\r\n/spJAY6DrQ7/7lbGjTyf6hdT4Bh72EPJmFDBFqFFHYpHZI578c4chD2a/lbc\r\nle4EFpwOn4HFhPFir2B6gy+e5UrTQmtVfKoHHc/7bM8CQrw0nyfbwYM0iJJJ\r\n+z8UVvtPahg/NBWx4dDhgDZNCUhNFP8ae7J/EcM9SN1adexVIIEhXMjd3DJ4\r\nH0OIt0x2wXrj7hGB1R4M28c8l8V9Ke/tw0ZSRkrRvO3tR9NXx4JNrCwhkAFe\r\nrxiqiltQBDVRGEi1gqpN7gvsN19alRJj5do817RUrZsQwDbqenftgYvhMX9J\r\nqvP+TYvRWbtLYRU0HBxe1OK7GgH5hvXPyO9N+97v5ZyMC+PabfKHmOTubrOL\r\nM2ok9vDzDEnRK67gAXhvQeNDkkqDBjIMr4g=\r\n=SZaq\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230108095613-2e8ce25.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/0378cfe84419d8c4eba7840b73b44eb0/graphql-hive-client-0.22.0-alpha-20230108095613-2e8ce25.tgz","_integrity":"sha512-0y64m/ry3/I9BNsDoK0x4PIyN8k3gKv7khpFuOteT7DaEtZjZlXWim/uaVG1G1wLg8IbTYtNla35se519MXeeg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^9.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230108095613-2e8ce25_1673171806381_0.7807101385731081","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230108100215-28ed9ed":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230108100215-28ed9ed","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230108100215-28ed9ed","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"46aebd989ef3c0646c62df501257eb9ba7eb3bf5","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230108100215-28ed9ed.tgz","fileCount":60,"integrity":"sha512-88m8H3FOvw4bnYA1Q9dg7Hf4Lkdan5Hi8uXKqhBlH6g0vHEpxgOyNP/465DtVz3wule/VuyE4Vkf7+VKmy+UHQ==","signatures":[{"sig":"MEUCIDBZoFNNRVWTuqC8i6KCSJIdA/JcMLzS8Et/QuOfIrpiAiEAyJQhm6ktb0ZEQ1FYmTVGdq8PW1M/B3QkDD7t/LKdSzU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjupTUACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrhwRAAg1n2C3Qcvr7Fbg4yIKZANyvN8ZwrjLVjneKOAf5lVcQJGrnL\r\nNxS1VPYxvOkOCgoem71FvqKm2sJt/YYuv7H9CHgleju1Coijeh9tgaPh+Rk8\r\nJJLg2nTURtRbSDrXPM/GIFDBRB8V0AdRfmNInVb9OcLrpqb+HwgC0nMxBlmw\r\nHAeJ+CrzJEufQYBQg5MdxFogQssUw3NATv0bIz5LBg52UohoZQabquDiWkk/\r\ngcBQvqusWEKkogFWSsIxq82ZAZp/kkiqVyhq5jLEyB3EgtE4IeUn/yjUaGM+\r\nTE1zvFuwmXEgRTmwtPevJls5EiNtpWe9m2bbY4zgqZdl8jOLW7v7sOSgvWjC\r\nAUDbjR558oPTjyd+SHTBuELkAMFlksDBqUJjRxBU0IVhvdTA9BqdDsHBM3sv\r\nNVpxuuqwwdDtlg6qlPwZdRNPU7mX9vOf3tUb33YZ0o+pNxpyph1XSqE0216K\r\nxQBOAa8LT1O3sIZb3XXlsrErBNcQCKV60X84XupEQbcLhceHSlQmyvbmbzmz\r\nxXYHbV+VC31QwRNhXyRpws8EXejefaARbvOu9DAYuovNTHRo1SqcwMYvacsg\r\n9GiGwCVPL5vd0kmZiEIUmhNM+V7HtY0QVdBBG7bTSYaVdd7/gML8EXcATovT\r\nw3Lr3/GpDylKp+8v4kp2ef2PxoTAbg5J02k=\r\n=E8O1\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230108100215-28ed9ed.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/13be40425a84914cd3873fbb4c1f7b5f/graphql-hive-client-0.22.0-alpha-20230108100215-28ed9ed.tgz","_integrity":"sha512-88m8H3FOvw4bnYA1Q9dg7Hf4Lkdan5Hi8uXKqhBlH6g0vHEpxgOyNP/465DtVz3wule/VuyE4Vkf7+VKmy+UHQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230108100215-28ed9ed_1673172179808_0.28695407209560675","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230108100701-421c729":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230108100701-421c729","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230108100701-421c729","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"22f7ae3e6b1b319f303f3f46761ab6271cd4e052","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230108100701-421c729.tgz","fileCount":60,"integrity":"sha512-m+Kd9Hxl8pGN9mGDZ3n3joSkiMcSJm5BGcqRg7E0/Id+ILQfIbp8e+UM0Aj2Ti/HX5/OcT7YgT3zPPkQEo42JQ==","signatures":[{"sig":"MEUCIQDUPdqU5EurzKeFfVGlhBW2nimtlMyQn7ZjHQtyn42FygIgEHpsYmvYyUZgqwNtabkEgaHg6WFZ9EbZyb3PEw/nqTo=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjupXoACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpFJA/8CvMBStGa9BQ1D1ObcozkE+STTYRComcsBH/bus3jQd8fha8c\r\nQBsR94UQU/yyLNxy7WyRZI57ri8hN/nDs7YkJ0atlhwy9Q2YutPD+DtTO07m\r\nMTBqW6wgeavEmBuzJazF5Khuspp3bQ1eUYRl7+7PFUQaVSUG8AqJO/0bl9dj\r\n0ol8GXUu/YAhZ9PMocuseMVQU8nbcQ1Hgj07To6hAfXectDfnp6B3HwjKy2d\r\n2Aowm0apdoboISXxe3o/+vOibY7nim1pKv4zMt6ijfa8hrfHYdrMvZiT4Ftj\r\no8uyUfnFpihlDCy4mlvPyi+LmU4B5fVSeb4GqoKw/5BEcflMqJP+vlAcWklN\r\nzUutK4YYDP5QZssEJlLcUINNdYMrpyQusl8d3MCpDsxsmfWIao14gIYHt/Qc\r\n/xsHx5zyFZ+PG3ZmV3vVdv8olRTnBh+/6brzVdmBqgTNjFVm3V+Olch4QHCo\r\nw8jr4mBsNlKWZ7N1hPd3dLPjcuYk8igTAOb4LHhpclvnKmf5G3EV8SsEbW/i\r\n9A0PeOyDt1iFhX3HxjFRWD3zIBfqiy8b5QZsWTyjjrgOewOGBRhsxy7CQ2HI\r\n6v8WppgG+bS5NuEfcO9uTzTZi8ODnegWYF+S58PepDPV+FD2hdjMYoj66l+1\r\n27BxVV65nDxh7Bk9e10Upl5x9KMYNXcQFlo=\r\n=Cik1\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230108100701-421c729.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/92645ff3ac123f9d7bdf1741aabe662b/graphql-hive-client-0.22.0-alpha-20230108100701-421c729.tgz","_integrity":"sha512-m+Kd9Hxl8pGN9mGDZ3n3joSkiMcSJm5BGcqRg7E0/Id+ILQfIbp8e+UM0Aj2Ti/HX5/OcT7YgT3zPPkQEo42JQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230108100701-421c729_1673172456279_0.6490595018176106","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230108101220-47d099b":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230108101220-47d099b","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230108101220-47d099b","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"24fc8307073bf930e13ad9b31d1536a91139b45b","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230108101220-47d099b.tgz","fileCount":60,"integrity":"sha512-wEKc0TyKGGH65f3//FOJuYkwDWZtMzg4R08HBCdkoIvSz+P8XTxOFN6YGmsBxizJTsRnCP/R0AeWvjZfs2GSeg==","signatures":[{"sig":"MEUCIGM0m3jywxREtXRVB7gFCYBxtAZR0T5YqfgohqeE4NucAiEA/x8JVDVZacGVwMzyM+9yOiIVXrq01+cceolqOVp9UJE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjupcmACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpMcQ/+NULp8ef3zKufuJ4VbkQXSc+CS20reTZSv7BCf6PTHZNhSaSc\r\ntxy/GTZHl+tzWHa0kiPO8MsEhU0i4hLUHIyPnpkBr3zzqMXFjXZkO6DUC82O\r\nUQfxG6a+o9MfXCTgOmLSEGtBG4qZaz92HCRTWlYz3EJK9YnEJWfFAnLVE2iA\r\nv52i8BGs1CKe/q7YYHbuqRx4NhMJzPIKwpxis3OSrdh+gp9qmrvQDFN6Y0lN\r\n13RmB1x1wEBxhoIco/KW8CKbwrC70+mbfJZHdWGEsvZsKd/LRGuKEvoHBbHS\r\n8qwfBFI8NyDrAQbjcCiH5Bu35tvbVPwN3SpF0AlM6XOS95QObyPfgeVEpBci\r\na6JvV5aS+BSCQddthFV0hMwnnNIaRvZk4EMIALjFx5nbla3zrngHw4eEKvAm\r\nYH9OFnbebWyKSmaVMmpirCuiq8PX6IadBHDz17HNKw5HfC41OMU5bHPzk0Cg\r\nn/so+FD56EtKZA+hK4TBaX1SBWYFcI1vzk9DqEf5KbUweXXIfBuDVwjZcg18\r\ne9GI0dRgc5gXMdU46Z0QO2CopSJBRBlzX/pZ+BKbq8LmG27QsOMHPHf6KsEp\r\nhWyuCcMbqrW+vqFQ8ng9S/OSLF97f9o/WGDM1EG8Kcivk7cfOHTnkXHWdNNu\r\nJc+9WG6K7QgzMbLJJ96h8WnCq85ZncI+qOc=\r\n=WPnU\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230108101220-47d099b.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/d707e38e82f8f8b7eb6bb85953c601b0/graphql-hive-client-0.22.0-alpha-20230108101220-47d099b.tgz","_integrity":"sha512-wEKc0TyKGGH65f3//FOJuYkwDWZtMzg4R08HBCdkoIvSz+P8XTxOFN6YGmsBxizJTsRnCP/R0AeWvjZfs2GSeg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230108101220-47d099b_1673172774756_0.05830896357277582","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230108101735-9ba1ee3":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230108101735-9ba1ee3","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230108101735-9ba1ee3","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"5cc02bb73b50ae1268b7e1f8791d09819f76f47c","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230108101735-9ba1ee3.tgz","fileCount":60,"integrity":"sha512-u2EaYxmLqyfPJQJRCHJ88XElM01YbCrYFZw5FhUvFKwGwAZ34TfrUF7+jt/WIi1pR9EsEyyhHe48i5VHskKw7w==","signatures":[{"sig":"MEYCIQC3NGfMls6SDClZnkaFCLyOwl5M3P3ESMFnEa1TiboxrwIhAOG2/y6m9VQXECU1kCyJAX9e1gDP3RE+gEwfK09KCFJ3","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjuphgACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmptOg/+J6zjb4U4S3bEuGakUJ5fxnB/mYGgyCRHQVeG2gVeRZyz0vDm\r\nTcmrAfvfSOtbYGpW+wiZGGNwL/vh4gmllRfLt+yRXRvE+GvKhDqfRA7m5EpY\r\nT3gTj7o8Fp2igGt5i/aiICUREmNEhf0JE5k5IH6EuyJq0KuVxt4ne/+uz6Ze\r\nXbAI+AJXJWShvmevikfuyhPwv9DTINpiBkxovr6SkA8GzHt19R6A6c9CH7wu\r\n3hxRIC0GwGTlbOiR4nc1OgjW1MTG7ryOZ9UdumzJz8z4KhRIMqTgzoPr66Xd\r\na+r0mtH5ADz/9UROMmOP91yU0Pkw9B3opCHApiPAhp1Nb4mONXwxosWIFGSZ\r\ncmOh4Z0EKWaPIcD0R+OI1Nym0zXI9wYZQVictjhlg0vNFFyftLwj6SbcGXIJ\r\ng1nnH6WOlOi0HqVyM9LaA8YkHED1LD3iiHtUqSGI01KtqPaxf0x9u3QRXSk2\r\ni0Jeri489Rd4oquRyGl6veHpNtBGCqVa8GzZrbEmAALE+XioF4w2lUGrP+H/\r\nS9NTs8IswEgvgnb4uwqglBGblXCpELOw4gAdXhTN71HNTalt35ONgmfJBE40\r\n57wGcd5CDBIuyPRcheT+KLNadI4+GEfhamjvzpyUNnrsR6X9QDbOvl8KxdGU\r\n5hTyR2h7q2kFQwFmDCCcsmPHli8Ao6ViMaY=\r\n=txYd\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230108101735-9ba1ee3.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/b3b7e947f475ffc7ea49abe29d5a7bd3/graphql-hive-client-0.22.0-alpha-20230108101735-9ba1ee3.tgz","_integrity":"sha512-u2EaYxmLqyfPJQJRCHJ88XElM01YbCrYFZw5FhUvFKwGwAZ34TfrUF7+jt/WIi1pR9EsEyyhHe48i5VHskKw7w==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230108101735-9ba1ee3_1673173088352_0.8322761979583058","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230108101941-dd7ceaa":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230108101941-dd7ceaa","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230108101941-dd7ceaa","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"e92a231d0f39d8bc353468f4d37734b7d4dcaa8b","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230108101941-dd7ceaa.tgz","fileCount":60,"integrity":"sha512-v4FY3Y0xxPh87jtJpmxQuIumWBmGJolalSfKakqs800qlGv9NwrmwZSVVSz1Zf/NAes/5+jBeySf/BoQgNy29g==","signatures":[{"sig":"MEUCICWkhfTCwJ8Wa1clYE20nUFxFp3sZtjrueVJ7gIqMk6cAiEA0VbnK7MzzhUp8XHNmZpqiAmHnR67K0xlbPedtfNeIX8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjupjfACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo8Iw//V3d5qrK8eTQbIqB/nG2DPjv3GbNX7nPqz8c+4ouniDsY2UF0\r\nadqMQ2VZhYYcQwbMUzQGekQOQeaBGXL6jGon+aXa81u1ckDyOkjDYNTA7j8U\r\nRQixSctrinxZvbDDRpN0DoJskH2Q4lqE8aZmItKMhvN9vsTvHRVjtnG+f34N\r\nQN0RoD5UJY1pjnvySJzeiVtwIPrGVzolW2krEebURF7MrXmbOH4MVrzy40Ir\r\nkF/z0a7qln+09iVyp6CNoDmnWNy/5PgYReXU6S1f1DwtVx4QBR8mCWQmkO6s\r\nfQhi/JOZm8jsEr6NSzp+kvYA4lAV4Oxu1tXRwbu9cJ5NWWmjME77oaVY7K0a\r\n2w9MNLoLT4XmyxBKzXChdCjZmsAk1M4xNGXGKCKy6l5K4OyP5Lch2tptn7Y6\r\nnSAXVWbEtxS94aXHRNt9KMCgY8/3jvIzUNZs8m3xGOA5NwAo5+T/GhqNFBb8\r\nlWqDifQXLykp0iP4g9g3ZDpEpqaQeJQlUapnAVWcOy4QADRLRN3qRS1r2aAT\r\nY/4EbTI2DKcLlutlmzop+IO61k02jcHO3O9GLW62WiyRxpMslv6oYYFCJwR5\r\nWMG9uT9bR25sMUa+evc33MVymXcJ6+/kDVn4/u6k+P0OVd8E0CL4N0Ed2KPc\r\nt9T7yl199IW0JpDsavvRefl2/YpPb5HgSvc=\r\n=gv3p\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230108101941-dd7ceaa.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/e8f209b45969a45c0cc5e2244f601b1f/graphql-hive-client-0.22.0-alpha-20230108101941-dd7ceaa.tgz","_integrity":"sha512-v4FY3Y0xxPh87jtJpmxQuIumWBmGJolalSfKakqs800qlGv9NwrmwZSVVSz1Zf/NAes/5+jBeySf/BoQgNy29g==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230108101941-dd7ceaa_1673173214847_0.2137653065416345","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230108102948-43a6e40":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230108102948-43a6e40","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230108102948-43a6e40","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"57f4175408a5928f132de3c5dd4f3d5dd4db4de6","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230108102948-43a6e40.tgz","fileCount":60,"integrity":"sha512-0+lC8vNFTqBzyDYlMHYa57+GEan7PU13qvNsbg2VBHwkGSTm3tQPwA8mJ7tGx5DWwzyvBl3ENt/xVOMLjBcRqA==","signatures":[{"sig":"MEQCIAEnYHEV7tlEZK47rTdYnBUpSbF3xniFupt3WVHcoC08AiBYmfuFozCHryHIhMI3+104flVpaaGapUs4cYrU/maCgg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjuptAACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpFGg/+IxAn/mSRtDkovLe52rMTp8HzzSC/tmth91fDqNQ7wvds2KfP\r\npZdQ/UzsyEI82mS31kdwwu9QS6KMFNiGm1LqU6TDZpzNLKg/P3NEg3TRjjK/\r\n4r2ao8lxquFXE/bqtdpqp8RsWoTsOOmhoPRWGf6lMSERMvJiPuNOYRsBp0cc\r\n/F2YBvO4Lh8G98DJfa7MCvFZh8B4qxSwL5zgS7dNOpAEXMJmZo5jPnvMksMk\r\nxg6fD5jTYx7h7eRsH63fNhUGtPMPn3Dlpgci20vXeH6mQWx0qb822C1MHUrO\r\nUHYFsTRkbiHqjlqYsLIud4/07QQbAH2qhM7EzmQjbryd18pJLZk/VqV488Nm\r\nULEvTJS6DVNZJ6tyJrk0jlEc3KsgwLafc1WPTeZABISuWZExSOSeyrCS/o0N\r\nE/RWFNwPK5B9ZUiavHZzEtdYMbcoDPYoQhOyARhD0ZUGf0dgYusRQaLiBVD9\r\nU0ooS1mWXsO5Wd5nPq8nWmytgk4dBYL8U4t7wGbLQV5BtOmuxCQ3G3YjU4U5\r\n40z0p7CDKCE1y9XrRpZOLAXum6HTx1AqBLoLBGNClJO7vunokTIye4LiHmmz\r\nhYxJtH0DIMOKIUlpEMoelpWZFsaJQT4Tlz/mttkdLrOPfgESIDE7ZMi5aPxH\r\nOtL2JZynVl5RYeWLKQd0Ng+Xf5+sI+QCETE=\r\n=tSiW\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230108102948-43a6e40.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/9d3374f0128072e75670e5fd1b2e13f1/graphql-hive-client-0.22.0-alpha-20230108102948-43a6e40.tgz","_integrity":"sha512-0+lC8vNFTqBzyDYlMHYa57+GEan7PU13qvNsbg2VBHwkGSTm3tQPwA8mJ7tGx5DWwzyvBl3ENt/xVOMLjBcRqA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230108102948-43a6e40_1673173824110_0.5552057899384812","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230108103009-0ce0ebc":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230108103009-0ce0ebc","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230108103009-0ce0ebc","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"d2be4c6a5be730ad827988beeed1f45446c0f22c","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230108103009-0ce0ebc.tgz","fileCount":60,"integrity":"sha512-jpvzpvJICfgfpRecPP6UhIkrUYBctCpEN04xhYxpbfZx5OoQPPbuaNru+9rCoh2V3/rllL5tUwyM6dawrvo5bg==","signatures":[{"sig":"MEQCICcZ+BcR2/FiM/4wb1KMk0XwNfxU8yF6EZcvzIMw3F4RAiAv7eI6Lzl2XdKlV80cwngit/dPgcKlklYhti0eZHNFZw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjuptbACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoWGBAAof2617E8cXpo/yfg7l7+18AOBNNktz8x8x2LyYJsQUBoBFt/\r\naU6ODmD+4XxBrtUfVo/rOflA+5iwekKMWTJzt0hDQYwg92Xm7ZwsuLtgCFu9\r\nEQOVc+iY9QjUEZ06XwYoIepmbI7B/RIf/5pqaBKaCvODWZKuoWjk7vB5PUUb\r\nGRdwvmXs4LduF3OiX249HwvhMSIva8inssLOtVlY6vme61Rs7b//UrwSlqOi\r\nVMwTvpPUzdHDnHDdFgZFsdyfaaYB88YgjXxTNTxgbcXK9L8QMyZc2rCEQGvp\r\nHni7b6IyRzKnCuL+PRweJVOarj8IJRYwn4+Uc+BpcvM6W4nQVolCOooC261M\r\ngM4IOZnm27ilOvwF2+szGWYchP6H/hP29a2ySuOBLBAuf8DaKE5DPzEQm/Bn\r\n5ZjUKm3ThlHcesghkmhNklQS0gy9T7ISm6Z6gbZAbBA4Ol1ufocnqGWzSAmb\r\nNddBevDdQycQ5ms9KnoeS8lCSev3/ycPkewQOo1d/WfkzJ34DhUhcPkeaDwE\r\nQzEgxgnSs/UCE0oOEDQp/3BZQy/HwnaaVmNYBdEa69XhgBwsuc0VUwbL1DQ6\r\n4+t6e8NsSGtILMIQSREWRRdm9JwR1fN0LOqt7PKcenLR4evWdPdemgo1Ui7/\r\nzf8zJNOrQXJ7NfVijV55FZ8NRxAtYMYOwr8=\r\n=WkMp\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230108103009-0ce0ebc.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/be998153717e57ad9ac55a54d2724f1f/graphql-hive-client-0.22.0-alpha-20230108103009-0ce0ebc.tgz","_integrity":"sha512-jpvzpvJICfgfpRecPP6UhIkrUYBctCpEN04xhYxpbfZx5OoQPPbuaNru+9rCoh2V3/rllL5tUwyM6dawrvo5bg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230108103009-0ce0ebc_1673173851114_0.40052209863451016","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230108103632-f310374":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230108103632-f310374","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230108103632-f310374","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"54539a097e29ea41eec001a2279a627424b53092","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230108103632-f310374.tgz","fileCount":60,"integrity":"sha512-S9To7OVQ/LROgM+vntYzgngjyxemFYohlTckXFJuk0L6EuPHbiW1c4LUMe9evJeW13KlsoWihU2gUfLr3PmQPw==","signatures":[{"sig":"MEUCIQDyM1ruldtNZu+E4fjwFvVjGjUOcKQPO/wAgiYrFr5VSwIgUCCGyqi3b6Gj9t0K29/r04hM7LH40ATounqiPRN6awU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjupzhACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqXSQ/+PmXEUgXpIJNk/JIBSReb3SrrgozHHUuhKGx6RxnUvwSO7uiB\r\nHMBHM3karRDOzi9aDwWFKUsfk/HYVIy9VcGR62jsCW8Y/P+8fSiBqDsRAADb\r\nYpXR6bXWXDJDhxACbD9Bc6ZocTfv0kvdB6xvTSaetOdwcDbPwHaaJlcE9ROO\r\nOcvYgOdylNyYrjqSkL8jla1dp7yiAu7c3SEObxDGuiISslFefLRix9f064FM\r\njeHCPNF46eZ95wAV+e7P+sBPZwFZ2PjzTTHmEBihEGCo0t6xc15LlbrK3Zcd\r\nf0bLlzPewWAcLc26q34x9/GolkDuGU4XuGfJEBEcSBAQeOCk1hU9NZ7maEBp\r\n7oQ0e4HQnOwKPN8Qb9lcNYlp/nnt3c3WDuFRlK/Fv+zWa7H4rWPNUb5/36QZ\r\nQhL5LXWbWFw/oP8H5FeEeKHi7PNB85Q+0GBYAQUbYnLVB0oX5Cm7LxiGmzpH\r\nFwKUFZlbnmORXmCgl/lo/I9SQ14iJfd+L9WegoEpZ1ojXL7Su2Fs1Bd7fh67\r\nhNSCPoP29eHGqyqJJ2xcYVI4bwAOlHvrjwiuuM+7RO0a6DFsH14aL3/JSEJn\r\n7Z6906yFgnT39qJX7C0ixKAIY9SSZhJVsCNt8hFQmy3cQb7kb2LOMuk18Cmb\r\n3TE+cQsWTuFsjoGXslfTxJ8+I/RomtcDEMo=\r\n=obs2\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230108103632-f310374.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/d6179b6dcad541962a23d9ccb8fc675b/graphql-hive-client-0.22.0-alpha-20230108103632-f310374.tgz","_integrity":"sha512-S9To7OVQ/LROgM+vntYzgngjyxemFYohlTckXFJuk0L6EuPHbiW1c4LUMe9evJeW13KlsoWihU2gUfLr3PmQPw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230108103632-f310374_1673174241156_0.9485092822675574","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230108104102-273e5df":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230108104102-273e5df","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230108104102-273e5df","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"335afb74b57dcd88e98de74eb40e80ec46b55fe4","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230108104102-273e5df.tgz","fileCount":60,"integrity":"sha512-pLk+E986rFMJCCndtmotynBugRLp+yJRo/3894EkAFQKaLEANS3ELVjrPRM+kgaBjzTlE2GIUNwoSNawvhoY9g==","signatures":[{"sig":"MEUCIQDIO11zuE/Swzvj1s6aTw+6JHY6w5xT3LHTpNTih/J8vgIgP9ZjR837EIATwxcL+thBK1l+WnZPCo/ovKJtVgaCGXs=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165581,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjup3gACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmq26g//VjAgLn1NN0EzWlnm5mlQtPbPudroiQMZhM1QdP11XAplTj++\r\nosV7/j/j9S2n9GiqGiYph16UvRHoZij0/Oq4B2o8YFWOG/uxP2Ew4sqnWuMg\r\nt3sbHYtClr0XCi4b2673rqUc+MLFV5WqkEsNps0cF/Lk/E6rkU4BJkskacQe\r\nHjVXU4NqbQ4mr6kWnGuGdbfAPIS8y8iIeYTVKBmIuYo1J01PFvruWnRWUT1k\r\nYG4sm+va+N1Kkqh8DcFqGX+vB6Uwju0cYv5ClDsIILokyDH2N5BEictxEww4\r\n7Pm6s6/zQIaCOMrmXvWQsxXIe7s9T7tfE5jMr4zfGr50EIVERhFVk7FOqPDt\r\nqp2hb8KJuchPPT4pSj7yPHoQa5zZg5bGa17HSZE0+vhUV7hkLtlx15CA/L4o\r\n1KOV17Mz/63l7i0jbbhwAJTBgKrtN0IvokR9K/XoGsdsqZ5rMLhMhudYGKZ1\r\n0w9wN8XHXqTz9N+oMLLkQCHgTxLhPqfwogjGhHyzuTJUVL5/92GwYLe2B0r3\r\ncnK8AKxfhgKD4XQcOWJFr87FrF77o7USHADyY7FHMVbaLP+A4w5zFC5iNMl7\r\nGJ4Dsq6D5aZKglEeq0myZjS3kTFuefwrObqNF8VTWBXafrsPlfXWBpRs+X1P\r\nB4kIDilbUXwK5Qpmj6ykX5S4pIYINapOG90=\r\n=vbSC\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230108104102-273e5df.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/20b812550a2f469b1ce50de774d828a6/graphql-hive-client-0.22.0-alpha-20230108104102-273e5df.tgz","_integrity":"sha512-pLk+E986rFMJCCndtmotynBugRLp+yJRo/3894EkAFQKaLEANS3ELVjrPRM+kgaBjzTlE2GIUNwoSNawvhoY9g==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^9.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230108104102-273e5df_1673174495996_0.8924997346903323","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230108104637-7c9112a":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230108104637-7c9112a","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230108104637-7c9112a","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"70843474aedbc261ebd6135233486372a2b9d3b9","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230108104637-7c9112a.tgz","fileCount":60,"integrity":"sha512-0MMkNhsycX7EnZIuqQca3dIl9x+/9EGKMmYmIlSHuJmkSFnGM4GgoCNtxKZaylFbALbJolHyu3yPR1/dT7zJKg==","signatures":[{"sig":"MEUCIQC0c7+0FiakbB1E9HAnyuw0dsuzjcw6wRxDjvQ23ksyOgIgdr+rugnUeSmUW/Sytkrf7YeiKymczBOntlHSdrOnqmo=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjup82ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrewQ//cTru2Ss2wdtdIDLaFQJm8cfVNyEeNOi28hFcs3jf3mSpUQW6\r\nzj8CO4MQuPLjoyENIjlrfB6sjle96u/BaJz01DJMtAscSZCqE48lCT2CH1Ao\r\nqopTNaUOUHNjO1V2hsXhY/KlOpBtRYAjjYEStTT+0bsG0fQa5iUGPnYqBB7U\r\naZBv/+teB1A5QZqGFFUdimNXpvkpBpK5FuR3wcaKocM84ajwml6MYJhjpfA/\r\nR66OEqZMvlmOvkwLNpGfwfA4BDzr+Q0DeM5DV2comuXWqsn4H8ZwMjK3BCKX\r\nyQNNua6NgN66PjW+LFZlxe5dJgY7nfKetI9uqDloaOy3WRVc8K3iZK+1fdQA\r\nEQJnlGA7a0vtztY8T+Gdpd5W/b8kAq8tZWJ5v21SQoFKbeMd9w0FV92NHv6h\r\n7+Cr3hzck2x4adQzghE6oJb2n0Q7u9V0XTe+Cz7ytDwyd18rG/wuiaIEurhk\r\nJJt7JmPFA9a7DUGRu3LGZ+lfg7mzX6EjvjencBs54ON8KWUUE/7zkcHGmAkR\r\nALls3YOYxqa5I/dLB/kOU3ADDfytyKouHYhefb773Buy6NjedKO58Nq7fYwP\r\nGLAp1uHBg2hi1K9G1olbHWOo1QAI9zxun4qfn0HnH0SEw+NF7PKaEURBOs7D\r\nN322EBT1vss5AlstFa7E6H2hA/bfJLHDtpI=\r\n=0Xr9\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230108104637-7c9112a.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/0d823c5b79f80b915739546a8b28d599/graphql-hive-client-0.22.0-alpha-20230108104637-7c9112a.tgz","_integrity":"sha512-0MMkNhsycX7EnZIuqQca3dIl9x+/9EGKMmYmIlSHuJmkSFnGM4GgoCNtxKZaylFbALbJolHyu3yPR1/dT7zJKg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230108104637-7c9112a_1673174838682_0.2915137099927818","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230108105158-61d9856":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230108105158-61d9856","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230108105158-61d9856","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"d1acb9867e416da360f0fc64c4defc7dac1a7bf8","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230108105158-61d9856.tgz","fileCount":60,"integrity":"sha512-pb6JbLJkuwErBGJ1fbIkdN2iyAuHAnkEdmaMoIsA+81I8PS7fZYVFMS73K1E7XnkZiiKOKzc52w+54eANeJ0PA==","signatures":[{"sig":"MEQCIH2WfAsYqnwFnV+tV6sepjmR1HSPMIs9OhHUafWdh8LmAiAFkQ34W5UkMsHq9zsqCWrDbV+Jgt/o/y3zfkDuMlj3gg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjuqB+ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoYJBAAoF1oXKbSMvL9ZeqjCv9goRijLjSnVYUB4jdP20529NULNHlK\r\ntuDMBle6RqTcw/Zzimx43g1gZmraHlZ6bdKs4YzIIYJqrsRqCNLk69W5BGTk\r\nZpjM0CfHqRsbLip/rE2TW69xV7DYQvHJbAUSDoOQrDh+eHKHdZCBnVRn+X2M\r\nEV/iTKkmJWHCNTVb0TjiIZQTel/U2tLL3z15dw1CPrSGBz5hRQgHlBrC65vo\r\nlu/t9/29+X6qqaw0qeq4uOJPoTmoDPSIUKiGSw4JxS2dauMOkGD8bIPRCPH4\r\npTma609FAGL1WMIClOLgI94XafkwpNwocCb+DJsKsuGrIHa7KJuybKeT2dta\r\nqIB0V6+bqYwLeAfqmoVPwDRs34rRCXZKWWWv2nFUXUVySpxeNAWh1VLFVVpu\r\nIM3xxJW7FUVDn2G9wZSIitz4L/lzMxdBj1C6uh2H9tOevF++78ONjmRwj3fL\r\n+SKp3duX6rpU8uw9K38R2JPKh4FLqhlt9DmpKVkWWgIozEPcqI65lp4DPAyL\r\nyUaZ1dO9jqQD2/6wC499sXdYu8NI6Dg1+ux2qzgbqF/R7pN4Dwwe2Jr2PrxP\r\nuSuaLPVQla1BI3Djoyx6FLkThrVUs5G/ExVMB9G/ZhqVboujcwn7eZu6rsGT\r\nn+bABjhCuekLUYfu18YEMnZL0zOA/lYezAM=\r\n=f5jZ\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230108105158-61d9856.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/96de817ebb1a7a04204b9c010a2a7b9c/graphql-hive-client-0.22.0-alpha-20230108105158-61d9856.tgz","_integrity":"sha512-pb6JbLJkuwErBGJ1fbIkdN2iyAuHAnkEdmaMoIsA+81I8PS7fZYVFMS73K1E7XnkZiiKOKzc52w+54eANeJ0PA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230108105158-61d9856_1673175166205_0.40415547133690133","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230108105650-76ab468":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230108105650-76ab468","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230108105650-76ab468","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"03748bda4957f658558ebabe1abd9a62570f57ee","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230108105650-76ab468.tgz","fileCount":60,"integrity":"sha512-cB4qrzmpmW06VQgDJaI8yP7O0Xq4k/v5YiDDU1TafL3VotQ/dttjdIkpaO0KBFLx62WoSS6b43dwW7JNOY2gJw==","signatures":[{"sig":"MEUCIHn/CwOolncmqXolzZEJX7e1MOclRJts4Zs5n4D6sSzFAiEA2lvOx5m04nMD/Y+FHvt652LmnJv7B8V8PK2QCU5ptqw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjuqGUACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmroBQ//cfAsJdrDRkVm35Qf2EMhM+vWjK7t/eM4+C3lpGH+rKKvBiil\r\n8tn2CzFlWvknlE2M1MVSVQ4A22Fk02wNKcR2xMIyePKaZiqeQjoB4DPYO7Xv\r\njbApFwp4UvMPyV1PBy+9Dp3b9u/uHgaWS38NPHlCVOSBgWJcl5NwdbefgIK2\r\n8Jap1FbJ2y4nMHa/fld+LhbuSw526mQq2HvEuNDS4lmFAwfB3ZrVlbAvPXO2\r\nQM57HwJqqe6tvJEIpIs4CX5QKuLgxcBlh72lyvHYzVcemnG5kZhNnyHELnA5\r\nGl2X0ChbpzuzdVFQp18cKQ4uGiQM9Q7mh6w6dJvlFnaNsaZReaphsLlBOcuV\r\nuARyw/EElvwnKcMhCcC4Q22iSd+i/eDrk1hnoS7Fm9jytlud/HdYHp8ej0as\r\n/7/5DMcg1y194MbxoZyQ6kr+yGrfSMbJNHSwi8VLM+FdBhsSGBwzp/UC0IEM\r\nLn/DqjH6TSTx3WLr9WT9fjJeMNG+81wstlo6B5VY0o5tAdCNLFPtAJDxZPxt\r\nrSr+Otuh9CyeCvwzAYm/tQRoOpWdwd/6miPCGL7f9qniRIDgRvDhm7IJbs2y\r\n4R9KKAFdun2Bh35xkaWiz+RE2a9b9fFFExRsqu126dn+HnVDH3M12lBqBDFm\r\nkzAz9Zne1DrtOxvQ2yopICbcNJ6tDRro2fg=\r\n=FkNq\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230108105650-76ab468.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/af952544d8a279dbf54e2bda5300086c/graphql-hive-client-0.22.0-alpha-20230108105650-76ab468.tgz","_integrity":"sha512-cB4qrzmpmW06VQgDJaI8yP7O0Xq4k/v5YiDDU1TafL3VotQ/dttjdIkpaO0KBFLx62WoSS6b43dwW7JNOY2gJw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230108105650-76ab468_1673175444074_0.39429037434461023","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230108110233-43f89aa":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230108110233-43f89aa","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230108110233-43f89aa","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"8cdbf1267919be0fb5ba8549475d8de0a43bd25c","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230108110233-43f89aa.tgz","fileCount":60,"integrity":"sha512-N8a9Py1fuecyvlAG2PPW5Evu68uh6NqWmEqJEEMfgEkDBZPLQU1K7+Sqlrh6dWBLCKdhS2atASW04nFM1v0XkA==","signatures":[{"sig":"MEUCIQCcZBm2iXIWpG85uqee9vj13bEV9OgGQS6MA9T8UaGcQQIgcLqziDCPsqWKluI2T6MnnCUsV7oGTEol/wikzIuzRF0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjuqLqACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqadQ/+Kc2TJiz7/auQU4fv81AHFbj3t7zLaEAAj3h0A6FPsGKMQV1e\r\nfrNynJGv1/heD/XWWUVTTF2Qw78BFq/6ro6XzUUzYdz80xepDDtn4uFQugVE\r\n0pW20yRVztXsL5JyVimwkXbNDVP3nB/q7CjUcQiA+m0zqr9zmCEp7hEwPooO\r\nA8ymo4cXMmYSDvS3aJlUtF68EYwhKifQWXqBb/HL0f9bohZO1wPhyR5+BFsG\r\njU03tnJ/s45KUN1fhYJdvIzgWXUejuTYtQao2BJYZFiLGHokwBhnEvxa/5LQ\r\ni8L7ZpVkA1+URHPwdeH6JPV4cGImrIBsHJO+4T16E5AmKqCKb+mjIqlAAZ+B\r\nyapWYUCknpx20MFOTIdPkIGOSO1MwkvO8BDytfBh/Z26SnqSRk2P7EndlvvN\r\nD473iygxSdCppsAetdC/zeBogcANipwcHbOHp7T8x66pw0fjSaDdhAzAtcE/\r\noSs2qwtVVcXBIuE5OwheZgXeOg2kQMqm2rACOan0AkX3yNsPD0KbUw2VjjF+\r\n+clyOezqiCDpsYmc11Ofh4/HkeUV2vsmfIzhDbKa0hnsLuhA6kflqN4D7Pay\r\nILrXVMjU6gZDVgDhMRbH2/3e2fSviw2exD9YN74UzErYeFWorIJ2T9d8mXD7\r\n/fLOoguSnw7yxxUlA5EqOe9BhrPhdKO/CL4=\r\n=fuAZ\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230108110233-43f89aa.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/f4d7889c23148f2b110d20dea1ddfd12/graphql-hive-client-0.22.0-alpha-20230108110233-43f89aa.tgz","_integrity":"sha512-N8a9Py1fuecyvlAG2PPW5Evu68uh6NqWmEqJEEMfgEkDBZPLQU1K7+Sqlrh6dWBLCKdhS2atASW04nFM1v0XkA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230108110233-43f89aa_1673175786689_0.013712352091546087","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230108110417-9acbf6d":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230108110417-9acbf6d","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230108110417-9acbf6d","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"fec45d3831d0b4f6141eceb9573b9183ecc386cb","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230108110417-9acbf6d.tgz","fileCount":60,"integrity":"sha512-nWXJwjgSbwc538tfdr5DjpPdgvSynbq3+prwjs6c4wH1/QFiBYP0W18Kg3hjaya0EnMETFtf80JenUx2YkF1ww==","signatures":[{"sig":"MEUCIQC18N08goWyTkUqzAx6Tn0T83rkQ0/veZ0Ep32ZH+DE5gIgQYEuxZNYN6nuGZG8w2/lJKuiO3uPNqnAbBk2ypoc3Tc=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjuqNTACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo6Vw/9Ekb+kzqmjZH3nqDom6M/U1a7/c22cGFVPxzzj9/c3ozOtmMv\r\n+i4bmUUtuhKpX0Ze7ckPEnqS7Z0VpoPtfaDURLAFyhPH/o+S+oJwkWuILOZI\r\n/RN9l1EOaIoB05Om1VLR9JgGbF1oyRrBxvOpSALFL9YlFd5A2oXqe20nhzob\r\ndmf2DiU22lAIKCAXqFgKIUKgvNrUy3e8XIBS6jOUILCxpZWsjYLkf2N9hf70\r\nLiNv6Zqxokl2LFws1z0FXdaP7y/rkCjXkcB4DV8J4+AyeJavjQxKcWGw2bJB\r\nC8TwpC/LAQYSazMEc8EUmYwNrCh7U1tR4RX1l3DZ9Q0jAvIwwyPSgC58CLL2\r\n/uY0JwD1cn/Un8bUXUnzu9NElC73UcqC/BZ9kc9QeQIgg5QZVgLLwp7dVK9r\r\nGD7dLbD2dIL4hbRLQ9CcrFHZUpRGGVhSG2memRNfXbAm81jpTrAAz3zHTQTK\r\nUbX6mcaHjmTeb39cHGc4V/0VTaz2kF/HH73V5O6kRpZ564vdvaHvA965gsGs\r\nXHN+XdY8IwitlXVffr0d4l6tt6YUW0gpW7sp0ykhNNimhKUZ8s/8Qyo6YWYf\r\n1fID48lKWhrnhVPn+Pcv9j4vfuihCZZAcFO2Er9AXGgNNNHVWBDWdVszHV9M\r\n8F0ApmTk4Gj2+LJhMzlMdoauSAVm4n+9b78=\r\n=62Yg\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230108110417-9acbf6d.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/ae1bcbb6c70fafbb06ec217911fc6a72/graphql-hive-client-0.22.0-alpha-20230108110417-9acbf6d.tgz","_integrity":"sha512-nWXJwjgSbwc538tfdr5DjpPdgvSynbq3+prwjs6c4wH1/QFiBYP0W18Kg3hjaya0EnMETFtf80JenUx2YkF1ww==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230108110417-9acbf6d_1673175891064_0.20682556932202778","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230108111317-bf1cf80":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230108111317-bf1cf80","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230108111317-bf1cf80","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"2909aa58aab27fff8891752247c4c8c92c0bc99b","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230108111317-bf1cf80.tgz","fileCount":60,"integrity":"sha512-MhG0XcCWDYqp38AVOGxIx9gJFTiuRxdmukRUzSE/EwEdKiAlwWkgm1CU/lsKUd3i62L0HVXXenoziq7MEpFJTg==","signatures":[{"sig":"MEUCICC6W1Yz4QAozXF8SSvoNypj5Vs/qY4R9Ey/kZBac3apAiEAlAhsV0CpgmmhO16j/qtB+eqbJJTRrYtDhP4l7NCVQOU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjuqVwACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrQWw/+MwMkmL24y58jcYMZxiHAaWxSgLNQStSgSQbhaeBNXN0XKnmv\r\nN/yKwA8hTCpDOUgjiSch7p0Btw7afNzrYkAPEefeVFsTddNbClOVOEcZTFVo\r\nYySjMGp515QFU0yN3IcFpObneUhNoqWAZiR/tdsu9Fj9ryPqkRIQmgUiND5A\r\nLpOJvVkYTS7CvArtYjNhTmL6HALpOuJ6coiLvtmf3yLTVvas6O7K5vZ7biS0\r\n7s9od9JTNM56lcZkNmi9Bj/SJZcWYrRgUaa883RlYmbkZsX4IPUMFQOBgZoD\r\nxxZVcfLPZj1olP2NTYJMlPqBLWH0teWGI014WSzC5Y1eZb13d24MUqsG1Ei+\r\n+wnPOMWPVMZGG+WiFH6tAU2nVNBc2L7DE8EU7YTa+PItdd0U5trqDJnEWEmt\r\nhWIuOPnyNuQZzP4yRf0MxhTtOva6SnlRN+NqG+GhW5GizFtj77qFsic9FQas\r\n+iunlLBTH1w6hGtUMuyTLqJ1HXhUgWS2ENNSPInQobrY9ORjENlAbDl2x4uQ\r\n7IIRx3XFc1YrQzCcTFTQ7q+WI4XK/vBvCC6RrHUNPAYCCyKmrBMZXPlqYZkp\r\nkXx+hQOikZ+JTSc5LBPsm6tepJn1ATKXg/wjP00bns7gPeM+gn9xzmhmvluK\r\nD0uptw2KbhMVLw56SnWSULC8iyHJkbNvWNU=\r\n=3d/w\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230108111317-bf1cf80.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/f0e1ecfe4c0569bbe728e5c640651a74/graphql-hive-client-0.22.0-alpha-20230108111317-bf1cf80.tgz","_integrity":"sha512-MhG0XcCWDYqp38AVOGxIx9gJFTiuRxdmukRUzSE/EwEdKiAlwWkgm1CU/lsKUd3i62L0HVXXenoziq7MEpFJTg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230108111317-bf1cf80_1673176431953_0.7035777094075086","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230108111329-ae61d68":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230108111329-ae61d68","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230108111329-ae61d68","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"78a44452393890bd0b06bce3428874a4d72afe9a","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230108111329-ae61d68.tgz","fileCount":60,"integrity":"sha512-0o3XL02qevcEGqkeZHzRFDKbf1JndRSi2oLL1tq9BAu2kTgDqe1N93N5D9uUMuBVRWVVEOP7beuF5sRlrM1wEw==","signatures":[{"sig":"MEYCIQD+lf1KmcKaaS7jFIUxw3FlPRbqWakQURiX2bBWS9j/kQIhAIOOlq78tD1QedIi0qu2y8viHG/Y2J2HWqL6pQHaIi8O","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjuqV7ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrCRBAAh9KByN7IMOzqNxvximBBaR59YC79H+79tSbu8tH7hx5bcN0C\r\na1cMw1M4WX2yN1pObfimrQ6HUHKO1hIGLgYzHEtGNGQZr5P+8Zv//rgbEmnN\r\n6V/LB+nGaZr9X0qqAdOznAhsiPmDH5crGJRjZFUqhA4rBVDLDeNJY/ndLgJZ\r\nbd7z7+Tdk9GcfESIfkuAHb7aPKLjAb01nvGncYPHR2qGeek3D0b7l2iT/K36\r\nseXC3fx1JoJXQOg7NCu8emYkn0VPhqfJqyU6U8Xe+57HFaKMUYZ1IEWz1WdW\r\nMC0LSbd/Wghw67GM07BcpjIzWXy+vQ8V8MiWE92XrwkQg/y/rUjvZV2MlndF\r\nAq/Bxz0/fyndGxD0GZadOgBKJYOxHDS0EiYpA6U4C6jwz4bedJrKzIxQA5T3\r\nGx9IRy8sFsif3VwS2a+s7yrLIFVvfn6optd71vJE8OsGiDuEXSxdiYQ6JB+p\r\nAGn0cErmWMMPy+9noem2pgCK5dSyHzd+8WEf1PyK/0+8us0jYhG2gZg2EZp+\r\n8Z+Gl9NHSnIzNaOB7OY9PPuVt6J3exXpMsHh2orpoI4bfN3s6H9igJbWh84Y\r\niHzYeF39ZcAuFqwwVPBLfsELubgC9njd2mqnMZM+2AGhBSBWAfbDZjF90Ho4\r\nOSDmUGln7bBvFr0ayt4X7uMwzvEshUysXGw=\r\n=06ff\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230108111329-ae61d68.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/97e0f6311f5bea9bee8a05a42a64b215/graphql-hive-client-0.22.0-alpha-20230108111329-ae61d68.tgz","_integrity":"sha512-0o3XL02qevcEGqkeZHzRFDKbf1JndRSi2oLL1tq9BAu2kTgDqe1N93N5D9uUMuBVRWVVEOP7beuF5sRlrM1wEw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230108111329-ae61d68_1673176443615_0.40224552843772665","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230108111919-420eca9":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230108111919-420eca9","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230108111919-420eca9","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"6dae5f594410bb5e816cef9982547aeee3d52777","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230108111919-420eca9.tgz","fileCount":60,"integrity":"sha512-5wEnLpse1uqOVM4mBypV/XUFiw7nxmfxJr+qDoBio3BgnlRrNT/GlFQz6xs8EaZAZcu9O3YEdk3gh0c4nFHw6w==","signatures":[{"sig":"MEYCIQCPRxGa2pAkizCjC3wpIzp8Y36nObGyTaOXqO6X5s1bbAIhAO3V6URp554L2z0UEjq/5ufHCvD7K0m9wArjFTfFs9Or","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjuqbaACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmouNA//c2512A/aj9kEO5ju8/pp2ZZT0hgqd32/DkA+1rO0rH1IYLN+\r\nrXSwHZbn68iNvw/DxLbCoMqDbR1UoSlJmshas1tFtu4xOwR27JvQafTQcDdp\r\nGsUD9pgbUTseAO/8j/5h0z1rjKxoUPd0WbYXvKsOhLJoKUu6WmNXz6DU8Uz4\r\nZ1xwEJ/siV7N+LXmAfMekY3/60XaleVObvWhWLrnjKXhPDbytHkIjTkahFeQ\r\n3ruDo8DFvblA78G9qxISq0omR+dMyk/pUOi3LqKd0XFLE549/mgIqb+NfE/A\r\ntcQPoBHSVUpoyFglsc0gXf2/stHQUoXeSGo19qaAjm1PG8+ku/fKKdUNvrEo\r\nmN7MsSnETYPaFP1fsnFyCUfBxI+EQhTaEfwoNYPPmJTVuY5hdBR1qtgfYp7f\r\npmZUwoynoXvtpdCtnwq+I26HhqQkmP9+9tDjm2iTT4n+EkVQGlZvt2KBPn4Y\r\nIMUYjZcpRTAQtBnICrBV0QeqiuzLXN3IT54ogBh+udLRKRDAfcHI1qe/7A5H\r\naPRLpTYleDmT8sxxt6uTTaofwRZsvqIDsarratjPYlnsMW0Td6BQP/8i7hHu\r\nKJsADSwSv/Db/E5Zcu9U8et/JkStEcfC3U7EnsS5bnW7oKPneEnpMwVzvCjt\r\ncvhxXhQSy5O8as/7SG+lyxMNzT0rKJxaus8=\r\n=h+Lt\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230108111919-420eca9.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/f970f2307fed616833a27bbf44735d7d/graphql-hive-client-0.22.0-alpha-20230108111919-420eca9.tgz","_integrity":"sha512-5wEnLpse1uqOVM4mBypV/XUFiw7nxmfxJr+qDoBio3BgnlRrNT/GlFQz6xs8EaZAZcu9O3YEdk3gh0c4nFHw6w==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230108111919-420eca9_1673176794004_0.3224310198532714","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230108112439-e4409ea":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230108112439-e4409ea","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230108112439-e4409ea","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"f717e068dc5066676df8fc1a0886f86f0f2710e4","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230108112439-e4409ea.tgz","fileCount":60,"integrity":"sha512-JCUWsbcWqtKMKMHB17OqcuGIYj+gDwXeON7gy67t8K6S6ipc5qGshhcPWbFeE9iG4u15B5zYKKP6jthOBU/7MA==","signatures":[{"sig":"MEUCIBVXXqIKeAO+0xb2lptC2XeeTSMdVemffaUFdsTtAzZzAiEA5l3v/cRQfrDtn94xjEa+Xt0MmJQPImhsYZIoApCGiA0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165581,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjuqgeACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo95Q//QNdo7tyNH++1/D+gktkLsJ5/JtNUB7YWsYiINadVkfgqdEQT\r\nSOXLRiXnVYEPpBtniaiyUZI/Wogf6r5BtRj5BX/qOvhu3/VP6ZD/9SNv7X0Y\r\n/8ooavMh6lgc6/j2zhp40kgAlE9tbHhHFeW31L2O8ZpfyzyymnghGYbK6nNH\r\nZyGHHMLq2tRai+NWbkUxbnnpC0g2N/tuIh0eyLFi89GGJkXat9Ewvu/JuTOr\r\nJtgWpVwp05Jd4dMgSNem9MpQ980Jq80b34aEYaAaj/2nUlmJtxeQG5+AK4Po\r\nxEec9P5+abxsRMA/7Y07nzATUgrRVg5AqInTqzPGkSTvPomLEfM1yYPFqTC7\r\nfKnFYon7+Uir8CZBBuQxLhJ0x6uvugJDyuDT9ci9AeiOI03xVmJXafgnQLNP\r\nv6kfHgAPs3bcocFcIhEPt8vJ7fNUL6US6TTNm4MeLGSOLLPmfJ+O2px/S19T\r\n8YwrBi7BMIqjOfxhEKrKc6aUcilIlBurMiSz2njkvv6FkrVfimVTOUPu6sjJ\r\ni7P26gm9UNJZtK8/P21ghaXdtZhuDAcOcGP7UbzOdQjg5I0uI5IXzuyjNq2A\r\nPQ6mVfCNxWAbNH2f11/QuEcLmjo+CGGMONWfCZ04xle5nlS2wVXgfzXsAxy5\r\nH/NBpeIbUkf2QsKi0wYfd+cLrqK0qlQZlwE=\r\n=AYal\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230108112439-e4409ea.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/240ddb1d3f54421bcf96928606063550/graphql-hive-client-0.22.0-alpha-20230108112439-e4409ea.tgz","_integrity":"sha512-JCUWsbcWqtKMKMHB17OqcuGIYj+gDwXeON7gy67t8K6S6ipc5qGshhcPWbFeE9iG4u15B5zYKKP6jthOBU/7MA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^9.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230108112439-e4409ea_1673177117852_0.2682522997522643","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230108113023-f7e9edc":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230108113023-f7e9edc","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230108113023-f7e9edc","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"51a2670bddcdcfb837dd4cd1302feaf533a2e0bb","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230108113023-f7e9edc.tgz","fileCount":60,"integrity":"sha512-teS3699pCVNlrelTtvrPYAfQq+06QXC83Jw/8zTByF/4sFxf/1b1qSKlvpzRqtA66WKyE2mYPrQ43yihhfbhaw==","signatures":[{"sig":"MEYCIQC3v+qWxVIr/6QxwnesPf24gA4s4hzvODsOn9TIddrr/QIhAKBfr4o+34inaXrPKeHfjfZ5Ba5ePgohyPc134NKILuy","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjuqlzACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmoa0A/9GM0mkFIjsOxJ7LTOYEa2QEH/eg4MipHXTYw0SrClDSTht3T3\r\nGF8B+iJWJ5lW1nAIxAIieCOr5ogVMHEHovUibTkS8mLAJ5eKfLZMn1NVmUNZ\r\nMCPMxQE3QCBP0SXb2TL/wQQiMomCoKAOGGM72nAQ2msoqwgqF87pJq+j0tUa\r\n0C+u8WVNTRXTB29fFgDE7t5rCw8S5/PuAQ2olMd6RAutFiXdKA/HSKS+jlIY\r\nJ+9YVQ6Vc8umkuklLj2/1YZpn79jurks2Fn/YtLhs7vN/x2T6rq6VTScY1gl\r\nsIMV0HPIJvoX8ZsYreR4VkCsNyiDyeBd3mpgq5GTN/4mZiR/Dh8uwto7U8iy\r\n5dGp8tZ/tefhcOmixLXAsbTCc0UPwkmS84N94n64r15wuP+fAZt/WYhEt6e+\r\nIokYoYvG2+qfw2H3unRPEmEI/j2Vx/5ML4CC6cPTF4Dx/MLScX0Op9GJ8HJ/\r\nVyLcbvX8FKRPWX7tY03gn8OFaasQZjAhuy3WNT6plXcWtzFbMBostpdJ2bKO\r\nUO3UyDOnkzuAm+ELp4rsArHMv1x1C+d2Ca323QD6L9XABbdzsI030WONlGZJ\r\n7wBBOaoR2Q5kjTEnsiZ/VL8TDxSZhNLM3ZXWexLK8TJbc6qiTITwaWzoTEzK\r\nKW1tBFL1JDrOboNUeGnSNEz/V8Fc2BfSTYw=\r\n=TXqw\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230108113023-f7e9edc.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/9a810399c69d760ad3c6ee9c8601fb03/graphql-hive-client-0.22.0-alpha-20230108113023-f7e9edc.tgz","_integrity":"sha512-teS3699pCVNlrelTtvrPYAfQq+06QXC83Jw/8zTByF/4sFxf/1b1qSKlvpzRqtA66WKyE2mYPrQ43yihhfbhaw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230108113023-f7e9edc_1673177458914_0.23043365767285118","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230108113427-250d99f":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230108113427-250d99f","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230108113427-250d99f","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"331ffce0a50579394642e9790db94cce3e356b12","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230108113427-250d99f.tgz","fileCount":60,"integrity":"sha512-p9cXRfWbsrNrMYSQmsUXsblM5zCP0XIOSYFjOc1spK6t0IxKh/zD5dER9mQOUiOaDwdYsbxesuo/0fIMTqQTXg==","signatures":[{"sig":"MEQCIFpcH/bmvLxlC50kVBGIg2Jkfr/ci6WCz+BrTr71mYXqAiBxvSm95kFEpcsjdxF23Ddx/E0zAz6844EFSJVo5h50AA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjuqpmACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrNQA/6A566xIc5pZK6y5UecT9OFAIwS1ZsSH50RB7dJ+sndrY0rA8c\r\nmuKOsj9nWoLAysDi+JTbYo5F2fHGD5vrMBazIBsjO3RzewT10Yrl32uqOtUS\r\nH+4P3yPCo06vgFFRd4BEv/RP8taUjY71ZVDPFeQ/2Drnytm8j+gNjHfgD33t\r\n74nNMjU2pukjkjTnL6CWVms4ltFZYpFisr+POzi+6bc3LLfwraMJPfajkTGC\r\nYEXT6+dtx26nU1hAdp+r7FQSRRNeJChpwQW4h1IpMlsriaqn4qBJnHhnrOH8\r\ndT2a2WfOjYNnxyDTuQmqLKj7WVmCL75JeqMPEdDk35hcH83Gaj/N9nZTfVnK\r\nx5y2L+Dy79A7Z13MArFpl8mpqvtSZJw/OmXs/Kq7Elf06jdPbkwKsVSppC/m\r\nc0dmyik2Mlavo94gHwJCkS+QW63zUSzzWoPbQXvl7+nsQHBD+LBMYZo+5gS7\r\ngAw2fkeP+6c/2DpCMUtQpPiv2kl83rzJKHHmNhSDCFTLQb+/PCuPXqBa5gdE\r\n+eQCoUTBcMP7hz95X9Q+kBtumufXDt8NHgTIRnfGMyURc/xhis7l3uVMn0sX\r\n8VBmn8FOcUaI8r1EaWMBOhycyy4h1hBUzFRMCGkDD567OGTIlc+OJzRUVeiY\r\nxOVCzqBsD6HtuT//tmO8azlTOtQ+XrDxFdc=\r\n=Xdpv\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230108113427-250d99f.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/7098941a20424770df38b2fe06d66b38/graphql-hive-client-0.22.0-alpha-20230108113427-250d99f.tgz","_integrity":"sha512-p9cXRfWbsrNrMYSQmsUXsblM5zCP0XIOSYFjOc1spK6t0IxKh/zD5dER9mQOUiOaDwdYsbxesuo/0fIMTqQTXg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230108113427-250d99f_1673177702068_0.8559575870700205","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230108114120-362c920":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230108114120-362c920","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230108114120-362c920","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"3940f2bcdee4865b47439244c828e9dda1ef8ef9","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230108114120-362c920.tgz","fileCount":60,"integrity":"sha512-A8en3KnEify+pixp2qYvQ/MpCXgNrTcoP4LlOKBeB++9WaDrTK9zdJKKb14NM6KUFHN7FZtA7srmao6CLibNGA==","signatures":[{"sig":"MEUCIDROW2bvHMlqdG6i8wTXb0naQxlSQL0c3aG3S0+fmIABAiEA5w0ZcYvNINOCTYJ7g4ICZ8pJVwkTqeHHEDcADecA6jY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjuqwOACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmplXA/9EorxyNDZX0l1rJgZHyMRvdxCv+CnPxkVQOtZeO6KpHdmoU2R\r\no/QEnKxEPPtrKSaXkQfZ2WOzBHcee0ekwEfA7XKkIerYvQzzIOC9NqBLPUKQ\r\nUaV+snIvfnAKiLc66llRY0t/TsPxWj6xxSpQBDvblMi62IWVTGbLAAx8kuv5\r\n1kahq0k7efB3xjQMVyHDLIe/WrgLuDlCOdYBF50TmAuWEcPDOvaSU0ZFOgMu\r\n6JkKz2W5waQXB4TXzCmQxr5pIACSs9iWxbqYzOCO3zFYRD/U0nB7XnxPco1A\r\n1iCy9MNJHg9YVYyU52JIOYMvxEAf6ywp1U57Y45tIrtLS+fOJgJmhjB+Eq/I\r\neDS6IGmWx5TUiqXRII9sd19iMPIBfaEmOHELAMWTeIU3WPING6SrTm6IgNF8\r\nesSjOXb3lCoSoBIN4wXtV8WvWv/PyZ8u/J51mUAIYeQEknl2E/qjqbTVKvFV\r\n9DE13MbDh0N4XO7wOQENI6PELAr46YyI4mjr5Xa4pisd9aexeUC3VViyoR4K\r\nb2WFLuI+ynaaJ6FHLuba8Z3grcvWAr46ai4RjAnLCcUGKiW5MM8zO/ENxG0m\r\nDZb3PxwxF2lbTJmEB4q/Nn5tDcXnJ5AJ295HnW+9HcuoP5A+dw/Ul/uJ+8SB\r\nvAbG2YBzBXhuxQr2cXEWLpYp7KUVB+o15pY=\r\n=Z8Sz\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230108114120-362c920.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/ba1f58fd88f6c917eafa90fb19a0ba1c/graphql-hive-client-0.22.0-alpha-20230108114120-362c920.tgz","_integrity":"sha512-A8en3KnEify+pixp2qYvQ/MpCXgNrTcoP4LlOKBeB++9WaDrTK9zdJKKb14NM6KUFHN7FZtA7srmao6CLibNGA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230108114120-362c920_1673178126150_0.25381166276982414","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230108130753-52b05c0":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230108130753-52b05c0","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230108130753-52b05c0","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"567b0af283ed0ae5e6a6a2dbb323f274ee8b1244","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230108130753-52b05c0.tgz","fileCount":60,"integrity":"sha512-xWtvA+hFdCcxpginURTgsZaxsE2/E6IZCwipF3/pkXUlfHphFW+bbt6EYMqMZ01axy0k/YavPXlF8S+35d6eqg==","signatures":[{"sig":"MEUCIQDmTWjRg0KF6IKBmeieeDNmJNLbiUgyRZ9BDCGPL3KNCQIgMyf4rD9retdY+V0KYKMWbAXnbUKpeGXMFX2cNLxykJU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjusBMACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoaZw/+Jmms889oAWaSDmiD0l6Rxpldx54En+ceT7t/Nt1vcWafV36s\r\nzUmkxDqpaOtpzdD0LqkFC8hNa96yZTdpx84s9bh9znzrEEM9CCyZHeVe55nV\r\no4HODRs6XyhQmYca/DY4s+8AV8CCoV22ggelJDd2APp9raJtb/pwep/wBkdc\r\n5avjwQGTl7wpQU5wD4cyYBev0Rr5eofMdTFeAIb48MwHiMZ6uPeOQuv8Pt6Z\r\nItqqySUgyHySzwlmRzL7R5119KQJSanyiTymK7plE9d/vcKL82DPzxxmeDCY\r\nD9AXvjv3tARL3Zm9N42PJdmQnP8RonlN4nAmTol3kNTjWlcazvmEChXEltpX\r\nin0fNl4UkhTkFxuXvlR+7bqOqbqKvuK3Esc/B1/M9epMf+lUj4M0JpniRLCw\r\nGZk0fvsq41eYzE7VN7K++qaHUw8MRz23sp3nWa+jI6wtthpvkhVWYpw9ETeh\r\nkI2NrXmaKgFqb5YcjHt03h3eLzgQE3vGz6iY9dP18R6mknP56xV4HF6YAp+Y\r\niDHzJd2RQO3y3Z7woQwXWcAFBy0rX/ReRaFbnpk3ocjMivfVFXK/ZMJ5fNPc\r\n/dtrV4FmVfO4APjjnpS54TsxxwFkf5YfL3IU7CH0GVjdFxgo9Z4gSbs0rsH2\r\nxAnKhMkYds26T0z7DwEplGcgG9/N8xQGIhE=\r\n=u4Py\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230108130753-52b05c0.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/a3d87f4f58c2236b14f5fa35aa993d43/graphql-hive-client-0.22.0-alpha-20230108130753-52b05c0.tgz","_integrity":"sha512-xWtvA+hFdCcxpginURTgsZaxsE2/E6IZCwipF3/pkXUlfHphFW+bbt6EYMqMZ01axy0k/YavPXlF8S+35d6eqg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230108130753-52b05c0_1673183308719_0.5449154145393793","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230108131333-ae25aea":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230108131333-ae25aea","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230108131333-ae25aea","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"6983c2983f422221f345ec84090be52b217baf3c","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230108131333-ae25aea.tgz","fileCount":60,"integrity":"sha512-EP67jspjPxJKrzBWP0m95Vp5xvBsF+5bM5GYoRlGe95s7IBa769ilffILyFo6Ew6l0AYbp4ZFQa89cHTIWhrAw==","signatures":[{"sig":"MEQCIFU20pJYZXIRgNOw4LZ0cwF/MKn+fYsMd+JfxCFxuemZAiA0/Qmp2yV25gcR95M5zAaQv2B1sRthCK5qKm6e9o5VXw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjusGoACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqdJg//Vf1Dymyoi0jii7wdIGy2A9s+78ExCW6+ANEg2upN2bYFwlvp\r\ns+pbcprDcd6jcuSTHRDOf1cLsZgGQZM7iILa+pZMF5rewDipa7xM2VNw4IjA\r\nUIhQ7ANjRkyTHJRRdK4oguVAF8oRZmGYQjXHju84glkHhxaKkO30CQICeIEY\r\niO7eWvQy7IbWCW8LrFYjJoB+xX6af878DUAgQ4vj8pCpLkjpjuBJGJz02rcV\r\n59H0xT1R3nSoLlHptBsAkKyAtwTGIUQC2cstTYw9wI21PtpFYSleM2z+0ov+\r\nJe9o74Uh+Wry7L0EhVIH2LQxLnCVGdVEdn7bZMQZ52ZkcYCN44ybdxEuU4g6\r\n2Z+LoqnBtccrx/6AMqU9L/pZrbvqaA2ugc9+R5odxUwPAxuY3I3hzdm4KE8k\r\nh1ocA7U+X7B6HuiPUWnfTwHUOceenh4zcFJcXckONb7uMBPbdxvW6O1rK7kC\r\n4r+tNpGpqQ9Q6cpNB/ZgURbFHMRuMOEVUUtddaKqR1Q4RpU/ez31UPrBB5gi\r\n+eG1xU2E36vhWd9JeoNRdUrvRp8nKVxtsUGVq83riaYxu995cKNvBWnMRvBT\r\nmJEu0ArnY1Gsxs7CjLTLW6MNTJJYRDq179qresz9vFsE9SN+0GBJ6Xg2WAnY\r\n/Y8R8DIE9xED9WwTpM9YWsp3yehnQTldBBA=\r\n=bK8e\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230108131333-ae25aea.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/1ba54bfbd4906fb1ce03e820ef74eb98/graphql-hive-client-0.22.0-alpha-20230108131333-ae25aea.tgz","_integrity":"sha512-EP67jspjPxJKrzBWP0m95Vp5xvBsF+5bM5GYoRlGe95s7IBa769ilffILyFo6Ew6l0AYbp4ZFQa89cHTIWhrAw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230108131333-ae25aea_1673183656489_0.36743771530078795","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230108132335-3282488":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230108132335-3282488","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230108132335-3282488","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"0a548d9b1072aa365d772eadd41f5cb308d39174","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230108132335-3282488.tgz","fileCount":60,"integrity":"sha512-MXSS5mtH5yd19cBdV1GtktL99cfXYnnNHUH3FzWSPjAQSc2+XCjenTQqde6mPtJ+WdPNQk+ptxRfqzwclU4VlA==","signatures":[{"sig":"MEUCIBVh4gpdfra+9vhlx/4Uef1P+duXIflWwVQjTje/Lxa8AiEA1TibAo0MRfhimykMgK+U0k/QIC6lxRpT8iuNLS+Xj9M=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjusP5ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrzNA/8Df2LAERVVT5qloT3PUOP6fXNng0eI7gL/CiNrRUSdMnansaQ\r\niRWFVE0N2BUNZ6m+AlIxdKXEqmyGJb0E//eHQ8TorZkWKjgQarRl2kaN9385\r\nN6GpuzfehMw7N1Icqv/GisGFj+XcuQFcmUqavQw6qoc1aaZc96GsH5HQUdF2\r\n4ux6oieQOM7x/C9rIkuXqMSFHH0Uh4o9ufHVMbL1n/+GQ2lhQgrXIg6xXQXJ\r\nFd5SmX7S1e0csEJD9KLhoqJn2jzksm2Yq9dfMhQl5NaNygEwGnsA+STbk0lv\r\nVeuuq9qgQWbtz5xDuMK0YE/KB6+KbtA5jGOa8j+YvTkpqzJy8Vlj9ONklYOh\r\n4u+OSNAM8lICVrpU9dXSPJPvQ9izQ1fVoNJLL+B0u4sO5WPU0rLwlbDHNcju\r\nAuQMH6rhWh+aONPfoTvpRdMQXyjQvb23vaPC6Du1owpqnTMVIRwN1oqjAspx\r\nJ0KoQhvNgBczZAxgDifIpLCiKzNVNcdE6tQxNT/PcYtDS6Io0kBNr0FKCA2o\r\nH0GCKatCiX2SxoqfWYIekY1VN6iC3v1gxmfWHROBZ+XfYHpYPMMhWDiChNkN\r\nmkPbG2N/gxoXSCY8zXlzydHey5AhvZhZOF/uDLm8s0bm6oE8SVYl23R+RKHk\r\nQzfnIbdrptlk1+MuLumHccQJJRxBKYupyLU=\r\n=v4Dq\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230108132335-3282488.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/038db3453c2831cdff9b2192ae86ae2f/graphql-hive-client-0.22.0-alpha-20230108132335-3282488.tgz","_integrity":"sha512-MXSS5mtH5yd19cBdV1GtktL99cfXYnnNHUH3FzWSPjAQSc2+XCjenTQqde6mPtJ+WdPNQk+ptxRfqzwclU4VlA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230108132335-3282488_1673184249120_0.5512942663978475","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230108132858-cd04419":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230108132858-cd04419","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230108132858-cd04419","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"772fcde57143cb12a9371cca8af77325100f904a","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230108132858-cd04419.tgz","fileCount":60,"integrity":"sha512-t5PXTj5oLi53d5WroZKe0GFxs5/JsaZBLqegggGcfPOB2ltjueXkY9h6ha8gdPFl/v5YXc3ErfARIt2nYkCXbg==","signatures":[{"sig":"MEUCIQCbiP7wk8OXxwyBWLO/UvrdXhzt+D+auN3Ee93ieCruVAIgcaQ6R2s5lnQvkLlrFH/HaiXU397czPTtCpoZZwxWQfs=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjusVCACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmptyw/9EReZ8Ji0pM3TyfgoWCTTRjDfIBB2+730E0YYFl8/EXl0bvML\r\nW7q7xzgLBRgYaySO9ScUHceIGddBtKTURF9pxZSVseWHxVKvarSIqDV4amwo\r\nfNvDcE6mE6mIfjsSTp1sQkFHNAhiecUK1pVGvYutjWWfhmKiyhw2CIerdhgZ\r\nOnXv+NnDRJop/Y+4/FVMb8g1nZxaepp3VRQUyh5ZWAZU7EYU0gugrWemsUOc\r\nRZotm8Gi4gICPsU5WAyB9srWAzaDnzuON+P/OpwBKFcQ4mnQeUgsOPDkIbZO\r\nQ2ZW81o03gTc08DBptdLbxejxes5h09CR7JMGDQUCWGf/ajy71x/T1/x6tsO\r\ndvPo+kuJG80cDQlkofHTbJa+A47/Pr2VK1owDljvjnAfkP9LB8Sq5PTdIHoU\r\nMqpQ7lQEQ9qk1f9wxxFoTtMLLu+0//cMhCZM9gbWyCDl/3WkbhzE/BCwLDjO\r\ns4rTM1RRW3Z0/U0CEDElI3uLausf3/MlkkL79ENvKp7QOYNiiKfyIhmrAsKC\r\nyjwTGKtk1ofIzIl+f1Va6yAWxHM4HL8pAjO4K0girB6JFj8GMp4V3EwEEh/v\r\nkQ7gvkzUrtuWvt3i97GRjYJPoGnqBwJPjM3GC9VKe1SqgLOV4ZwG3FWrYz5v\r\nBYV4NfT5b7F75grhs7Zj3aod24qv/IALbyo=\r\n=pSgk\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230108132858-cd04419.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/02e8a983335c9ddabaac15ddc5ad70c0/graphql-hive-client-0.22.0-alpha-20230108132858-cd04419.tgz","_integrity":"sha512-t5PXTj5oLi53d5WroZKe0GFxs5/JsaZBLqegggGcfPOB2ltjueXkY9h6ha8gdPFl/v5YXc3ErfARIt2nYkCXbg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230108132858-cd04419_1673184577977_0.16147672497122967","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230108210338-0b0ebb7":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230108210338-0b0ebb7","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230108210338-0b0ebb7","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"3d1b808bff81aa1c09523fa50e491bb5027c4e1f","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230108210338-0b0ebb7.tgz","fileCount":60,"integrity":"sha512-zAm0yV1mGnIPuazQeEBiB881oSUSBsn2PS03wFgR9xECrFccyfZZo5lXfBTeLJo9GkX+i9/mOHGsJexMTuAENg==","signatures":[{"sig":"MEUCIB6JsDWObv8IeoqqFpF4xfV3AXpaEOnjH+CpNEZbACsRAiEA1WWY4+9bW8kc3wNhyZoPfFm7x0M2EBJGAWdWTqH7yfc=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjuy/MACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmoi+g//UhHDI+RUM3RL2uRjiFMwZeHtLx2NhqVBcSLRD3KHw4N2/sP0\r\nAaLw8sdjfgXqRTx3X65iNmkI50WzZWqRHcUCV/Qu8YIrtUICtGfhgrge2l6x\r\nFqJM60b7ZoyqjVkgbI6ldMwZNJ8t1lR91x0By3in3XYpGSWouqIeW2vfYA3v\r\nVwfPvI8Xsmya6vdk9kvy9CtRf1SVFMyaCunb60QhT3IEpe2XDM7czPN2MKT3\r\nBvaUcDOBRv/PrMbx3kS2o7kDDC7pF9R4vkbt35W5JtQ2/tgOvL2gWc0HsPBZ\r\ngM4gXRBtjAPS4aqMyTiFY1ZOLsGvg3ICona0tY8E43D5Awb6ygygfYEMKrzZ\r\nquwn1VtI605NJt4NBGom+ctaJJSqtl+Q0RQpbRw/idIOrPr10MsSOaXXDVnH\r\n20ScE/OTn8XBnRIRy7EY9+SiuXklzdww0yrddqiJ4Ya1cbMobMa/0bmCZNG9\r\nDyD1uNquwjOb6oOGxOnel2DGE4aMf/VEAROQtlHoK/9cEvKo8ACRY6JVmQ8I\r\naQspAU/CmbhLsh+K/m2onjaymSwc+cvF2IKYHStXMmJgN/73jmAQw0eOS9U2\r\n9RTv7pGz5HLDzJD0wfmKuT/4ub5/n+ol4FEl7cctGhUyEmWRJ172NdXQr+5f\r\no873eW8U8/wTrtHVUIWjw+e9b3JbrCxJjlE=\r\n=1C+k\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230108210338-0b0ebb7.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/c644902be1a390e84cbdfc662de37d6a/graphql-hive-client-0.22.0-alpha-20230108210338-0b0ebb7.tgz","_integrity":"sha512-zAm0yV1mGnIPuazQeEBiB881oSUSBsn2PS03wFgR9xECrFccyfZZo5lXfBTeLJo9GkX+i9/mOHGsJexMTuAENg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230108210338-0b0ebb7_1673211852081_0.7898567921504538","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230108210900-89a0e20":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230108210900-89a0e20","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230108210900-89a0e20","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"8fd9afc1941402487f3c8840ffaf98f48ce1c196","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230108210900-89a0e20.tgz","fileCount":60,"integrity":"sha512-6uY/xlyH0DB2hK0Q8aMJrcwZl7oI+9b3n0LePLxJMedp4L/oTYvqSenzxDRUCvbKU5TMeGRpVFqNBXRxVHXVSA==","signatures":[{"sig":"MEUCIFk5OBQymph7IMhWefMaz9y79ow//A+IC9Ieky5iqFWIAiEA5W8lHEOYeZQWh6Q15LSurJXPAYrh0vRPshZwdkUuQe4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjuzEVACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp2BRAAivtyolyB/ESW29xnQ4t0xSvXJfC+Mk8YWD79XmWcNugtzMN3\r\nwbeiFOc7XCbywSi+aj120FbBRLaA29ANp5scubfH1n9dKAnykVKG0GmmswON\r\n8eIA/hzJk3b9sjYZ7cZ+y6r68mt3YdWfrRBBePIl/Xts0saBFkKn+NotAenr\r\nD+WiHxn5K5Lxp4eErnxE7D6lpSrJ/bjJL9/YaZghzcyBo86GEYsZbcKRRx6Y\r\nC6MIKDM4fbafI68uyNVtu+o2GqXRz6Q13wNna9g9oUhb4nXxUAQf57xD3cdm\r\nA0zhReNMhirjZS/pexjLHzI4j0zUyCNWO3sTZJyn7F34SaiQ6P7YjqcwqNZy\r\nStpt7TTkm4Dm7r5rBg3R+vORaSZCt58+j3tHQpdSw/H0erQa3BBCMPlUy+1E\r\nMpDkxO4EVVaBIs2qitPsCBUwbEfvQou1dSq8/DcYzmcS9/z5oRy99VZ7xVOm\r\nLY55itCCztA0sKipEsPnq7xqGmkUG4egivXk/i0OFcm3iY2EWsYIORjr0V2J\r\ncP4GIowBC/jYfCuYC5GSqqHWJTUZp8XHTcSU65ayUqfnOwOPeNwRexdpBYxm\r\naMN+MN9KRyIC+z89D7ptL3ujFdcwJVMZxGpDkPLQypuHj90N5s7TLM502y/y\r\n8Ojp9XtdS7esFGKa5HuLaN1FQwzvEdY27/o=\r\n=qGM3\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230108210900-89a0e20.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/24a170756dbd4f25f73a0464a83d1a5b/graphql-hive-client-0.22.0-alpha-20230108210900-89a0e20.tgz","_integrity":"sha512-6uY/xlyH0DB2hK0Q8aMJrcwZl7oI+9b3n0LePLxJMedp4L/oTYvqSenzxDRUCvbKU5TMeGRpVFqNBXRxVHXVSA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230108210900-89a0e20_1673212181077_0.8848583771243423","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230108231202-dfd0881":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230108231202-dfd0881","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230108231202-dfd0881","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"69158acc1cfe7f04146ee506307800d9db2a026e","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230108231202-dfd0881.tgz","fileCount":60,"integrity":"sha512-vLVoPXbVqfJh5qSXBhgioT/X1udysFtkj1tyR95qxIBd5oxcIEesGZWlTveDZEJ93KhlCB+Sijknzxdj4a+m7g==","signatures":[{"sig":"MEQCIC9xN5qDMB8HaDcWuFBHbSEuKEh7qLHhdjyuBc4wngFTAiAkMhswpQoQA7BhCrN2+hWeCULkUe/fmXchtu7L9Xj/GQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJju03kACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpcrRAAkPUkiFU0kElymbsKJt9GBhth0FbJtAIErOIdun6UnEFEXnX1\r\nKPvsClledRuGZq4opFmU+P1spnABP++eRFMjJxpjbdk/T8QGXweuvn3yHu1h\r\nEdg70/J7T1gvo/PCUwIKPy7oW6pCDIxA6LwGGzPRI+28tD6Q1hKCJ7J/NeBm\r\nkO6DJJJE1k3jwzVbUSNo6kTLO7KCKeJapipXiVUr4hQdjPXhrpNC5A4p9rmP\r\nbrJ19eNzP8C6MG+Q39O5O5t+SH8qwPAR8rv/OeMsBo7r571drlrNokk61GiI\r\nEYLeIo/WQPlgONSsaYlbJdS+Ds0ZioYv+UY13MAJr0jLCRk40EW+/RMh35fB\r\nmVly6BSfyTrWbfoZTwECPYddcVGRqFPqADib11o7cq2pkOWHoFEIOg7XWgWb\r\nX1ogmlDQeC/Xwjg88ckpqLVkvxnUDWpwIuVXplwe0QrD+YcX2DnbHcxlLehy\r\nz13QVQgx+pQIYvnSGeDQ02cbcdKMz69faFSwIl78s6mjnv1FMfypOSPSPHCg\r\njFvWebcJDHcPSX9VXGRINt5lAM7Uy8HMul93FfHOQYcXJn8TnRMyscSnQb+l\r\nIjoH1WIHS4nWTGV4eDKIXwTqrkUoWszNm6gnelaOs9wljnyD/6w5wc0cDkuW\r\n01LRm3iXAmLwOtCkK95RG5Z7DztjfGb5VKw=\r\n=QK/q\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230108231202-dfd0881.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/ce8f1ed269b8eef761cb2b70fe133137/graphql-hive-client-0.22.0-alpha-20230108231202-dfd0881.tgz","_integrity":"sha512-vLVoPXbVqfJh5qSXBhgioT/X1udysFtkj1tyR95qxIBd5oxcIEesGZWlTveDZEJ93KhlCB+Sijknzxdj4a+m7g==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230108231202-dfd0881_1673219556608_0.9863459182475021","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230108231754-eb2995b":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230108231754-eb2995b","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230108231754-eb2995b","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"8bb23260708eb1675d181c3e70703922b21902e3","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230108231754-eb2995b.tgz","fileCount":60,"integrity":"sha512-BGnzi20UrYLiEmlhmFpAm9rn+pHD+4IFiFlpA1SWFgXHdvezEAz9RGzmiqtoUvMT8QzFPgEwC3QBwbw9Wa6+DA==","signatures":[{"sig":"MEQCIDJmHikrqnHoAb37nuivXPLeMQoJAoVo4Z2xXdpoQydjAiBxhSepq8QjXHbaL1rtyA4X0pcPTBFdmUA8vbzYGT9jHg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJju09NACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoqrA/9GpUriBLRTJKa9PLhnYjKIP8ZvFlphLIYdLzJaadgb1OXifZI\r\nCEqJPpy9KYEN9tLDgZcgRLLZQ7PXi6ThDgFp5yOfHO12i3vjzbCDNJ0AFr5j\r\nPiiJBbZAaRZbL6ZdffZgbaJVwFg4EvZSOFQMIrjLbUC/LGsq1po6lr955P3J\r\nfBoQj4zsa7DBMXkuEcTvCAcw26U8yJQzEXntrliEAB87TYQER12t0UmF3LnQ\r\nb7p0zUD+F0wiyYBhmZVwys0gEUvxwLzAlCpCnEH72HxIgS4lnukTJpwm4/Bd\r\nCfvSwYzL9T7hu1wuYDcGbYyCgAXT0bekGyhyVK1iUBdpye+daBbLtgm6arqE\r\nqr8ulrzuR3VzpAtHHLHyV3CgOD2t80e4MWAaAIB4AadsaQsvMxGsjUKLnFwz\r\nvO5OsZUh5zFzz68D2NHSTdbu+1VT5TBgGG+HQFkfms72Fhkhm8K7kDA50OGD\r\n73Fja9BK+uprjleUKJycT4aY+YIUBYhqEZOd4MOsMljZUg/74JDH0Pgsthb6\r\n8r+4kYY8ZKrleCm6sxggflU3LLGxzjFS903iLxVd8EqNvt73vXM5B9uCgSUt\r\nLKfPKbFiUv4lFbzMSVdFnLJvOhvhePCHWr4Bsw365Djx/xkbuOUSzhUs9W7+\r\nXWN5gjodLoz4Ux1n1cG0P6w4Sk1CBKZg+ic=\r\n=69cT\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230108231754-eb2995b.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/2a02a4e5cb0c0b7637e22bb285e048b0/graphql-hive-client-0.22.0-alpha-20230108231754-eb2995b.tgz","_integrity":"sha512-BGnzi20UrYLiEmlhmFpAm9rn+pHD+4IFiFlpA1SWFgXHdvezEAz9RGzmiqtoUvMT8QzFPgEwC3QBwbw9Wa6+DA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230108231754-eb2995b_1673219917723_0.5374112096791197","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230109042309-965bc2b":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230109042309-965bc2b","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230109042309-965bc2b","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"efdce011ac97eed5079ebdad2f14abd28bf9c11e","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230109042309-965bc2b.tgz","fileCount":60,"integrity":"sha512-aNM1ZfckjfcVtj3tGh3A57Rqd3aZ3dB2qYZs6B2UCE1UbW4L/ZISPQ0l3I+EivUjK6B7Hy/W0NRif2VGHlzwPw==","signatures":[{"sig":"MEUCICj0TZSCVdmtR/Xme6YsO2oMlzxHWkBHzbcLZC4jiYUjAiEA56XGkxtlXKLMITLfuIUTmah618DxCew2TJIxoQb+atI=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJju5bWACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmq1mg/9GiTXVr78XI/X5Rss171FCIpcNmiJDHqRqklNXPLjnXeTdmFm\r\n/a+ebWx1SIFbI2ZDrVbLSvGlCnEDEB7OHR/cseg6Pza2DGf4QdyHjPsUNW6Q\r\n9uVy3qTcOxfEpAVqI/1lKHl5yqjWAgtlOS0qnYm/Ti73ABvnoTE9X9aV2cF4\r\nYe8rURO4TjbsJ5Oz2r5vMlgL/ymVvNsUMKU3mOrnARTkc6TgpLfjKZer6SC3\r\nPyxjcQ4oXHmuWfhHcshlzgZJwjciSTiV3BFMEDohZ3kLljz3Umtg3nXtYPDf\r\nKPodmvMjhkHdCwPsEIyTmhfkF37rY/K4keLLt8wJydY4CQqia+LJ7LJIWQKv\r\n1gocVR2wLJsqsol52cNe+xEVIbpC/7fDfiFBbsjwWnVxrV0K8n21CrTfQXV/\r\n9GkVA0rfJUE7mYQI61QTwxuSdgaK/wtRg57xe0h2glGsawIDL2Lft2SOpyX0\r\n5MSJbQdmIV2KoabDz7VDBSgMdSGcwVNmr8kqZ58weIf+vqqPfFHGCsS7pIr9\r\nBq/2sSMNnLSjrT3vB7vwlZAuQWznblp5FLdRbBlNJVCHkwNjxyuwIOBK766C\r\nmTniwQN4HGXs77b2Q70VNn05cDj6ItusBvi2XBXkkzeIjqyg9M+hrI3wNDhV\r\nn2EbAyijJhgZUfSyKY/y4AKFkufonLVW1K8=\r\n=0vu2\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230109042309-965bc2b.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/423c6f4f66b79395b492bd3a28265db6/graphql-hive-client-0.22.0-alpha-20230109042309-965bc2b.tgz","_integrity":"sha512-aNM1ZfckjfcVtj3tGh3A57Rqd3aZ3dB2qYZs6B2UCE1UbW4L/ZISPQ0l3I+EivUjK6B7Hy/W0NRif2VGHlzwPw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230109042309-965bc2b_1673238230634_0.21656886838642908","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230109070813-e8f8762":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230109070813-e8f8762","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230109070813-e8f8762","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"849a62afc27f814e9520161645b17fbde00c2733","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230109070813-e8f8762.tgz","fileCount":60,"integrity":"sha512-Ji/Hxh4r2B2IDA6cQ4rRjJ8GqaiBSXfIBRXeUWImWoFi3dE0z53SLeq9t7ORlSsGWay6Ei9gCZR81NbFnILytg==","signatures":[{"sig":"MEUCIAmwZ6eRo1jb8IgZR8qV2O/WIoN0YXkvuAg5dSV/kKwkAiEA3+BHHGZnOQDWFZNJ9fdTuWckTCKBDDTeztEEHV202Ng=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJju71+ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpJRw//e165dL2fvpk6zJWR1r0pMlfgOj0MhonU4sLnVwnv/SJF/ue1\r\nFCEX1MZCZiQGGPUcWrfePWxFFgupI4Mpq1A4Os4xhpJsT6W2eOISLOnaEIed\r\nPwvlgLdcYcKzejyHb9Pu0YxeOYZI9quuqiIBWj4vK4L0pOL4hh5U/IKsbqC3\r\nrJAQs2S8OA89JZ9WEObRdKEyPIRmnS5cVj1SAPfnB3C4DBWWYRHGg+9J8h37\r\nxktNw1QPiPHvZEW6a0/A1zxIF8FJtHAxx3y+20FbuEd8OLzi7jVRQ4OixQVz\r\n24tFbnvUO0xzQd6hdQGd4lXHhmF0nYWdnNSDRnkKKNu8LRBNO4AOcfuz0wLf\r\n/g6u9PPM0Ja0fsMolb2F6fbV9m8CCdFJJOae/8yxSAjwUm4OARRSZFZFUrPy\r\nso7LrDu1GjW1tPM2n74k/gdQ0awW9FKyd3MBQoUYiOnl7UYI2Zf9182Q+J2m\r\n6Tz+jwK1QUprxKDxAfHkhFNyDvN1rnCZ4RXqnP2VVi+cIRM+e+v0KkeUQxmg\r\nAvaxBvyR8RGAxAMv0LQyKG/Ya+BgfwgARSRLsIMjpRfbddaebg1Nyb1P6Yxc\r\n6JtwlsUkQgIs9cCIlVkjF+8ZzXTdcBpyuK9bmKQSevsu7k0D9Mj7Ca/gstgS\r\nt0GOozq4pBNKaIawKHOrQmFuRlwNOAQ4nGw=\r\n=taRg\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230109070813-e8f8762.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/7e8e523a592766fe74570cf2991833e2/graphql-hive-client-0.22.0-alpha-20230109070813-e8f8762.tgz","_integrity":"sha512-Ji/Hxh4r2B2IDA6cQ4rRjJ8GqaiBSXfIBRXeUWImWoFi3dE0z53SLeq9t7ORlSsGWay6Ei9gCZR81NbFnILytg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230109070813-e8f8762_1673248126648_0.4313035757101209","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230109071349-6070bd4":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230109071349-6070bd4","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230109071349-6070bd4","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"469a53032f1515a014dea59cfdfdfd623391ff2f","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230109071349-6070bd4.tgz","fileCount":60,"integrity":"sha512-v0EP2sGTudF/uVbaTS67U7sBFV30i02nJS25KkertU/aYygKrFUzhwNtq1HABM1f8aJX6UB0Dv+6D5T5z3CWpQ==","signatures":[{"sig":"MEQCICfkfqEkeQuVSQG7zlHfwyMKjNnb0Dv31DDOP5Bku1f0AiAR9Pg1bU+8jN8CEpijGZVpxmwx4D12JxK9fZpuiB0l7w==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJju77XACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqgIg//S8aBp9GafsjuTMQ3NiaS7DnndSRb5U0zx1vBvnRMcwKpFruU\r\nCCnjJZkrCOxajN0A/rqR41Ya/JGRxnV5lSiAohtPc1uoA83iyatWw5/XPedd\r\nGnVIDhQDhehEdJ1nnz/Ju4v5sN0cwA8tkFbCZ3AvFCvlukY5hlLO1JM8G2HI\r\nsD/yrWpoPUaCZIsRYdLra3f4L2dOaaNPrsW8QH+V+nNfomgw6IB3au/g0HVn\r\n/a6M6n0AKzUpCLdhVSOruzo5LbNSWbPI67g2z/+VqoT/1WdQP8C/RaIeYm4S\r\nlOrgLsc/clUvsXjJTEzVcHCXJ7pHvXBOMhRJNF6SF5t5E/Jqbd0KjsPlkFM7\r\nGvk5YXbM6nCCti/0DURRGrEHWC0UwiNAuSMuvQXdAuARPs6fbO4v9LlIVspX\r\nmOaI+JlVbfAelPX7ymug2ExZ29GXRikl0J8G4gaE8RAIlRVgPZvNcDUolOUZ\r\nWNrlutMIy1muHYDtKrrSV80f70u93CJ6PrfilbglFj1e4b6RIqNVH/+YsDM8\r\n79kQDJw2o3geB49wOyW/b5Zsm2FBApJ0jMd/4608TA3XpNyH54SXkcewbW1O\r\nUg9PYWEdoYOuALI+YlCXrj5C9SwKUWeCF4p5N13OibQ/7/M/02ru6MfkuIcr\r\nesdA/9P8ssGUQlH/ki1rqKe+LYFhFqC8/ig=\r\n=s/rH\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230109071349-6070bd4.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/4098eb4668bff9b13bcd31b5672315c4/graphql-hive-client-0.22.0-alpha-20230109071349-6070bd4.tgz","_integrity":"sha512-v0EP2sGTudF/uVbaTS67U7sBFV30i02nJS25KkertU/aYygKrFUzhwNtq1HABM1f8aJX6UB0Dv+6D5T5z3CWpQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230109071349-6070bd4_1673248471218_0.476335480338542","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230109071524-9446f71":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230109071524-9446f71","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230109071524-9446f71","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"010fbbee0e2ba5a836d24a696d19be080f987445","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230109071524-9446f71.tgz","fileCount":60,"integrity":"sha512-Wk6gca/vH+8zJAZgwpEQ0/ciDjPh8VsFGVYDjVmKilt60wqNs7HXoc4yKTGpxrJav3rXrgEFpSReH2bv0BMJOQ==","signatures":[{"sig":"MEUCIG/neiYjUndjreGzaOnCLGcF3XPB+k7lOH8FDMom+2kIAiEAmbFP6s3l/uteXWKtXzhgtHu9mka0AWEtvYuLi2CzWjI=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJju78vACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrS3g//RFKgM0hQYN1Yd/IwijxUASH0563AHIMin2Kc0s5v1SVuX/Gn\r\nKIGcHm3iFgm87vQII0tfG6ogJGk2TCeuAev4vWdBLnTZEtM+Abq+UKoNUs33\r\n/KLDzj3hsuLFHszyagU1sM6NDjbJb9ciJMIsQ+fBE0d4FZEyZMwTFqjQ6F6v\r\nTfHN/9uKbYJVE0uqILm3+xsefohOPHCXXZxYIYrxMFV+4ZBMuyPc68daMFtm\r\nL2Z190ZVAOFsyMUyIRHJ+yLkL4J96svpaFE6FLBKHmXh2V9x40nbuciAZMJt\r\nn7DoJWQBB/KMIViTuQ0sG0yndlSPM0kzrKC2g9o/cpkqEiORTcNlJFtLlseI\r\nSCFV2qXHqiDsYthfufxjLdLOt/31QD4euY65mS9bqHmxKPmM/svxYwfX0OoU\r\n1DpgFOqlu/QVX8JyNXBoO0R68x5kTwx6sF2zbN4eqI5Fk+Uj8Y8lRxfqw/a9\r\nyZiVFk2M1NwyrMX7L4/rGc/RDB3MYRa1TFlGN2GcvBbP29t3lZr9FFK+k6KH\r\niYgAApOhhG0pzq3y+RsiD++eq/8zutc6vwc5HNrVthZK3ziu64TPmVdOx8we\r\nPQMyIUMTEW2lfYr3pXVvaJybVWXWScucg3Dny0FglkANpn2zzhiFr/pvoXoL\r\n1UGtNaiEjRXpDetf2tsVBgCuOpE4S+QtLLw=\r\n=lpbr\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230109071524-9446f71.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/9b0f6d452eb2f57fa936672fa74de92a/graphql-hive-client-0.22.0-alpha-20230109071524-9446f71.tgz","_integrity":"sha512-Wk6gca/vH+8zJAZgwpEQ0/ciDjPh8VsFGVYDjVmKilt60wqNs7HXoc4yKTGpxrJav3rXrgEFpSReH2bv0BMJOQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230109071524-9446f71_1673248559449_0.11291234213073631","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230109072536-6cb0998":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230109072536-6cb0998","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230109072536-6cb0998","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"ea4c1a730785eee8276675d831313ffec3f5e503","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230109072536-6cb0998.tgz","fileCount":60,"integrity":"sha512-lbQroA6WktopSjN9AYMAucmRrRdZHvPd/y1TWxJWBZrgvPIweh1uuiXbhymnE3sBy9LTFdqf0V3H/+R6zXDNpw==","signatures":[{"sig":"MEYCIQC1Snj75OcHjrgDvUp8D7CHaunT1qqW8Brx7KxNa8cVewIhAP3kgVwH77Do2EFHa2Tlr3pLeu8mv2iF5bqPITHr+2FJ","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJju8GTACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrOtA/+Kpl+7ygCmPuxQo9JYdMkfnBMYC7wXStb0VzSY2wSBySnQXr2\r\nRkKAycxWtsULF87FuOZ8hqGCZ4UTDYotonNWjt8Fq43DS8/NsSJ7xF8Gsrv3\r\n27tthcgZ8z/SLBs1sYLsnEi+7SSGt04pG4Lj41MEJtyWQKLaHIvyPHB/3RwF\r\nJCzQwSj3mjQSzeuNJv6hwau8JgQoE728YcKYDkwPu6xzSDuVbrGqyWJf1dNm\r\niTYKLf6k5dsocgIuo0iMROJZobfart4+YarBQRPILjHqSictmv5tsqoAom7d\r\nllNQ5i8kygJr+XOOrU6y+97i0nvGSIOU1moWWlQYDq9GohTNuyl8DW45WVbn\r\nplS+UEzysXKkRUWVj/uZadkerq2HqLw+qA5Fd4Etuu71xQ0n8xCMZZqaayWo\r\nDnqZuYdMRZb86pEJFwKS6dovXCisoOHQQT4qP9x6odv9sBPRAvK74UJMnE/6\r\nkoXt4RqUhLqFe33J87jbmXLeluZRFyz4uJNj6fhgRu6/duzwg9Ea1uBe1Hs4\r\nxLcaP5xcnHGnHhF1LTMCJPnHGJoGHg61xkHvdMKv0U6zb9Ulk+gZ8OOFvXIP\r\nAMztQPx2QJutUSxmjOECGRnCFyL7ut9EffEHncFZdYU8qI/k5IesyPrS+usk\r\nGwYTimMtaEne+OWYC2Y+dWHTlVdrUkLRW2Y=\r\n=ufAt\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230109072536-6cb0998.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/1b055996f516e13bfe91834b5034ca01/graphql-hive-client-0.22.0-alpha-20230109072536-6cb0998.tgz","_integrity":"sha512-lbQroA6WktopSjN9AYMAucmRrRdZHvPd/y1TWxJWBZrgvPIweh1uuiXbhymnE3sBy9LTFdqf0V3H/+R6zXDNpw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230109072536-6cb0998_1673249171103_0.4191994862945274","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230109072601-25cc176":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230109072601-25cc176","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230109072601-25cc176","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"2fa6e2822dc4d62247f9d06dcb5fbc9b71fe3e30","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230109072601-25cc176.tgz","fileCount":60,"integrity":"sha512-PqY1Z8ZuduaA4sXBtTo61tASTLJevO9thPPq1H5nImqxRT1jbpUN6FZicYrzVDhs66Ib+NiuGrVERalmSXk2Hw==","signatures":[{"sig":"MEYCIQCEq32HYvTnzQgw+72lz6OsmYXzPlF3/6UfyidOHx5YnAIhAMXgVyKUZA9c06HU9USatZRuS/WabOk1txHSUkriXpW9","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJju8G3ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp9jg//ZBQhxVbGFzuamp//wqhY2u4DMj4RZoiE2iXlxmJhD+S1kgyg\r\nKlKqjEfgjL9N9rurg8v+y35AkgdaJcXsqV0xAD7m78hZaOzpyOc1NM9YkuTH\r\nwTbVlSKXCFkNT2aqWkLr6ZpA5VEZclFU/DtjNeawzjS5RoOA3Zds+/T9LE1z\r\nlMGvFTQQjLOGE+KbYJ0pEsqKtb2AN8YjOwkphPznRvbwpSSmSjWz6XXuL6Qn\r\nEYf86EZewlteMMUU8vTL0vdZghVk0l9nG2XO/TvbUVq3O/BE77myWf6len8t\r\nNMpjI0qopqIhVpsdKXcIoIgO+a5d6+tyb+PijXQEfuOObWWUnajmKSPQ2WgA\r\n/BA+j12tXBlYj18AzPITyIAxE9nDAAJX4aazmoY7ZXvb1u72q/5cQ3QD9t0/\r\nzyV6tqiuxpyu6JJRMY0d8r1cmKF43jen2SqPzK0+98TAzChXp51YysZtpsT+\r\nJu06qE7KGQ3Z71RxJ8zu53ae80qUAXY38GkgOx4Q4+ZIAxI8vglB0Os4UwXE\r\nm+bpLdJ5fuOL2XrWKASXRnjv2GALfAJZ5PTmcN1QA4yZz1MqH6Mkra6jqg6v\r\nXrHBShI2J1xr2fmcKVCPU2NfwR/jXGh+x8ycOBi/cZOai9Joo4wpxCGyq0OO\r\n7mXC3fugV//ee7M66r5QjNukZ4sv0br8vs0=\r\n=dyJV\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230109072601-25cc176.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/6c58048d8a17b29ae5b4d4bff8ad4ef7/graphql-hive-client-0.22.0-alpha-20230109072601-25cc176.tgz","_integrity":"sha512-PqY1Z8ZuduaA4sXBtTo61tASTLJevO9thPPq1H5nImqxRT1jbpUN6FZicYrzVDhs66Ib+NiuGrVERalmSXk2Hw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230109072601-25cc176_1673249206883_0.6570014000354854","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230109073137-7a64a9d":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230109073137-7a64a9d","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230109073137-7a64a9d","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"7964551449bd8cdbb9e54e06b974d662b15b3668","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230109073137-7a64a9d.tgz","fileCount":60,"integrity":"sha512-jhKtnrXEAzzLcn4OwJQnCLWQRC9FqsVWF7FAYdgznbsiIQ9skO6mIaRp+dJB3CbGrTjlS+HZY/F9yMbjypV0cA==","signatures":[{"sig":"MEQCIByQBEBB16ENlJnFAaNEaiChvZzGIXY5472DNW4Gc9F+AiAqPHeoLJY6VlkkgnjkTZi+R14HUtPHA6XCsVoAB4UBRg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJju8L8ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmq5uw/9FIh+QPXKyPmdARdknEGCDh+u0ofKVUJfZo6NzV8vI/pOPjy7\r\nET2J1+WJffXcSNqvmW7ndbIw1kWWhCw4L8vVf1YYsU/gHmkMVeV6Gmxu4412\r\n0zMFuvKR0lnThe9NKAEQEp7JUK0gbE29X3jtGDckaljOaVtffdw7t0r1d0nj\r\neXCIrglKtVgv25/j683wIJ+VhMz5UJAW28j9JKoFN2pIrZ3LBGBzzAFK4ZV7\r\n/jzbXKwPYGWY2DxakdkF9u5zW5+rUSGlglHd0+SjiP88JLGzxVnqCCKk2hoP\r\nVmMGBiaE+Eu1dqiavwf3XhHEPt42aN0LiiVbkDX8j6OOGcMIT6qQWl9c0bN2\r\nHfb7yKsst8LMXDKncIaMuerYgtsuQZ5U30l5quh1IHaXaKJufiVr/oX4Zl89\r\nD9ydjZXXvFC0CD6M5Nfd3GgADPkCaUFxMAhFPcpYPiB/cbburm8ihw4BNGey\r\n+kYgh3QfX0RQvC/cUW+v0pcnji3ZoEDu8nsk99TXFZ7JORiq+tS51mNLFkmh\r\nFrzHyuVviw5HKSAgEHsEfRihZQ25Kcjzxx1XLEQz/YXM5JOQLRVOt2Br612s\r\n2YnOwe8X8FGaKGYBXV50SOGFVRO57mTUGopCVZwDsIRxCB79khJ8hvRM3dHP\r\nYUbUo4dNPGKCPUH2i6Cq22IrVDRvRcH0dM0=\r\n=8tZZ\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230109073137-7a64a9d.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/fdb0affb936a8d493729d64c2340f3fe/graphql-hive-client-0.22.0-alpha-20230109073137-7a64a9d.tgz","_integrity":"sha512-jhKtnrXEAzzLcn4OwJQnCLWQRC9FqsVWF7FAYdgznbsiIQ9skO6mIaRp+dJB3CbGrTjlS+HZY/F9yMbjypV0cA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230109073137-7a64a9d_1673249532306_0.095888574181348","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230109073649-b81e6e4":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230109073649-b81e6e4","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230109073649-b81e6e4","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"4f588bea5a080bd5ae6232c3d6f43ed1373c0521","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230109073649-b81e6e4.tgz","fileCount":60,"integrity":"sha512-GRoVxeUSKX3/K+kj4lt4Nz995Msen3YKc3uqlBd1KayvlER5vGdoNvoTYapJLb7PBA+ay7zibVHkNRaipGa9TQ==","signatures":[{"sig":"MEYCIQC/+GyvXO4NOSU0S+o0vmIm6XcvreplEe3PcHYYtizfKQIhAMsf+AmB3UWlbdlbNJ0hX9GmQ3J22jB+Z/aRhA9na1vr","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165581,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJju8Q0ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpCWg/7B3RRLLgnecLottTQPp16nz0ZG8y+KVjU3SgdbK3eQzsRNJCS\r\nVdik6y7Nyk9HdbL20mEW+jnBZ54APUrTYgtzSprV1ZwmMlSjmRjMVICgw8X4\r\n+fW+GK1PZtL5WAr4j+OKJbUEwtyRpDO4bxg6fmz2q8TnHZpVHiAHuAN9cdtf\r\nyAJsUYrrdutOqa9guxH1pgUckuus+XVIFbKDF+8ubnI7ufXIiZ/CHHDtEjDS\r\n6LeTlHwR4X8wcCQho1yXoW2GXjy4VF27NuYRc94XWa5OZV+wOu1VKoTh5pqd\r\nCgkmAWATkjDlZj24aizzuJpBbWMMydZHlHXAOqbQCiRX+4WZm09gICyMfovc\r\ndDpaaRCQ09L2+H4nb6NJaK9Lu9TyELfU/EZZzUO/nsKvpSp3jVDGWiFpMYqG\r\nOJ/8zJfVxhYFD7dxqenSOW9r2BE5SQOvdmijw4z+Zwsk4+8mXXDVFW4JUEtN\r\nAgR0UcWphWhHtlSh3HDGi5ukuld5nJuHDsLM4+Uf0yoZ31ilxX3Pp2p3P3Hu\r\nHx8rlo1mirSTJ4shZdaMLcNITbCd1SHNG1AbSUBcxeu5/NR7DTvlJt+tBot/\r\naOhV3jeJzNj++u5+gBgOWcf5XP0o/8CbMzyHqUqMF/q2ugVQkEXsMyMWRcjJ\r\niUwLzb+IY/dD0Ta4nCjamwcZgRZqHZq6VQw=\r\n=Wc8E\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230109073649-b81e6e4.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/331aa4e6a109561509072f7488851c43/graphql-hive-client-0.22.0-alpha-20230109073649-b81e6e4.tgz","_integrity":"sha512-GRoVxeUSKX3/K+kj4lt4Nz995Msen3YKc3uqlBd1KayvlER5vGdoNvoTYapJLb7PBA+ay7zibVHkNRaipGa9TQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^9.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230109073649-b81e6e4_1673249844068_0.5179858352073115","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230109074241-65f7c6f":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230109074241-65f7c6f","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230109074241-65f7c6f","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"bad80a87392144a7c0eb270b2967ca104851c5bf","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230109074241-65f7c6f.tgz","fileCount":60,"integrity":"sha512-lj0wNMy74uO7fA+a5HJu9qMGcMKZS2DWoVjPGyHpftpJWDViOMwH0MRfIf7a/VplpPglWEVzxkFCVSANy15NBA==","signatures":[{"sig":"MEUCIFsc0j8z/JUIQ8guxLMmIR1hkv7KgIqxPTDiUJr5OQcuAiEAtLgw6mA2SJoVcOatvMjAu2LZXi0PDbAC/HXpDHPbEaw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJju8WcACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrstBAAgCWi2uvEqgKc7nPyDQYKpt9rnkqfek7tI9D1XreBz2jp1fOV\r\ng/h80QOmIkJg1vT0/DY2Q0pJx8oo4LJ5geuC4yoYkxCZs+pfAgaZvS+ijN0X\r\nkPV3yfbt3aodoCQipDkZbjo2wJnRuZXl9y8QpdAIfHFlzSw94t6ayRWt3stb\r\nN10CTc54sofrnbO6EBnc+1Mvhy9JrYzdddVYhp+Y++wIcHgDQM0d0m0ab+EJ\r\nRJVv1DP7cyyhRwi4jgsEgGuyaoL8LsqpeWwvA9gBfwVKibQyouOjjGyDruZX\r\nXWqUW+UEsPKZwd5AuXpLkzB3IHf8HVa5VJdWySvuZnmCJr1lIDYWLZ1GI8U5\r\nG2cwakyOJfJxzidhIc28ccnbBH53C1h2xjLgnx0lwWxzVgu3dSbRXhBV+uN1\r\nicOU2BH8CRZZVyjlWwByhZ2nqoe5pzGdkcgR2Z300b5mLofKPLt792kjvASf\r\nzjTTRw3FIrVEuZmT66MFsizD3fTPbYwHZtuUBY3z/cin8VPhgq/ExAJ5cuSO\r\noQ2eQoheIclC9wdLpwVJkncvVUvkECDd66VFOPakZe5hnghqpf/fEJLWWCJu\r\njGtTUqDlYGuNbvaIQlhTN911qT0sUdK0dGENBPpFZvDX01OMhKr3iKNT2QL0\r\nY07zjjsFO7/nqcPzdza0/M4uUWgU7wW9+uM=\r\n=aGbI\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230109074241-65f7c6f.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/c84b7a6f063c368ef5f082a8401cffca/graphql-hive-client-0.22.0-alpha-20230109074241-65f7c6f.tgz","_integrity":"sha512-lj0wNMy74uO7fA+a5HJu9qMGcMKZS2DWoVjPGyHpftpJWDViOMwH0MRfIf7a/VplpPglWEVzxkFCVSANy15NBA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230109074241-65f7c6f_1673250204727_0.3108740123733318","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230109074703-f28fc94":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230109074703-f28fc94","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230109074703-f28fc94","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"1ea03f6a478548232f01f728db38f7726e44da0e","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230109074703-f28fc94.tgz","fileCount":60,"integrity":"sha512-9/h76LOIZMSZgsp4+YwcLGeTDATWECdXfiJRcxI+pau1RGMID3ZfO81rI+9tPB4xM/KCsZ75uYChRsAZy4m7zw==","signatures":[{"sig":"MEUCIFcgIcKB2ounp0A5h5Ur0LTFYhwcPWYP8mxJbQRAxCZaAiEAwvljRxPqKNcg/ELEM6Fm32dgPMLlzCMKYYskdlhItIw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJju8aaACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo1XQ//UTQzd24fksYN6VzKXm9bUFMf9PKlTi3zFbmFhEqvBr/GI5wA\r\nmtzqsblpIdsSmg7eoOFapVoQZg14TYCwwWtEKNsJHua50KFoBErgG4C1GOcZ\r\nQbeIqNGvOlqpdarktj682wFDrLy4L9PJDkGE8Yc0S1fkCPSUZo2Q3reKEQf8\r\nhpm/wFauz7mSHMkbb7Lws4WV/848OABzcbM14LXH0FFqeOXpgYXb2duNb4Cu\r\nUX3DGQzmVE8nYABvGpg+8DcFQUuppfwkUPz+bzW9bZFmIJ96RTWO8Bt6wGRk\r\nQ5CyXqPBMvVFNhS+7xmceQhh5x2POe384rYbVhFqeT7vYjZ/VW9rXUvh4KKy\r\n53ADvQ5qngnEzPWMddlo2fdD+VfHR86z2mNsVkiDLxVXLh7CetPimEkLCTFL\r\nX4hmte5cqR1ZKrSuqHyZufhuqX7jz4e5hzV0AkhwValP1e1NkijQw5zxWYdU\r\nCu0J6GB4VnjUusGzzFnpd3jBClT8cg6cQF1lj9IwRlSl6s12YmqgUaUgS2Lh\r\n43Ce8wMf4UTVSvjvFRf+cV+qRdNcueuUzQUXj8yCFLMNZTvxGCCzTL2ENG0Y\r\nUiavutMDzK17PWusT20BxbQd9rhOCHAgM6Y2R8jZO8J7sUKmA2J7vP5sywO6\r\n12XHyNeJzTxihE+Ex0iLotjVdGho//mciE0=\r\n=fIu/\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230109074703-f28fc94.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/954e61243af0161e706828d31f23ac5e/graphql-hive-client-0.22.0-alpha-20230109074703-f28fc94.tgz","_integrity":"sha512-9/h76LOIZMSZgsp4+YwcLGeTDATWECdXfiJRcxI+pau1RGMID3ZfO81rI+9tPB4xM/KCsZ75uYChRsAZy4m7zw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230109074703-f28fc94_1673250458324_0.936337739591877","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230109075231-1c9dcfc":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230109075231-1c9dcfc","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230109075231-1c9dcfc","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"9b37b404933e321b7bd1e2df71ae9cc43eb46396","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230109075231-1c9dcfc.tgz","fileCount":60,"integrity":"sha512-BDQ99EPnl3NNm8LxLCeI0J0ZdU/7njlbwc+q6ZLz9cJBtlzVuqoPMeivD4qL+2zd0dg+cIoCzjLC0nhSG034TA==","signatures":[{"sig":"MEYCIQDWNlO8jChQU/wSQKAr/+ILb5LNiW9K0X2LzvV1phvdLQIhAMwPDvbeOYjztJJhAS/zMc+0EST5oXz2O5VBdWpv2yTq","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJju8fhACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmptJA/9H15qaxxpZffwG021Cf2hvsdPRO2ICoPI5PSo/pVx3K68G/AI\r\n33xDVyR8rQcHkDZrUzsE9GNWfFU61jHIYHiGAQs+7c82LpigaOQV8jvh+TWm\r\n3Zl2zszWOdjm8W+HsaooJp/BK94rf1SXi1bpu6CCYZ7KFHnMiipiZSb8kViD\r\nPJZy3zieuHu5cmGS6+9aOnWxQFiG2Ww37sFJvuwgtUIpcrSKduUEW7yApQX8\r\nJ8Hm8ccN+7GDcpnEbX6TotGIsAofhdF7e+gSdcfjAz5KhExIvAKb60mYzH/l\r\nWz2c3RA+8iLatbXwwi5sMih41k+TMvERTuPvsKZwjE7ul9kLwqsvgg0T5bA+\r\nSUENGM+Sezab0m/Ib5QwFJn1HH0O96eYtbP0VNwVTGAh8Xucp4WwO4y8Zt+8\r\nYvnwVrj/Pe0Grp2aQyb1DKW1aoe4bHafc2L5oLdLjN9O+AuNXZviG0YtanpH\r\n29wS4PdaYA1Xkn3o3iu40hqGBhVTZmY7ETOB+TcS03+VNZnW3S0/HnxloW7+\r\nwg1MgRltY9gImwjwFJhgVuHVbMjquf8OEU1qfh/pk6Qq6nI+W48JGqAWrW7f\r\neCUZ0i7T1RmbhdRvoTvdNE+r6l6eRJpWbhwAu2KaOFYCxeVEEMD+19XKyJ7R\r\ni559PKdx+PDgxQFL8cjphAM2+KVDUgE7oB4=\r\n=d7Ka\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230109075231-1c9dcfc.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/b26b8e4b87a7e288fe817e78afd0b46d/graphql-hive-client-0.22.0-alpha-20230109075231-1c9dcfc.tgz","_integrity":"sha512-BDQ99EPnl3NNm8LxLCeI0J0ZdU/7njlbwc+q6ZLz9cJBtlzVuqoPMeivD4qL+2zd0dg+cIoCzjLC0nhSG034TA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230109075231-1c9dcfc_1673250784825_0.49369766714683294","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230109075746-f9f6bc7":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230109075746-f9f6bc7","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230109075746-f9f6bc7","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"9186c5f6c2610d97657b13b6298b75343b27e9ef","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230109075746-f9f6bc7.tgz","fileCount":60,"integrity":"sha512-AWQ90XlAVSrMxNNfGEmym3MnnL3YeFBbFsFWbNnMQou2uuExrI7CeLRZtqPl2B/rk3WNtQKTTAA+kr1ZIQXIRA==","signatures":[{"sig":"MEYCIQD8TaRhod343Wld9W6K44rFwv7qh7z65IyHNe6fl7m3YgIhAOX2N75VNzCluwE8fsYT9TePGDcWxvUkSLN+vi/e4Tgx","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJju8kjACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrZ6Q/8DZaYNi42EdHvUkWjSx8tMuSfnYxNrtn/78ZOdd0FarjKQtlg\r\nzYRHDuBELhhKgje0CpPBzrAaWXUVfyvn+X+pdyrEm8riJHdeDRJEoiegEDPZ\r\nFbTRjen2cWjU3CK9+t0rNnvJIMd/Xz/n6ro8/DeaIzjlSQQkdSa90cZ0C/Fe\r\nuIqTbHEG+bIsEx8hT1qOX1e5xZoka4q6KsIENvt3Mi5d6Q4+BRkxmfqMUA1w\r\nDZQGSywvRLDxEt6goO7uoywKbilEEtm/hVKdd0HLekQwLJStTGaaWJI8TJGB\r\nr6ZZxjDsb5h+npHwLB05kgfYerX7hLOH5fKkfNOwUBcrKWnSlgbqr353DROG\r\n6DE2Po6Gr2iNGK5NutgTyDbBPN8HQCbSAfgvLqe0B4ASF80mbP88wr8nmOSg\r\nd7Syd/oDnpV2eMb1u/zoMU0cXU2m9ww+g6/6pL7LYzB9ZEHuIkLK7ZNS6CXT\r\nYAdofBbYC9yfhwGzJuqWIM8P1cCUrxBA9blixH7zmDMeZf3sfpYvn8ZQe/wK\r\n9lBBwxu4SpS1t9UT5fFYEzmlHnoXffBbglkLbFfwrBWGqR3o4v7NNQfrb/w7\r\nIfnvkh2qS4HEoMjYQmwQNZyqh679HQEyYBid3r90BBTjE0ofEnT+iYsvvgT5\r\nszp2o1ibTILbbBrh69R9fhvzZXGsdy5pa+Q=\r\n=qbNa\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230109075746-f9f6bc7.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/ad592b7507edb5b2aeed2aa260e6d62c/graphql-hive-client-0.22.0-alpha-20230109075746-f9f6bc7.tgz","_integrity":"sha512-AWQ90XlAVSrMxNNfGEmym3MnnL3YeFBbFsFWbNnMQou2uuExrI7CeLRZtqPl2B/rk3WNtQKTTAA+kr1ZIQXIRA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230109075746-f9f6bc7_1673251107635_0.5892255752364581","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230109080225-0e1522e":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230109080225-0e1522e","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230109080225-0e1522e","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"5cd13da359d8263f55274b38a8645e7a45ff79d5","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230109080225-0e1522e.tgz","fileCount":60,"integrity":"sha512-ZMhERjdISrNXT4LYG6gZswx+88/sVyUcuX3piOPKCXeOWE1q0PNZwZsRWrGkbdA15bGJpDR1SptelMrMYjw2cg==","signatures":[{"sig":"MEQCIEyBHLuKki50CJ7Kikx2TCR8aGWTQYjxDIH/NDpHz40DAiAfl8rkh8CCZjJ4NK+vwieDGIDnsiFZU67/VQd0mD7uRA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJju8o0ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp5JBAAjYhGlMKgYTQKA8H9udDOCBFX7vr7E/lxCa2G2lc/avUAVF7B\r\nAM/K6AgWZcG9r1D8b2gyjr99ERN7shsRs7SR31T2Xpx8DyQxXpZ3NCfhHSZA\r\nPE5oS2XmGHpMD4t+KVzuS49hVuUI9abzv/MRhTp18ZWMyCYMOo3yPVpAYJTx\r\nO8Kxp7arEbY08oiXEV6gODJoApu6Et6H1qkKrGzDgE1frH9J6HWNvFBuTbQy\r\neUtCdJhn/7Yn57M3YgPI0WhgRsqbIhRoX53/IDBO7R/xT7ssgo6c+i69FSXD\r\nDYr96wQDdsrX6BqA59kHak8h+l+TE4+Wm4wjYdhmyAkTC2U+ws/LejtRhpQ/\r\njVhcdpN3pLTZESzeIdNsroxDWY+9TbAhqpeX6QjrS4+DZmvSYqjHKTIPIPiU\r\nvkbqALlL9C0uNu8XCDM1tDa+UiPKbqfu+M4RLXrpNy/buMV2NrMph7SFBRkP\r\nvaZ78hemLxbBuMjCYZPaHOQ5DVugrsNWDav6FsAnxnfctwe0WcD27dZ84edD\r\nvdnqBaMqL6N1ZuS6jxpJAinlcPCh53v0AtafLsccwE2Zq9z+T1T55Zvc7ax9\r\nGfDNv+B6wu/Y/hW3N+q30MIGR9JRNxKG0IIu24PDZ2Mmy75mGL7k+kOru7GL\r\nRsYxaUqSGWXQb6nejbKSloJx3gw/enVrfQQ=\r\n=217/\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230109080225-0e1522e.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/86c2ecc369b0b591f4d0ff9e573cbc6c/graphql-hive-client-0.22.0-alpha-20230109080225-0e1522e.tgz","_integrity":"sha512-ZMhERjdISrNXT4LYG6gZswx+88/sVyUcuX3piOPKCXeOWE1q0PNZwZsRWrGkbdA15bGJpDR1SptelMrMYjw2cg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230109080225-0e1522e_1673251380563_0.2922424205572782","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230109080425-f8ebf1a":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230109080425-f8ebf1a","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230109080425-f8ebf1a","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"09cb4c2d2148799e86aed127461391da5d8e93aa","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230109080425-f8ebf1a.tgz","fileCount":60,"integrity":"sha512-JFkJepUVGpBo1I3a7a1pjmBeyPe/YxykjAkQU3U0ppZQFYe51or+Qv6aIID6kwbVxniHYDjJLl2CCglcO7/G6A==","signatures":[{"sig":"MEQCIG/HKblB9xf/U65nURyvqFx0bDlHN8nl1bG6zbO7W5yPAiA6n59pdkP9A4Sv5Dw0THOo0dU7hVS5lQct85C/zsMWcA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJju8qrACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrQ5RAAnm4+Bp7ZEaNZuTw/kzMjh+L86Wnui9h9mzcSYwIHFdNVHseX\r\n5/A5IDWdgkHqbMNZuFhB0zqu1ekoWXa9z/IpyJccZY3CEUWGLmUUpCsjfHxM\r\n1JoYGCiiWe+Qikul5lWAAEMFY6tYT24Fanwkue1GMxHu4hDz7MCyZEgx8HbA\r\nbqljWjDg3kdkVSQfR4HtM0FqgfW91+YXbpKcQ5hYzi/of8wqwIJ4zElU0LPV\r\nZemDl9VAgN9qJ89v1u3TtpU7gCs8UM4LAUNmBA4jTEmDY3PtQXsdejlJg5VS\r\nH4DyYIVYm1y5h/bst/GyDy4fM55F/bxASxynyfD0ve9et++iS80kJ/xE0Feo\r\nA3vBLmZyPtUSXBj5VjH3ZTZgjXD/BLLGmw42b/Puuh6fcNyPngw70rpBw0qg\r\nV5bOiXvGdqMR5TVyqrClA64iPwE9FtPMBiMZHgrVcPVMYMD6b5nggZcp1gjI\r\n2xz8cj8HWrpFhQdaXxbAEjtSR5txqJYDJ3NeAT79r4F8F0GD5JJ2C7CcHUm6\r\nr9Qs5fz7cwUrhzfRFT8vJzLyGp2HSlXYubSpV9VVJtjWFGnSvmhMOSS/fV76\r\nmIZYXscKBqHWBLCCdfIwClgAGE5qpoIpNMFpGmKse8WICeH+TaVC/butjkNN\r\nMVzTgN67r2q4k2sr7q1aX1aTQEca/ucwCyk=\r\n=ihfv\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230109080425-f8ebf1a.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/5e72f7d0198d719beaba93c2db56c9e7/graphql-hive-client-0.22.0-alpha-20230109080425-f8ebf1a.tgz","_integrity":"sha512-JFkJepUVGpBo1I3a7a1pjmBeyPe/YxykjAkQU3U0ppZQFYe51or+Qv6aIID6kwbVxniHYDjJLl2CCglcO7/G6A==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230109080425-f8ebf1a_1673251499742_0.8487914012791962","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230109081340-82288f4":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230109081340-82288f4","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230109081340-82288f4","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"fe3afc0af4a739803cbc1f5a0e04f1010736ff90","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230109081340-82288f4.tgz","fileCount":60,"integrity":"sha512-g7Vo1CZL9PmvpIqvV/2lb2Q50AyoobB9qH5yJcrDjwTf0Lqdvq8tTNPlcujAslBOxa/yBemCF/ylAkd6MSC6hA==","signatures":[{"sig":"MEQCIHLIo9fLKy38mYSQV04es4p1lf6lHFoOkTDBD57F39bgAiBJlwf8hX1eN/bdMuzIuAnQcbLFavTbs6Cm/tcCzJ5nHQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJju8zYACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoBJA//SkD0yR7BSmGEfCuZM03AAWCDxBYp745wFsoZEn4lzhxVrwji\r\nd7L1Bmr98J52oIhS+dinOh+zWe9ezeefm1jHsTwDnIG26ztVxkUnrRKF9Mb9\r\njbtttlJCQJbbMnj4dDsZPKRg/QnFX8rmWZxBPaQeDlHT1GlIwh0lHScDJglg\r\nVQ9xdWwqoQ6OWj8Fjat6QF0aqVh+PEFBN8lQmQ84iBMdo+W8GGBkw3Q1AAzk\r\nr7bocHbzzPnlp/T7AFB+tazX/l+fxN5p+5DKlV1esc5fTw7/OuIRhTet+idC\r\nTu9EOrh9QW0SQdFjt8oZExB6xOKN3yVRrHUtARvvP9wrAtiSZwTGp9CaeDta\r\nE+xYHALoZ5MIgsh4GuLuJVfcBsTd4m581q0sysD7bCR1jAwCgU7urx2ybkaj\r\nV6GQDyufyk8bd1WUq1R46J6G7Jp5M6Ii31vANeVGv4nsCDOQQfAUlcNygyES\r\nxOfah58AKOmJHxnFM++QREDdYd2Lo+pEvhKY2h3tmW3joZ/X/UDV6de6MHGp\r\ne+jg8WZEfjSBCSxzSfeLZI901C7Q6UC7g+8nSz3ixFlyEKI0r8126SN8MWCW\r\ntYJRQ1hnI4Aw07nXQGkx2F+nbih+Iia/2uFPqABnsxtvqp40KA4TCGnKhp0+\r\nVLcbBQ7HzaYdkoiqFsyv3rzztfxPXddMUok=\r\n=mLIK\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230109081340-82288f4.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/73075debc5298778af756cb56ab686fa/graphql-hive-client-0.22.0-alpha-20230109081340-82288f4.tgz","_integrity":"sha512-g7Vo1CZL9PmvpIqvV/2lb2Q50AyoobB9qH5yJcrDjwTf0Lqdvq8tTNPlcujAslBOxa/yBemCF/ylAkd6MSC6hA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230109081340-82288f4_1673252056134_0.7628082639979437","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230109081355-84deaa8":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230109081355-84deaa8","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230109081355-84deaa8","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"7bb6053195de2f5d45ccd5dd21b04838843aca0f","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230109081355-84deaa8.tgz","fileCount":60,"integrity":"sha512-1mQmPThr1uBeAoe7hCytXdF0hHQx7FdGqSiZap6VLKH7d3dxJTJ0RFJ9usOJeCwOcHBXl12q7juzqcIJctjZuQ==","signatures":[{"sig":"MEYCIQDKuvv76v0cFZNw8lKsRQyJhKwwsW9MUbJnImXH27g15QIhAKDI2Yi14VrCw0gxB21TCAkA8VtwDsmnhDi1CQA4JwrT","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJju8zlACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmrc9w/7BAo/GPhZrF1eB5Wtey77uU0JCeou4HbGOPdpQuXOz9Pax71D\r\nzKyDFsGiIEEluBdai+ekAMofdtGSVdtsdiKjfy0qU1H3C2TNgQLK/87fgHMx\r\n1FWm95rciptAcfHhMbm1wjoJQe09S0tEV1uLQHEf3d+Y50s/t/fgpITKPSKo\r\nF1QI1YdPliLp5S42R4VENiidzsws+15E1AKw7E0iEjDa6X21YHlrYcFhkQ/k\r\nBTkVMfd7bmjzpDZhyxC5KXJXQdptxqHOwiPzBKVMO5DP+djzAQHYvrcQWImL\r\nyxMtJcjqDFFP6Z+IpN26h54G8wnm8iO6j/ZRWYEOyXLQW2AKG9ZQP2yxUOmi\r\nGY9H0yZZ/FYHYi3Gqn/GlM5sSn8QT2A8V5zcBCcD/6UpiKpQXxd2r6E//jWK\r\n6udoJI4XRcz7qfF1HfcHr+8H71Ar2+H9fs+ngiGso9PlYzkgEuyuDyrxAieO\r\n0mBHa9+OvBe64ShTjMwgXE+EEOBCD06abhUiMOYG8s0rFF3cXe1oATZrUjM/\r\nZtwwn9SHE6XTgbkuQu9QHVGb568uu+xSLi0zJElN+3izXWZZJ2wo//6muMbM\r\nL/7W6zIJOr6xWYl21knvhjrtGqnR+vYn22eSpYZAk/zQ2Mt1XS8zKXtX9TgB\r\nG1WX6Bb4aS4DXE309+Qwrky1a2BFAXhP7Aw=\r\n=JJeT\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230109081355-84deaa8.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/23cd0ed93229cc91c58efbeec3f0c5c7/graphql-hive-client-0.22.0-alpha-20230109081355-84deaa8.tgz","_integrity":"sha512-1mQmPThr1uBeAoe7hCytXdF0hHQx7FdGqSiZap6VLKH7d3dxJTJ0RFJ9usOJeCwOcHBXl12q7juzqcIJctjZuQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230109081355-84deaa8_1673252069394_0.546649636316378","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230109081912-6b2ae48":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230109081912-6b2ae48","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230109081912-6b2ae48","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"fe64b40bf3ca8f27d168e71a132bba927f594182","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230109081912-6b2ae48.tgz","fileCount":60,"integrity":"sha512-CVSLfLXpFKcX99kqZBgQ99YAHrZ5aMtrv3dKodZmCHSer2Ct+HrcfNheFu0qcS1JF+0I+zkgfsmNGXs/cDiASg==","signatures":[{"sig":"MEQCIFslWjHs0jMEvdrYKxRnM2NPWmooQ+dIv9TIJZGsofo1AiBvNYnW4YDjuwymfJxYAjkC6O729dHXb9A+bsRuiqj0oQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJju84kACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmq5pA/9FqePoUNnPLpggE2nPd95q85nSZ3z3MWceois1yQuANJ1ccCr\r\niXF0eAZlKDzYGwbg3d0dQUgMOB5EI4FslAFCubiwTwrhbzM2cKdeWf1+niYt\r\n/4Nbf4D3c/iDvQEn2YVPotHA7s3tLVxXkUOBYy328AWtbHsvfkD9RWuoU4aa\r\ngRjxX23wTmcnk++nfhLHp2UybfOqoZ+9TICMv307p6YXJWqWuVNe1n4oCkAG\r\nXh7469XMMNANJLhTBn4S9uc+K62Ks5TgX0pvKKvZ7PcgiaUVVN6v8cpNWkh0\r\nbBlG7+QS/T1lZairJZzX+ym17S7ClbQrsCUPayHRj64lvW2sWXKvQ3QZUOYZ\r\nln0xypWtgBqaDEljd7GeeF41sGKWkT08KrNXzx+vcwlF9Q+CLDXaiXlW717T\r\neB37fw1OeParaTdlGJbSgFY+AxBhi4IdcZuChcvELWH25LCnGxoFK22FJVdJ\r\nbK/mr8VEXxYjQMqGzWSgBmG2yq+GLCvujrMfUzOO+3nO/pYe36pajkvCHOAH\r\nd1Dyme5hqK5gzIMkQTagruZNenOJM6enoUpJ0QRkvFDi9+EkLn6jaXjcBqOH\r\ngPX0NUic6Lhkjg0IVduKnhGoh1j9u/iQCZe6+bRecV/1kOYX0xIArkkxaK77\r\n1w8YkNbbd42AdL1DfPGBsuKNXbj5ugoSxBk=\r\n=g0uY\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230109081912-6b2ae48.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/984fc6e527cf9f2c13bad6930cc2a85a/graphql-hive-client-0.22.0-alpha-20230109081912-6b2ae48.tgz","_integrity":"sha512-CVSLfLXpFKcX99kqZBgQ99YAHrZ5aMtrv3dKodZmCHSer2Ct+HrcfNheFu0qcS1JF+0I+zkgfsmNGXs/cDiASg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230109081912-6b2ae48_1673252387931_0.3743050513566124","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230109082437-f26ec6c":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230109082437-f26ec6c","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230109082437-f26ec6c","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"619c843777dfec9153a428fcd3536ce960db2b3b","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230109082437-f26ec6c.tgz","fileCount":60,"integrity":"sha512-hPEj6FgxYtuigPAHgRjTKArEUOTeZ8aOsN9HwgYBJ/xwAHUqso27hbB1XF31bKEq1aAAe7MRt4me7BgxnmkcNg==","signatures":[{"sig":"MEYCIQCy53Etomd2pidvMN7DA1UdJlRAp6LVRIa98alvAVsS7AIhAPDnbgI5xAdUIZLbc9o8BmO5uoo4q21JdrIqDtxrzN6d","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165581,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJju89oACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoI+w/9FLseZNsNw7pMysw2Pl0736dJDH1DFYeBAv2kxMwM+Vms1y63\r\n+R4o7XG56H9Y5zDYF/7GERh+ReYs7SVXX7VfPrB+FgflbJ14CWq2KtJSCknW\r\nYU+A/GAUldPw0k1JaJYFpd71RiCB+viZH2cPLWDIc08rYT/7OxcuEf4WBiuX\r\nJjikEZZbjwoDTzBczEkEkaxaF/jrGKnScKXxq+0Z+Gsg6reQEqewlEH+Owcs\r\n/z0ISyNTNMpzHmxFKvkKn3ALD3LxNuRNuAUuW3CooY6+1mrH1hT11oI7bFle\r\nsin2ZqkxNKJGZv1KHmPwIe+4bomzQvrBueIvjS4Tgo0lJ7wU669OVmMEM5Xx\r\n0dthXOHOHdymK8lCVD7iaDrN7oEcsFDHbQr2kvZJ/eYj9oJM+OKvkOkIkxck\r\nWo2f0ksTHt6XvAdVHD4rkPd1OFcIY7MscDXmQq72cw+EJ8Svvwr598jrktLE\r\nDJv/3DpXou0wWg1xxzE7bZp7wlJVwPgyBQ3npVAdlnepXISvilRJfVhKn1di\r\n0CUV2mF5Cl8vJR/YH/fy5W2Y8qevxwMctwsc0zOZLcmnb32HrXIqNIEL79aI\r\nrpcDDzAlZMArU/xLAkuLLGTKjP+CPxqWoyD7Y5RSvi5REIJbFFW2oN2PI/uF\r\nuhA2k1HwtobX6X2cv5L3mIGC6eLCsgKNp8A=\r\n=CkOk\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230109082437-f26ec6c.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/237c5493431d156d8263d8908652251d/graphql-hive-client-0.22.0-alpha-20230109082437-f26ec6c.tgz","_integrity":"sha512-hPEj6FgxYtuigPAHgRjTKArEUOTeZ8aOsN9HwgYBJ/xwAHUqso27hbB1XF31bKEq1aAAe7MRt4me7BgxnmkcNg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^9.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230109082437-f26ec6c_1673252712071_0.6496624042900192","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230109083016-e59ce84":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230109083016-e59ce84","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230109083016-e59ce84","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"e2c634ba1098399b57285a7335c7edde090bba34","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230109083016-e59ce84.tgz","fileCount":60,"integrity":"sha512-o8FlnV4peuGld2WTq30w5DXhC2zu/DWgJutyO2YSkGqC3xVQzELrNYUGFAoloqTAIH4o6278lp4ShJ7Is9hSww==","signatures":[{"sig":"MEUCIQCnN0rU9DPVmXluqbA5qsUCt2BW7SSOll2XmiQhxE0CTAIgdsoNgkZhJ7qzRmSC4KF3AGP1yRzRYceP0Ccv90vG5GQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJju9C8ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmoh0BAAjnEZ1n+L+9AC/RkFWVWPBnCyUOpYm+ezOO4Det2u1ZDY4B3P\r\nLY6C586rtcN9h3TlBaMW0zlsUIj30/pHQE2L2a8wAKrjq+J3OqHYNbX6/nd1\r\nSeloWalMt5hdpF2ozj9PBen4lVd/6Przw2ZG58ODhlBXUAWXcJCL/REnazN8\r\nBlA5r4AHTWvHaU2RSSGHUgOw/I4JFD5fSUmlL47aS3HOeOYGIr3HN6F39FNi\r\nX/bEb8qxODvrYtN0WdqRIUQuqygJLbhfkCjlML+k4O3ksc+OXm9eUNE8DQO8\r\nn/tkN+DhpH8SVycg71yEeOF/OoQ9oXRGdYQlx4UCK4+I2qULQjsHeWTP7G2v\r\noinBAa0SzpyJ4CT4/+ZcmD0MfGP6wOW1k9+gXQ/bEZgYLK4Z6IYnhnC2wrX8\r\nHwQBZmTEIPf0l0L+E+jGq0aNU/fdLtVKm1p9vbxi1DzELImNK9SVzNJzB94E\r\nuBhugNfc2aRuFhbLfZgmBHzwuY+81GCui3BR7mH2HRw0Bsz46QXM2wpEIg00\r\nphlLgzLph281oVmN42GWADfapBRCdOsTcl0A2Xxe/qRRw70WFSO7wapo5Swm\r\nshr0XqWW2kcX0DXs5ri+5sgLHHH0aF1Dd48E56sFmjbV+kJT4k8v3dn4jlQ2\r\n2//d359qnj5j53ljgI03aJwys6wwZ9izi44=\r\n=tkkK\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230109083016-e59ce84.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/d2ba5f67538a6335da11a8566ba80ef7/graphql-hive-client-0.22.0-alpha-20230109083016-e59ce84.tgz","_integrity":"sha512-o8FlnV4peuGld2WTq30w5DXhC2zu/DWgJutyO2YSkGqC3xVQzELrNYUGFAoloqTAIH4o6278lp4ShJ7Is9hSww==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230109083016-e59ce84_1673253052402_0.8820600036755404","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230109083435-fb4fa45":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230109083435-fb4fa45","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230109083435-fb4fa45","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"0e80df590a2c8db8a963981a46641ef74a2fd9a7","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230109083435-fb4fa45.tgz","fileCount":60,"integrity":"sha512-YPypMD3lOQI3g3vWcUwtR3XeGS2wxzMUhVj+pnIlFmei3UHZQ8UZOqbhj89H/HI38DpTXCUv/hTJGB9oMjujAA==","signatures":[{"sig":"MEQCIGqUvZ+P5vzqNvMMcJp07JairKvo5fDqrg1kNRZIHt9WAiB0UZI9FJJUVBB8cGm1jVPdjYWX2KhD/Ax6XKtgHCkILQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJju9HLACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp8+Q/+LgssRJO12tvFK40uYD+7jRNyYkl2inufeSOyfUaoT4w7XiMy\r\nDQpXKYWxTe1lPBgknlpqSlMx/WQSyFj/I5bJBeNDzWt9uIupBb3VZzJJVCxj\r\nYwTEw2IbE3BRDWgjh2xT8EJw7QxYgsY2yYsA+5ei2YtgjefydRvIHWm4O2S/\r\n7jpjpPsekYq6I5YX+d0FgrP4V7eTceHb/Rmt4gnzJ4Z42XzV/kEbCifociLV\r\nthqNzsKodAn01ZrtN4hMVxOSYFd91Wxr1jNO1pNB3iv/ZMnY7kR57yME6k0t\r\na49JFKHcwLe3Rtvtc1DE2sNDRV/b2R7/4g3ioqc4WkSWiBAq5FqExM4PXtzQ\r\nVFZ9lSABQvANtYWebUFQkIpm3l4d1mZkCQfB1vBw2MDbv0SD8BUD3vma7gK9\r\nYlij+Vu/tExCrZPmTgWc+1FT6qanddXlaiFZAyfhC4MfVGrKeUOEq2qd4Wsq\r\nfOsrXlxXpMoJ0mQ4e5mFpI9e1NWnG047s5acR7RdAASzPh539wTDHlxgYXoL\r\nPulGVOdQSowbhDWCcJyOMaZV2VZFfbQTAYGoT4CjFnd5lKhfJ0LSETMRUxk9\r\ntXChx5cvrYf25OGzv769QPAfGG05PU6voNUSKBUytHYyA45Gy5rZM6RgnsE3\r\nxdYk43sRzD2uKdgd8CRt/wOhw85/LhelpAg=\r\n=tmM0\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230109083435-fb4fa45.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/2cdd4e196c3216c7601151a500a7523c/graphql-hive-client-0.22.0-alpha-20230109083435-fb4fa45.tgz","_integrity":"sha512-YPypMD3lOQI3g3vWcUwtR3XeGS2wxzMUhVj+pnIlFmei3UHZQ8UZOqbhj89H/HI38DpTXCUv/hTJGB9oMjujAA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230109083435-fb4fa45_1673253323383_0.24503222171004468","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230109083928-1e58a5c":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230109083928-1e58a5c","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230109083928-1e58a5c","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"34af4f0aea1f39126b5585f9487fee7d060c3e4b","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230109083928-1e58a5c.tgz","fileCount":60,"integrity":"sha512-3xCuMyAtXSINiFxgSOc4x+CjsJyVjmQQ/Wvtlz69g83wPP1tpaVUqFYA0kSufLzuAw18Vn25Z+LAv4SdF1OBow==","signatures":[{"sig":"MEQCIGatvK7NoR0CHZeiEsRglOAKv9e/nM0U/F2GdT12+NMlAiAZbbTrYagudc7Z+V9+Hb9dRV9oexGLjY4BTdXp1ug2UA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJju9LjACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrHxQ//YQ1uQa+gq+18zbOsKyYwTg12QnKYNYUaTJm2WAPX6FTMFTCC\r\nlgwIWwoT/uKwhFskB6cqKJdwu+RwkXmEfrRFPGoR2mIZDZq0qAtc0LZrk9ne\r\nIKq+dTc012F0UpiCtiUMBf5OCeKQ+rGFeeJjEBKp5E8G65sAEwJ8rOGHDuj6\r\nV7APjlEw/lwPXrb1g1i4cXL57lEHTAVqpqR8zIt/HH2+2SykLbG++pB7vT4b\r\nwSaBfSN31Y3VDVnYAVaudCRNMAhTIWNMw9dlpmuRyDbDnbViL/XeQgAny/eH\r\nbH8qb8XlMNqioYxBA/eng87QJ2KhscmCCgrP6l6ApsK58MmeOgQr5oHiyxtG\r\n1anb8bctzz9LVDuNiRHcLkDvrKlNSMLrIcQ4yP+mHVZ1seTVantRHjD/OXGc\r\nOBVp14Ty0PbG7wi1g7Y0JYb5/wBYAbDQK+AsU9jnfFTJAESjo9k2zR3p/54T\r\n/8WJGhrXp1U6W3WuZCQpwb+G2pYlJQLj/6ABtwslwzQNfMZR8H2cBOHpfqJp\r\nC3wjQSH0wQI0HcT/sbV0CXMUH9APnUfHp//2g8svVHRlO5s1fwXf0ZC9qZVR\r\ni3NHLPkO09sWwgWDKr8AICGhye9rqjZOXdySWvx/4cGlLJjwW0HI8wRgvFb6\r\n/VMcLCK/Yxd1wtmrpNW9yKaYG9AjkheU4rw=\r\n=PFLi\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230109083928-1e58a5c.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/773bf42a14e4ad8a50d3d3bc4ca41e6f/graphql-hive-client-0.22.0-alpha-20230109083928-1e58a5c.tgz","_integrity":"sha512-3xCuMyAtXSINiFxgSOc4x+CjsJyVjmQQ/Wvtlz69g83wPP1tpaVUqFYA0kSufLzuAw18Vn25Z+LAv4SdF1OBow==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230109083928-1e58a5c_1673253603252_0.2887409408728667","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230109084506-469a844":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230109084506-469a844","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230109084506-469a844","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"0a4a4683bb29c2227bf76d5921c6164e6dd72468","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230109084506-469a844.tgz","fileCount":60,"integrity":"sha512-b/arhh9bZl22nl7xHTm/UXR+fjdE17GOtvfSFdSYcY0djcGmTE55q3VDeXspk2GeGBE4mycYCtGbAY5eB0DVdA==","signatures":[{"sig":"MEQCIAXomlbOOeyTgG+5e4qV2SU4lRTdY2R+tyIqDzdVGWjEAiA0eusbZAHmEhR9DLp12Xw6/IyNJh6kFPtdjixX55Onxg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJju9Q3ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqQ4hAAlz83/F3QhDDryWqwOjMkEybl4lgEDsdpZT/RChYLUQShueaK\r\nhklj2lP2jsUNz3sxiq6rN4qV7HSJHSZTRBzsOpUz8qMwLpAI5IzUQbiMCfZ6\r\nLglsc7YBSQkSDFKtyaa4RMO0JIzrC3Vt1TYVUbOPq+7E4aolwSAtyK+sM1Wy\r\nOfINiz25k0bVVtv/ImYc6YsU6+wu6bAR099EB52PP9I74zoLGGPIcNIpefBR\r\nh3eZHttfFRjyAjsB4yKdUWqZHDTDx3ZXzBNGp8+DJfwjsL9kJE06MGbnbNg+\r\nWdfMIVKCAhwWPY9mcQL7qOSKtFPx9A0goA8/DszlbG/gN5p8i2qJ5VxppZNG\r\nCG3HEIVgQV8+WFDdnQIpVqhpjAXNJ8Ydzn4jBlwk+rIGz3iWmPiHsnpdQnVN\r\nFhY9qQdPLFGzHX667BqZsa6fmTDx3YgWhqm1FkW00tAk0vg8FefO17Pa30XW\r\neieUDffgp4+GSmzHrUSZfyT7pxDjJErJWq2iHuSfkUKkOXyyw5pJL/xsGWEy\r\n3JiHUDCqMnBJZbhtYCJkZmeGlpPTITLHVXUuV/8IN/YEwIBg4fa26XJQ+STd\r\ntInca/9VRbDmqh1sgN63zlS3WgnsgF6z7MBAyoLlZOMKlRn8/adgp5XH6eSh\r\nNZNKZd64cBInjBy+9oC0TldBUrWGKynLDX0=\r\n=B8Fl\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230109084506-469a844.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/6b4b187957a61d6e427f79a92142642b/graphql-hive-client-0.22.0-alpha-20230109084506-469a844.tgz","_integrity":"sha512-b/arhh9bZl22nl7xHTm/UXR+fjdE17GOtvfSFdSYcY0djcGmTE55q3VDeXspk2GeGBE4mycYCtGbAY5eB0DVdA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230109084506-469a844_1673253943097_0.7012354382865689","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230109092718-b0df1ff":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230109092718-b0df1ff","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230109092718-b0df1ff","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"d77938bb66a6a47d8d3fd9b84866bfde9c463a4b","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230109092718-b0df1ff.tgz","fileCount":60,"integrity":"sha512-kwcT5zzth25wUhFl8x4/pEZYJiXE5l2nESm8XxxO3HevDyAzuzhRLwcqKSkrB3Ca4t7XcE3/9tQlscOHMu97uQ==","signatures":[{"sig":"MEUCIDAy/2SY8TYvmzn50QH0hbAaNOm/1toC8bTXtv6t4/7CAiEApGZQAS7PRKNQ0t3Gg0bIRjN1I8fVL05u3RePSTZL6XY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":166123,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJju94lACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqCJg//T6XHudvr6Usc1GcY2u9YBn11WQzFjrQMeUgv44jPVFpglVzj\r\nS0I89DcjrZYVCys6RDBQa2Gx34JKCpj66n+6rxh0v6Ix76VkMsDf2mFdhZ1n\r\nFrvJ4FMdZd9yiNQEXad8moAnNnP2t/g6o7yJPKMeefYiBUFOOmPpZ2v7KpO4\r\nfg6rTMwl+ek65nQgaQ/9el/GYmSxw/YdkOTKemIit4NjbAhTd91x301Psk9S\r\nHu9pab7JqgwSmUaOHti/iQuXrwup9WGA3vopq3TdOu7JmpPGkb63P6BeJosk\r\nxoZtFAU4FKCDwG9+BFdNVdMjt9/m9gvBVCgjcSWOiz6VHaStgdb8im5ev3SA\r\n+y8GMYKS6YrEJbVk9YOFyF3EA9EmR0P8QvYV0CRFxxNrBJDaPeV9e8JJlC7r\r\npulmqSVluwiVRyLnY9JAEINIMz9RR2yQPVxuzNf+XxC6F2oceYEG62ibkQMF\r\nUmAjZ/gGKJetwYAB6JurF0SMw332HfuMll9chO6IY8267q/kMmAariK68Zhc\r\nBnIKVSq9lFccFbdFMV+lujJmdwxEavfFVNlWwtrdBnQkvSKWANv3HMl2gTcc\r\n3M/EaG5c+B8twbpxF87OjgYFKjyjwkylCFWOzD4dyDuE7luURf7q87V0KkAb\r\nyIIecYU/F/EMJOJHikjmfICfccJRZ87jK18=\r\n=sOa/\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230109092718-b0df1ff.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/f70f096725ddeb6cbeab4b824233c5f0/graphql-hive-client-0.22.0-alpha-20230109092718-b0df1ff.tgz","_integrity":"sha512-kwcT5zzth25wUhFl8x4/pEZYJiXE5l2nESm8XxxO3HevDyAzuzhRLwcqKSkrB3Ca4t7XcE3/9tQlscOHMu97uQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230109092718-b0df1ff_1673256485602_0.968420863041201","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230109105438-70e12a8":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230109105438-70e12a8","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230109105438-70e12a8","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"69e9b0db42c9f8ee935947735a5f172bc704434e","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230109105438-70e12a8.tgz","fileCount":60,"integrity":"sha512-WnZY+W2Q0+7xPchOWtSwznKTzNn8ef18AaX+QaSMcZPJOHGvKu2jOA05/fPNmId51MXXgnXyHClg+RObcrqb9w==","signatures":[{"sig":"MEUCIQC6w431ylEoyVRCBeE/OZK18chcfnWUhTmBefmNP8EMQAIgEIVDvKMLB8xbdozm28TDxkl1gK/XzOMkfjNyfwaECGQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJju/KVACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpNbhAAhBO6Q+6VhnK13QpeW7DOhDiPi4LeXzXhN0SR6bWqUcd0R1SI\r\nApeMRIlGMyzz8PFJNhZcwR62GH7qvEfZIIXsBGDvwiU4jsMbB/UM/a9daa6R\r\n0E3547CMRm3FJ2P+d6BqYWoQ0IeRVjNCH8gKHhqaiV1rrKEi3TCm7jZ1IrZK\r\nbab9zIEZMm6v6wx0V8g7MICI0cpJQIiEsZuMzhESSUuR0JUty6WTpUGi6lpC\r\nM5tfed9FhUx0vHADLrWjj4GF3zaZJZ0JnWGoO8r/WJ71KEbQN2K3TqPaB8qc\r\nhKWqo0MujfmbyYtlCi7ym5qgs7DKEZT3VIIq+wGUTB3albLHCJ0MrHVPjW1v\r\nBLmPp/ROwst7xJ2da7z+qiM37sFQKQbX0dOroRve5h/LM+cNjB2RY7Z8eZKF\r\npgvoqYzr837ZTc25byMCNaNKMNOCwMswqPYzYkDGtKwYiTisHd6rtxYZ8Hwd\r\nIy1zUlpvLK2YVNsMYYoPWDMw3snRzu4T3sVidbUiI6JsFXGMeVKr7TKlFEzx\r\nSGGl8JZ27vAEi5ahkvuFTgPIWXUccFU0Maiebkvgbm4lv1zCU+MQsCn5FGLL\r\n2vdBKtEnjPvECrkEwtnduBWVo92+r5N7BoE6Mu2qgslaEf41fc2Ia0qTVQYr\r\n8JxjOzDXvcSaAfOylrr5CoQXCliqBbDw/yw=\r\n=180S\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230109105438-70e12a8.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/9c9c326a1e1add645992c2044713aefe/graphql-hive-client-0.22.0-alpha-20230109105438-70e12a8.tgz","_integrity":"sha512-WnZY+W2Q0+7xPchOWtSwznKTzNn8ef18AaX+QaSMcZPJOHGvKu2jOA05/fPNmId51MXXgnXyHClg+RObcrqb9w==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230109105438-70e12a8_1673261717400_0.6211749129710178","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230109105655-685bb73":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230109105655-685bb73","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230109105655-685bb73","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"490722e9b8dc88c28270b37714b696f9ebaa3062","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230109105655-685bb73.tgz","fileCount":60,"integrity":"sha512-S6/HwZcHcMVisYE7YzTOgOq/nBKkGpn6i1xdjv4MyIsM3BMNa1a0tW8VA6pidcAdrWrGlPAy2D7Xoxez3GQVKw==","signatures":[{"sig":"MEUCIEh3FogYlB9r0+vh0SmbqvIVDH7fk11lrer6XIDhco3CAiEAi3isTLG/7dOCicK/tCyYBZATwJN30GwwfxwlprG/aiY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJju/MlACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoAvA/+KVvwQyWnGXxUZhODTtPD4DmroIYsmzCoDbbGh7RTu2xw4fqK\r\nF8YMZpsQop7TGFIH0QQppUn36ibDWEq5bhqmnYNSVo/R5PYK16fhuBDmSw5o\r\nXQOWkmYJH//R+ucJ9LpL1+TzM1lJijkSr56hXPAyCJyQrT9VOw6bb3zDZZ5m\r\nbztnSgBjPi2fUnQDOJhKLkcbzVVbvhlEV0oQ1YYPdls7oIyVDIpf0+NHfLr+\r\nVnhY3C7uYYJuV/M00pkRypSYlN6Qf+5YuZAJvmuOYonOwtlZqSv7mN2Z2B3s\r\naxN97j12xswc8A6Obh5nS6WkDcF8hfFtH3MSTu72clY3BQy6RBtuOMfUJrkQ\r\nqXeX2qX9LUXThNMGeR+7rVY/BqZ4ME6nQQ26LXNCx1PS7YXDVoxu9I/2Q/aW\r\n322sGC9bFFhCz4QdW7DIcJYLlG1l/91iJ/AZ7ikkAulY4dpPkbXxdXXpfpkG\r\nLeYFECCK9SOlMz7DtmsmYTS+zwO/LGPUAlCYC77/6J+WWsOKzac5OlXKmGBN\r\nQg4i4ehB8RTFE0LO+MVnsD5PLBTGDCciAIJwhiHCd165zGZeHyMwJhIoPjRa\r\n0O3xHcGVS5b1Y719PBEj+UXxiwJbiBJZ1nG4cfAkDFL5/JNQ5tTazdOVq/wm\r\n7YIarqSC1mf+1Qguf/oN8LELLkZmiw+WHwQ=\r\n=1iy3\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230109105655-685bb73.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/67e15d171ef1b0eab0cd94e2cbee3a6c/graphql-hive-client-0.22.0-alpha-20230109105655-685bb73.tgz","_integrity":"sha512-S6/HwZcHcMVisYE7YzTOgOq/nBKkGpn6i1xdjv4MyIsM3BMNa1a0tW8VA6pidcAdrWrGlPAy2D7Xoxez3GQVKw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230109105655-685bb73_1673261860921_0.08162154506437025","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230109105759-a6c5ba0":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230109105759-a6c5ba0","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230109105759-a6c5ba0","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"6949bdc54853561a8474fa91d6c4c570a8f88c65","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230109105759-a6c5ba0.tgz","fileCount":60,"integrity":"sha512-1EGSb8E73k/7d6Qzm1JO1XNyDxLWQZK87zN07TEVJ/hr5/pYRpgf64iKN9lzpmHkATi9pafXylCEKkOu2Z7OEg==","signatures":[{"sig":"MEUCID+AXADiRYrDJM3Mg5XCcZlgoGpjkvjfqJqBZ+qCqnUfAiEAtWhUxFgFLppzuWHyrlmAm5VV4tWRktcLFqxSjD5gqUk=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJju/NaACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrsGxAAkVEZpQWzFNwh/O3KD8t/WXgBdwfWkMPr9qKXzicq/45ucCii\r\n/LxVKpi6pnYdb3rZeqgX/ww7U8qhv5gKM4NWOaAmJ9Fmt3uy0mgZoP+pA4wc\r\n7hNHykz9OLTH8IP/pMGUIZOrCho3pWEiVaS7fqf89KAci+YCl5ZDF4lgpnvF\r\nXcxw4v7CpMGCo2BnphiLEd4yuQ9Kuz9zbncu7GQVCKFoV5TAeOGY8dFiPz8B\r\n5Pd+5tKpo7ojAsxfnTJshzrUKJ4w1DY3lPeKLsKwGBUwAOeJyoEpGyXDt7gQ\r\nhYppG5V3ik8jQpiFqu1drPSnPyA64D6SRpCcI2WT5xNa0GSCNEVAi12BD6Z/\r\nSVvktyVwFSBqrT4EpSpdojfQLdWuoMvV1BnCurRux0eiLFDStVwfMHAsujJ+\r\nNG8JKxgxo6pY0C5RjyQL3HoJY1NqmNgqZGmuXS7JgfwmbP2URMrMOnnjagQ9\r\nCgP0p9M337SnAyhFT6iVPSoYvKh8tuD3L/hDnqKGhLBmvtIcPO1wCEg7C+OI\r\n2RH4TZg5EXnZC+qtTyxfU+8Cw9lZFsC78rrFLGi+6U2HWgOMDldhCgK+ZFjV\r\nVid305o9++xnXxe/z+ugCXJPMvOvBwIKP8OFXO3oMsSNXegLBaWD9UX7Nttc\r\n2j93vevqLHJJFCwx/3xZbzFkDP9UAelMI4U=\r\n=YlpM\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230109105759-a6c5ba0.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/6309491a9d885c85770701bffb52ccb5/graphql-hive-client-0.22.0-alpha-20230109105759-a6c5ba0.tgz","_integrity":"sha512-1EGSb8E73k/7d6Qzm1JO1XNyDxLWQZK87zN07TEVJ/hr5/pYRpgf64iKN9lzpmHkATi9pafXylCEKkOu2Z7OEg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230109105759-a6c5ba0_1673261914202_0.41267436488103026","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230109110310-685bb73":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230109110310-685bb73","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230109110310-685bb73","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"03047e54a1687b5794f3fb0a77ec2897832a59c0","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230109110310-685bb73.tgz","fileCount":60,"integrity":"sha512-0xxZJKBbgBBz3NqKkKNA9mG6oKgf9jiNsaQFweEbGHBgNQ3mwPs70C+7ioGVfGJ39euL0V1C7RsY4iTml9opmw==","signatures":[{"sig":"MEYCIQCcLHsP6IAVdo6fAQzmbdbI2KjijbfVzkkkdcKBgPM/IwIhAP/ZPKzeSZIHuyjrOvA7Y2Ajwq+OTQn0XLojTRZG90vu","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJju/SUACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqBohAAnso1749ea91MDOT4xq12PvVf0GhOB6ED2WrGXpFoaBd54LsG\r\n0L48OKgxFjMPZfVEkgL49Tz1VhXCRZ57IqxgzyI0wq08zWohQFaKv5Dk0xco\r\nQ+fUUe0wx91iXyFC2NKCN1x/9ta/FPKvfO3q/6i4aiyCyugR8rG9O0bzuoLi\r\niD/tvfpdhZiZNKKLfch3CuJNcHaroFC5it90ocyxIo6MAyVf8JD4uc/fGllh\r\n/tYr+asL9JzidGWO/7tmWMuPHenlDKF3Fx+L65uX02oBQkDoGB6uiN5BpulI\r\nE2eKIKjivMrloNfyMy+dP8LsMZEZ2nJLlzgLBwD8JbjT2uJiUJ+kdrNkChyR\r\neNRK/qevE7yVeRCJ+coBXQY9VR6scxpCvAqvI5m9vNO6+u/O91xOhXbCvrn/\r\nFLMqWEGSIMXqbPEj7/kcXsfxF7jfiGmfbjDvte065jiCZnRWCdBllNfZUUXS\r\naPomDh5aDYpS6Ip0yj4y4WttKWM1zS0ryDnnWwjaHZ7Itq9dWieglbt2/VaT\r\nBhemcVXaoMcJXEEG2dKrL61XEaMzCBGxdxm9Pe3Ju8KSeEdQeM9Iph8vw6U6\r\nF28QtAj2PY1JNZ6bFOtUaYcYSz/3UINPA5ecc5dQ//6ZADLxQgW1M/wKQzwb\r\n6tHDEsgYHFNHeXFK1pfqI1KvBjrzYvw2850=\r\n=XLWo\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230109110310-685bb73.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/216541bc3816237626b8170e10e77fa6/graphql-hive-client-0.22.0-alpha-20230109110310-685bb73.tgz","_integrity":"sha512-0xxZJKBbgBBz3NqKkKNA9mG6oKgf9jiNsaQFweEbGHBgNQ3mwPs70C+7ioGVfGJ39euL0V1C7RsY4iTml9opmw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230109110310-685bb73_1673262228664_0.4923994566448424","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230109110418-d61d042":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230109110418-d61d042","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230109110418-d61d042","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"355f652199759f674f5d7714cd9e9c15195a3afb","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230109110418-d61d042.tgz","fileCount":60,"integrity":"sha512-VgUCv+bCh3whyGswziPvep/xmX/Faln3QtKLPuNke65IxP1jQxgLbQIj5XuZVw7eAdlhoEFnMo5WlH5K5dZX2w==","signatures":[{"sig":"MEYCIQCrUcmexxTlYG93iatXk+oyxQiLZyooocj1BmfEnTcVBwIhAL37D5kCFGcH+UYnkxJL9TaD8MEBPAhXeJjpE/7y+wbA","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJju/TeACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoMQA//S029LQ8iYZ/JoYVdwOwUFHOIo9m4+OAR51WLtbznEhR29Re/\r\nZHN04bPKj0uKfP2uTjseN6JT5uEA7LvGEPAT2rCRU8A6OqqFVsfiuz7W7cRo\r\nYlgPYXHxuobmllBQtGCnLoLjOff4owzyOMwC9srPUcgD2uDO7TzgfIQkLDIZ\r\nbqdFUZQFU4tDs3x3LLv4PUWV0GCS/DKmW/GNOmJpekKL9HQQwmtGDuiMC52A\r\nkYbIWaa4lMtb0FhQOzMq7ljaMFSHSrzO6wFYBpBhkkjvbrlnP4DiIB9BPwp5\r\nN9scAUj2Hw/3+cShGOgn64ss6dykwwQeMOrOwXrlXdDK9SgcFunqAB064VjI\r\nAAJgwgoncdTc1wgsx3ers+faTZb/ZgZayNbimwdjOfwssDLxmuOH1LbRB8qQ\r\nNHLtxfY3X8mIdCPCQTCJn2HAf0WEmwLofJY8MtQnD5SDtgiV9jvY9Qxp1VWS\r\nXgbIgFNhv+RrSInqitR1N8w5lsNNOLjKIYkLDWLTS3WqjM7KhOJ0G3WoZAQk\r\nwVentzSLYCkB2f/gw3SpLtv3JURFtyw3djdWkkC2bdSqbAKSe2EfhV8CJLD6\r\nrkqpMFuKATnhIjQ/8DihJ+DAdPbKp++Cn0q/Tn7Vj5asuJmlJ9kU+YSbL4cS\r\nB9p7QmH+r88602POALOrHJT96ccYzTBZhcY=\r\n=3Jup\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230109110418-d61d042.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/a53ec4461bc2ac2c28003a8579241284/graphql-hive-client-0.22.0-alpha-20230109110418-d61d042.tgz","_integrity":"sha512-VgUCv+bCh3whyGswziPvep/xmX/Faln3QtKLPuNke65IxP1jQxgLbQIj5XuZVw7eAdlhoEFnMo5WlH5K5dZX2w==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230109110418-d61d042_1673262302373_0.7679361469396471","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230109110856-65271c6":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230109110856-65271c6","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230109110856-65271c6","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"ddb6243cfa74ebfd6abd15edab7d567e34a4606a","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230109110856-65271c6.tgz","fileCount":60,"integrity":"sha512-OerxNBvI09Uecsi6JiT3F+chyXnpVchqRCrMfbFpxp3BeiBaPuX7eJW1FJLnWgQMaNQh0OyZC1byDDjjUVXatg==","signatures":[{"sig":"MEQCIG/8nIARTwaPl+JRecqswYQ5KwskSXCoCxa8VFM92ZIzAiAIWBmaEAh3GjNbF01PqlAhB8TM/jKcH0woCqSMHByUDw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJju/X2ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmoiww//fNRokKqi9qXvopL0u8pEqI3qfG3i2GoGS5vV0VX39OanUxHX\r\nYUB4h5Y9L4IjMQpTHXgK8bdfGfEQFroUFy8A/Is0ADZcqlrmGz8H8ILgea00\r\nNpzNqm0Emxm6zt2eyXkfhiWwJpSi0GhgzuajG3EAx6Hc6l9ZOy/hOM+g48D/\r\nWYaxa0WAEYEUhMrug4IWloss/35NmJTdMRWedETtYox9dw4s79tBwDjbxQVT\r\nfM/fUO5lBbf1b8syMIXzYglHyGnkFPA9lFk4xpG8lsKqrt4zBykIgM+KkYa0\r\n8m3JunAuVd60c+8QQxuKp7jIDz0PLEswvYPN43FXsoO0tOJmg7QoGShQ09Ba\r\nHjjRH5zP6/9dlxWLpdkW1G2mvVkTCt15KJhjjuB0UGm6D1oUcEDoxfEwqKUk\r\nTKoMj9upHFq2RbxMr7mhRvqwgYiLJvx04QofZSUpV+RzY15ReV9V7FTnG7BJ\r\nGJ7vGv9AISVHV+x9obTC041r14Gb6abVFZ3WSDl6lnJXjkvp6OLrhlmw5Uxl\r\nYUlbVWmjNKS320Wf9GTGtnkG33dIjJ4ZE8tdE7wLEm3G4govh4TqIpu3LrWn\r\nQvuYE5Ir5LSzOu5LzLLIp7tMvvbQcMBxQZHEVUvYsSadDM1NFCvPUXQ6gzSU\r\nYKBryMQxdgu+eZfSwJuflgAjcWxi4ptewtM=\r\n=pHWl\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230109110856-65271c6.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/6c68872672a17644f3162679f5c0a4c7/graphql-hive-client-0.22.0-alpha-20230109110856-65271c6.tgz","_integrity":"sha512-OerxNBvI09Uecsi6JiT3F+chyXnpVchqRCrMfbFpxp3BeiBaPuX7eJW1FJLnWgQMaNQh0OyZC1byDDjjUVXatg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230109110856-65271c6_1673262581903_0.025891668596488948","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230109112602-ce466b6":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230109112602-ce466b6","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230109112602-ce466b6","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"1ed27504ef8727915cb59ef722e34bf5b4950681","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230109112602-ce466b6.tgz","fileCount":60,"integrity":"sha512-PCfXQ00QtQBwp5Se3QA9RugQ7bZR0Hvrl0HESPM+L95xMVSOpOoqsdDZpl+uCGMaOWexh2H+c2o8fAcY4LVLRQ==","signatures":[{"sig":"MEYCIQDEydeL8U9SYWZ+SphGkbWjbdhduZUkMAThWD3FK8mQgQIhAO9glqeWNpUyUgOIgg8jTbMj0v5Sv0YrhLc2YPJQS2oB","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJju/n0ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpSnw/+IJr7qLB91MLZ7uNcB9UxUJN7xQbNjkygyoQRQg+n6ApYE0a7\r\nNUM1n1eivUh4Pj2/QKF62qeucpLwkP5DztNZn/UU+ece2EJjkRCeXpf1IiPm\r\nn7U+EBU3aQUzO0owavaxLjwtihaCLIM2W4UbxzDQCvRMpgCkYtjYRoglpVRU\r\nzVsTW3kEwnPgegPh9U35S8mA6yKgN5VMWqgrvs50JhIncrSzA5sOwJvrsvTg\r\nVe4qeUKXUHe0VBU3BXMyLPLdQ2d8ySw8/98Z6EAix7ffzsrHxBToXLMdxxgC\r\nZVONmOcyleCvcyauOzAIpdg+BFmRS7Pd8DhPXRwH3dyZekDmuITSx62UxbkR\r\n9/spPYIaE3xGOr8zT7Kxi0M6bnHJBigwF/pcVvXRO7VXoLu++hmQA5IGIvdT\r\nf3F7SRPnwu7yVwHKiA7GwiniIvGlFdlHNPYEhAuH67XnDwwjWW6lfqllkN+J\r\n8T5XkgD3Kdz95/CovZ+nGl4QxQAJLe1Cn09ExPXToolTpllHODmJ4AZFU7sP\r\nWxAyXY0TAMOPhysKkUwVZHBuxIWLAKH05VVn8zdzGgsGEvnRzPM7LGl0kJ6W\r\nxkcD7tRwx75iorVTXXk9eDTLPRr1Wd94Ov2iQZ1jY6wpBoCDonmi5Yahuo5V\r\n2f5s2aBsW5AF1xiaufEtrJv3VmIN4P0eLB0=\r\n=6gah\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230109112602-ce466b6.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/6e06356c785f1b5f0d55adceb35c2552/graphql-hive-client-0.22.0-alpha-20230109112602-ce466b6.tgz","_integrity":"sha512-PCfXQ00QtQBwp5Se3QA9RugQ7bZR0Hvrl0HESPM+L95xMVSOpOoqsdDZpl+uCGMaOWexh2H+c2o8fAcY4LVLRQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230109112602-ce466b6_1673263604448_0.2561735909909282","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230109115600-4d71111":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230109115600-4d71111","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230109115600-4d71111","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"6942e4cb324300c066fb37a30fdec377c7b10b67","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230109115600-4d71111.tgz","fileCount":60,"integrity":"sha512-8rN5Tky/NRULMd+T0NfErZqRslY+VIUwXSC36rjejtbWLwf2qIqWdHfsdW79sTeCoLxNAoGXfSoGZ/XUD8KFQQ==","signatures":[{"sig":"MEUCIBAy8RseVXiD8vtwWBv1JDBDTy4uDt7BQ/Nli60XOlhjAiEAxz6qAypu1fr74MXPII0CynDfmz9umuJSmI7REiOEdrw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvADzACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmpg1g//RlBPX3m+GK/tLivnogFUTVkEhYuO1ItFcYM10uNOF4lesNhw\r\nvkswm+kPqZB8hK5nvF8qDCGNhdVSF4F7x1uDCFaYxT1uKAJ8h1zHO0S+3nC+\r\niXDy+2jtziWHjYGHRPRmXT7Z+em9mdyn9QXHCKbyZrIzb603Pj65F/P1ycUd\r\nCJFwj7UPTIwMLcJCr7ouTtJjKfpHrnY/UTSLdTEtXkewE/KrioyHIR6ZaAZu\r\nFXgzaQYlU8Yne931PvEXF3HCiGywQo3gPruL27pqkVnw6XIm+3+Th0Obo9dE\r\nTYLP48azJ4AnFd60UfOBOCp9sarXjXnt8Yw34rm7J21uiPo8QfX0UPU/nJ2x\r\nVhheVSzX/ich3L1speG7bcTNO/GUP08nEE0F8wlel+ShU8uYIfGb05h0Jx/C\r\n5UlMZud2S73/IMzuU7YE2mGxQCAbXSzEyq5b6bpr+L29jO90BvSCYO9xVx0E\r\nZzoO5RNt4v8UDVIkdVYjKWkb1GGJKGUAJVwpPuxXRfVGXlkAb9rx778RhUGh\r\ngXbPhH6QB0us9v+eTTNiVrCb3YHTpmQ7XSZrNB6pHn9evkvqOJc4Jh66xMSh\r\npAM2XQcav2AVqz6Xa6WbU4KnMdrSwLhGP6ppbNQAa5/8qwxnIUGbFfh8C3Eo\r\ng5/yNkIDk/gjVrSeorWVVf8Zn5hhfnV2WTo=\r\n=ASPZ\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230109115600-4d71111.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/880545ce3012d8f689594e98c3b0fb50/graphql-hive-client-0.22.0-alpha-20230109115600-4d71111.tgz","_integrity":"sha512-8rN5Tky/NRULMd+T0NfErZqRslY+VIUwXSC36rjejtbWLwf2qIqWdHfsdW79sTeCoLxNAoGXfSoGZ/XUD8KFQQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230109115600-4d71111_1673265395049_0.28521048691923734","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230109120127-5284a76":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230109120127-5284a76","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230109120127-5284a76","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"307fed0fd7dbe91ec5e5f7e50f9d8b408146270d","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230109120127-5284a76.tgz","fileCount":60,"integrity":"sha512-QwtaKF2LHiD8UPFGnWZWr+AAH9JaKk9/wTyubDQSmz2sKi3CRdVse2RGzerZip/VN4zzpVO16ChhemCkgl/UGA==","signatures":[{"sig":"MEUCIQCXm+7aca7gS7SJEeDQjJb+KHz/fbGOmTB1ShI+NFrlcAIgDIdJAnDC/K07ajIe/bEuyuRO3ZyU+YbmJwpwsH7HfTU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvAI7ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmou6Q/7BCDZwLVKITpMxYZs3YaLFCr2ALMF/YbkbqSZFlmxqRnSwXZd\r\nbcSLc6b2xty9Bh++z6rEVVAWTGjrPSDd67DXquRaPLlOuSrBGdmqXEZbCZY+\r\nY150XIVEOGWZRGqAgdc4vjp/YoJ1GdJXC+IQTwFV62JQpwFATD/jjdpHoaNU\r\nPlQeuaX66S1NXjMhI4/Kdq2OM29ZGBBnrqNLmVm1lvkLN6LeVt8FnT7RFGB+\r\n7jEflgAVBwTAGZmNP3D00UPkrJORUbO9ewP7141jOLvajBGRooxgDnKm3ngd\r\nzN0smUW94D6miz8ge46+qRBPykPOjWT2kJujGHoaRukMeX5xCO809DEjinBD\r\njInK6nIDLDe//Z+QLxlxQshKgk/NmB7Wk3NM3U39nfiTUW0bwlsKYfHUayAa\r\nwAAlQeVMng93mz5CABdQ+Os9CbXLWbjqK/EqWp2G1kuMlZHBEjpaQB2/jKAv\r\n1GO+fz18ekd16Qx0YS2ZTQl1vnsFZCnT+cqdi0eolRHTVCh9lu7dyNVoozGj\r\nTYxmEgdQOvqqD7rwe1sjPuASSfu6j5K0IwpbXU5lpXj1twi9wNnHgAgPVeRc\r\nz4tqgwcHGLUT5iugSS4NqkUv5E4r3MrAIJn3pLWJHvT43TA34dXrvbRSG7uZ\r\nHE1qQMna4D8K2FCGHbexlQ8/i7ClRmRlam4=\r\n=nQux\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230109120127-5284a76.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/30f36e01fc619dc96d33f637af163ebd/graphql-hive-client-0.22.0-alpha-20230109120127-5284a76.tgz","_integrity":"sha512-QwtaKF2LHiD8UPFGnWZWr+AAH9JaKk9/wTyubDQSmz2sKi3CRdVse2RGzerZip/VN4zzpVO16ChhemCkgl/UGA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230109120127-5284a76_1673265723650_0.9251958331939778","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230109120415-6184545":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230109120415-6184545","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230109120415-6184545","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"9c36caf1a0e0164e3187cd331803e5c907b08be8","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230109120415-6184545.tgz","fileCount":60,"integrity":"sha512-g0Vohbvcbt1MEi87hUJF2DasFvRm9Jojk7SpPhYQWw/pbFI+nXb2sgVgTnIKPzDMlcCUit46EVCR2ncW4lDIoQ==","signatures":[{"sig":"MEQCICT+/Mu3D+1pVJQXvLGstmhuK4D6olvQ/ERbxxoZmj9aAiAyYbOzWHo5CDbgHReaB+BEeY2Hcrf6RqQoGQhCo/KiPQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvALhACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrxDg/8CiBCLNdYmgem0bN8CGJydpxDllqc3w01+MeuHVzSK5mQQdwJ\r\nMq1HJTkBkNRJ5jJ9Q6WOxLN9YZcZux9qZqhyrk165sJbWIR/B3f8bY1v20g5\r\nOk30n+Ksl6ywdLkbHbxPlUReJiGPWBhdXEM22R9QghkOyk5KJhXEuLtyAITq\r\nFHxHIjz5w9HTcyFH6aiAHKHhL1WWCk8vtKDZvC2TIHI+jrvbV2SbcS4B63/r\r\nBImAbiJSqGOaCTMaBhwsqhwDM2wH5qusiNsvrqOzDQjTKPRZ6kZfyJMGX/l2\r\n6XJtd3jXoZLKJKPkYQwMZ85rMiZGV6VkNUBss0KopE7tg8JJZDR+Oeul+YJ4\r\nDJKKedEbPu+RpDUbzZpPi0FA5+CDhSdHMp/mccYKKWOR0wX3JR8RmkzxPm5X\r\n2QRLEiU6aF1kj6MMSr6rzsb+R6WMFbevNPeCJMPexvhH05JCZX4OqkgA7Y1F\r\noXV98RQUOJG7vbthOccFIRkW4huxm8Juegfv6ebJR4LXFkkdvAQDApj82w8v\r\nHuMMLNMEnijW8nQfNPRw72U7mjADhpdzE7bw1wJGzEZygRSb0ipuJMgn3934\r\n6AxkpfidzNKRJr4mjbdoKLvJwUci36AVR/0hEN8cXrwtzkcEWeQLkNwQEpHU\r\nJ40PKHUw3S1UnAENrwLpCLWNFdxdkv36yN8=\r\n=LeNF\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230109120415-6184545.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/74122582bdf2d99d3b954b7dd9ffc9c3/graphql-hive-client-0.22.0-alpha-20230109120415-6184545.tgz","_integrity":"sha512-g0Vohbvcbt1MEi87hUJF2DasFvRm9Jojk7SpPhYQWw/pbFI+nXb2sgVgTnIKPzDMlcCUit46EVCR2ncW4lDIoQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230109120415-6184545_1673265889304_0.3713918509148453","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230109120408-f61fa97":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230109120408-f61fa97","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230109120408-f61fa97","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"a553a3c7a59b801d971d178317312e11b5f21592","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230109120408-f61fa97.tgz","fileCount":60,"integrity":"sha512-n40R4I6OPtXjFbe+ly9mxMeEkv55U3Crt6e6v23/0i0NgbZ+14GQSwGIA9KUyU5riReiBvRdA+aCbDjjSMGKVw==","signatures":[{"sig":"MEMCH2zSioAKQBQHBYtgiMT6EWxSWtulzqilfJjZsXhR3/QCIG3o1j7yTwJBV5kCEDnwmfuRJDpcpwp+ZyUzdKX0tgkN","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvALnACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrZJg/+MPm1O0ohkGmBA32JXSjxFiPVJpTIBSIIandssS9akj4FWW6P\r\nrdP0V/ThGJp8CGMxoR9bmYh93dSQ2qcCYXvFRRrWsv5W8cYRQu8S60Ai3Kxd\r\nJjNzCO9rfHPkW01V3dDST0XQX2iJTfc4Pn1o4+N3Uvj2tRheXpEnNCMHI3kq\r\nP7mgHvoOKbEIkj4Lu24BoevXjEt8xhalGizzuRsKHuxaIl+StVzWKEvZWLni\r\nRc/wH8HUq6KAG5dx7UVY49Y92wIk/CjZg78EDj8Sl+D2B99qQHHP0ST4o1Sz\r\ntd+Foq14IhF94CFQm3IExxFeL0OKe/vXkRHeeoKvCQYaRrOjibIPZ9agvhyv\r\nRudOuTCD4IbM52V5a7w3Sos1yz4CaHN9Xj13RMbqsqcnMMtFvgNVjW8de+am\r\nQbsID8/hf7n8uNwh2gxk89JikChJLoj3CG1S5nvnRPAhbJQgY0pqXW+JTwre\r\ndTyUluufBy4ce+gWm+oFYOxD7N+/rAczM/2lU7WwmVJTN2gkmnxm+h5IUDGb\r\nkeaFnib7ld4ZJBQRKBpWCimxH9y7iRpdqlmVssj9k3QvRVEG9O5E7Y+U4yEH\r\nXpWbn8dTUqKk7jxxaD2OuFaMYrkCykvwbDoU8a4dCFTvI1J9nVYAAF15iutz\r\n6ZJKIsMajmvjBzYS4A4qakUxmw8vrXEqvu4=\r\n=B7Kj\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230109120408-f61fa97.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/bdbebd94b6a73fc73d0f1282ad01223b/graphql-hive-client-0.22.0-alpha-20230109120408-f61fa97.tgz","_integrity":"sha512-n40R4I6OPtXjFbe+ly9mxMeEkv55U3Crt6e6v23/0i0NgbZ+14GQSwGIA9KUyU5riReiBvRdA+aCbDjjSMGKVw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230109120408-f61fa97_1673265895689_0.5237079215392151","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230109121348-017713d":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230109121348-017713d","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230109121348-017713d","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"eb9f8bca01b7a4294966d448be830d01247d73c4","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230109121348-017713d.tgz","fileCount":60,"integrity":"sha512-53lApokZQztTodE/ucrHBYqnbtHER9a4lOFF4uBTmGRoC26yTDcxWjsBRRb5ahuaF7wDembsMLTXNqzfXJXmqA==","signatures":[{"sig":"MEQCIF/CQbJcEb3Jh9q4julv+v5yPW/ppNILHOd1ywrNvVFCAiBGAN1L4nl0mBZcGON9y67erZaAzDSignU6T9msZ5513w==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvAUfACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpbiQ//Z3QsJwOEcUTFTIvz10AXjN2JDZrCs0+UsQrsg1QUbz1QoELA\r\nyZ8Fc2gP7Qp3SWowxJdBUyRapecjtUmN6rol1IEXgR6rkEpWJkfY4kmhk8ZR\r\nvtrDaI7USTtPdXC4L8TD048QtAWRdEh60EJtfSQ2ooMHvhoVujs+8tIb2bz8\r\nVJUUXNPqUs8qQ+3Eo6B2r+2mxpJj6uDsHQUZ3YWydgmsBJv8Spd9wk2tEpS/\r\nYyORbEwkDxqZLeEuGppbB143f1FzBWqVrdWqhtAKAfzCcAw6wHgeOfdxgIh/\r\n75qH8tEs7H4orI2ymlIbfrGFYQlxxQE44v4ooWQj9dEb2S++tWOOeL442YGn\r\njCYgKZGQfECQ9Sfd4OB8ZbM2qujW3Cbv12lKqmXYz9ow6tPj59jrL3hjmhbu\r\n2ukglHaaudNCRAnT255ncH8+G8X41qVelQFDLKbBuw2kK2bs2gzKgGjV3tcr\r\n48SZfqFeWgSQf1v6VX9oGe2mNtSX92W8izDrpMkm2X1meW5pGebpHwZu2XBF\r\nW8X5HfNGRfQpaGmnSaeblC3k/10FV+67Qii44jeSUFX3XB7635f8vHWo/XRD\r\nFUGKCBqJ5FLlXxb3456fJT1X/p8H49KeeyLXkM6IX2NJjiSYivbHbktx2fZW\r\n2agxS8OGKHsTtxeQ35OLAREWzjKh2ePwje0=\r\n=hC41\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230109121348-017713d.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/07f7791403560097a6db2b82b5c9102e/graphql-hive-client-0.22.0-alpha-20230109121348-017713d.tgz","_integrity":"sha512-53lApokZQztTodE/ucrHBYqnbtHER9a4lOFF4uBTmGRoC26yTDcxWjsBRRb5ahuaF7wDembsMLTXNqzfXJXmqA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230109121348-017713d_1673266463418_0.405736476018548","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230109121351-e652a58":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230109121351-e652a58","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230109121351-e652a58","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"66b2708f8fa1e5405146842260decbd66db85b45","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230109121351-e652a58.tgz","fileCount":60,"integrity":"sha512-wq7Y2X3ejC7W9koaWuaprW9hXABnPSzuYsKcXpGXpMcXpqogVdQ6bLB23prliY/Rc4HCLn9kM/HriPhe04i8Ow==","signatures":[{"sig":"MEQCIBibeZHB7Mn2hXbo8gq7kfIeYu+QuUg9YK4HV+Hw0GYZAiA1n8GapG8xDIG6FGS6cT+KUtmCBpiODvDofg0zmzdSFg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvAUmACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr0oQ/+N3isgIIDUZI6NDQ5Yb7zW9g9Y2+tNFMDSPasfN+fsFxSWgdw\r\nmL0H6r+zcHlsvt4c43WxPulhhjvMwcVkyo0PZIwcd702PPEyzIPNT++jeb4u\r\naYiSTGJbjvUKUclp0LHerQ73hygMfrk7QgKQl7M3QYlOn4Q8KeMfZ8TEwOqE\r\nzYR6zNfWlLIs1LfjYlGgPperjZ647wlR5VWlK+7RHjolxS7mgC7uJpbtlu58\r\nU6H1sSVJc8BT/ny3JE0PTB3HgQcOtnM8O6GCokqUnQbIvS5S3bLK006VT+Vf\r\nKwmtONefuzfArzrx8HjwwHqByuv1PpKZ8hGSVVGmkGQ9qeHzi/vJdkyDzz9Q\r\nHXbVZ8ET1Fk2ZeeDOZBiCJct1H61OA5jjAjHIeE5Uk52SUHS4hbb38RzU7RB\r\nysb+bnd7kxfySPl25KUk4wBFOaiJkL2jla42YP//REDzwXjbfkzS/sSUGAJC\r\nX5MFDBcU9XoONCbXKr/mIJQqO+aVM2iKtN/2mU5Y88HCKotzRgkdDsqZN/x/\r\nx8R31qflMwEDRVShf0wzfz3nahplkeMP7c3WKJOaRphoUZBVZHLs7ADVL8JG\r\ncCxLjS5wbIplpHd7kF8HxE6u4t/rgPErrMSIPdLQstusSgqn17T0T0/1RYgu\r\noEC2bm7ILvs7c9NWTKUIKmyJdpQ0bX3ueVw=\r\n=5GV1\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230109121351-e652a58.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/b1ead91e58e53846021526b0c10759d7/graphql-hive-client-0.22.0-alpha-20230109121351-e652a58.tgz","_integrity":"sha512-wq7Y2X3ejC7W9koaWuaprW9hXABnPSzuYsKcXpGXpMcXpqogVdQ6bLB23prliY/Rc4HCLn9kM/HriPhe04i8Ow==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230109121351-e652a58_1673266470267_0.00017293309075006036","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230109121407-544800c":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230109121407-544800c","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230109121407-544800c","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"12fb837c97a43d692a8a4758c7335d8a5a0028a8","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230109121407-544800c.tgz","fileCount":60,"integrity":"sha512-0lUION0Nm/kqCfpOyE+TSf/RLO68XNLQVxjoa4L0spJPyZEOYEXmAnrPQJ/fnX4kBo5JHj5JzXyXMBrd94I4UQ==","signatures":[{"sig":"MEUCIGqcGT4EUg0FsMHufRGdXUDggk3Kyt/2KMQBO6tbGDGPAiEAsxPxAsBGyhzj+Ek5W3gu4l4IWdzaa3iNyp0X1ppNAp0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvAUzACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmogpA//ekAmajjJcIfURAx0AH6L6FG35VnSESE1VwgmH5EV4xTQFm8z\r\nvL0uAPF67rrU8KYBh5PpYyJsZJk0rLitewWfJqynhZg+TLRca3Y69rliVOEW\r\nHGhm/xM2BaZFE5aTXIGoTr4RaR1B4/AA5iwSK5vjmfz5eTasRnEWBATMdz+8\r\n9nL4IJIlbKT7PrSR9W7tGvsHUu0SqIroUuMYho6K38KPLtXNPo3dREnLTAbR\r\nqsQfs6PiY+bzsXMh+YU8YLJRd5ot8WiRSf6I5OSU1+iA4j/Yj+z5PM/vTMtq\r\nv680nDjsmSOQ374vJmvbrP9tG2f1cxpbl5aX237lSicN2/994V5D7RReqdAh\r\n2Ik269XY0EDnATyEBZTrR5pnaSef4Vz5z+Q/+WKbIoUMXVOV9kjFw22hassi\r\n7xYncPne24Da0UcTuvDX5pEzCsJO0UYePP9DjSJsWvRBqHla0QcpcTcbjkhP\r\nDHj9NFDxr0WjE8zMJWxjnegnWQWDZppoeR2zKJC0rfwf6YtDtJqrFQVQtNpj\r\n6OIwhsGM2xnfagqZAxFtppfCZEhOa9a5hXqzy5EZM2vinMAoWT9zLq7rlWU4\r\ny90CY4K3hGLwJCTQ7V+yWQSiwVZE5toxr0aDXAVhR38CwgqDDxYVT1B3Yi85\r\nsAAi39gowr5I8Y9le3zNn9buHjmzS4j8akk=\r\n=Abs2\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230109121407-544800c.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/9a01db10567faa87dfc91477d65caf82/graphql-hive-client-0.22.0-alpha-20230109121407-544800c.tgz","_integrity":"sha512-0lUION0Nm/kqCfpOyE+TSf/RLO68XNLQVxjoa4L0spJPyZEOYEXmAnrPQJ/fnX4kBo5JHj5JzXyXMBrd94I4UQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230109121407-544800c_1673266483760_0.7049889824750621","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230109121714-cd9631a":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230109121714-cd9631a","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230109121714-cd9631a","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"18daf614aea43881b204260fc913ae6426f82697","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230109121714-cd9631a.tgz","fileCount":60,"integrity":"sha512-yVEIuna9gLQcB8swloyXLgqk/iy/FBUjL0ltT1t23ITVIuWLi/HWtcByqSAhn67cf52jISQIf7k000eIgKhgzw==","signatures":[{"sig":"MEYCIQCO1Nida9TCaJiilc9ezxqpcYqJ/h3QGn5JRUpf9Iy9xAIhAOKy+FOZCeVEXUw+q8cvic2dktLb9fuYv9FXghtM9pHO","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvAXwACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmplDw/+NoW/CLJ+I5+Q27XfsqmGcU/MnjKdz6A3mNMp4hXSJS+wDe3b\r\nv6h+ms0GZw5mwx/J1Y/HBkdj8l3Qxc+qNHa1AyW5IbV699HJz4p/9vrM+Jv9\r\nUXUW1yAg3HHOtwfZdtlE8PM6uV1UMmpaozsYGyL4SYbYsQMVlbazJfFe7+Bm\r\nMY6/6m14KNKHBRe36dwadu/gfhrRmowXTbkcq88kxplrNd/kduV9J9BH6Mgy\r\nqdZaxCfTWbzkA/VzmRodTsd8Uiw4aVP2fvnbBfSsJBokyKgHpRfcfreuHiYu\r\nTxizqM2K3Rcxk+p2310HVRmHhnSpQk39o6Gae8J/HsbKptwAWymXtuIQCtae\r\nEw5+UlKaB7PoGA3wf4gifQRDz27dgFHO5XTzSYm+tJPadjb6U6c6Cq9MB4V3\r\nopCo4GdvE9V5VcQOijmtrBcLwgFDchenL4HKtfPDX7cmCaDdNmrbhNa9MkpV\r\nYjQ8cpF9Q41wsGLn21NekeS+dmTMNjDrPst8IFTVKHBnq3gDBz5vX8voVxaT\r\nO+Hhwnznd4JLxSJiVirf14eqHlP6E9S+ucAnpcPUzVmGKB9hulySMquiN8L4\r\n55CKa8OzrVxub+OUmItalAMO+MkKulvbgn8Ewi9qF5v0xmPH8+8rE0AJMzOZ\r\nooyVW1ypfPWbLeaM8fPcoUR65WIXZpl4ksY=\r\n=axyT\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230109121714-cd9631a.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/4624f305afbd12b9f8b78155a9c1ce01/graphql-hive-client-0.22.0-alpha-20230109121714-cd9631a.tgz","_integrity":"sha512-yVEIuna9gLQcB8swloyXLgqk/iy/FBUjL0ltT1t23ITVIuWLi/HWtcByqSAhn67cf52jISQIf7k000eIgKhgzw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230109121714-cd9631a_1673266671732_0.18653429948616318","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230109121939-c3272fc":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230109121939-c3272fc","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230109121939-c3272fc","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"e3b45cc2d74d2ec3789bfd289f2e0c2cb6b8498e","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230109121939-c3272fc.tgz","fileCount":60,"integrity":"sha512-MIs8OMFUI//K/TYGzfafD23WTxNszcT8zxx8R2QRsJWNfKtzuxT8MtfFZxBAFAsa6w7jdtaf0owL1sT0h9pi2Q==","signatures":[{"sig":"MEQCIHckCxaS10DPU7KzV9qR7CJFWQa6Liga0fykWfsGyiudAiAmz2LxscjAN2gHCSf9n665jeOmisrk7z7lF/s4atjvwA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvAZ/ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpdZxAAgrVgpRGqQjFBENXrzrlqByQ6X1qSRL6QrS8e9Mf4j85Bhu4v\r\nO3BjWRRaJ1+WFZnl1U6Rte9LNPrU3CIs45EAenoVPUabrriJxcOjFHmR7MV9\r\nt+FQkhesVRY4r8288+SxS2IevsS6dMjxvCjt/bmNId9Yz6nx8FN4WsN1XzAn\r\nFC/Oz3tW9kRRRsrsoXD7ziLCOI9PoEezpGIGEkBo88L8/TZgnuGpHRZ0uYWW\r\ngTLXxDltAGXJQ7lP5rdVSP+T5HXlBK+RJaBREkoRQ2Ls+JjSXMwQw83ltEyn\r\nf20sg2HzoYT8FPbO4rRcu+oZpTsSxZgQZ2fnSTzu2Ejbs87iXt70tIuioRQg\r\nom/oWj5KE3ela+Ef+e9d8wxh5LQckX6s0noh5cZZkKG83row2ifDEWJuQiyz\r\n0olJzc6BmB19A6TqJmpGNyf/6YzWXbTR67gJC+WWN34vN696T1CiW2ZnxYC3\r\nCaqoi5Mb3tyrNNatCvCg4aWCA84bOFlvKM3r3mlJVeExY5BcWbXBzkX2P+iE\r\nNRasA8uADsC7Vetn4SQUoEWa1WDjYE9xbEqrh/OARa6jfn0o6WhtcAGBxVrZ\r\n/q++/iP1mmdFOAmGfJClR/VFpGl6qEPWnfKQFrVyg64PH79Z4u4RUmzUAN9C\r\nhOuxgfjoAtmdXC/Q6lF+uBMenLSpyuS7UPs=\r\n=IYlO\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230109121939-c3272fc.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/29a2ca1b50cb171a62f5267e2481cc7a/graphql-hive-client-0.22.0-alpha-20230109121939-c3272fc.tgz","_integrity":"sha512-MIs8OMFUI//K/TYGzfafD23WTxNszcT8zxx8R2QRsJWNfKtzuxT8MtfFZxBAFAsa6w7jdtaf0owL1sT0h9pi2Q==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230109121939-c3272fc_1673266815515_0.6686874024749629","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230109122533-c22b8b9":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230109122533-c22b8b9","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230109122533-c22b8b9","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"7f1c24b764b0e1804c9fd86921271cbcd53a216e","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230109122533-c22b8b9.tgz","fileCount":60,"integrity":"sha512-FZWB/5cJeJ3by8hXiTz2QV2NFLwN5goc1vBDf7OpfykSsbO1kKnW45IvzvqH+1loBvukXWJr/iDf2t+5Q4eEGw==","signatures":[{"sig":"MEUCIGMRFRScNP97lv50tbTLlHjO5U420zcAj07z7/paJc3qAiEA2vyht41sXiafwM1Gx5PV8LitbGelMHgSAPDUQUP5xRU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165581,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvAftACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpyZA//RI5FkYxQ5Ft1kk7yxAZJSolNLV2kzhN2XztmlO+JOGVj0v3K\r\nc81nMmle4a1iSho6uLNMdVgWXrsfd1k1aQXOjs0RJJhN2M0kztTfKeMjWrRo\r\nzihRA7yW8pnuAL1FgYMz+Bv/sQ+X1eCayo/vFCKEQJDjz9PBXs+K24o5t+HG\r\nwvuUf0CF/ta7iFKFu1QrWkNO0gg4bOu0cV9Wycj9Vo6gZJ9WBD+eXF6fyjfI\r\nqlIBJPeJ+Wy9W6TnA7N9MKlxH042FHuv4V33bFyXqmRWclEOP1QLUt03FVWN\r\n++zsnpDplt4L4Xqh7z2993uNRTA3R5/FXAB3mPQi0EVZgEHNs2MzUvRCCGb6\r\nDeN2R8JI8Jx4SMq95QCe5c9qJlX8AUHP/uHw6UdK57LeAO2u4IN5US+uh7f5\r\nWY0HpaLG/D7Aq316F1PJGwKu7+Y4vx4fZwzPLwgzyzQqdyCOFuu1kM02zF1y\r\nnYAUtHuLUG40h/BQqe9EKfast12WFKu3pPZ9I8K7Bh3FawYYicypXQNtfPzC\r\noe3QKiXwh9HJg088uOx8/ZbGDI2g5l6T5cAxrwhd53bX5+R2rGKtcWnj0Ig3\r\nVAG+RZETjr9Dvp0RJfrCQgbHybCVAgGbZCiDw5nBIjsscuWsqSRa6kC7KSzZ\r\n1rt5P9MenEUb726VmlpYnd/mnVx345hgAP0=\r\n=8K+j\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230109122533-c22b8b9.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/40989d0e8dd7ad85244424f56c07af92/graphql-hive-client-0.22.0-alpha-20230109122533-c22b8b9.tgz","_integrity":"sha512-FZWB/5cJeJ3by8hXiTz2QV2NFLwN5goc1vBDf7OpfykSsbO1kKnW45IvzvqH+1loBvukXWJr/iDf2t+5Q4eEGw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^9.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230109122533-c22b8b9_1673267181586_0.6239340062519341","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230109122946-94b6465":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230109122946-94b6465","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230109122946-94b6465","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"a296274171e603511b283d70e1fd10cc21acbe48","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230109122946-94b6465.tgz","fileCount":60,"integrity":"sha512-h/otnloPg31L5zbObanMvttzzET/DZQsaNbRlbnne++/P6XEZdeuovM2NciKtFn2KR+IYUEYpWzGXqXJFFumww==","signatures":[{"sig":"MEQCIEozxGUyEBt8zgzWfPoo43qHXz8aBjLgc+rfWKINrlOHAiBd1KLo37XXT95KJ4mcswoZcJ/82qJMSlVI6jN9OlwDRQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvAjgACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmpyzw//Yy8WfoiKlRN9PeqWRceXCK7sbjkBEcGlqnQf5iyyugQh+hSj\r\nRc1arz4t7iAvAwuJjA6mlMxhEnCemXPgbLiK9G/xG7SIBNyrYA1o8155Itih\r\nXIdNTBvYKbRegmSFPPXc2j7xs8z1KwvfbsD3JRlk7HUC49fPfeDJiub52jEL\r\nn/mPavV7U++SlqJH9OgOt/2BiibzMoj5uReTVRnFUW5ZuE8PJ+zDBbVUBBCt\r\nK+sLlAA3AC+TFz97X813V8JQiD53uo6av8+j1AIusSrIBtcS7mTAhKSU7cY8\r\nFvU7qYfqikMtuLRj7P5VFKokH/bt3AZxjfRBuz5dEbYtZnx4RmmnchPPn5T1\r\nWPg81Bg22Zur933m4W/VmM56wqnHuh97lNoXaAVO1zHH/NQHo+J/RUzRGylS\r\nZZ7UPWrGDGpyM7pdSGtpmKpd2Ct1EiKuUWCzXlyQKYWqx6ckrWcS6BD+rWmR\r\nenhpfdPfHpabZqwDam2J34X2Be+anbRqTy2GWfu/kB7y71KOffiRQshBNyx2\r\nAuW9fTFYd41nB0GPEQNMu+Q3SUi32NG+cu8MCPk7hye1ay9ezalQaGLiF3sy\r\nkIGJoO951Jt2U+YXxCcuNnvR9+NAw6uxdSLYz7fVW30koguFBSY6wXwGghxq\r\ndWI9raNdSJ8KG8wAgDm+0g4XsAtwYa+4P5U=\r\n=zdu8\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230109122946-94b6465.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/72983183b8e67ac18a939b2a46a19ce8/graphql-hive-client-0.22.0-alpha-20230109122946-94b6465.tgz","_integrity":"sha512-h/otnloPg31L5zbObanMvttzzET/DZQsaNbRlbnne++/P6XEZdeuovM2NciKtFn2KR+IYUEYpWzGXqXJFFumww==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230109122946-94b6465_1673267424602_0.8432310110288974","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230109123457-69f9121":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230109123457-69f9121","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230109123457-69f9121","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"7217c115e413290c9b6fbb4008a1c4b968cfeed0","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230109123457-69f9121.tgz","fileCount":60,"integrity":"sha512-ClNi2Q1h3rx3+ey/KzUlnbG6uK//W/RxKm5i7PdinRLKEIF5lEteI3zEGxK3JJiuZASZzYYqjxD+PCmKKpTj5w==","signatures":[{"sig":"MEUCIB9SzUoKomokpF7qc+Cu4oLRlEWZiY8Skzu9G+Kf/tEzAiEA9vJgIyoxB48WCdlne1aju4uk1G8TMxmOcZqEpgrg4No=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvAoVACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoBuQ//aGSLGUGBomVVEA2DU6yTLwlJzGIAz/Rfke4re+lTMDO+n1Zj\r\nz0TcvcFoZKs5J1PuLYtTsT9wXWGAYfBWMA3UfQnD0XCWvaIBttJXYDIrdIaK\r\n0ql1HKERQXQUlq73G00NdOR9/IVecH6CWTXwYobBYQZF49xBkYNGA37RYckE\r\ny5wtnPwhdww/NSouJdjaXOH86uzPoU9/pbDIpl6BXvPWl3W8xjIoNxrpn3fH\r\nUE7BEQwVVgHshnIYAGRTTBPT8f6wzTdiI8SeYqxYxedBSCsNEBClX9IZd2IN\r\nfR63zFDrC2N37qeKDRFOdGV6mgxCDG3J/oSgyWrHwrc7jiQ+C/7vV8fUwM9G\r\nL+3VvvGGJ+oea+IfnBDRzqIxzf7mUMkrAeF/QZuWX0F3QcXxjQPyje0dqcId\r\nqN4KYkYREd47ufee4izR++1Cg3ZRHa+L8YKfg7YIwt3Z9DZ5C8VSh7e03kpG\r\nKm3LPTEJsdvefYmx1QAv+IlsSeAg7Czd4sF8C03oJMvEzfV+VHGvTQh19wUt\r\ngYC2XP0ZzCMptfwwok2Jnx99kNENA9xLp2RdC2Guxuj+01N9D2WKfZR8JMPl\r\nC+bfKhrMwA17evo+mTSLQTJRY8WVWyuluFL4o/a0A/t2g2CBIl9R6cxFcLZ+\r\n9g/mCDvuTXyQ00O1dWUxOY6B7do0tUSqjPI=\r\n=hsPs\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230109123457-69f9121.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/f25f2be4684dea3b06d48582695caf03/graphql-hive-client-0.22.0-alpha-20230109123457-69f9121.tgz","_integrity":"sha512-ClNi2Q1h3rx3+ey/KzUlnbG6uK//W/RxKm5i7PdinRLKEIF5lEteI3zEGxK3JJiuZASZzYYqjxD+PCmKKpTj5w==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230109123457-69f9121_1673267732877_0.7778177892190634","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230109123936-8aac5d3":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230109123936-8aac5d3","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230109123936-8aac5d3","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"893e2503f6152007c227ff2aa553a26234c55701","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230109123936-8aac5d3.tgz","fileCount":60,"integrity":"sha512-0VHbSspaaIoYKL6HzXJTdt4u90grCIn4jCvzh7sk338BVMmTV/+hy/X1zkBopPY8adh/3c66Ntaxjah2Hv7wAA==","signatures":[{"sig":"MEUCIFygi3F0EVYTlPXHaIIpev5eUJ877be7y1wrvygaw6oHAiEA5CYOoQVuG/pu2UztIJtqI4E0Lzoq3UBCTdQHnfNC6nY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvAsvACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo5kA//bBY813Q0pl2XzMnXJK1PJTCxu3yjFzebmCxOcN5oKBq+sP8T\r\nVOF9jLc9yZvSPQ4ad7GP3v80brcpXActf49FbD8S/3a6yWp52r9HY9Y4R0Zd\r\nfUFRc+/N14OHZUD8lKrT/hHTn2DAoKE/EhfJ9JqZ4wsdXmP91+8O6l4NEQaG\r\nE3evchMShhRyi7/IHrdjR5+3sUEJ28+AGnCqc4d2mwpBMk1SJXb5MJKeDAAQ\r\noudoFW1b7wFDsAsv8jPhJBKlTriyT8ipNz69Acq/u11aZx7ePMIrEz5cuxn/\r\n/tc0KLlMhdLy3kk8iGKaCKUgP34/CxGvF+nD1UqvxfGGuHi8OPIOe+px/wME\r\nG+MvF1rks1ffTVSnkWBJEJYgo7r/DdWs3lr7wumiiBT5birf4nvQDBbHklyI\r\nfbxTPM70RH1MCEBAambaLj8apz+GqkOwZJTLIHmY4JqFiyjZTBwGkLRgYfva\r\nbYpQ05ZAHesl/Ktpr44ocW68OM4MtH5i+FlU4Q9s5Nax+TROroYuPSsyqHIz\r\nTpGCqCKNke6RBNbPPBjI7AmIz2Z5AdCVxhrAEQjryLXNEnY5hxLt79EJwUf9\r\n8bydH86qRippsgH3Yf3UJliNLRlVntCL2geX8wpwvliLNx+JvLaS0kuA5Vgg\r\nsL9RiZ0XWyVcx678TEjpV+/pRniyECUd+CQ=\r\n=OjPX\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230109123936-8aac5d3.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/c5ad97bc135867487833198896322af2/graphql-hive-client-0.22.0-alpha-20230109123936-8aac5d3.tgz","_integrity":"sha512-0VHbSspaaIoYKL6HzXJTdt4u90grCIn4jCvzh7sk338BVMmTV/+hy/X1zkBopPY8adh/3c66Ntaxjah2Hv7wAA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230109123936-8aac5d3_1673268015560_0.33398322380016054","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230109145539-b28a86b":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230109145539-b28a86b","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230109145539-b28a86b","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"3ddbfa8eb940b028286b0f288fadaeec07af8355","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230109145539-b28a86b.tgz","fileCount":60,"integrity":"sha512-SMvsru6wLKwaSKiQtGuvWI3PElv5XhXrKkwSpeASlHILnSGFMvT7EC3FV9062tcQ4A/r8gS7nYrheBpQbkifvA==","signatures":[{"sig":"MEYCIQCAGZIrGv5Uv3mxCbLXWiSlMFbQil9GD2nCEUzSnX0IzgIhALdLmXt2z7gdAZPeHbG53/yypV6FBauDeKl2QqXPcKXa","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvCsSACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqJuw//TQdd904fgzdpF1TvqCM5dTFcfzlsKP3WfZie1ViU6z4UGsCy\r\nPlOLqrDQUykowXnHYMC1OBRmXHLyEbCb5EJZKNbsgufVnmDqiYrnUvcgrQWP\r\nm9pE1u7B/Iagr8QwRW5bD1XrKfBrFjkpafJGU53tHVAxltwO7RiUSl1FTHG2\r\nF3+h0r3Rspk9WBZxR4WFX07nWoH9N1xhj9Pbg/1AXmksATT/iBN71ZNI4lRp\r\na/hM4GHwtWzsZhd++zxuzYHflh5Fvn58yR7ZZlIDa30bw55xbAMcq28LJoZc\r\nXqs1sokx/1wlE+0Z5RIvyNkBvVnLgKWUuZvxus1JKhzzbM/ggSmQlq18YKqt\r\nrLZUB4SORHPr1d+hdHDC+qWDcYWDUpVj48OZwe0R8wU8/VqUdrdPh9hAbTlg\r\nygo1EHqOPdOgP1qTUc/69RehmGmYbsQYw48PWSRDqFu4eGqaJACMPMj4EnZO\r\n8v5NdYz8dFFXR7IUOcNp64uB94p0WJOOJ42ayldqqFrsT1VmCVRLD/IIQZZ1\r\npfvDWbEmgAiW9q2J5fgIoLaW5j3+V9bbYtK/6gE+PhPD4LWj3wYpteRyfbGL\r\nAkbjnp9PXpe0Xk0sIn4XHmrOTCYAc6eYt9om6Zp+f57aWAJMGHefSQupulTA\r\nQeTuaMDCqjO/aQMXnA2g9blq052h6rlPh7I=\r\n=hWPV\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230109145539-b28a86b.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/89914412b359b975502aced269045bdc/graphql-hive-client-0.22.0-alpha-20230109145539-b28a86b.tgz","_integrity":"sha512-SMvsru6wLKwaSKiQtGuvWI3PElv5XhXrKkwSpeASlHILnSGFMvT7EC3FV9062tcQ4A/r8gS7nYrheBpQbkifvA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230109145539-b28a86b_1673276178299_0.35730874703810067","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230109152654-c66727a":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230109152654-c66727a","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230109152654-c66727a","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"5f839850f1fc12f6a47350b0f7c6e1123261bdd1","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230109152654-c66727a.tgz","fileCount":60,"integrity":"sha512-1MJcxxAZ+UN8dus+lW9BjxcatpGDNtNK83EoyiXnZtupRGrN1vcQpyhbbO7pPPfoaDeRAxPX4qFyfEKgk8eyuQ==","signatures":[{"sig":"MEUCIFrhIqJufM1IFEbp4QW++PYZXrTt1uf/8reS+xQYATQLAiEAhvqSDM+HaTnEbqHvpLoUAnupRXdmlcxSRwIW89GSz38=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvDJgACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqgnA//aOYxZBlMYWkeXbxnP5soZdndWYKe4mjzRNMrV2bsRDEWDYDr\r\nH0NcMj5ZBX3WE8rjUQS9TLjT/8mC0DKgzouc4qSGbsIaH9/RV0B0IkzerD1I\r\nHfddDtm5795IUP+0XFTIr1ydHJNA0/bOA3R8usQGfpsjHCIvs/QfnG+QvRiG\r\ntqg+Ipg05uBYYBTlBbBUAqnGR+keD73mdZHAL4PCtX5k13621XDF7VnCWZ83\r\ndHHCzh3DlXioZRlpevrL3NXz30RZNdUBCFtoQ8uvsrcrMkZ7VlfBT91IOpL1\r\nVliUr+tVfANHZPsonMiRuBeh+GSkVNZZlcKgVLQyLUaosWLIvmixaaLyAnMI\r\nH01hh9Cfjef4STiQMicP3IBr5DXQq+fiH9AOwRwkd6U4jbjOSP0dy2Kn4r1R\r\nMkjoUEyDkaR57eXm2mUjvq+6izsLvnvIK6nVw/cWdgwh9bVZscD4wCFzjaDw\r\nSPK29lnjuyiYMNwqMZdsZGHBeP1oi5D1dIkeM2/kBcqD0r2SXFsU/t7VcBLP\r\nu/MC+jte9G2U6pqb/vN7hKcGiEZs98Yr1lsNfYmaQMu2HimCYul+93l0k/h3\r\nTsklscMmiG6oErSLdgBRqEc5Dw7WoGd4SM9yRXcMldF3G/XZB5wXKXf1/JJU\r\nXyetb1VONQ231CJCFE9SYeOKzl4bkRbCH9k=\r\n=xMr8\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230109152654-c66727a.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/6a2d1a7d9e7a8cc7229adc2633a8daf3/graphql-hive-client-0.22.0-alpha-20230109152654-c66727a.tgz","_integrity":"sha512-1MJcxxAZ+UN8dus+lW9BjxcatpGDNtNK83EoyiXnZtupRGrN1vcQpyhbbO7pPPfoaDeRAxPX4qFyfEKgk8eyuQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230109152654-c66727a_1673278048521_0.36873077776430496","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230109153209-aba188e":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230109153209-aba188e","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230109153209-aba188e","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"b7a244da6299a66f66c0bd1bb4f5d38a7ab7307d","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230109153209-aba188e.tgz","fileCount":60,"integrity":"sha512-KnB+gQCUTFXKyAQjYYJuAy+eyagZDuXfp8b3jWlfknaZzTknvv83TDcet2VosrtHuaMrrzPmUyZ46AqUFiK2sw==","signatures":[{"sig":"MEYCIQD7ITtGmd1TJ5NwoSZYjY9L9nwS94/5lIXTnFEC5oqbpwIhAM5v2zBTHkt2BlE1dHFlf+Ekvilaa8WSreb59PFWnn/m","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvDOeACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpteA//cOThs6jWU4NV3y4vPJ4MpztZXe2Tx7/qajFQ2RLxi1d99D+B\r\nOvXogtnBgErxLZuLTBYlDbgxMXPj6rPrWj7HSTfIydnV+ASo+/2mn9NjdR7V\r\n5GBBQXFH44ID7Jmass6dMg0n6K+cIKz+Nb7mE/JvQT4IIhXOxNJV2vhVc2SX\r\nZc8pw1r9DL8NJOczT28uHmicyfjbsVcFS1KTpsis23Zklir+lVZhDpsTi8p0\r\nOBEzActGUW3G7PvZOLVDfsfhkjYjCCRvx/cDiWAUwQRs5dbV84V3GcX+Qbbx\r\nMdGuNCsldDiriq4oTOclE3enAOVp/2Dd3HoWE8vO3xXsCTT49TJc5QJaQr9a\r\nKAr5M3B7nNf7yaHYEzVRIBzhmkoWIPNSQkdr+DdbLOHbEWE9ZjeOO3Btu3uk\r\no2SVxX/5lbVlefCgbAJFYTx/jmkLwNXYSlpSITV0wfTy98qTXUCrW1SUDfd4\r\nhkdLngyOfLjA6YSatSXlAu7B47qwhupEOwMfaou0elkGlUC589/p/vSEAlZx\r\n4gECEr5IL2Ksej4tsZtwc/CARmXaf/rAYzFe3gTQX+TIeKl0kDzhhKkEmgOE\r\nwRwNonpoUrqAMqcBPq/ukR8zcJKt9I57spEcbdfe4n72J4n+ko0QASH3KKqf\r\nkoxAzzP3vhWsFUngJwEU5RfgQ1mQjzS1ThE=\r\n=Ieuh\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230109153209-aba188e.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/e0b2179606604b0644d0980ab6bfc032/graphql-hive-client-0.22.0-alpha-20230109153209-aba188e.tgz","_integrity":"sha512-KnB+gQCUTFXKyAQjYYJuAy+eyagZDuXfp8b3jWlfknaZzTknvv83TDcet2VosrtHuaMrrzPmUyZ46AqUFiK2sw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230109153209-aba188e_1673278365937_0.7539779626481953","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230109153648-f030adb":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230109153648-f030adb","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230109153648-f030adb","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"20bb69829f92554083593cafa7c85215666b1537","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230109153648-f030adb.tgz","fileCount":60,"integrity":"sha512-QUA5Cl9lZbjTD7MF9m6SwuWj5xI5rayhPGcLCcdXasaTIfPJKrsS6g1NxAmPorDiiXBb3vNBvK2cEOgqXHT/Mg==","signatures":[{"sig":"MEUCIQDkCiipKBtUd7V6Vbw5Tu3jJcamgREuKV0EotiTKn6fhAIgTgwOcnLO7Zbcu02eO46+E2sX3F1exA5b7Uj4ZZrkw6g=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvDS0ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmrt2g/9FZp19SiSbapo6Ey9ztcW0QVTubd5+sPgUhWZad9Fx8GNP8WP\r\nG0Tu8fc75+KhFLpHfPPZerHyZtSa9tnt3RfkrvHVguPnWfu2db/eELZpiSNF\r\niRoBA0YFjPA3slpR7V0SRNVEyhK73ANuaFK9mMhPTsdSGPxsqpgVKlUTQyeT\r\n5GsAVB+fZPZ5xn7oQ+yiqOiZs0burzPezTmweDUO97vEzQ2d+fcAL0st80LN\r\nyX46jwN15JWgbHZ+m56HMO0N3RF8x09Wk0yqeBhNub5mClNjeH+JxhoC9PgX\r\n7xP5HI1DkxSEAOTooEua8DpNFXQR9tGR7NW8coDtSHBhLULGyEEL8AgJ6S6d\r\nU9UA8y4yHRVrMmTjoSeY4I4rEv4kuId5ygG/ksb6FRGk0KBreOJmC27k0X8i\r\n8pjgKL60A2bJb6oDvp1ASwfvjOQdlONAPh74+NmbSDFx1zfkPnJUdjPklwNb\r\ntGKK/X7cfAs2ITK1488ZSAmDaK965K0Hxd3c5Lz9isMnNaKDqdNIiiXbFXzL\r\nz+D8xtVVFJ2TBAfXY289cmbKmIZFs6zmPzwj/vrdcoCnpfQ8xfjjPxgcRxSP\r\n68xcz0d1+ZxgVHuCUqakN9JlRBiklTWrB/SkmiZSvWGDLhot3/N6sAkcwBnj\r\n/LUhKWs1/xZJ2LwPadbP1ANYcQRyBW5DMO0=\r\n=U2ft\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230109153648-f030adb.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/8fac8cea8bcf55be6c53b4f55643cf3d/graphql-hive-client-0.22.0-alpha-20230109153648-f030adb.tgz","_integrity":"sha512-QUA5Cl9lZbjTD7MF9m6SwuWj5xI5rayhPGcLCcdXasaTIfPJKrsS6g1NxAmPorDiiXBb3vNBvK2cEOgqXHT/Mg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230109153648-f030adb_1673278644603_0.2916067414848833","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230109154705-b714d7c":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230109154705-b714d7c","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230109154705-b714d7c","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"a34f57b051b05e16e521554ff3cf658bb276480d","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230109154705-b714d7c.tgz","fileCount":60,"integrity":"sha512-VcuXi5za47eIb+/zH8HXrna+ndjSmgv6oKIK5lp5itqWd6mSU60R9K263plwmj78vOiymCYz4cGfaX1tuyTdFQ==","signatures":[{"sig":"MEUCIGLgRrcTLP26vKHqOUaUA0KoSEHDhGDDn3pp5WBTa/Z9AiEA8meujD/GJ56tOHuEOrWvRCVMfj4JhtPpRVG7Uh/I408=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvDcdACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpJLg//b8G3U97sg/YwMDWcVWOZaViJ2SwNmvjNefrP7qpO7NKwbuTz\r\nzNOm8ZEbKG4PRIbQYX6JnDEXAWw/Q5CrSQWXM+YrlGw9coRzs9gqThGeT5w6\r\nAzCS5WHnKw8GawzFwuCVoPVCx/NMDbAz+YZaxt1N9PGKNW0NuESJrCLjfRqX\r\nN7SQH7qQPhWtwEpTQ5AtEXq0ztSUuL1Lq6zFdBMWYUrvIHlKjuQKZopWLrZf\r\nioquL5pdJT05Iy/YyX066ksP0PyP17u0jTCwLoe/6u0yeRhD0V4acv1acKbZ\r\nDpYcg/d7/h5a3BbH8oKFaXUTTECdwn7p696SwSH+rcUJIVuL1DvwGQ4dkn8O\r\nRXwtk2jKwc5U17xoTa8qVg4q4c7TzqV5qPxq+TXtzH01mMF/oyMxIibw5G1c\r\nBB3/+4H5WWI020VlFN6QZD8GtUOj/qnTGf/voWbAMVDlOGCtmIWs4e50a3qj\r\nT2pnsbjiDktqRGDrVXo0sOq4q4QKrmws2n2JBLn0gNT9YrrInA47LY1bpYc4\r\n8yoASM5MlhEARQ4hI1WgmneNEb7c8ZQnZMK6Yvmx2oLPv1bFY4ZHYxwH6IyL\r\nOpubepAe8ZYq8IEko/VYQXozdIcVTCuodUoA7x1VogbpX0QezyLsSliaUmhT\r\nF1WadAJbJTCrKw1ccAJQoGPDoVzGEIMBOvI=\r\n=IzYc\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230109154705-b714d7c.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/546262c1558959b6820add0422788092/graphql-hive-client-0.22.0-alpha-20230109154705-b714d7c.tgz","_integrity":"sha512-VcuXi5za47eIb+/zH8HXrna+ndjSmgv6oKIK5lp5itqWd6mSU60R9K263plwmj78vOiymCYz4cGfaX1tuyTdFQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230109154705-b714d7c_1673279260777_0.4202334117858717","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230109155254-7458caf":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230109155254-7458caf","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230109155254-7458caf","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"91347023620f048ace43355009936b279ee8f0a5","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230109155254-7458caf.tgz","fileCount":60,"integrity":"sha512-DtxIATUS0k+BaiqAXDG7wqphgh9HWkL5yvl+gU4/Euer7uGaU73LfVetJUDEGk2ZhYHpsKjMZm7n8jpqc7c/1g==","signatures":[{"sig":"MEYCIQCE5d5ApioArh1hnM25XAfM+AzB9UfrLhZ59tRbSk+m+wIhAPk1WEfXsLp0ZD4z8i/miFBodhAfcTyiYBnYpvd3hwfT","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvDiIACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp/RhAAn8siDUARbMaJUw5CWE5TulA0TwhAX11DC9IFjyphbSABf/aU\r\nBf8fq1FPwEu4MfJGeFvx1asdWQ3Y0F6L8UieA0rhH722y6Rvh//discESVAX\r\nLXzoMD/M2HevwCpDt4bva3HUvjYdu9Mdv+m5qxgoC5zHIzJsDqhDO0Xkq86i\r\nbByG0xMzBXypDvPnX1CYhtgM/pLsbWfrP8xkKAXCXP/D+f2XagJf0gmzcjde\r\n8OsylVi4v8Voz9mwbeaNmMyPQ7SHovtjLZMEh4VceHiNf5NBuoBWDhuZrVyH\r\nK3AIJohpaTnDH1EDxZjrGQGlig2/wR/CzvZVNt3qyqqV2zZUTwut3S8/yA7O\r\n6i113t5lRIU71242QJbaeWnh23QWCnxMQ7EUq6xkILNn8F81XwNmUKQgDV2Y\r\nxpQDYeIdZh7xzzKgIffbID3Rk9wx6BpoLoNIB+OS0vG0Y6dT/nznoTniwfPL\r\nFxRd5bHCc8KMYAOul0oJBrzchWvno29ffEAXMMtM083qs+NUW0l8AcroRvco\r\nq1qxDnLjF8GjagfS1NbyLKLKacxbLTa46jN5mLmQ1A85NAG/TmaFQrG14hjl\r\nUUBV7os4JK1RlCZR3oKoC27Bn6AVPRPgN3zDvB0IXHpnjk1eyBZkgvs0SWt/\r\ntlqpO/NlT4E1BhVITYuu94AFQQaByksnS6A=\r\n=9QFw\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230109155254-7458caf.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/dc519756a8003b2d2653d270684a798b/graphql-hive-client-0.22.0-alpha-20230109155254-7458caf.tgz","_integrity":"sha512-DtxIATUS0k+BaiqAXDG7wqphgh9HWkL5yvl+gU4/Euer7uGaU73LfVetJUDEGk2ZhYHpsKjMZm7n8jpqc7c/1g==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230109155254-7458caf_1673279624535_0.6750302348706061","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230109165030-e21be70":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230109165030-e21be70","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230109165030-e21be70","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"77529041393941ed1fa43a060c3e49f5032b8ee2","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230109165030-e21be70.tgz","fileCount":60,"integrity":"sha512-UvLe0shT6RE9X/7rLlINWxRliZXkPylWZ811AP5N7fmiMu94ahEY+WkoCl/+jsJoN33yjvcuTbiOv+V6XEvbLw==","signatures":[{"sig":"MEYCIQDbpIIAK7P48njkmY3xN1ssfQVJtJEt/R0sVwlN2Yn+EgIhANbP6sdNM7myNFrLlMB/8CLZjD7r2BCAsqdtQyI2wDMN","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvEX+ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrlHA//XlaCasHf3YjNwa7cjHKLWi6jfCEk7i1tFlSXvHSVxE+R1ixI\r\n8dsKI6t0IeTQAKRIKE3QPDKaotiH3WzyXl4N1vSvGMsKDQLFcBmqzPByHVwr\r\nw6pfCd1R9kSJH9NhaTzIID1f/0hLa707Nf3CVPdiysh3IG0gjf+VB+UmVCxD\r\nNTV4d7rEzRQv+KVvPWPg85gg9ClsNmXmE3E2wd1uc8/6srL/MPq1JpSuaeYR\r\nB8fs0swsQw6N2R9mdAUDNb6LN+piutqHrvv0lApe5pEpuHweXten0h9GXuZq\r\nMfvSlSM1xuwWBne4V99PCq+zd3JCNP6XP6b60IroTxW2IGapStA7meKZbud1\r\nFxDB/dnTwUzV0UKNmCCHe+4b+ND1/DV3qCe4pZABAlo/XNCZiQhRrfVm07iQ\r\ngkrOEesiFiS+1r2zHld2JphgpX+FSf2RQAbt2Xf9mExtRSQiuQ/gHVwJGCgq\r\nTU21x+pq66K3GXFTvs+vcEt8k8FeU1ChHpqsmSVVAmBV4Uq19P/6sCawVqJN\r\nFA60Wi9icxcFLizRI237Lfgc1vJ4Evt8/H5wmDSa/pEfv1sMUi6dyhcBZTIC\r\nX86vO01wPIbBRd77lTQaKL8l5JU+XwwP8HKGrpIlP+z8T4cUVNZJpOw3n20x\r\nuITzObebR9iSR8vHi1dVOtkYgz4/KXbqd84=\r\n=cqAw\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230109165030-e21be70.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/eadab614f9540459987a6413da806d84/graphql-hive-client-0.22.0-alpha-20230109165030-e21be70.tgz","_integrity":"sha512-UvLe0shT6RE9X/7rLlINWxRliZXkPylWZ811AP5N7fmiMu94ahEY+WkoCl/+jsJoN33yjvcuTbiOv+V6XEvbLw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230109165030-e21be70_1673283070170_0.3136595873722585","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230109170410-b4f323c":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230109170410-b4f323c","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230109170410-b4f323c","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"f3ff6cebe6e73b1ed8ea06c65675ca68fee01793","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230109170410-b4f323c.tgz","fileCount":60,"integrity":"sha512-uN5YptFJ0xxGVXinHcQGNFn+kblMZofRULMzhx4S6saLNLLXzCzRetl6rMbYjxKyB5dHOZCO0A86Qno/Mado8Q==","signatures":[{"sig":"MEYCIQDXsvu425BmAyppIZc/RZhVyLCXeU/JDjWYqiRNRwZ8NgIhAPINwUNDRXdlQAOfDO9iEhinmaDmErH6Q5hbRgIWPn1U","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvEkvACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqsrA//ddBhNHAHwuzhzUsp19FGmFlwfjQT4Eo6yoaoVk3bbPqDbQzg\r\nZ/Ju13c/8vFEoPtzwQ6oQaP3o/S1tkvqMfvr3hpCG4T2+kUYebV9LL9opQDX\r\nF2d4Ucnim8bAXZy+tDtU1lLbCNTVm+67e02bAk93LB/PHQYauzsuTRkqlzH4\r\nFZfJVYHiAXWnsYHGT0iTTUuU88WbguBReDvLgWfvv8Y8TTwLyQGPUJgg8Qic\r\nozJTO5FFG5PtWlJZwjR88exVgUAHTMX7eX4A3JANeuhe3/oJdGb5IQCQDgpY\r\nV8TX90m1LLW/sGmT0/D9LJJpeDWj6rGYzTZXiLU7xPF0aajiV1dqU+7Cl6T/\r\n+5pR3M5YD2ltEq5ZvHqPVHnDYDxEa+aSz64w8AE2BQmZJKsHDl0YTC825m/3\r\nOo++n9k/kROLzZ8HfRPJhwQN4Xnff4zjr5meMAs6V04tSJLZBdHNPxmtscLd\r\nvDyA+6fD2IbAU1JFHEAPpRD4aqB6XL0WKfYrHYdUDDEFsRrzb9WiYHzmF1yH\r\nbFqNjqNcZMiRWxph/pbLw7L9D8DiezySV4zDAXapLrMxMPxPRML4tC+lAqh5\r\nFiGnUDMn8YYm/bH4hCx9J1oAAG0gE1VhOgCAZFxD/QvCxjvBA6od07oNMu0r\r\nYQiU1vfPfqBM9K5RGjdsenhEXDtrti1thvA=\r\n=IZCh\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230109170410-b4f323c.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/5d4602dd2c5412acb609df522ba9414a/graphql-hive-client-0.22.0-alpha-20230109170410-b4f323c.tgz","_integrity":"sha512-uN5YptFJ0xxGVXinHcQGNFn+kblMZofRULMzhx4S6saLNLLXzCzRetl6rMbYjxKyB5dHOZCO0A86Qno/Mado8Q==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230109170410-b4f323c_1673283886758_0.40773027221025226","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230109171537-a1423b7":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230109171537-a1423b7","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230109171537-a1423b7","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"28d01d02ea331e5d3ccbc0112e5315a2654be1bf","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230109171537-a1423b7.tgz","fileCount":60,"integrity":"sha512-wzWrXA67wdB5JBx3ZPcLRiNguzdzWgnfQ4eBt+F+zWnBCSqIM1ib3Kww8ylRvKJjI7LWCQ3pJ5KnG4CBOz7e4w==","signatures":[{"sig":"MEUCICCZPQnzxBW86yTsSkESVPiPYpnSKvrgrh1I9uIZIH6JAiEAlorvaUucBODagVr4PTSsq4CLie8pARnlHGp+F4zjq34=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvEvcACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrbPxAAgw7llglM6e8xTFYuZKaCMjoJxDMcfJZl3JAwEQQJP6qJZdWi\r\n2pw2FtI3G1wVOEDYH/ueKXmpQm148It4y4Xh+06Q/K7NE62JTjAxpBLy0kyL\r\ncWNBP6MCssiLq2G3QPAQ789o+Tiv6VJC54t0U1OG3tCt1Pw1noWyCVHhZoC9\r\n/ej2OKlX6fIp8jBp4LJtYGYeVXBTzymQwYaAk6+ThzyQVFAg1QRe2kZz2QoF\r\nVZCEpFI4r2sGmQUFLD+lFLDtkbp6YUiFvEyt0QiLnMUtZR1ShJHmLfAfGIKQ\r\ngtFnJ7HlPpwMQa0ajZCRp4IBfli5Pkv9j9+S/SdFs7u+Q49ypIMbq0Mm1QvP\r\nXQlfLvNR27cxM9jTOPglk/7daLl+Hme5etkmn9x0iqECjebQ3GMnCMjbjTmy\r\nyZyZVX4fRkD+MJh/HDOHlIeSN3s06olfqPw4lvKe6oOFAgzpSnLn4dmWzeeJ\r\nmAXsyJ979m/lLBiSx/cfRHLT2ttSLa1hOWKKatGmgL2VWtR6GUrLc1srq3+G\r\nesC9vvNC5x0Y8K4BS+atrqD7ohMxA6nV32oSXBuz682Fjn0E94r9CJub4039\r\nd2YlCTdtRRu858TbSel3iZUjUAjAc1q0h43J/BKI+XhbtnwYCA/K7SglaE7E\r\nuXG2rUtE86Pl8VhRJoUM0L3gh6qGgGTeXyg=\r\n=XSKK\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230109171537-a1423b7.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/11d762a748dc29d0e43d319402072968/graphql-hive-client-0.22.0-alpha-20230109171537-a1423b7.tgz","_integrity":"sha512-wzWrXA67wdB5JBx3ZPcLRiNguzdzWgnfQ4eBt+F+zWnBCSqIM1ib3Kww8ylRvKJjI7LWCQ3pJ5KnG4CBOz7e4w==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230109171537-a1423b7_1673284572299_0.5835538339785558","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230109192625-084ad89":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230109192625-084ad89","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230109192625-084ad89","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"4c4078fdc775162ad321c39f22f25f4691eb400a","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230109192625-084ad89.tgz","fileCount":60,"integrity":"sha512-NkX1wHxp9+hrkWJCMZHANwGOpkdsJA4auyLel700A7SeoqX42OYYHmsk5idTUrt1rWLONuV6LWjGgKt1reXlZg==","signatures":[{"sig":"MEUCIFoiiWnuk/uIVVInK5b1oRK+c6iL0/cohc+rhqmQ5dMAAiEA8G6WP1hWTMWTmAemT5HK/T/8L0H3XBTl35Lr18OkDPI=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvGqEACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrIzw//Uahr0Fmpk8QO1vIqfmy6Ki8bVueMul1qlOG6LBghRZ2SXFSH\r\ntCfO+acqo/VLP9D3e9ISmSuet3H8/aCO7C76+ns6rYN6Vpuy64YYHniG6Yx0\r\nGagXX4NJq4q03Yw/4YYSedJRCGUgorPwQjfexWlYGdL6e+eWktHSyClZvwHf\r\nvnXNO7CPN/SYsJ4ipkTGp8b/076ZKG6+0ihxnnwxq/uSVq5U7CgqspQKpMlG\r\nM99uzlaDtsKNoVfvXyD8+xpNszK55Iq0x+CnIs3ajH64g5ZyqrTaPPqU3HXl\r\ndQpREXGBL5SajKEti62G9iwKobJjgYGsWUJrM73LAeprVjnsR4ecInEFIdEZ\r\n5AxIKlHy+UzTvB6uYWDQDN6BTFjWlFA/vL91TYJrqaDdSvhnyOF6cLqTR7rp\r\nDGu1cC9WR43eWGsONfA/WmW6FK1A8v0I69ykW5TjOXa4aJ2dG9aZ9dK80Wc4\r\nwisYAq57e4EWWSzyBXohzhfbvxdzQBfZpULLaeqRtT3A+waAA98NIjgrtW5y\r\nJqamXCc5y4tN4dI1NiZyRfSkun0DESC6NS7w6VnhH3/wK45c1SFH8sOcJr1X\r\nq8DTUu+7bJeNLZuvMUi8Zmma/w9bEEDqO02TLDSdVR96VkdGt0jMpAFWpP1P\r\nq8lyXxXwfOXhzoSzhyV3ECU5/o2pzFq0plA=\r\n=xkhn\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230109192625-084ad89.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/0c9dce3669bb844902b88253b7cc61d2/graphql-hive-client-0.22.0-alpha-20230109192625-084ad89.tgz","_integrity":"sha512-NkX1wHxp9+hrkWJCMZHANwGOpkdsJA4auyLel700A7SeoqX42OYYHmsk5idTUrt1rWLONuV6LWjGgKt1reXlZg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230109192625-084ad89_1673292420225_0.9541962590208826","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230109204347-7ffbbf7":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230109204347-7ffbbf7","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230109204347-7ffbbf7","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"6e8eb6b5a4a215d3ca4474e7f95576e5d9736b75","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230109204347-7ffbbf7.tgz","fileCount":60,"integrity":"sha512-cnBsRCA8U+OH92bjCQ/UCvQo1rTNtlTW4p2X6AGEekX9IVy4G+h8xgR3SsUobM1jixW0Y2IP28/PsuPcRugvMg==","signatures":[{"sig":"MEUCIB7vbpeez4G3QJ7HCyLPwmWx7cYoNAvfdEK8H4Q/WJavAiEAxvQOnRR1LDyIvDtimBfb4ASCm+K+SgvTQ/S/DNNJpIs=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvHylACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrGfQ/9HHrkXgWB02Nefm3G3jNvIW31MQC54DA73lz11jyRLAxSZzTa\r\nFyNNYFncFX0Vg7iTvnZxANkZMQV0HkuONjnl5Hi1wJhqjqxkxoi4D9VBTLL1\r\n9EsWIMhGZYcMqiksz5am+9e04cKW6nFrDTObIVb8W134SeLjqsOx/rfB1iR9\r\n1ujonmw/Ry5cUqgZIFEphL8BTdkYuSMTMRcnsxdDY7S5oqQSqyW3YddrRSek\r\nIgLooh5ZWhkBTS8yxneh2I+lHFGHsj+2UMlIj5y6IOvdEAStUU6zwF5feRYX\r\ni0pr6JSLqtLg0z3E+kJP7Cp1cAP6ydegUrd5CcmMkBVmjK0hqyIMp/Kho+80\r\n2dcYkdzm+J2gRdORmZa1nxMiLdCLYLGaU6ZGS6RX99VKD61zW4gwoMd7W3Sk\r\nirfK7GyJdcJLe/R0HyZ3cCTSHukQk3K99gHIFxoLq1STj4QeQNfFQ7ebnzsj\r\nflXK1frD3YpQGidMQukd1ka8L9YBXqpfrV4SRMmvAQwIuAFOm6myhv6l7ngy\r\nxOT6CAYvmJt8NqqSnRpsTiuVbLiifk0SrfhMxgJl0v9WR31KbDCp84NONdoz\r\nsm2MGxpgCbthjySwkocByJ1pDj6J6tItuoXvTAdGGP2Ouiq4PiQzi9oXBClR\r\ntmvnbwu6FYwy2wW46zv7XlDhmJtFHqPKSPw=\r\n=xNG/\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230109204347-7ffbbf7.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/42adc0f8d24a6cbefeaab8f6a2ae31af/graphql-hive-client-0.22.0-alpha-20230109204347-7ffbbf7.tgz","_integrity":"sha512-cnBsRCA8U+OH92bjCQ/UCvQo1rTNtlTW4p2X6AGEekX9IVy4G+h8xgR3SsUobM1jixW0Y2IP28/PsuPcRugvMg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230109204347-7ffbbf7_1673297061256_0.8223298652951956","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230109204906-87ab419":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230109204906-87ab419","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230109204906-87ab419","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"e91c9db0ac83a1f43242666dc3c6bbc478c2e0e2","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230109204906-87ab419.tgz","fileCount":60,"integrity":"sha512-wtV1aaF3b5Zez6hIYyjKu0lyoxcUTVjV9WP+lNtLN9z21ZbyVWlTl86kVOK1M73uCaEw75rLwC3DRPLjyIHEMw==","signatures":[{"sig":"MEQCIHePVfA9G2nyOP/RrpH9YzxxwzP02718KpSYIyq87XSKAiASiZ8WcLLH/hiEt6nxGf+rqjcZTo92Es+cKLSy5KyuQA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvH3jACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoLOg//ftIlV1nx3qfYh+eFujmqoa4Pu1qdxcnxlv8PzKSjv5v99bfn\r\nVHljYB+N+k5AYQPRzm7+2awHEfwLpR9dxNMpC8RECmYXyDfEYeFoONC8q7BZ\r\nEGZ7ASWkMdOKVac5mEB/MC2OvlEmFTev1JHeHh07y0niWrCODWjYokQlMSCN\r\n3dqr6lHI1xkiC6K45GyUxneZbMAIm6Q5N7nn4+9piiRSKSa5rbQsKmvXSgkt\r\nvxcWfke3I4x5yBpLxQkjO4IiuAN5p0bddAwjJGk1hJ1XuSI+0z0LqG3dusVT\r\nzdaF+EEMlaZSUYw3J24tkwvT2vjW9jgkEGjSdlHieTFZBHEGuZ46qHjIy/oZ\r\nzIfWQmv/7cgs6YdCBplLhQ2TvCy6iFydxzT3EvGpppvo9PFaTu74FsUdQhqS\r\nBWO9Zqnpnh7KCPB3K87IBVHSCnD+qNUtja4wkHkgIwgn0KCkGMmnjYQ5nz9H\r\nixj3RJOmY1EDkPkAOhWnEkkekzjCaq4gp6VQrEwAkgtFxmTKkkqIHapjSA78\r\ndQYokBrUrQYR/b46YaOEgkFGmk1uOgnPGmYPZi+Os1C7S5Tf01k+FMqL89Sn\r\neFeoRXQ+ic9DTKzU9ArhhO7NBhr8F/xe5AoMe7DjU/5+wbNqUF4bm81JKG7y\r\ne93ouye7uEk1BTOUJ83rXK9wsj7odJ6OsJ8=\r\n=y+Yj\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230109204906-87ab419.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/8a85aab9d8512cd1f19d7886a82dfff0/graphql-hive-client-0.22.0-alpha-20230109204906-87ab419.tgz","_integrity":"sha512-wtV1aaF3b5Zez6hIYyjKu0lyoxcUTVjV9WP+lNtLN9z21ZbyVWlTl86kVOK1M73uCaEw75rLwC3DRPLjyIHEMw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230109204906-87ab419_1673297379283_0.13426331998994812","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230110001005-13cbd26":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230110001005-13cbd26","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230110001005-13cbd26","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"30ab2a43d449023f6ef48795d7195f95683f57b4","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230110001005-13cbd26.tgz","fileCount":60,"integrity":"sha512-gEQYILW6n4x1AhnealEg3NrcnBvkH5OjApiWc2Ah71D4oi6V/8FeyxNSm+guokvwgqjVz63q489TKNX3i9DPVQ==","signatures":[{"sig":"MEQCIFBOKyOlNb3CUcmmJ5IRnT13TAsXNaX3eWO9e4HklUK1AiBIzfPwGytlKp52kJa4hSOm+TpBiP4oqppMWJw50v3hew==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvK0AACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpuPA//SKPNtreg73apowpwcL38JvkK/L7DmL2m5NBNOVNW++Xqlarz\r\nASrgZFf09wvZ+03mzMUSXxOc5OLig8I+O2Uod/PVsKXNAN6oRcM+1E30iBSQ\r\nHSI2Fi1oInib5i9ubMykTfRKBpXjsuk3DOfhZWwWzZoG+prFdsIn42rqzpP1\r\n0uUVlL8TmIgYLpuuwKRV2+9BJ+Sf0DCGU5k4plJHTvCo5B0Q3hp50Wt+1Kuy\r\nqgqCliMOqzEVEaauEAMDxEFow1PgfeHCkdpH5RwgAZjfX6fmNVIqy5NdGCl8\r\n4VHcAHfN1/ndcGUfYQxhU1VdZ8gDMKRQhTnvo7gf9RuFzntq6zHbdcWQd+bP\r\nYTp39tdRR1CM9Gj7WFzfaBnTbM5QfdQLFjr/x9DF4PM8WPX/yqKvSJS3i3Y8\r\nqReSgnrA9VjKab2mclyB00xGiQofi5XqZQg3sWKR1cX69syuMFTd7xs0N13A\r\n80WLTNkd8wy6e8Z/oy4y7OK4CTy7pVVkF6M0euGKacgdd/dl+anN8h4e87Kt\r\nlEYyRmYevGk5sXwPKqydAekZuDwqdKBJk8e4w7jmg0ljYMh6gGcvAs1UTCmq\r\nJ0k1HwWVOewLyUuvqqLkYG3AsqxRXfngeGyjs5qrgAb8WQjDk4ek6uAZkL6t\r\nBZu9vSJQQunPKOI25cvNRMV5+j4ZSWi2Vx0=\r\n=LE22\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230110001005-13cbd26.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/732e553a9a1cf264f1ea82b2258c51df/graphql-hive-client-0.22.0-alpha-20230110001005-13cbd26.tgz","_integrity":"sha512-gEQYILW6n4x1AhnealEg3NrcnBvkH5OjApiWc2Ah71D4oi6V/8FeyxNSm+guokvwgqjVz63q489TKNX3i9DPVQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230110001005-13cbd26_1673309440035_0.6855879168930876","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230110001509-a73e306":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230110001509-a73e306","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230110001509-a73e306","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"5f34faffca2442cbc6599b28ef42a904dacbd062","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230110001509-a73e306.tgz","fileCount":60,"integrity":"sha512-dGBZXVUSXyFUthUIdGkAjlzq/ycUljbZK8ZC3fSFkz/GJINKVojCk0GEMiz+mgJXQCK11LrlDQqiysaQR8AReg==","signatures":[{"sig":"MEUCIDms571ybQc8yCcr+2LXcBHjbOrfjsCQfPghAr186yPGAiEAo9XSZaVaEaCmq8CV/AISCBvGE5l7+aor/9eLtmg5wHc=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvK4yACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmq+zw/9GuXHRY3vpnpBliyUQuI4E0YyLxNXPVvXAQ4E7WbxK+gloOiT\r\nFSXDoAk7wtlBOtV7Z2ARGNjqSUwMssoAV5noDOPN5sHlVc5s+2aiS9QTvpFw\r\nlw9vWRNAa827EisOOEZ1RV9hTNYIhNeAfAz18Oc8YyUsjrcU0UuYGj3cAYDi\r\n3I0ePmKiKgDyydD2VrXaoOEq0MpSFIF/JFlfN9uK1Q4CJtxwKKMTOiTLLU7H\r\nuXNSoX6rd/MRoGvv/J0pB2pRsXHo48eygOXTknoXXzysBeDF/NfBLLSl8R2U\r\nSD4lNg4FlmRZjF47JAM0z1VHKL4SY0v50wqqkM73iMQ3DVfMqkKeZp0gIOdg\r\n9qfecfMXiGPOjUHrr2Nd3BAgrrYDDJyiSjzhw1A5lx7yW+gbyQdlcfZxh7ro\r\ny843fJumHKDnH+j74Wt7UuxLgXcwF9bxIYoTjx2ALrRgibGtMLVlkcYcvNZ4\r\nuhPL9g5hpfnOQQpj+jinAl3dhwExyHG6tqK65fbXLlVsF1zOwLViUlHtNta1\r\nwPqGJGAhWRtXyZAV4R7GpNIKbhCJy9PaxdCp7R3S7/8JcsgvPYMwrfAUtBu0\r\nwHUKiKkbhjihf61k+nOuQIjdSLVs/lSvaqIHu4DlrQN82b+xPZboDJpEnHF8\r\nnTKrwesv5uCt6nHGf4FtGl0ZT7gdsy1aLyI=\r\n=aAVz\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230110001509-a73e306.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/3ed72848c2a8b5f20917e85937928224/graphql-hive-client-0.22.0-alpha-20230110001509-a73e306.tgz","_integrity":"sha512-dGBZXVUSXyFUthUIdGkAjlzq/ycUljbZK8ZC3fSFkz/GJINKVojCk0GEMiz+mgJXQCK11LrlDQqiysaQR8AReg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230110001509-a73e306_1673309746314_0.018721697207629617","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230110033101-b737cac":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230110033101-b737cac","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230110033101-b737cac","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"65f24f1879a042a93ad538df785ab3048c60bd29","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230110033101-b737cac.tgz","fileCount":60,"integrity":"sha512-fR50NNp7dfOSJbZSOsVkuOSUFdOq6NSogJq3QJOK0a4i/LcDlr404OhjLV/sbUvrcgeXn0jaNIGWq3cwo10V2A==","signatures":[{"sig":"MEYCIQDomXbfoeh6p25foQLyZ1B3Ow19whHsteFDC0Y4bG6R8gIhAPFw0xyO8pxzbjk88PWNGh5U0k13jo4VwZoWpro+S9tH","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvNwWACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqfTA/+KM1bJwC8XnrxPOnjf3SCdrIWjZf8vgMkHwdb912Dao4l40ZW\r\nQ+8d7K4GPl94ANMnOFldkgfBNXnthL4GvFxFQ3WFIzOMWsT1gK+tT7td8cUv\r\nEzk841SqwWc37LO2Is5VnMwXqFXWPz1BL7NQM72OK2ywY3by9Hc4pnjHecNb\r\nOjPqEjBb7E3cktOhREMEnTDkmERaYiDXkrMLgyQBScYrRF4BTaG9K1m6fUfB\r\n3k/Z2u2eLnBjIAAySNxYsY7mw0Hsq3EE1HHTixllA4eL80OKMmWNVDf+T5iS\r\nAnA/9Em5xXkX6akETk4zbXItGJlCH9Aa30l2s0pVmAKI/WGkYHOitIviErSw\r\njQa86QcM3/Z2x1GRVjDwYfaVXYueUNtrkVxUPRp4RThk/66d/ZVB6r6ZUJNY\r\ny5RQ/FSzYisvBlWZEath2mkAZxUH+xaW0Lb1CN+niW77keTrBhUSG9iX1meP\r\nyRiWd+xqmpXHgH7sbmPLKE6tJSHu59vGTGNO4/ZPgVRB9cIeMSuvN7ELZ6nx\r\nxIfN9DQSyvbLvlxYb/joEM/SnU+8dwmietQkjHZor1OpXXPfFeiBGeP1Vz+P\r\ny9C4Bm0JDPFriIHoSHtwa4azWb0U4CHnlS3/ETWwa9CzNk4GsQ1xhlsP/zaW\r\nGjs0TYCAA/DkbQ00qHn/KdzTYBwdYgprWa0=\r\n=7H4w\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230110033101-b737cac.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/c68a96bd8f1bf0e6c420e0a4f4a8e7e6/graphql-hive-client-0.22.0-alpha-20230110033101-b737cac.tgz","_integrity":"sha512-fR50NNp7dfOSJbZSOsVkuOSUFdOq6NSogJq3QJOK0a4i/LcDlr404OhjLV/sbUvrcgeXn0jaNIGWq3cwo10V2A==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230110033101-b737cac_1673321494530_0.8244528532514563","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230110114150-1d28d95":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230110114150-1d28d95","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230110114150-1d28d95","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"384b09f42944cac87f4154e1fd9bd20f9528517c","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230110114150-1d28d95.tgz","fileCount":60,"integrity":"sha512-v/kRTnY1+pwBZnCjKZlZ3xIq9Rh6Rnd947F/Ir30YprACvsN9yOnMtrqLh3H+woolFplZ6sTppUpgClCBySQ/g==","signatures":[{"sig":"MEUCIQD1IO8zTR12WVpy7b4dtx2MXNLlBkzxmyrgEc+ICpmEugIgbTlUITxIm7bY4OVkpuL979GhHTxoA0Ipfsaz+yVAu54=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvU8kACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqLVw//Xb8PRkk/+EXzQv/qR/r4DcmzJEE3xnROk3BOmLs5ln2KSwIt\r\n4T96lnUniGvPXxKl8Mv/xxBEn0+70FNHmY8yUqJUifPqB+IQTxybpMqWO7Zp\r\nYI45Ozm8iHPdik+CiwNhfLmLCBJXLawGeHM+NXu8ODXVG3/0HTAhzXSL9QCg\r\nZ8hri6bzyRwk6vp2zPrEETsIZ76XO7I7G27enkDnG2O0NkLVm42wreZon3U/\r\nOd/3NXgSUCjAQh5yHizknpx5xJz8FXuPiwpwEKqC2RXkdJspx9+UE6P35BMX\r\nDh7GxsrTLHapcwTGxY6oNTo+5ENgvxThPxrohcwVIUFgl8bFAgK4niJATp2R\r\n/tp29jAGW0bj962pr1Tk2DTA3Z2AO8jD930AuGDqyiBQq52/fxiOtH0/L/L6\r\nfJIXNylkTMTH9XacemUTTshdMzbBtxkUrs9tSyljGMi48tYUTie30kL424hr\r\nKeQpjjZ4Fb7aYDqhZolXNuJsCg438zDq8oUQRcV4XsSSd4jhm0+3qUOQyHIs\r\nC1y3+uw67u1VtdAOmnFQK1/BznUongLdMEBR2SnDKkR0qvP9YO/oDCT26FKT\r\nt7xZ/CfRVkcIV8SxaBX119mm4Nh5uOZo7jM0lU5PfV7FLu0zKV7+q25JiOlx\r\n6BT09CC1wyQXMkJm4CRcx4VepNicNrlJ1Mw=\r\n=V60m\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230110114150-1d28d95.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/48ff70732e243812bac7e05f10b09c3b/graphql-hive-client-0.22.0-alpha-20230110114150-1d28d95.tgz","_integrity":"sha512-v/kRTnY1+pwBZnCjKZlZ3xIq9Rh6Rnd947F/Ir30YprACvsN9yOnMtrqLh3H+woolFplZ6sTppUpgClCBySQ/g==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230110114150-1d28d95_1673350947899_0.8025902952761472","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230110115140-e5cf489":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230110115140-e5cf489","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230110115140-e5cf489","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"8e7b010ae3c62e3502f9c57ced90c0b9c5e53dc9","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230110115140-e5cf489.tgz","fileCount":60,"integrity":"sha512-M6xLdGtggHhkLSiNhROUrG+xnbDr8SjE4BCNw7rS/7PgQzldTn+i7XcYVWqsyMu8U4w2bCtM/DQst0znJiurHw==","signatures":[{"sig":"MEUCIFPajX19SbrprjRn5wqPbPGEumWuhlm/WkGlqtMHTMGFAiEAiKdvxZCwrtCE12d6L73wayLnxjKrm+kwZ53kaku+P+s=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvVF2ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqZnw/+Mxj/CemIhVlcqS8byFLvT2g2xH87RmsdOqPGr26GdcuOVtMx\r\nWMedPMPHu5+xNzFxiH6+8kE5NV3VqwjFMUAXL24cFL2BOWky8zFuEQNUzGU+\r\nQcYSfgXttc38/7fpEnXHCuS7FxQuG4iZhEFn/qCKpcVBCyEZlDXPbrY6XmI9\r\niGU4Gcq+eVKZrpM/QJYOraHUoFcorNSeG+kzjH+j+umWcn2ZzFwia9Br8BNH\r\nq/PB6VzAWUYd/MvD1ZZvKdFmi7uQneES3oo5n1sTU4jkF4fzP+H9qNz9OyNo\r\nODZfD/72hoZmCUTieMhCiq4MzSPD9GjViG1c39JXHa7nSOjakYtsGxBmp+kH\r\nMhqOe2iL2bwCA940MWKoWV/eoIqdFjU9Ob/dsdjXmzobi2jFbH+v1lMbsWkT\r\nwPA4xELZ6bW9MAl+K8LnwygsL9rIkECQ8AKJF4fIvlzFuxR1oh2vJG9pu+w5\r\nMF/U69YRMZq+NJI6mgbtCSMu0ojI2/F5Rn9MUwiAW9iIfkJoiNv2fnCYj6Nf\r\n2U3r82U7wKNktVPVG9dKYcaj2PVgQ8F4or3FyRd8FaLNhlSu/c8nIp3nZhDI\r\nYkgZzonekPeYLKyQNfNqGa2N/vSq8RrHYvG3VDM3K6PvMWaJgnhpXEwmq6ff\r\nW9Ui9vgKQXhuPZgGeO2NKsbfpm/mhrRmogY=\r\n=EO+V\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230110115140-e5cf489.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/90a43bcf6d3c88fdf99ecbf075cb37fb/graphql-hive-client-0.22.0-alpha-20230110115140-e5cf489.tgz","_integrity":"sha512-M6xLdGtggHhkLSiNhROUrG+xnbDr8SjE4BCNw7rS/7PgQzldTn+i7XcYVWqsyMu8U4w2bCtM/DQst0znJiurHw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230110115140-e5cf489_1673351541890_0.06544537617946333","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230110115716-4286959":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230110115716-4286959","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230110115716-4286959","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"73a4dd7d8605d27f7bd65a78549c0a15f282801f","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230110115716-4286959.tgz","fileCount":60,"integrity":"sha512-ZYX5Svz8SZnDCq8teYO4L6QsqV/7P8ifwS8B4aX9vKW2BxxbBKs2iuFA62OjjccWx2l28ceZ5vyRjmICvzkdLA==","signatures":[{"sig":"MEQCIEHN/OD8TDfKu9fkapbnLV/JCVrD2M4VbfqE99r4THHLAiA2IWwjf5ScyhpVeIKXv8bROnFEg305hrLlhqPpt4DwQw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvVLIACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrQaRAAnRf14jiVLXJTQDbDxtSjtoCuYLvnR8JWpwXlzFwwjYaVtjsf\r\nUVp/48gS8uwONvTw+QkohgZ1jsdTJh8l5a9DlleJ80cro5u1hdvZHkLQf4z8\r\n+R3QuzsAtDk2sHN0Re1lLiynh87Vo16k92Piq82rUhUXXB4kT1BNGtBVP+F/\r\nctt8WNjR6bz+QcWsZOmDCpoETssJeu45YCo3lykm6fV8XIdWGwqQjdlC866Z\r\nM4vb6+ZV5p7iO950fTcDRAVtToE9TuzI6W+lbCxCfkVMxw8Oj2nj6TdXOqxL\r\nCiGzulesoNrnn+OaKjG8LczuYvIZqElo9UJhMgu+ZDcVhIP7YpC4kQG3x7eX\r\nr+SguCNG2maIoCGw0aMCvK46ULGbvzTzMkrn8JQaM8HmRnKgs2/5kQRARpFX\r\nOKn5kX/M2q7gCaYIbJ3S0/DRywuznhGMl/yu9pcfMIVCLKFK6NJkqxKJ5vGH\r\ncXY5ib38P0ohGt/VxMqEnGpXn7DohM3uFZpOAoQCUd7OhIoDLjldx+Ywe7x6\r\n7H70wvrz3iXwMoOkWgiT5/ZSyZZn746K53g4YOy00crrP7nZdbG5VSxXKgW6\r\nnN42DJxpPOIQfB3/jDWfrarM+Gp4ZygOaNbD9JkAbHJ+y1T7OcI7yKQmnXTZ\r\nID5imrfU0VniUr5kz+cvnGD/b37WPzHpqDU=\r\n=0fKO\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230110115716-4286959.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/e3ae609876f8b419fdc4049d4c8fffa0/graphql-hive-client-0.22.0-alpha-20230110115716-4286959.tgz","_integrity":"sha512-ZYX5Svz8SZnDCq8teYO4L6QsqV/7P8ifwS8B4aX9vKW2BxxbBKs2iuFA62OjjccWx2l28ceZ5vyRjmICvzkdLA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230110115716-4286959_1673351880088_0.36658623487793074","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230110120153-813ed92":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230110120153-813ed92","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230110120153-813ed92","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"a8a2e85a458a348ff81541e716245aabc2aaae64","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230110120153-813ed92.tgz","fileCount":60,"integrity":"sha512-3XDN/NsuYvVrnDRkP5jpWEv2vTXmMMNJYrK0xEkkB5yes6swkZtqj3EHwvT3WzeucbofHtkcBgSyy53akwZDAg==","signatures":[{"sig":"MEUCIExPq/1axS4F87aPGV3td26Ik1zTK5m2cSPI/31G85QEAiEA0OhbUqUVd9PdxmoVxYnwF+9NYtQhwiWyTye1dn4g99w=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvVPWACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrdjA//Zp6xAnOvdSsX5aE8L+B3v/tyVHwqzZtA2TgG0UDmrkQO1JQ8\r\nyakaY55J7pbt/qG9jBmxKJhjBtl6Xo2nMkQ+4yIxS3rbPkCSUOzYAP5edDYH\r\nxiAd0PElaucN5FbwV0pk7DU8/uoOXDmxfIXgvLK3v60zdOnZ6fUOAhmus9ME\r\ncSxWzRVuBpsal6nWhGVLGjB9jqiZoA4phbumUTlJcNnaMRKcATt8UHRTJXoY\r\nzwHJvPBqxocvu82vWv8+YSeahaiZpq49ouDiZJHqBUmyEbzou2HnaqF73zxJ\r\nGv2Ld5p6mLlvB6TCtErO/vXRiH6n/aoDv+kP/poBGB6CqVbc8TGK0ACi7see\r\nytyC8pN3rmYdODRL5BESY4fnuF6tzJDcgjz2jfCmertm/pdNWXs2lFF4oMqN\r\nASTLAoUVDb0tfljecmTeTjKl6fB3UBaZPzy5SqH6Z5s2LcsFb3IMLpxZL70q\r\ndBFLVS6schwVSitqjXdalDUit43XJ6863U0kt/t6L8kkKZeGiElSOvnNrABl\r\nDoLDn5RrYIeqgBWZhkuFRlEF2oW05NdbRKPgWShI91K+O12Kd/qrjdbPpuPR\r\nbTPGHu29qTfzeZ4Amkrw0H36lhDISj2nm+496Z6OA5C0NXtQhOT0JyDOl+07\r\n1ZKKB4bPuE7NVp7e0KIL3eJBMR75moQWsyw=\r\n=MRGd\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230110120153-813ed92.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/3bcbbefc3f9b488151994a173aefbdc5/graphql-hive-client-0.22.0-alpha-20230110120153-813ed92.tgz","_integrity":"sha512-3XDN/NsuYvVrnDRkP5jpWEv2vTXmMMNJYrK0xEkkB5yes6swkZtqj3EHwvT3WzeucbofHtkcBgSyy53akwZDAg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230110120153-813ed92_1673352150388_0.5720516863293261","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230110120655-33e8ec6":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230110120655-33e8ec6","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230110120655-33e8ec6","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"bd31f7fef4e8507bb70dc64432e76fc3ad0768f0","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230110120655-33e8ec6.tgz","fileCount":60,"integrity":"sha512-k/ad5sal8eNGFGgiF7LLDRQoRxjh5tPUrd70hp5L3hIMW4wR0Scx2/vL8IbFgS+SMzHn2bcasTDeS0XRUWyzMw==","signatures":[{"sig":"MEUCICYjsBKqzvkB0ICHbXXzQcknqNhZn8HNGRKGwF7HyXqsAiEAjuSRL2dGdxWbnUTpmoDxORbp+8vTxe5+RLCuDUFhuyM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvVUHACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmosqg/+O3B94WIw/C+a9p25meAwD2M+dgYR8awGDPUYdEphrNq232Y7\r\nVmjSbv766POR+v7XlF7IBkG2KifaExBeSaGyeLrURhzn00KE8IDXUmtucIzh\r\nFznFxo9dQCFdnxq2gCtuytHZq0662fKZKelVtPPswyf/ibLfdDKudB1f60Ah\r\noqo4Q0sllQzPZpp1Y6EoAy4g/T2L7t6isyIC10tDLtrF9oNotw2QEmJid6eV\r\nN+4kQhYR5wSBVTZf2r9dd7NTVMozSZd9tC2TEHKK7ipntezVXd2inokwJp0h\r\nB+Na/d5U82cg22hYp2WPO6OYcxzu99EpHwBIbTBE7zjFwqT5dVQ4qxpdmbR3\r\nU7dZ1Vrll7vZtybT816bcMST/0tgaeXhuTR3GL/IQmWIatrXHlMLReigmIit\r\nCZJ1yoDPR+PTqz8IsJZaxmtr9fJBNHhbTUAXgJFX0l3bzJA2XH39TcmhJSiJ\r\n4wcXLGuZlH4+wHy9A+2rHkiFnTbdNkXNdS9CKCRc/ZsEVKwHyvH/w0NaY69G\r\ntV0rXHdogd2TJWr21/PscdQAZZUhHsVXlYsfljhgdh1XhmxdVvQeDBSjWW+G\r\nePGSV9KfMeZVwtDw5RXf0DdyasOOEvCzkSyg1EKZRgwuN5T24pgzicGbJoeh\r\nS0x0iLVPjWttOvX3ONR5bCFJ17a8C3x0bWY=\r\n=wSkk\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230110120655-33e8ec6.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/b5c6a0b20e6c365a117f549cce6b1959/graphql-hive-client-0.22.0-alpha-20230110120655-33e8ec6.tgz","_integrity":"sha512-k/ad5sal8eNGFGgiF7LLDRQoRxjh5tPUrd70hp5L3hIMW4wR0Scx2/vL8IbFgS+SMzHn2bcasTDeS0XRUWyzMw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230110120655-33e8ec6_1673352455053_0.892400611958535","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230110121318-023e555":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230110121318-023e555","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230110121318-023e555","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"6d92e27b8de6361509bdcc4ad72d81844ba31def","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230110121318-023e555.tgz","fileCount":60,"integrity":"sha512-XHKhECZTdKO6a6hKv0IUoWLv9D9LLLYUbaCzodoXvAvUiLodUQ7pr4d8XtMERqaOcOT7Ao+zGBuA8qPvxJzIHw==","signatures":[{"sig":"MEQCIG+/fOziBiK0awSTyfGGzLtTMerl23oH4CR3waYDqiX+AiBhIdNgiH1TQgWn9zqwabjrd+f4CTQT5odeIho4/RWX8Q==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvVaMACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrpVg//a9b2QggqvcZIZdaIXJBO28nBhQfheso0eKnEPHdJv7MXn7VS\r\nVNFXPDCQEtpEPCXWnfjZ8gGBADrBQ/KJ09r+fVU20Qyj8SZBnRuSKhsjdEaw\r\nO/AdbfiMQwO8Sn9yCE11bZjy6ZHIdwlACItoDX8frs1ljyplwqyzzlwHZYbr\r\nvAPv/DIoVjLydUfbjW1c92oQ1iX6lie6M9uVC4+62g/KgLRn61OWS59kYJDK\r\nr3N5mYgLwGPtW9fudP9C0Iw6Gf56asIhAR4uymG1kdZUKQkwYsBBDkjC6NnV\r\nW7GLCGvseG5f6GjfOiyhqijxr83Wi5HX+/6CfyBTC0+qaof8o0wck1uXjBM1\r\nlKuTxlbODdfi+QF1hpssP2YIfvzRcWdKwV6bt3qRyYHg7BXgf2fwdxDOnfDG\r\nSb3DmE0GhTmEOwfGnF7B/vN+E3rIKwjfQviHIs01V8UoygQJDRjVsu1UhJtp\r\nXbCmTQufBKadYMl6Sc0mYhVmZOZXEnnWmvZ8Lz3r39Kn7wkuVSdjATXMKQj8\r\nRgMArGQfnd2xaCKhH2K4b6zadI7IJsumob9KA5yEwEPzYbkaXP7Bx0yg6Obd\r\nTUhEX7ZrSyaKb7hgRhaWloKjIVFxU0v7qlAtgayqaMwMqyhWpw1ytsA468j1\r\nYD9K7R6qVHz59NcQuWCHZ8oIyoyrUqpPfjM=\r\n=74Gi\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230110121318-023e555.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/1f622ecd65518b23a64428ebb9fc7eaa/graphql-hive-client-0.22.0-alpha-20230110121318-023e555.tgz","_integrity":"sha512-XHKhECZTdKO6a6hKv0IUoWLv9D9LLLYUbaCzodoXvAvUiLodUQ7pr4d8XtMERqaOcOT7Ao+zGBuA8qPvxJzIHw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230110121318-023e555_1673352843919_0.9232234971606605","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230110121739-b53455e":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230110121739-b53455e","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230110121739-b53455e","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"fa2ee278fd26358bf3964ca89e74cc6cf7ff5b7b","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230110121739-b53455e.tgz","fileCount":60,"integrity":"sha512-hcwFAVdgIwz5r9kX1ViEfdun2a/Ns7vTgK698zYNOkcbzjOBj95k9P2nfmEPRNs6G5JRA7P3GMdG4ZVScBUeXw==","signatures":[{"sig":"MEQCIHKKSzshk6MVv2YO6pyfW0vK6/C8236NTOoV1wgRhcVVAiBmjk9ti7B2+zLgD1tXk6sfUshhx1BadHm0QZbOluaxIQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvVeLACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr4yA/+Ljc5MmiPAefmay1pfE03sJYS7G3bdUFVjA79YLXO6Iv27Lp9\r\njZvsEU9EqRQgy1DRUAZmiQLWUgWvyMFIrm7D9eY0kE3VxLWhQEW+H6KW7y43\r\nTg9chATMm6jpA08EeVGbY43P1QfumuiPP/nITrigKxw4FJ6k+udHcENKpLvv\r\nuQYLRazH8evKN9vuPZEi3hnFeEfA/+Io+6TL84ooQHuKwrzbvNJZpVt/JH3l\r\nZrRr/0DL2O6j9m9tvGSOc0L1Q7ZCUUTWlGQEoa3EPRzzStmknqm/qBLn52i5\r\n3KdOJiIanLA4o/WoFbuQYL/nC34iwiU2kvLuRi7vt6rAMoOgjyFj640xrjC6\r\nOtjNHkHdsluTyzgVsBtDN2+/GPefVtfbZxAqQnJp9nnkCNXZPr16PS15jJ9f\r\n7iT2JIvyzQMF1ew5Z+Hi/MgKuFal+owLZAfGtg06g8ajyFFKLUv5sbf7AgpV\r\ndbuf4ncS5zXT4gtgje9BfnnbR2w/IfSIDetowDD30FYNiEuxVvxHmIMDz31G\r\nvU6YWZJNSFpbbC/2BC25sa3I83dJ7RC8raxNK9Ase/qLO2hr9vTe1+yEDU1D\r\nW7QSmM8Nrt51jrJS1I9FmYVqEOLOXPO7mxcGW12IsmFGOB+m6A59U8Fc07lS\r\nr8kQzySoJEaG+LSa6G2GFprRCUDVabiA8uo=\r\n=xDAe\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230110121739-b53455e.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/5544727e7dd93c04780abf95febe7582/graphql-hive-client-0.22.0-alpha-20230110121739-b53455e.tgz","_integrity":"sha512-hcwFAVdgIwz5r9kX1ViEfdun2a/Ns7vTgK698zYNOkcbzjOBj95k9P2nfmEPRNs6G5JRA7P3GMdG4ZVScBUeXw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230110121739-b53455e_1673353099718_0.03958544589378454","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230110122009-0392125":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230110122009-0392125","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230110122009-0392125","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"2375f2ca0794e7d37e1da3f5f5dbd28ba824609a","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230110122009-0392125.tgz","fileCount":60,"integrity":"sha512-56qli1xiPoaDV1jGBdle3Gw4VIC5Nx0COpIlGqHAoWGXYKMdp4EHLfUwvKVhDuzkEO9fQIsuV+yDXbpkh6SlHg==","signatures":[{"sig":"MEUCIAa7UuA8+mD6TbG/dmRXI8Pnhy1xNtCcrha6amykjuANAiEAsKrKGoCA69jtbLqCOr83T5+VYPVY/f3knQDzrgPERN8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvVgjACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp1SA/9FlvlMjzwQMHhGdl38ymb18+G/TyKDbkA8VExKtn2QM+V3BoD\r\nmmZITE2vXHTLyUInx0gib3T0GwHICqcSIrO8JVuRqIbFQ+mNZAQOo61v83Zj\r\nyMVizv71BWEat4W4axagIONeoaTLFpTcbY8iI0vNfEcaNOv4owbM2T2FG7dh\r\nv5uB4CeuEwGWGfI5rbZbDh2ntjzGVwigwb2m2CIoNxpP7SOEXhPLbTnd/qya\r\n5yIuOaEXFZJ4snX0uz6bLsfrJXL1tentdWmzb+FKiJ43t3S7Mp1/ey3EjdZ+\r\nLcQq3Zzr4mlx52DG9lKlpyfGzUyXMCBeC5tuAQ1TlqeMv6Z8tkcWkoHebdVz\r\n+xkuaXZLEItVvvT9m2K3CU5+F5araSp2oWiH9s3YqYA12oTN82cAZeG5R51Z\r\ntWQAVC7dbc6OaZGP2D0GGpyI5Wdpb32MDOs2zsE7LHeSQLMW/2byse11oEHO\r\nXlyppBm9BOY0gsrw5BdagjE1nez4Aduxg7fVzPz1Jguw9alhQ5C6DPEfIU+K\r\n0ak/4S2NFFKqx3KNRuxD7mX8WsXaKy+ghT6UPs1BxmfFdneQfZecJTOm1hgm\r\nPZpt1TogLytKLV24b9TNw8Rp4q3gYGKTqplXu2cI1EJzTPY7H3Ix03Y+4Wqs\r\nt5MKe9of5+AM4CQ2yHwQLWzR+XadcJJJRCM=\r\n=UOck\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230110122009-0392125.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/d8e62ac8e2e678d58ba58d5f614397a2/graphql-hive-client-0.22.0-alpha-20230110122009-0392125.tgz","_integrity":"sha512-56qli1xiPoaDV1jGBdle3Gw4VIC5Nx0COpIlGqHAoWGXYKMdp4EHLfUwvKVhDuzkEO9fQIsuV+yDXbpkh6SlHg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230110122009-0392125_1673353251414_0.17675416839148905","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230110122930-cc03f60":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230110122930-cc03f60","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230110122930-cc03f60","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"01e2c2f695a1016d429f54bddbfea82f01f3b592","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230110122930-cc03f60.tgz","fileCount":60,"integrity":"sha512-cXRCJpulydzwoQobZGiDFIHMlsDcp4P7nRt1/yNo3RYILlNmgiiPtf3ICQUrLW4NoUEUpIbr/Ews4qkUZBGfMg==","signatures":[{"sig":"MEYCIQCvv6sFnFF3ryc5HMx9lD+vvTvh07U4mLROo1pCzmVQ/wIhALyx7j1jiIGgh1VbkMdCc/sXjEK7oNGlRAFRlzNn9f2p","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvVpOACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrOFA//RxemVIFpxkwkHqaf/bFLsYyG27+Q/DzeSN565WEeBHJ/zaTp\r\nf/65dpxk0Sr2XAzR0yCyvX9cYBTKqZ3o/aQHBySgcWZu2kckLYS6Au1n48lm\r\nggeNShP0qPC6YxD3snRxNjNBCne+MIulE+PWbeq+UG8E7BNJIsyoXh8ykI6C\r\nhMzX3zfpBQ1aJHNtbpqFw4T8MPLYo7rW/mExUYsqwEhYQ/SXXrI5NbImEOqK\r\nKSJXtlpf6lRl1Txn/7//Pf4hY2SN6ucCpQO04wXh0VfaSVKHzhFOqD/RP0Q2\r\niiVkvifvWFy/uWWQMNKIpDqfsk9dh3U8JCtdr75C2AMMe9NGFSGEYrveeFyx\r\n9nW9a4ffqui3VbqvAN9Sw8Q2rKVeDljUsd16N2bQuP0J8xSmq5PsV8O9+ycS\r\nwhczzBqlB7Z53FOhKw7ay8ms1VbmP3L/q05a+QRD9oC+8t2oIquv+26vTSDf\r\ntjTin/8hlk+q1yZOdMKZZhOJSFEl7OzVEWiWweSmllZnzaWETWBsAihqsyRv\r\nAvZ4lZ3T03u/Nuv/bNy8ud3f41bD1m7L5We+oAjBdS2hxwyThJVy6Ft8EB39\r\nKRgmYNDXU3lLkqTecUjcaMl/yyR3ECRa2KhOg68aWmtRbP2j5gP907U3doCG\r\nYelqgRxrQ8O+rnLsQ6in8i8cieoKvOY+pR0=\r\n=zmLP\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230110122930-cc03f60.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/3885deaa3c13575f75830a108e0f1e8d/graphql-hive-client-0.22.0-alpha-20230110122930-cc03f60.tgz","_integrity":"sha512-cXRCJpulydzwoQobZGiDFIHMlsDcp4P7nRt1/yNo3RYILlNmgiiPtf3ICQUrLW4NoUEUpIbr/Ews4qkUZBGfMg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230110122930-cc03f60_1673353806474_0.06947618639503061","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230110122942-cf69358":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230110122942-cf69358","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230110122942-cf69358","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"8066b52154b3b00227aed3f94b2a0fd25e2f057d","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230110122942-cf69358.tgz","fileCount":60,"integrity":"sha512-SakOEioLKZ3yz+hDHrO0Pb2KI6L5a3IF7aVnAVYMPJXm+PMrEK4Ema+nV8zaRNfHF233XEYhOHpawfD5I3Fatg==","signatures":[{"sig":"MEUCIQDejy9OENKaFGvLwPUaIJQFJWCKa9rF5HaUclZK9tJ1WQIgNNO2EF0Ug63PFHCWTEIHFP0sdKCoqEgR7TnaoDRbbns=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvVpeACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmoe+A//WBlmkoLI5L+HSPxDNgyThGvHqmB67te6V7Rx3O+uodBY8nAt\r\nk8FclmplJFHOdKiH6BW+VFCrDQuvWrP/D/hyyAKtAuF0SMU6l0dn3eyhzFS5\r\nztXITubAUwvPZ7c7bB00C+JaguyfkvaP7b+XuLj3EreoPdg8YiMHxR9gwuYS\r\nYnYL/TQ6h0vOMFauaEoYlvaK+EEsVSwUx1FPhXBPizxBNGxo82uSOTEI8T8n\r\n6lrdFHGids6huapIpG7KxQ8TrFsLfsdik4b6P3g2OCbEgJdeTyNd/Zu15ciE\r\nAoztIbhSt2RlkF6XF14EQcln9a5zf03SgCevGB1qXi93E3zV+8ABDS89jUO0\r\ne4VcU+TiJAsNK/tlbeu3IpkwlzyV6JadEb3cjlZvfmewsuRDPZVWw6g56DHf\r\nuD5lYLyVyAindJveIgwzyOpDd4f2n8BLn75ZxmEJEoT/t821n7NSgLRCuwJO\r\nba9e5kjQZnlaYEDWxsw5RpWzxEJLS1GUZJFD6RbwD9ipDe/3z/T5KvUFlMMI\r\nFFzn9WfFlKP2i3/d3nkxW5MQ3BYPF8VlT+dJWUT5Lnz8d43ldt1ULqtCv+XK\r\nbOGxBEJiFh2VQrEwOvbSF7pUcvLZp5C77YTq5J+WJkN6pr86JUaFnGfgpUMC\r\nlqfxyRe3Rf5dP1nUO99ghtnlKrcpWLf7eYM=\r\n=74T2\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230110122942-cf69358.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/e9f33a4b277328f7d436e76ae2dffffe/graphql-hive-client-0.22.0-alpha-20230110122942-cf69358.tgz","_integrity":"sha512-SakOEioLKZ3yz+hDHrO0Pb2KI6L5a3IF7aVnAVYMPJXm+PMrEK4Ema+nV8zaRNfHF233XEYhOHpawfD5I3Fatg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230110122942-cf69358_1673353822632_0.6125565618131616","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230110143217-df4b511":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230110143217-df4b511","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230110143217-df4b511","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"6311ff63d27e58313a3d4c971059ee7be163a5ca","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230110143217-df4b511.tgz","fileCount":60,"integrity":"sha512-x3XS0RHNAYzY/oR4tXnp5P84IVNQ5b8Z3/+DVDMXc1z4AqHgaviramXSVvP5IdBG246A8ujO2YgMaDeBrMajFw==","signatures":[{"sig":"MEUCIBuUKvQ4LxR2PdorCf8sZ61PEw13xp/EFFEfRExWFIr+AiEAzjDJK6bpR5Fa02wqd5SzomZQv9JoCA+psBuhbLZe/20=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvXcUACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoMKQ/+KuYoxLxiQEs58eiRrlSo5iPSex3/CM6FNlQW+RjO1rLMydAr\r\nuRn+vvI4Y1MwsMTVDTrFfMw0cue6ljkkexFrpntQSJZOXJt6AKTChpXRxQJ0\r\nFvyJjRJVAtLnU2m4GehjL7YDFBwHbBiZl49Pv+7EWhbIsyjJmlZ39qKfEHlZ\r\n6v6IFOnHGx1uwt0Xd1h5RyXN31AA06oIlBXfX9rH02Hb9LUjf2/4phCHO6wu\r\nImfpWaWB2nSRPJY+qCtXmLl5i0yJ7w+yNiex9h/+gfJfTu5TCdyKZdQqF2th\r\nOC4tL7XGmqudgEXPZD+WFFMkvAeD2WYrWf0+qxTKtrvTrSi7H56PcYpzMYeN\r\nAva+5SygitCa1omXa8rSi1+d8w6Ing0BCKXIbJyeKguRXhqpVFpahLSVnSQ/\r\nZqal66FiO2SgWegzHsrZ3O6iu6Is4eSnnqylts+XMgMKa1/tWEbipkZ0trAl\r\ndrhEThM1tVsKzwlvV5VN7K/nGuHKKtn6ovUZR+2svadMF03lQcwWGUs/Q8dO\r\nO/aWXPrljDialkr04JZbZK1Z7h9tlr014cE0XijpYTw3gPRRAcLFg9uIHZ9b\r\naLuOzYrXqQfeUrr2Jd4RY+SvDu7Dd8JelXmRCseuK+6N6X+0EH/kjG4Gh4lG\r\nB3m9yPFL4hY1XYA+IuG66guPMObclgQIsO4=\r\n=wtVJ\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230110143217-df4b511.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/fa342ebdb8c43df873b53743d1230d53/graphql-hive-client-0.22.0-alpha-20230110143217-df4b511.tgz","_integrity":"sha512-x3XS0RHNAYzY/oR4tXnp5P84IVNQ5b8Z3/+DVDMXc1z4AqHgaviramXSVvP5IdBG246A8ujO2YgMaDeBrMajFw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230110143217-df4b511_1673361171910_0.5666888686069584","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230110143735-58a4d41":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230110143735-58a4d41","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230110143735-58a4d41","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"5d87c875be0a484d493b08801dea97c8170a4386","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230110143735-58a4d41.tgz","fileCount":60,"integrity":"sha512-etmZSf7hHC+kc/uUmbTzNJNhRO1/lA8HXytI1f1z2Mf7Dihok/afADLdBmUKc6sguOZ8nGXBWfbvdCKASmuuvg==","signatures":[{"sig":"MEQCIAmEYXJmv0gkeXp/0EXyA53xrcVEKotvivdSQtYWRhPCAiBQP6IT+HiB4sKJjy34oL4VeyKAnGWBdWqfTZ2XhGsFxQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvXhdACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqMHA/+JatoFgmDvGj7zzJNREaQoaYnZjc+Yo5CzSB6g2lj+Kfdvwji\r\npMQ81Gc4GBq6RtUreyyoavZ9Q35PpJyMvlmiXnqHRYzXUA2XrUv01b7FYeHZ\r\nHYwBTS8jT0XkphB32ATldeSfxmizS/2WX21PenOjL5Sbhjc6ITvp7EwFmtpF\r\n29d2tUxMgXdBXU1cAyq40ORp4pYfbkqYDlvFcVrh/0qW/XrgdpR6D7zGWokF\r\ncb4Wxjj8EmQtq0xugdaNMb+sknGCHyGTlOacb8Hu3gKizaMIPSDZoDYEkt6p\r\noy9xodiOVmlmmZQuxgMuBfG2z24EgPY+kq8/vyGXBw8hgwf9NTW25xnfSn41\r\n96uZp0HGCBkJilbnl3V/pxlvHoXwh9Y//sB5wnmm6cTQq8xdNM4/rbEXD780\r\nP4fFy76iAYKwRF2ARBoLG590hL6tGzJHeU9Yk7pbwaJl3UiTzj7wtpqg4oP8\r\n/zzlPZwR/vvWCVFa19OSzDRpfnQFc91GLkA13SNopQqkVUp8/CN03205xTGL\r\nLSt9cXpqVQ4VTflkzQINB/1coPwB3w//d9WVzMtdyR0VR1uJlhOxuLsQZy29\r\nVALxPVARRfbH8KidP10uNQTn2pZE9Eb/+8A2AnPzXdFnuKLrK78CLEC1A2F4\r\nqzh3JQk77Dq6K/gFkhzFsmVkZ8g+DradKxY=\r\n=B9Ve\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230110143735-58a4d41.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/294ad2e2c4b6d7c20033d9a8d585d76e/graphql-hive-client-0.22.0-alpha-20230110143735-58a4d41.tgz","_integrity":"sha512-etmZSf7hHC+kc/uUmbTzNJNhRO1/lA8HXytI1f1z2Mf7Dihok/afADLdBmUKc6sguOZ8nGXBWfbvdCKASmuuvg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230110143735-58a4d41_1673361500931_0.1260203764425425","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230110144917-e011c41":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230110144917-e011c41","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230110144917-e011c41","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"90d24863af97b76dc07f0a6f9b3cb63a1360c2c7","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230110144917-e011c41.tgz","fileCount":60,"integrity":"sha512-TR0YjL/NxIwu6p29Y5zHX2Vf+GWdACbdMVwQoIr+6kP4dru3RxZy3GjoM8bPXGdJ+O/zQT7yUrGu0W2EJp8H9g==","signatures":[{"sig":"MEUCIQDdB2s237Hux2n0qHSY9Lm+QQfJt9rUCinG02DkW3HBNgIgN3yVUbmKulL99Xzf/MZ9t3G2Z450z2x8c4CyzEucfgY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165581,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvXsPACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqKgw/+LsacAVsJo0nSK4kL+zx5tnGPLDc4zLSb160KlotOHDgbI6EX\r\ns/VddrlF0KeJojJScZDaE3GexYbuqUpSpcacHEu8RdsQC8lNhLFpnjcUzXIO\r\nUbWudJI9NIhxHgKojoEZV/Te6mdfzro8cqnGTvgwiTRz/dV7YkFQ3D+x+EAi\r\nEQwV6r+NNoTe6Xg0A2fiFHa+aMm6LY8tpMCDfPeae2IWboNXcZeg2YzdvbTK\r\n9ND2R6eiVUV+WzdPHTYsHbDC9UbC68fTg9QGgY1zDkgaje293DzouHnsP6jE\r\n+FIoUVaPI05V86fAk+lXLxRAoqXiB2JwyaS32Wu79JlbmKhvFj/VDy+KB8ff\r\n05+/oh+wVzKzeVGhqlPmpN48AoKpx1pqoBggE2ZpF9yyY2+FEVV7W0hu5P8S\r\nlB9rS5mP4rS5K3HwoeO3kvZabBL8YdE31a82KJbCphCcQ89TWDRkXfC3Ah9x\r\nPMS/b1r5ynf3DVB+OXn1DMsBmmVI0bsJNN/BL6Sixma7tXykrO/ODZBw5gYd\r\nqJw8LrRzFgcN06SxQG3IcVVN8dEVbGGp3sem7Ec+atiQqTBIi8KGmGVTqXYR\r\naGnuEE2kp6Q6u96ady5Dp+835CtOCEyZ0CZKU0rHT7k4YXInxh8sdO0XeWKY\r\nDAIQx9FYIxirfx7s7/oAgqWx3x/j6Q0n9vw=\r\n=wgvU\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230110144917-e011c41.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/26d91c237783342d7a65748b7e89fe8f/graphql-hive-client-0.22.0-alpha-20230110144917-e011c41.tgz","_integrity":"sha512-TR0YjL/NxIwu6p29Y5zHX2Vf+GWdACbdMVwQoIr+6kP4dru3RxZy3GjoM8bPXGdJ+O/zQT7yUrGu0W2EJp8H9g==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^9.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230110144917-e011c41_1673362191589_0.17808532922200682","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230110145039-ba3b317":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230110145039-ba3b317","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230110145039-ba3b317","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"9667c6e101c534baea465575729495d0c1999de9","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230110145039-ba3b317.tgz","fileCount":60,"integrity":"sha512-y+u8Ky9BE2dLP+YNRBeLQtrYYf9cFYgXAyt0o+RJyov/TxocK4QGWRuJNeNaPoW1ZKTzMpYVEyTXw5qRvecnGg==","signatures":[{"sig":"MEQCIB90R/KyjBBB/FVBUHLsx02MFCTQ2xEeIM/g5p0/54leAiAD7FaXu8DjRLHDOqSDJFLbf/KXfLxd15b4yYgyP4Wrcw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvXtqACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoZzg//XyJAoCXy5Gd+IL3jFTeW3o23YR66A9b2UnBQ/ckCjJ/pJPuA\r\nD7avQfC5nSce/L1eK0RwH+va+7lNQhIL3ZDQsOsMCdyK+si9j6ExczK0lepi\r\nL/heJTsebFnQpYT9zP4xjMRAqzH1gqnYU9QFMcl9wGqbvDzWzF2kHseVvtME\r\nJ3RCSVthfrf92wtEEjNxoIfX/flVqe6QoUJB8HcDp558L1tfBKHwcaIm4GFJ\r\ndwIwRh2sr2f5FspFso9gXbHQTl3HMpeAP4CO2Q9DDX2adSEO8N9cKd41WNA8\r\nw8bXUZZigHvOHTWPnt78ZXMf9gOykH96qqV6BZWY4gZqBi8QX6uZcEg5KVa1\r\nDdeQo9NGLyuDLCAAPqSaGfoQGMb/zQl3qmOTlGL1Sh3LvL+rHqEvPZEvcBYu\r\n8da3KNwd42Dky05nxoYqTh47CtMQjRZXpOLwSYQrQN49frVv4GfuhRnMcXCs\r\nOqzOVsKszYAIpYMiwM/f9FtGsQ9f0Mh+alLuBZAHUU1kTTJWXPG4GKS9Qx45\r\nulebWFomlBGm5RJKeMTvLfgBjFAU9X5otF9/YPwUbYKhjkJpWoh4qNtMBhRS\r\nKOK2doviLyR47/z7VN+kZwzZKTsDna6jhxzvIfG3vewYIkC1UNqwSz0n+Byz\r\nK6QcUzhbtLPIgQQj3aoZTJsN20Jr6ejaD9U=\r\n=8J5z\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230110145039-ba3b317.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/f7920629b2772754ce882cd36d6798aa/graphql-hive-client-0.22.0-alpha-20230110145039-ba3b317.tgz","_integrity":"sha512-y+u8Ky9BE2dLP+YNRBeLQtrYYf9cFYgXAyt0o+RJyov/TxocK4QGWRuJNeNaPoW1ZKTzMpYVEyTXw5qRvecnGg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230110145039-ba3b317_1673362282691_0.13808580566369466","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230110145451-cdc130e":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230110145451-cdc130e","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230110145451-cdc130e","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"9e28739ee06f57ce66fbd230799c0f16de46c7b8","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230110145451-cdc130e.tgz","fileCount":60,"integrity":"sha512-ea8KtWa+51h4BTDsCRZlE6yPFyQpu8gYF39qFs49oI0bX7ASkYiRroGll+ZROVxp2qIlJgFlqkJSgILM/ra5TA==","signatures":[{"sig":"MEUCIQCGqLUDFQjpKn/rPw6X/E2a2ahNxwAl+2uNojX8pJ/MVAIgI0+S4Zal14aeQgECEjgaNt5u7lw7tQ3qsAHvEe3u2eA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvXxeACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrTfA//S3oVfLwriftShfl+IF/UgSJHZTtzVIw3UQ50AdQo8iQJHi7a\r\nmjqRkAeZDPhF3bGxptUUYKCVsxPBLtYrCnJh3DR58nuruzXo+muys7wEyrpT\r\ntmIJvMe8KZmFGKRDsugBBl/G2T3kv5Tj5YSe2H8TPmfk4Kl+DNyaLYVBa+UP\r\nHraRsuMssh7IyPMc34B2AHfJzTqoJguGs6BFGTMgpZoxxDBrfdg8Z4lNwTCh\r\nZR6YKz3Otz3wfYFRLmpys7sNpLck9FAl45g07o2dhvC4UiMxYbTLoTm0utzY\r\n3kvpMN8GaRZdA0iCMLLUV0jvaKi3VlhDjg5+pPWuT0RjdYJ4iZ3J1cbWWohc\r\n0V69MkMuwdzrOAjVz6+TTG0/DiQMSatEVcZgc2KUSfoCAFSHjHT20xT9casL\r\nBmALyegNpzW4WjFugoczFMNiWBrbxuZh1R9iL7tyQP8LcT8aXKtQ2Wnse4P8\r\njhyW0rg4AtGv/3tzofowUMLJeMs0KJA49EJARpzm44mQfgisN4CzZJINklmD\r\nZsfrLFWKMRlGptHYwYA44+KbRKl+0sEl32N+Uw/yuhkdAyQfzfiTmPrkDZ8O\r\nXtpqJH6379aZnfiBMtwAZSHEPhB1EihJFkeQrbIY8qhIe2s0uAQncNZHWtBx\r\nztz+Vw1JMuzC6+SJDcPnMJbLkhOI4GjcAYI=\r\n=kkhQ\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230110145451-cdc130e.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/c2fd0d97a2c313ed4ddc474316622d92/graphql-hive-client-0.22.0-alpha-20230110145451-cdc130e.tgz","_integrity":"sha512-ea8KtWa+51h4BTDsCRZlE6yPFyQpu8gYF39qFs49oI0bX7ASkYiRroGll+ZROVxp2qIlJgFlqkJSgILM/ra5TA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230110145451-cdc130e_1673362526721_0.44641992453577983","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230110150113-0041a59":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230110150113-0041a59","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230110150113-0041a59","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"52b32f4f1731348de19379dac3a452738c388006","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230110150113-0041a59.tgz","fileCount":60,"integrity":"sha512-FL0Kr23Tewh5eqdHgXnn/f31mHKW70926WvJx4VX/Lz+V7d6Q6aLGs8DeY58QJCUW37Vk7rmKLlRKXeUplDCpQ==","signatures":[{"sig":"MEYCIQDAqpKqzJXTPtT4pxdZ3Jt9Wz232fF/2OjNcwaarn6VGgIhAP7BvvZpfeamVNDf7tqKH1ZoNk+dzxF22TqU48qS1rfk","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvX3gACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmprBg//aM8DwORKzABYW7HiGiWMrsHH5cp6ZFFi+lfay8eG5mpODYSq\r\ngb0wrzp864BlNwszNd5K9hQdFygsrVhy58hBNiXrx6uXjAgFQ0wFyIz2O9dy\r\nMAj+tvc+Du/11x0pbA3bdCYXlMn45/rkWJLeUT3gy/FCfD2VJS7lYheppbXh\r\ntWiNbKEYSq9iXIms7e988TSD0JuM6RjF5N/DJI2RQi5TuInGo4+0loa5mS1f\r\nJhyg6+GuMHMAVBsGA3aQvRvYeX+fkMpgSNFsSzqwUsDzo7mvLjSZqtrrtRux\r\nL8DWXokgAPkBrxBLBUXBIIdAWx2rmgk5uU1o7t3BBlToXKAcoTJTKbQ2To3f\r\nRNk5KTGX31D50t5HrrkFd1OhU9wJlJKmoL3JHc3GUFi0TNMm3niNjFWqqC7k\r\nYtr9CRDtx8iWSjqbQO6S2w7NxTVIHgKMJXW7RhhI6+ITMaJkt0pNCgrcX0F8\r\n85NKVuU0gLYbqem/lm7xcKxk0EQ/av24JCKfLAOvVUwJneSp05IaADX1SHph\r\nGIkIhN32s1gKzmR9RvgNfzlwpGBGH8W1eRloBrVC3x1G9Kluz89t3o4gPvcb\r\nA2+1OJJB8pvxMM/zek+tXCk4VEnBWV/JUd/Gh+LL0XJDOdRssGW5byWzlOTy\r\n3p9t7zt8JZ1EsoMSZJgMz9DsnYDrHT7N70k=\r\n=fUCw\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230110150113-0041a59.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/9a8d9b3790f877902e9b4e2a0e6a2b8a/graphql-hive-client-0.22.0-alpha-20230110150113-0041a59.tgz","_integrity":"sha512-FL0Kr23Tewh5eqdHgXnn/f31mHKW70926WvJx4VX/Lz+V7d6Q6aLGs8DeY58QJCUW37Vk7rmKLlRKXeUplDCpQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230110150113-0041a59_1673362912277_0.49882983616593357","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230110150614-fff9d6a":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230110150614-fff9d6a","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230110150614-fff9d6a","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"0539dfa80e62914adbe7895e07519cb217ce1735","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230110150614-fff9d6a.tgz","fileCount":60,"integrity":"sha512-6MCkeieePJ/8kuxkYKCMNjTUszpjbmzFWuXkcMZTKMZ2mm6gV4lMWE0e8oLUUXDfTHOv8/UEUu4+DdTbumXQxg==","signatures":[{"sig":"MEQCIG++NmnG/zI4buqBFdj0qaOVxP4kF1BMppK4SkkebGr2AiAeT0J9eJ28auNrCpMk3Oyljg9K9BI126zOgMZlVSXd+g==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvX8TACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqQMg//eB+ZrL5WlYliH/07Z5BCYgjGkzV+34YuDAKJJmPE+XZGxUnF\r\njsbDpDehEXM+yqjThgI1hzjQWztFRQ4Msu/5m1epraA/NrRsphX/gosb3P53\r\nqZ+jY7RxuvyCmpPXyCctMbzeSjNF+KqvMzuPgJELhR9izPBW+eUNdm+sbWVz\r\n0Q6AP2wzcT8ZQAhlul96ecCX7kdh7QE2DjiSLF8ghJTN0PWWy/o6OtZuw509\r\nLYCYa1jx6ZWwKU6OCGNUnGJu9pykjPfu+4+WkSCGlh9QggnfFhCxvDnC27Oi\r\nnhM136YU7fOpbdyVFEWUZzuZnTpNI1FCEv9TikibcgG0jMd4/Pxx7/WfGM2m\r\nGW8tbkvyF2IXTou3JxCxU9SeBWfGt2Bb08aaiFyRVHaqFZak6nLqTDI9STMM\r\nriq06hgn3J8IqG1yYlYra0r0nRRHm28WU7PWxQqMrceudkHKUUnriyN6jgOL\r\nR8glmmhgzx0pPzvw1Kh+Z6oadxyvcloQHNukf9ZOH6q0zSPE6cBfV7y9nF/k\r\noDd5vAyXWAcsU6IAZS3M+W8lY4bf2HUGEIwMc8JKVweq03yw7PpYSphQ09PJ\r\n2mYoVw6aRCRPhDjewPXQUMoQGSh3NNBrRzmZMir3+3u55jZb9+Hq9vya8V0z\r\nNq4alDl0j1syqibSs5dV3ExXonF5MwuUJzg=\r\n=OO9U\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230110150614-fff9d6a.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/97005890a41e12673c009c3fa9b9846c/graphql-hive-client-0.22.0-alpha-20230110150614-fff9d6a.tgz","_integrity":"sha512-6MCkeieePJ/8kuxkYKCMNjTUszpjbmzFWuXkcMZTKMZ2mm6gV4lMWE0e8oLUUXDfTHOv8/UEUu4+DdTbumXQxg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230110150614-fff9d6a_1673363218961_0.4388615328344623","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230110151200-f84a446":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230110151200-f84a446","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230110151200-f84a446","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"ea5912c577c3914ea326b0ccacf23cdcb833b2bf","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230110151200-f84a446.tgz","fileCount":60,"integrity":"sha512-+VCrL1em64uM5ppgI1WJN9qAz4yAW63BaD3EOJoBHUyH9rkdiakBcZ3d/khKshulX6QsCKl/f7S1WwMBgjvxmw==","signatures":[{"sig":"MEUCIBrIVcNhxQseqUUYKhertRSPLHjrCpnUOnCK2Lf0/1ZjAiEA6gAbCgFsJz1X3/KKzzZ8tVXvTP8DckHlFh3yqeUrp4E=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvYBoACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoN2hAAm/MLH2z4aajAwIGxD6ydWnD3DeAZvIeJewtruJirSK4OoaSZ\r\nueyvWZ1Ozoz3VyOogmJ/Sujh2K4Uw3uG3YD1k/UkjLyQgmXrCbOTbRxj8BmL\r\nZWBtW6lWevh7U8wMFKqr8dvTdevK5PufGMlh+OZ0z1z+Av+sDYoVEmaHYrhR\r\nChDNLMEHr+HVvqze6F6Vpo8jNMQPiMl78CHe7jLpPinAsIlN7ooTm3AaQCL4\r\nX8oumo++wG5fBRgd4cNDMpQsMHXtYNBMoXQ7AhOb0uG6h8Vyy5Ixja0QPqnG\r\nsn9n1Z966cddKTvjqDGQAbHEWnEHcZIlf21JSbgKRstb9rIzDsyNTtB6VipA\r\nZ5kjDF++Qq+ASrfq3bi2rg4nsmYs4iCns5oSqCcns/qGw7gw8WrJNpzuBgps\r\nmg429QmYOsX3rWcAFvwRxP7J6thV2XG9j6DQx9/eNgGfjauSZe8mjRfQfZ8g\r\nO6LD/45LsRW1HE42P19GK8k+/PThb+O1lxFOl2gnloHVAz502UTERIUcMMTJ\r\nwpvmB+p8t/o1QU36DrZCHvkPkUOzJCghzWcv+beoKSjYPDbTxdZW90Y43USY\r\npbd6gMpgwxP2vcBuOZ4OrD71qhoQ0qpS4aFD6pm0EhP/HnligKCKCle2IaJm\r\n1AKtrfFgmKJd7YrC0atK8ekAJnl3Y5+odsQ=\r\n=yRbS\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230110151200-f84a446.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/77362986cbed6232c92a6a9c251c2582/graphql-hive-client-0.22.0-alpha-20230110151200-f84a446.tgz","_integrity":"sha512-+VCrL1em64uM5ppgI1WJN9qAz4yAW63BaD3EOJoBHUyH9rkdiakBcZ3d/khKshulX6QsCKl/f7S1WwMBgjvxmw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230110151200-f84a446_1673363560137_0.8179642722882869","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230110152302-38d0744":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230110152302-38d0744","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230110152302-38d0744","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"632000aea6945dcec530e99c7774052cf068897c","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230110152302-38d0744.tgz","fileCount":60,"integrity":"sha512-QsyKDmVGZe95tKzpObbcxr3Qyr4iewOO0HuBq+MylQiAqt5uu1CIZxALqLAxqzRuQvENgnN5hdLnHp9OCQPBRQ==","signatures":[{"sig":"MEYCIQDH78e0QEiI3nCg6op9V14SdJES2AONpu5tSLOFadAQ+AIhAIoQnhhaKQ6diXEqRPxTqYldwcaQet/6LIaWdqGH1xPO","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvYMBACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpcNBAAkyovsrGgqcLbKyHvEfHZrjj9CuF4qoWFzKBpkcGb7fmO6n7S\r\nPFIrxpo74s+WcGIxrTFPArKAiTiEiq3iG1pgThT8GpUqfmYjlKBVs4avGVFJ\r\n3y2jBuCAXFY3UyFC5Th52ROSwoeYuEjMo7QuKyT7cVVN9plc2EpQB/XRkin0\r\nmXYmVLgUDuyKTW/dnr0gSfUi2D4KXeCFcsmdFOdSrwZpZeHhunp/6WBW01/C\r\nFlTcou2w4CaOGbf6TTa9YTTfqUeD2iufI6WJQ0JxWfN9pr+DOQWISVHHYxsO\r\nucmWHw+Vg/jekuJhgw9Pjik7ooeL7USnCQuVWuRMOZCAPTtYGTopKyq6Qonv\r\nXH9PsTQzJgTmMjxv4R51p8I2IoI/sNAQhPieJAbGIinrSyFAFzYtVqIp+SS3\r\nMgmC/03lI47A6c53OTGSvz/yJ29p/GMonrdQCnP+Kue85wyVvrQq4S3WuDbq\r\n1UIbjuCpWvbSWHWpb4DYIwkgwtufReNGT+2UvaJ3chEc1FNsSWm5Ps+rX7kQ\r\nOXuEpcPWE3zKjwitLGkqGqWIotrDrxHKML4orOycPWhRJWDO/nlrbp9T1MsN\r\ncGsD1pWCdjbMrbNzF+9luYiC/2AuFFIIS68YKvnHF5MJvGDuY6RCtZxgLmx2\r\niW/EZdbWZljkD7I6QZq5vBH1Fwv+fEKb9DI=\r\n=ykTP\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230110152302-38d0744.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/6675efb743b29bf793646ac4e5589953/graphql-hive-client-0.22.0-alpha-20230110152302-38d0744.tgz","_integrity":"sha512-QsyKDmVGZe95tKzpObbcxr3Qyr4iewOO0HuBq+MylQiAqt5uu1CIZxALqLAxqzRuQvENgnN5hdLnHp9OCQPBRQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230110152302-38d0744_1673364224955_0.3173787169411655","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230110152832-e757bf7":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230110152832-e757bf7","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230110152832-e757bf7","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"3db4b57a49b98ec64794b1f451e284eeba66ef30","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230110152832-e757bf7.tgz","fileCount":60,"integrity":"sha512-S4KxLb5a7raRKmUGAu1ffwgxoRchtuVTP+hz8uOvpkNS9ASATDW2BlVbjHcjatBRpqTiZhIm46WI1OSEnpi3Pg==","signatures":[{"sig":"MEYCIQCbICDm0JRQkrA/cwsLW5ozvqvUgXVcCeDz0uzOZMBQ5AIhALPGGr+tg/ms96JxYKYgtmAeaW4oaQZGFZtjdDkpwHG5","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvYROACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmpu6w//SRPCQDsx/toqULD1LnEcPWAWEv+sqBShjqvBYG8QYcTzqNSQ\r\n6zk4h6+Idkrp47hzXYEJALjKJc36oxvqcbfl7vaSXaj/OEhkakg/1JZiZNmi\r\n+1SSHIHYUcDXMyEt+qWcW/UlH3SILhdGL80XzEhPRT8FpLWh5r1LpQzeGcX/\r\nUHPTKCIzOcEeHe0TsmgfyrG5z5tpuy6/hegaS8s/pD6WhFrejsidk1NxrHwL\r\n1VxH5eIswjxbg4Kl8NHukjnhBanfoWBuG8KM4Akg5Xy8v7CDwCJ+0fJXbhCi\r\npLsVkDYtoozB3mQDf9wAWD65A6xGl6dm7GBqJeOlkIavrit0RGCAjAuUribS\r\n/5m1n09eHkG6vnZk5y7j9pvxst+WoC0AsguqboUinmLbaoz2gJyAdtlqC2dU\r\nUi0KUcHfJctwVHhV7k+fSXn9EVMvjlHrv+FQ/hwWMjl/OAEmrT97tzTPlesT\r\n3EXcWrqXgZHyw3Vq1ZRZJsIBJBmMXK0BPnNAynqZUn8Ug2+YxKz4sGeJBrzf\r\nwPOkntPJCl0KV8GQbEdWbg9Gg/Vf5wgaf3WygR6Gx9q5R4wCarQs4PKpQSRW\r\npI1NemDIiPeRfhrp1RCIxSuHYs6BEMXJqeQUY9Dl2q3Srko1bEUe/ILeGoUp\r\nQ9hz1xj68B6ASkBIEFZL7WQEz4khXvBU1Q8=\r\n=8GEg\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230110152832-e757bf7.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/682914f907e677f6c7e1df33a11ae141/graphql-hive-client-0.22.0-alpha-20230110152832-e757bf7.tgz","_integrity":"sha512-S4KxLb5a7raRKmUGAu1ffwgxoRchtuVTP+hz8uOvpkNS9ASATDW2BlVbjHcjatBRpqTiZhIm46WI1OSEnpi3Pg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230110152832-e757bf7_1673364558249_0.09923482569961362","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230110154711-a793c7f":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230110154711-a793c7f","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230110154711-a793c7f","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"0b8bb40c4f44a5446006802fe08ef83db7425ef4","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230110154711-a793c7f.tgz","fileCount":60,"integrity":"sha512-KzKNsLd+aeW5+CaYWaUTTKwX3gj0Ear+L/xqM2qDNv10v86BWj7iSxQFuD+xH3HrkVyhcmwhGJL8ITNUm74OKw==","signatures":[{"sig":"MEYCIQCF/tzs3s/mq5gqkYBdzQ0K0oI76j5/RGHilaWHMYhqKwIhALeKR7HpQl7HuQ91X75zJUG/kmnpv1fFwxq4nqo0IfQ3","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvYiiACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrkQQ/+IEGFVGUsqOqbvw1UYsswhIq1KQS6kywEcWZYYQi8GgIDmwWt\r\nMa1/rJ2xpxcaTFUFYap0WTTlyY8Ng6AoZun0UzbqmoJKXSvQvVq6bFKd6MES\r\nxG4z7BOlhkZxovRhv7bWVr8QRmKEm2i588Af2ltVHnQ7SRcSmo5PoTK50SEj\r\nkvS5Opvr3pA14bP99UtME9JQkidBuTOywpoRQZVmbPC3XCTGZ9fKy7GkeLc5\r\nAwM/8oH4yKat79LFLLwMF0kCYlqEvrC66ghtWvYADEI6ST/pBKhBy5p7hvHY\r\nErfYHCF5C21tKIM9opEJiUUVm27SA4bRnI2cCIKBq5IwLKbLRJL1+8T/bHY5\r\nx2deA13MnSH+AkJVaFgQemt2SyVwPQyXwqKku0FZ9rQllh5gy+ixsp3VSx1I\r\n2E5SvP5+kNABXZ42ZM1oW7qx0T0w2zgPSl/DLQbS0K1jza9AnKaBXSfif/44\r\nRvPRHwPAEy78Be/OaY/cpTQtluB6Obb9J5qPRE7sxn6etGnif+A/s80XcpP6\r\nKoJja6OAhZTx/WrSyg2NloOjwoUq9zWJIpnY6DeEJ1PF8OQ3P+lhqjaEatSR\r\n+N/L2FRQg1aSt1twYVIIuOWMN+qAqINYIIALcT00wvWjCXwajEA7CUB/sa7E\r\nGlGU5dWlpTCWmNwIs37HP6ThmS8lsA7pLtg=\r\n=IDaa\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230110154711-a793c7f.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/f9af6fa143339f707cb6c933abb7790d/graphql-hive-client-0.22.0-alpha-20230110154711-a793c7f.tgz","_integrity":"sha512-KzKNsLd+aeW5+CaYWaUTTKwX3gj0Ear+L/xqM2qDNv10v86BWj7iSxQFuD+xH3HrkVyhcmwhGJL8ITNUm74OKw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230110154711-a793c7f_1673365666168_0.8399971279757703","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230110154730-2fdc6d7":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230110154730-2fdc6d7","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230110154730-2fdc6d7","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"da412d1fc5a25fd3efb781e07613dce1fde9eaf8","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230110154730-2fdc6d7.tgz","fileCount":60,"integrity":"sha512-X39QKo4WEXHfYv9q4Iwn0GMU3jKSJjhecSC+/KYZDtL+GvTvdyvswPIwBqeA8ZVq7nV2rRFPlMP5gxIIdx52Ow==","signatures":[{"sig":"MEYCIQDIrxxEGZp6GDhhCAnUPEQx0H3whtzqXZBqrteRrR1dVAIhAIa0OE2CqktGQVJgtrXhIb8fYFaICsVSavmPnfqCrjT+","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvYi4ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoZew/+PK2rzj/Zk+Vq9E901NyKsHiY/XpjC7EBYwXNZ83dOY3J+SNz\r\nkMzYihOQsLE5LjPDBIdWS4TyR8K/kGEAJhoIAWAVJgSQ28JdLxCD+QqnYoaC\r\n3lrwSKxwOH+vBH27H4AypDDDH7JvZhzn3ZhoRL2bWsCog7EtXAkdaYEvr50V\r\nfH/yuBbJ6Zt+qfn5yxzKfyXc7KvYsR0bpAdiCF6nSA3y3+FJFZODVRJ5S0J6\r\nzc9ha24nuAS9q/6YsWbsE46OEa2QnO9SevcDNiBvlwY6XGpPmFpk0l+9dJPC\r\nZ2KdIgyV+vuhPKntIJNZoXkFAEIaIKOdy4IbWmbBxXnDVn75q6QXih/VWi5j\r\nBIdg9X61Y0Uhhy/lEagIxS5xD3tPD6WCO7/SHeUDwxm8pKUFtzJ+4mWSiJ62\r\nbFV9+YwoeAsMULJe3DVZJXxwaJDFC2TnP7W8gMHBDbn+wQYi7N4/oQXMn5KG\r\noIjFCdjVj2RY8asTHQugHCCjzdo4ciuj7f3+FTyzoLhPvVJM1N30NU8v/HaY\r\nDUrO6tI0tPqQm6wQ8Ic1PL8UzLaZf+33ugQMv3FGItXYFIDMmA7JqguQU2ls\r\nHSPi3HCdytHAOXbXUREsNBT9K2x1rdco7vsYW8+HXige/MCEdDerAaWDRcjI\r\nzD3DIzGMgzVFzAJpBw5HdtkI26gYi4dOZUc=\r\n=BMqc\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230110154730-2fdc6d7.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/3291bce450201d4319f47597c2a0dad1/graphql-hive-client-0.22.0-alpha-20230110154730-2fdc6d7.tgz","_integrity":"sha512-X39QKo4WEXHfYv9q4Iwn0GMU3jKSJjhecSC+/KYZDtL+GvTvdyvswPIwBqeA8ZVq7nV2rRFPlMP5gxIIdx52Ow==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230110154730-2fdc6d7_1673365688570_0.805608035345976","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230110155517-db8ac96":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230110155517-db8ac96","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230110155517-db8ac96","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"bf6d283d9b1272a370e31234c4ee233c75d43c06","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230110155517-db8ac96.tgz","fileCount":60,"integrity":"sha512-my1/u/DxcFGABNRCywT6L4Ajo+Kj8DFVt6xt15+LbTehqEorTgHVdWivX4hgmUR7G/R6Q2MfnQwG18LRYmQ1sg==","signatures":[{"sig":"MEQCIFtABmBhdtofV2nMb3fAoS2jC2W3CX0AYwPizddQ6iPOAiADaBSRzTVHfF32LdDytOBL8hUIXIwnIhDuJy2OXgSBmw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvYqRACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpEQw//R9Y3PremVY3/iLievl6XxAorevBAQLW+FWauc05NE5oHfySB\r\nzEr/0oiijPW0tqYQElpVM8eMkxRIV98psIQgcbB+rc+0NtleeQgiJx348mJQ\r\no+5X3Kv3OOEj5Rh1eODZyr9BZ7hxBbhrnSLg627PNYa6uUdB6aVW9UTlE9Lr\r\nHMQ1KPRNwr8mNd9sfyjfRbzOVXTlyqhEtQ0FJmjrHrUNuOSUBMYH7Rl9c9TQ\r\nZc+K8AZF4x9uR7oFIZHTKdO34vtXanNNhyylWTmgWSxTKCfx9ZcKA1MY6JNr\r\nX2dr6yfgnk58Obpgt+v0b2Tq1lSB5VCAT2xkf+Ekt/AXuklbUvom5dv9ZRM5\r\nieMgJ/O6RtfGrW/iHbGOohDcyEMWFwIkWEtnCzlfZERHNHFXm/OSO2MjA6rj\r\nSPmrsiA4p2VyPlij2ZcCaAWk1rsIlkoIDfRxSXVYEtghFtB7v9FuvchUuWf2\r\n0D8Vs8PV1E0eLlNVdI1yiRXnax8XVgrG1nFyundWNSWgODmuo3UzLEFCjEyK\r\nUo/2ecbl1/F9muHkPR80pFy7XKK7PTNJ7jDfp2aOhdHrJj0SalJHn3rS/3os\r\n7Xc8AoUykG2l3F4+uc5ruTM65b0WHlTWrss7IIEpqlwuy2YBxBYX5pOXiDUF\r\nOVUGRc04DPuRGu3O8A/jTEhMQfGp/TR++jE=\r\n=cFie\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230110155517-db8ac96.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/efc80b340b41d6e296e49801318aa7d5/graphql-hive-client-0.22.0-alpha-20230110155517-db8ac96.tgz","_integrity":"sha512-my1/u/DxcFGABNRCywT6L4Ajo+Kj8DFVt6xt15+LbTehqEorTgHVdWivX4hgmUR7G/R6Q2MfnQwG18LRYmQ1sg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230110155517-db8ac96_1673366161279_0.0976925555970991","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230110160040-29966f2":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230110160040-29966f2","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230110160040-29966f2","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"49d74260570cdcd9f7f18b24959b8570c101a626","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230110160040-29966f2.tgz","fileCount":60,"integrity":"sha512-4yZAylklL/Ii6Gn7K2jQWo4jSdtY+M2TD2/h82uW5aERb5ud/0qCncbf4gLg/qA7leCyFCatHV3Y9zRuMP+APQ==","signatures":[{"sig":"MEQCICku4Tk45AGacaWIvwPZAMIftbNRiVbVbCJNGkGCc40JAiBpHzXVQm3npJ3D1Iq59X7VvQT+Bu9WA7OyyNARhiQeJg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvYvMACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqxbQ//ZH9k4mEgiV+iiWk4mvv4APrT9qw5ISMvMJnShnqanrd/2+TS\r\nv+J+Y8VDJveu6kBcgYrQORrGyMmvk7kJKwMiCQiwg8xeg5H5VGVKDQwGHLKP\r\nq91Lqufu9h5LiWtchMhKxM06oCJN0W/FUkq/7ddsaqpMLqSEugDnQQaCHfMr\r\nVK6/6XmnErnFpMyaBbqQBA/cjCoRH2R0tKi1lNnYCzKn3b075AP/q26D9VtM\r\n3CRor3dmYapm9oRaJMGF84KIdQThEI06Ze5GBaStO0Uvu/ylNUoioYP86qUc\r\nbaK0QM2Cgx7Y+gW1iNYG8B7EGuN0u8XAUuIcKP0yK5lFrZt6xbafV8l7zf52\r\nR4usn2ViJivu3RUNR4nlGTHsCqxGFFFCOzsaGeeao0mJdfracew7tFh3R91n\r\nkoIohxXWW+6q4YeaBX2PLFimA0gOu5gna/W4MhGhmClktN4pzPo/QAd+m6bG\r\nBW+JRpR67sWe0AP1oBkvktJlbvIVDwoQw8Ko8kJqsiPthAaFsr00o83voPlM\r\nmmyF5iQ0nb9v+fkWV88pQUvLoK4FA85B0PLe9nZAsQcN0YpYi14kUQM3fFms\r\nbYJ98Vcm9JB2U4zpqP/V0YL9UpC+Wvu07wjLbgPcfAYfOW1ZXnNBWIk/PMie\r\nj9fyZrHL9zDSjPYvKD7ojKNQT51HQRkF1Vg=\r\n=12DT\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230110160040-29966f2.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/ded003d843c319753f40153200f2dbc8/graphql-hive-client-0.22.0-alpha-20230110160040-29966f2.tgz","_integrity":"sha512-4yZAylklL/Ii6Gn7K2jQWo4jSdtY+M2TD2/h82uW5aERb5ud/0qCncbf4gLg/qA7leCyFCatHV3Y9zRuMP+APQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230110160040-29966f2_1673366475930_0.20233434360709612","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230110160600-8540415":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230110160600-8540415","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230110160600-8540415","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"4a349f755b3c8caf9c9ce8a78841f14d3759de38","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230110160600-8540415.tgz","fileCount":60,"integrity":"sha512-tTwP6G6K4Fj++4Ri1Pt7DMUGMAeEM0WrDfrOytMG0hNeZ+IWtWLGtmCTGN1Av/9O4xezdnOsmrGPej8WLO7bzA==","signatures":[{"sig":"MEUCIQC9LiLWQmLhfi8Uc9xa3zJVymjFhgCuIgxvnUOgLqkZNAIgMsgno8Es486zRAIGJzJbFF6U8p0A5xdnI1/1fYi1P8Y=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvY0LACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqmeA/9Gox3CrCFq9ipvzN+Q0ldnKQqhizgNeyZY5rdqOJRUXSuUzZD\r\n9vl1XGW2tFxGqXjrobXvnGLjbp0e/Hu308wYeoOIddPOIclZo0ycJY68+hSK\r\n+M7qWNQQGwM4snoFAc0TLCaIvZJ27K6oUZD8mo7sh29RA9Yccm1hdgMngwhB\r\nTTimvol97/a24sTsfk0ged+xO4/A3pR/tl+exgEFygueuDqfY+4wQlgaDivp\r\n1k2fqfUohJVzSBCPnyxQnJoZvhNVSoZT/vYl3W+rVR+l27/bI3ShX4qPoqlp\r\nAxslMM2fGxXdEIyWSdikVG2V0giXVBGIHPAuZNBOwXIPip7hGHypBr1KXrdW\r\n1+za4LOy2rIuDeilL2+UHN2MX0r9CUGnxHkzY7XusGp0b7T0feK96dH4hTaZ\r\nrm3BLYWbLe+2s+EjRoo2G+pzsWubZv79bIz5b2s7wCCApyTXerV64UhjIxiN\r\nfGFjsQrq5emLxyzzzG7Vji3WZsCHxd8sRvKjvggi7Kt5y/C2R4amWYLqCxW0\r\nj32m+Hv3FI5VrC3gF+M79hm3GUswIk5kDf+Q8XLYY9d7jVyqMkeXABZVUG05\r\nWmrYh1s+Mxgu6dxGkVwe6++1xjb4r5+2vkh6RZn75Rm2qt0/Ra0NJvMvdfGU\r\nLTv4vbGRpLJyyfidSSyypTLrjeIgD0NDZ+k=\r\n=igFi\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230110160600-8540415.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/64471746e9bbb75744c96d029377241e/graphql-hive-client-0.22.0-alpha-20230110160600-8540415.tgz","_integrity":"sha512-tTwP6G6K4Fj++4Ri1Pt7DMUGMAeEM0WrDfrOytMG0hNeZ+IWtWLGtmCTGN1Av/9O4xezdnOsmrGPej8WLO7bzA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230110160600-8540415_1673366795698_0.6250014072194323","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230110161120-db40036":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230110161120-db40036","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230110161120-db40036","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"3bed8b38bc0cb55261e053815a124650402c9b23","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230110161120-db40036.tgz","fileCount":60,"integrity":"sha512-UmVq7b0IOAAuYTYmm+sQCFnrJ7aWw6aNmgdqZvCVzIu1oW+y94Kflb3BatPysq+MMXWduuZnQEeukRxmYHXigQ==","signatures":[{"sig":"MEYCIQCXKxWH8tn15npdiRyUhSpL10/5cHj4sBkCAh2JZVVHnAIhAI1FzqzKns+A18oUwFzt1jAcosXnb5NRlcr+BkQOsi9W","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvY5LACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqUXw//Yd3TA6pEaF80QMUkNLvJYSqcPBW66xSjbq/GZdl+E7E7+FXt\r\nkjbaqmegoyfjgHB0v80wu75fM/vu2hTIgf1weFPuZ/WAbENBQfKoFsvuwL4D\r\ntiJAAbC8WoMtZYMwNyyGNpmJ7MQ7EdafNEPsKb2MPXGZRSV4a7ndXcx7GYOW\r\nma8qZ3LuQKIZThcj8IxtbvZXSQRJSUKPALkL6gxJ5/MjC57SpgWV2NvCeZ/F\r\nLKIfEDBOGKKSYeGcbUNfeC/KjbYHGVOib+xR+Ld/ouoiYpR4jzAzeAZiA8kx\r\nW/fPlF8eIw2d8AH3yRYPZx+lbwflaJhGZQQXZQ5MwEdVSYOF7lZg8aARIlrs\r\nnCMOfDNhtJ4IErsqR2hnUxtu0y0bCACz+3HCtUIUdrs7/ed3YfdjWaNSiISo\r\noEkkdufwW60MSILphiEhuk5UrY+t0yufyXJl+zEzZlUZbA/897IZUsrr7y7t\r\nUMbWLf+jzd0Oj/DrGsTfKsy/1yC9nHO+ANCBpKGFOd0Of8qc4ksad0sKd7Ud\r\n04zx/HKuAsMAFD/7B4iQiKAXiGHGqC7NIOzU+ttc/+xaZYS2CrAB9rZG2AmE\r\nSNSivDEN5/bs4rqIppe/t2XcY1q/p2LSGmOnPnJ3xCOVPjEO8Vt7uAGJI0Ca\r\nwbwRmnw/ev49GnEY3KkMO+p2p8pKXSaZKCc=\r\n=Bxy0\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230110161120-db40036.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/d9a6b8644a248863cba4e03ead9128cc/graphql-hive-client-0.22.0-alpha-20230110161120-db40036.tgz","_integrity":"sha512-UmVq7b0IOAAuYTYmm+sQCFnrJ7aWw6aNmgdqZvCVzIu1oW+y94Kflb3BatPysq+MMXWduuZnQEeukRxmYHXigQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230110161120-db40036_1673367115062_0.17976959245770807","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230110161627-6cf1a8e":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230110161627-6cf1a8e","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230110161627-6cf1a8e","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"0ae9d7043ac0b1128dea513262e853016f124e9b","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230110161627-6cf1a8e.tgz","fileCount":60,"integrity":"sha512-kbPlOA8GrpsPaoWz3lqRXH4c5Xv8MpTmsIlTlvyAERvCTo492F1woiCOCKY0WfUW17SvJ27YOyhnTNjEsNMzqg==","signatures":[{"sig":"MEYCIQDBNEkwnp83qKLprzs4dIRRV0VfAeQaXPMAuUPZ8TqdJAIhAIMRl/41Ast6XelOhGziLkIsQcL72O5ILBwq0hOTwmPz","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvY99ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpJsw//QvClBlCD56WuGf/XNiMSj9pkYHVxcmbDeSioKJliOosOaOXb\r\n5vzxM7eGgj1lFaeDrVnTUIpP60c3g4yGr6hNxR3egb3/ZP4jChB9pG6AA3eI\r\nii+up7UYRyQGibASp1JNbvItu4b+bOUXJmt8eJNwuCoCOkZfPbG9eVoJJ6IQ\r\nkESc9ywPgfuzOwCdVTd3ngIJ6QP2n6PbInwL7NsjJ20jLHvOfmq2/5nH9oJ0\r\nKpbtvM+Uhvy5V3qHKwdv1pdsIGU/b9g6sL5r+HE11c/lSSut4PC7ozdgI1y6\r\nZvGHlCgKNsFubQbFazVPmLPC/OZYsqd0d6drHF/K7SZ7NeTqLhzkwqiRTgVF\r\ndO+VmdXbGFoUNqGsZbZ2wdCZsjgRycvGxhdeudBXfSEPEsv5KQZpuLGv2HSQ\r\nMNueMvDVLE2Vl71eOcsDsNm+JKqbvwwLpR4yjNg6E1NYq3IIAyDL/O08dXB1\r\n0P9tUgmeRmhxGttq413k+vypyL+FHbCfZjLpMuB1m2wL9Bl8PdVcvGZA0EVh\r\nXH4odBXNrqe25DcgfSYrlHDyGlwspKYc0dWPT+oXeA/6AQ7w2dKTYqLmVq3k\r\n/AZkfDs47pUuzG7MEbDUXsqx7aUhbXO5AxCp3/V9TzMkLoblAwIY8sBCQq00\r\nJJP9MWL4KaihKklpLX3psFjn1kjtQKcXksA=\r\n=LgM1\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230110161627-6cf1a8e.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/e57d292ad9595d8901e0558cc9f66982/graphql-hive-client-0.22.0-alpha-20230110161627-6cf1a8e.tgz","_integrity":"sha512-kbPlOA8GrpsPaoWz3lqRXH4c5Xv8MpTmsIlTlvyAERvCTo492F1woiCOCKY0WfUW17SvJ27YOyhnTNjEsNMzqg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230110161627-6cf1a8e_1673367421474_0.9592258320682958","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230110162204-349d7e5":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230110162204-349d7e5","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230110162204-349d7e5","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"de3c364a01a45d3bd3f041974536866b9ba1a9d6","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230110162204-349d7e5.tgz","fileCount":60,"integrity":"sha512-pIjdd+vLoEPEcL5eNgK3yIKC8tfuU6nPsi9V0zlT1qZTgMTIEQQghlb2IfRsCb1WrpoOkQVQhzb6i9KAeTrurQ==","signatures":[{"sig":"MEUCIFOGJgIO0BAUxJLFzJXHo0yDyyTQcV1Bbv9pZA7CApyXAiEA0CsDkpj6DbqQgsmWTjcZAztx6VYY16e7xtldLTWd5GQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvZDOACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqGLRAAoTrgk/fZVxf4BVyWs9dijG0uuwJGa74jIhzsUIAX9V00p5Zg\r\n7bKw6umoPXhbGD6joDNmOmRlxBXu7VmECW1e/EpBJucBwrapvqL+HF3i07e+\r\nsPZUx9UY5yvNPEY7He6VQh/1EmIdiG/zQjtBVXqGrHOPtamnY0ZxPdGiyF7g\r\nOTMFrDW+3vp5Lx3hM37Ceu+p0/Az46VEDs/z7REpqU3scV5kFd9mOgUhI//L\r\nKoZP9kIiuYCAuZfJwnVTqNH08i+ByXdyUzQqayk2PR7mkNs42nyC0CHcCiYT\r\nLF0LS/YsC3DU2QkbmprE9m1PNFIJ+PK0t09q+iTGEV/avYC9wk2cBZg1rr2j\r\nIKPXwktpgFa9FxBBwzZCuTETexzBfGP23azJTly0Pi4nsNfUP87Nlz6u7Qum\r\nudJSSezoJADsMcJT+0asehV5j+ck2QhrTicc9P+oxY/yUtz4cDuMeS2k4fs8\r\nL0IOSZVQdCc+1lhM+TYacNHC7m5fqZQjmUy6brtlRTqqkAJ/F56D5y8NaHrd\r\nPKsG/n/ZeIiwqJkhtng2I/8rItXrcJpLjRjoXvR6xvxnxKRviFImws5mFzLn\r\nnwP8Tba2XA3X1yuPjVhWYoGT4zCycmqBmeK8QGyA/XXKbxgT8ApP88nX1v6b\r\nxCcvsGFYRHobBVJ/2SMdybHXQ13O3cYE8xA=\r\n=Vp6+\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230110162204-349d7e5.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/3b123201f86d93319be6fa2d9cf739c6/graphql-hive-client-0.22.0-alpha-20230110162204-349d7e5.tgz","_integrity":"sha512-pIjdd+vLoEPEcL5eNgK3yIKC8tfuU6nPsi9V0zlT1qZTgMTIEQQghlb2IfRsCb1WrpoOkQVQhzb6i9KAeTrurQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230110162204-349d7e5_1673367758325_0.9021452898866684","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230110163202-e90a996":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230110163202-e90a996","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230110163202-e90a996","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"723744509e168d7cafb80c79a648886c51500544","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230110163202-e90a996.tgz","fileCount":60,"integrity":"sha512-syT5F8YPBZT+h+CKx/AZ8jGMHjCCvpO5xS7O66dpDpJ2EiQX32ks+TuZRXb/q6XAUjk+CBTFKYgBdR31A0XtAA==","signatures":[{"sig":"MEYCIQDC4hyVmawjjMhWCkqBHCcyPRdOxYHQitRDwFPr0PjjIgIhAJakEVoiK0zRhfdsW5zG1gLVO8Sv3HeRWZW00yyYhOz6","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvZMtACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmquiQ//RZcMKLekfmhf0iKmrpR0Aw9q95bmvcN5WnUbtjS0Kb2CLePM\r\nBLotIfVqmS/qt1cJ0QEdcKd/YWyNQkQdFmKMEGymib8QSRZGMcTxFEkrksKY\r\nSAF40vIwLImd0DqeGzKmmMm/XH0HC8N9+zYvKU3kgpUq/9E6nIaWBe8l6BLR\r\nb3naTcxBqtDLZnD5uoax/Mi/6sYTJz8nfw4vWTGV2eIMZKGGtOwcmdERiCrO\r\nMYNNWR3z3ar6iM6tUg1oEPKLu9N77L4V/vuzJbgQZyFNv2fy8zXzoIeQuQ70\r\nZMm4ITEKpep0iyl6B4Y3Ifj6bPmkD5kv9TEdDvlcu/Pwf9Qo01kI1cQtEtOu\r\nkCpNGgKfTJyqdddcF3nV0c3DnvuXFHwr9F6Zod6x8TJaIB3YoDFZa6qPeikC\r\nMo8mIA/6xmY+tix4k4N3KT3kPlzUxisjmCae9zo8fdZfDKpwHY8+YNRcSzgh\r\nXiviXDXLULrRZPtxIdK1/Ai6PGmKgcc55EVWDiLQGNp2sgNKF2nSCf2Eezx7\r\n3zSvmISz0rZUSxrxUeQ+gMlfRg3TIb3XU9oSVmKyy1+Ow94avdUMkBGSWb/3\r\nXvx3zsuhI8aoe7nm6qRMetZl7hbfEMXirYzicv9OSWbkv7hOXcBnLaGg5bHR\r\njda5bP5qL5wGE3BGOCIhvMMIP3fiQC4IQzU=\r\n=7/DJ\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230110163202-e90a996.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/5442e68f607c3e4dbf2b01f2a28fed50/graphql-hive-client-0.22.0-alpha-20230110163202-e90a996.tgz","_integrity":"sha512-syT5F8YPBZT+h+CKx/AZ8jGMHjCCvpO5xS7O66dpDpJ2EiQX32ks+TuZRXb/q6XAUjk+CBTFKYgBdR31A0XtAA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230110163202-e90a996_1673368365180_0.5134488333014544","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230110163444-59531ef":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230110163444-59531ef","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230110163444-59531ef","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"72ebe93c57b893f528b5c7dc3dc5a3b290116e88","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230110163444-59531ef.tgz","fileCount":60,"integrity":"sha512-lYHylfqPRoHeP2/TYg9AtAQ1GYPHTqktXvoiIWCP4Tq1yjpB83CYqn/L9X4zcRyMl1IIsrI5W6YBFeUG6hg57g==","signatures":[{"sig":"MEYCIQCKPvgaUY6hDpgo13i0WNwaG9cHJ/E4cvB2y4JjgOwMJgIhALzMckFSSVsABNdhqB5rtS9xvVWX3iYYuWLiRAZ3BMKP","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvZPJACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrSaw//W1vHRHNfp35GBCaeu+E2g9V0E376YMFRANUA8ZEjvwyEeJTs\r\nqA4jTiOBgnrmjDtCTY4CGx1JgVFRSiM+YV7oLnmO92UDDS8gVnpOB861lyOD\r\nGTdNzDbGJW13wuZwTmX3+OUNklBL8uHXT5Cl002g16m7znLIK6yl095nUUlB\r\nCxShG9pjv5XlGJDaq5rlESlSpIK3kwS/k0dHvHdmdUnWyONts4KDKbm7EzoX\r\nYzmNnwhdxb0EdhCJKRNF9u98JeZdOysNNsXMj3oIsXd6HBKpicHlacCOawf3\r\nGL74VnlGB/PI5PGUlUshH7eEN3EZDSFEMS7gQZZbYTpgdEXeoBUykjVpQNx9\r\nIBI3YgG7ejJwWtbToNMp67MWJSBB1CbOuCqTUP6x1Kr3kmVzK9ejtdJdubh0\r\nwMYPiAxBci3Sr90s/g0yCbkz9e9KRZez245UAgoT2i7tMj0Ix3uvgtoWSJKp\r\nRdVO9AlsxupexmG2XACHVd5iFCIusAqYweFUQirz0J8MghXlxcPUoTIMQNU6\r\ntuglyHOQD5e6bnkhl0clw6AUhI1Kri11thC94E5I01Hm6SE4tOE9nVtUNv/5\r\nJsm18ALvqEI8gWOxmDpMk6xQ0d7SxZQvNbwYBsiX4jPiMI1nIbU7IgCnu6jw\r\n5fZ0PMpV6fHMx7fMMWoNfWErSdyWYAbksWc=\r\n=4hQk\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230110163444-59531ef.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/460e2f75bc6e71f84a66ece057a566f3/graphql-hive-client-0.22.0-alpha-20230110163444-59531ef.tgz","_integrity":"sha512-lYHylfqPRoHeP2/TYg9AtAQ1GYPHTqktXvoiIWCP4Tq1yjpB83CYqn/L9X4zcRyMl1IIsrI5W6YBFeUG6hg57g==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230110163444-59531ef_1673368520983_0.12038998638598097","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230110164551-49700bf":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230110164551-49700bf","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230110164551-49700bf","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"75e8867a0b36692f484d8a66655d6df1e5332784","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230110164551-49700bf.tgz","fileCount":60,"integrity":"sha512-7ObNRzRv+0jiPdQa9nIX2k40JDIfAt+w2H+vJQSIBczdZvvCfLKvqH2gxWGmEv6fH+/LvgYWZKmHVBCba7UtpA==","signatures":[{"sig":"MEUCIGnNbP0dTy5aMyxfPOPrvoU8kKhr+R61TufmuhKcA0GNAiEAt+qbJItZFhni5ZgGKU4MD/fVTigbuqxJ8l7rP1cYupc=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvZZwACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrCuQ/+IYFH0QdhAkcfeOHmI8Lp+l+/Zsx5UYQhVRFS2F7YnknwDOVk\r\nOgdSIDIyQ146ElKL9SQoFy14GZnIvMNF8a4lntvuh5V4XYihnryinqzyKFuu\r\nrBT3XMvFaW8yhHKofSrVgQUCvuk1v0UgFiXOi8z1e/zsUulwOmfPx8UJFF11\r\nw549C4qnpE73+ETSlYImHJpZ1rygED6z6p/YBWMi5XVxZujuHAYXy2aqTakT\r\nZeWEIXWl9+a969jTMdFi0EH/5rq0geOP4uVW4OIKabblxQ0dWBlBoai2zTiY\r\nFiDwggyFEx5XvcNS0AzoNmXrP24eTtEuMxrA351tpru/J9aQpHg1Yhxeg5l2\r\nSbPXA7B8kSS4s9GXXXELK3IxcRMcSFIMB9cj88+FXiDUF05b8AIkfw+Ut9IM\r\nhUFPidOQ/IeblttgZd/9lVZ5rew5WGL9T8GkKqLHEuxSUiNcCTN0oVKMeYLJ\r\nB05Zt/4IjHaEavZcTnt/O/3AODKDwaOkwy7injArq5SSHgwadHlo9rXMkTcU\r\npf4Dd/0zAwdVeOWqVmGSk4qfVY4x741IMn0ViHxsmZtgdd8WQ/mZuO8FeCcX\r\nCF9XpdX1QlME1OcvDdQim1iYFPorsBkG6KjAjCItVDiGFkNE/f+9cwXlo+gL\r\nO6j9F87OfHLdWYSE0FFsM0a2V9GkT5dnjak=\r\n=7ACK\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230110164551-49700bf.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/6798cd283cd1ff4bec747313f6ed5d1f/graphql-hive-client-0.22.0-alpha-20230110164551-49700bf.tgz","_integrity":"sha512-7ObNRzRv+0jiPdQa9nIX2k40JDIfAt+w2H+vJQSIBczdZvvCfLKvqH2gxWGmEv6fH+/LvgYWZKmHVBCba7UtpA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230110164551-49700bf_1673369200452_0.9478807006036609","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230110164943-e2e131a":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230110164943-e2e131a","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230110164943-e2e131a","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"a04662df0eca86af22f1b656a7897724ea5e73f1","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230110164943-e2e131a.tgz","fileCount":60,"integrity":"sha512-oHO7nKYEiL14IO/4ULmqSvQgL6jG2fm7bb5Sr6s3+zrcGmy6YBjtZGl8hDgG0EFeAxpke+PNNk45gI/ImMAqNA==","signatures":[{"sig":"MEQCIDj6IeUNWAw8jH5jjoXQHZy6S3guVXdExTOAR7/QKjWsAiAYrWBL/HBRyhQ38aD4kJM5GVTel7dKJbtJXcHTIbUbJA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvZdLACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmrolg//WpqNywfA80WQ9x1G9Tb61Qal8N5kvNmuazzBU0rVSlN0tBv0\r\n13KKwti5Au501s3ovha+J0KoA9TfCewRHRM1JPCFQjYnd/+TmVvcZGiKyZFF\r\nC0/NEuKwWViYn69zIBTt/qw+pujL1Nh5vToK7z8B7aX5PSRmv6GxrbBRM++I\r\ncEVk4HhVroOo6oz22tlpGqnFtYWElE/4QLCiCvVJJWqUjLsXFXtrd+xSUSzB\r\ncV3sDJgJDFV1MtLgABazNCAXfcxjPHbtHzrRbuamSazL/QLldhoHumbDVkre\r\nC/xLRA09MTyyEkGD+aUO2PwN85Uo+Z69dJhbzQ3ukMMH5YhqG0U088nNQ+F6\r\nUCGSZTXB81HWvveDetAIQ9/im2OEaEKunsuW30RuP/5V7I44IqLjLcwvzIhB\r\niiKnTDoz7e2EhGWkcxHiNlGBddZKGVYCifBqppa010n2gh7JHbPksQsbf39O\r\nTBLeVsDyxghFGWv9e0GnLIPdBhUQQqvDR15hBGqcumSSBx1YjNXBEkOVgAfK\r\n7EZDk5w3i2CUFenhDWrEDTfP+UrD43upSv/OO7YZWg3AAi0k48QTdqs9D2CH\r\ngMwpFAfMT4ju0eXP5cDdcROU/UE9mK8JPIxlDxuW02Ft/P35FTRYcgW8uh4n\r\ngvzfFaAWh0nEOc40uXyao+8dGk1ji7+eUC4=\r\n=9SQP\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230110164943-e2e131a.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/73fc8088b4e03fcf087a4f0301f80ea2/graphql-hive-client-0.22.0-alpha-20230110164943-e2e131a.tgz","_integrity":"sha512-oHO7nKYEiL14IO/4ULmqSvQgL6jG2fm7bb5Sr6s3+zrcGmy6YBjtZGl8hDgG0EFeAxpke+PNNk45gI/ImMAqNA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230110164943-e2e131a_1673369419566_0.08609585949735887","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230110165159-8873105":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230110165159-8873105","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230110165159-8873105","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"fb4901571735b5982d67f6745031acc9cb177437","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230110165159-8873105.tgz","fileCount":60,"integrity":"sha512-1DmXWv4AYVdvg63fbyIUwCBUjwZfdUfJIwdEwkalT7WjXEBhlKkT76fTIGMw7jUAInoZKu30bW1TrHISBCpPLA==","signatures":[{"sig":"MEQCIDLzraw9B6vBWxvTyD+8GOyewRq+kqYQb7Fipn1mFg/1AiAEZSkXWfq104+J8TEod8nYEurVux0hFTEXEq/kDRPsPw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvZfWACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmroOg//SItWc42uCkfyR+okhEWyl3lIfz952ROMoa7DVhoHNPcyo2fw\r\nPU+PfbuajsUgDajTEGU94IT5bHPsS+aW5RgZanWdT1INdDrcw6ei2PMp4Q3t\r\nR/kRb6amhCZES/c8bufOQsj6oE0lHQNq559Hl2D47wcBS7L9ktFyJPQDeL/o\r\nHDkotbi87jUv/Q+kf5E/3Xrff132pbsfMq+umaqCVQaHsbxotjQyNiV08UzF\r\nTHBT5NTm4NraB49jRDynGXrgNKGoRRinLQzMob9n0f4bSQSJu+9KcRthCxtF\r\nVZOvwdLDUAjHw8byWb8WOdqAFye/V8bCGCBzLCG4exAZ0f6+yRsn9ukAm2fc\r\nQBSuVV870PH8w9Kaio04rO0BqZUzgmGLvfns+gkISTeoqukbWC2VZYFTPssb\r\nEanP4EjeswotbHNp8RBzcCIZXJ7/ebpTeLxBRF+66MtPU7tPfzjAYB9RRPc5\r\nLB3iHsveW4vpzj9BcuylKXALJUxmFbDAsf3QoBD8OVC5BZ8TBzr5zpre+Do1\r\nE72/DmeRGFJhKKBSV1XLUvhRQxEAtltdr926sVpccBASLiYaqQmpr/J++cDG\r\nsIZoF+Gta9wLgERcKe9T4rkJ9BdEDLkMDJ4NZ4cIbIEMEt4OGg/ybfFSNkiE\r\nPEHp53qmxGm9a/LDnQrGNF8kOZHgccaMHLA=\r\n=MnNB\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230110165159-8873105.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/4e9d1719f797926a0c4c55f6a5fa3d86/graphql-hive-client-0.22.0-alpha-20230110165159-8873105.tgz","_integrity":"sha512-1DmXWv4AYVdvg63fbyIUwCBUjwZfdUfJIwdEwkalT7WjXEBhlKkT76fTIGMw7jUAInoZKu30bW1TrHISBCpPLA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230110165159-8873105_1673369558503_0.258810193674486","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230110170147-bb8ccd2":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230110170147-bb8ccd2","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230110170147-bb8ccd2","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"2639b1e2526b47d692b78eb9cdb4282509fc88c5","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230110170147-bb8ccd2.tgz","fileCount":60,"integrity":"sha512-nOeX6LKx8wAh71CyFXXb5iPiUjxJQo0WRPrBIO/acJUjYaPbE0tLZVgQxqry9QPnn49LP0rTsR/5hU/g27kq4A==","signatures":[{"sig":"MEYCIQDFpqh/F2NCI0cv6n6F413XKgoUffN9EIPJqe6V58bA5wIhANVGmIDJQczkryahnDjYGSXD27tVXQxF4h1icN3ooxXB","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvZopACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmqh9Q//SAAd54NsotLFzzXTDQwApZmKRH/Ep+UUyrUzGRjlklDqfevE\r\nAYJ01H/MUVky8GxTdodZsbzRCaKcWdtI9RJMAEaar0vRyd/cR52W5x8tDy1l\r\ndOxVvOdQMGnHT0SIMO+eshKOgPV1+bvA+N5Kj4T0VCUVccfaPssGqwVA5aAt\r\n9EPH9aOEZUTMd5adSDXlyU0a+q3vj/4d0fClDsqiY/pLCCxQSCMgFAUU6CnR\r\nqy7Sg2gYOtbmE4ucwGey80K1V7b2VsSo6m0cxbf/PgIKZPWJIWxYyLBQvg+K\r\n5AD7S3S30wmMaY7HGVJkpo4TgKOroPpfEVQRH6pU85C5MEDqi+l8sjtMNZzS\r\nKasjwbXmDinqK+PkzOtLkGn5SA2sHL5Wx3dEfs/u3CSHG0rwo11u3x6j7l5g\r\nc2+bz4Up0/TUGLRUCyrX+AxuPhJ+B2u05JnGBAPk5OiSjtcCbOktIIG9BoM2\r\nbXuvCiwuB7CV6GipGVeivW5eMWQr7PfLuSFqT8c93WgoIjPGfhsdqD5FD6Z3\r\nTUt2Ymi9xLhMmlE6hC8LlDPOoD8nDV8zRZcEAvsp7iDQgntefSGttsEuZFSH\r\nNTzH7VeHLZVeqxnXGCIOY5hADOgwUkJcYyOM4AQThzBKh/Y7jVMh1/dO9Q9/\r\nK+C2tuBAA69tCxUU4B32qubhRePR5Emfsik=\r\n=/poc\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230110170147-bb8ccd2.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/25f74b32172f68f48ab2edd0d5658952/graphql-hive-client-0.22.0-alpha-20230110170147-bb8ccd2.tgz","_integrity":"sha512-nOeX6LKx8wAh71CyFXXb5iPiUjxJQo0WRPrBIO/acJUjYaPbE0tLZVgQxqry9QPnn49LP0rTsR/5hU/g27kq4A==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230110170147-bb8ccd2_1673370152807_0.13779465321856788","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230110170226-d22be20":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230110170226-d22be20","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230110170226-d22be20","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"fbe59161379ff4791035124f68e2b5d667a1dcc3","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230110170226-d22be20.tgz","fileCount":60,"integrity":"sha512-CMPTcC+aXo1o8PE3QdHPipJ/48Kb/5leIvLx0FT09sRIXaqxFFqrUEe2Od7hgp0gKHGPjY6JGrXIyEtB9cOMTQ==","signatures":[{"sig":"MEUCIAUAROkLEjzakQWmjBO6zqu7DBeY+p2kKJiGzpo+6nVGAiEA8XyX/YWw107gKSi4zRJ3bKgqkBFkUWRLHT0a8GeN3cY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvZpMACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr9Ag//esspqLJ9PyHxDyAko1PMTwaXClfckun/fXFMEcpAlSLOp1f4\r\nhBete4hqYDxycwUU7UbOCm/6/Y9CdlnccOnpIdSCxJ0xCPPEj0Vg+1IVd75w\r\n+EXHE2lx6NV3N64k6zkhwTUHsCyl+MBmVTz7CNG6BouvBqY/6nx9aKXKqzmO\r\nDUzCV4uovuegN4VoHkH1EZh9D4d7lznK+bBxz69a2cNUOiqM589pV8akJ+Cb\r\nJyQ3buTGSksFrqaDZhD2YVOBmqkoKHOBwb5q8ZBeysVMoMWET2/Oo5NiEgZT\r\ng0htZ5qjEgzWt/ook78X4Cta15xjn4abwgIVTsMVkwWEFTHRr1Tm2eTCMBc1\r\nA6Jj56vYBo6ziTmTFcyoY15XM2k1CX1rz2o6t+QP5XSp0Ojbjfd9HfisALjv\r\n7NKIXXV4KVuxOJ5OdssoyRTw7RoMEp3aipt0h5xSnCi9AJ/mgkeuWGLCzhtp\r\nB/P+Qh3eL1QfdQP3Ygm73u7GAyIsmz/3e0ilhirIbk1WeFJhud3rjsS+C/ty\r\nDc4EW9ITi2M4K3f7hAJZkje/vbUjtD8EDZQj9D+pPuAwifnAyjmhqyF6tK6h\r\nP6fir1A/KoJqBN/nKZqU+2/WYB0MRk6YBoVRHX+Sj2d2wKDjIio7PVCGf6YD\r\n8L+B6NBL4xd9mnMWrhxS+OKRpAHQ1pnSq9E=\r\n=EUu5\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230110170226-d22be20.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/4003dd022447ab940de7011e4e849b81/graphql-hive-client-0.22.0-alpha-20230110170226-d22be20.tgz","_integrity":"sha512-CMPTcC+aXo1o8PE3QdHPipJ/48Kb/5leIvLx0FT09sRIXaqxFFqrUEe2Od7hgp0gKHGPjY6JGrXIyEtB9cOMTQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230110170226-d22be20_1673370188093_0.2658394933631998","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230110170707-c844956":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230110170707-c844956","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230110170707-c844956","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"23390f1d6b4bc2004ce8050631d1184368491e8a","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230110170707-c844956.tgz","fileCount":60,"integrity":"sha512-4SFfFs0DQBXOQkTzzMg/8gBfg5lcF3ESf7SNbjhDUSVpbjYWpc3G+v7tzHewGfY7+ccHMHlJ7I42E0S9eZGN+Q==","signatures":[{"sig":"MEQCICCpR60Ry0PHjZy36hAQweuKxprb8v1Heo9ouLQdiaDXAiBE2CIiXdPhYIOo8L9He384nxjgxQfa99Cg2a4l3t3IoQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvZtkACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqEAg//fV0avlwQsAame5tcaNNT78EJy/5mVX8vR6NnlPLWePPmIfzA\r\nPGBjWBwxkazIxPeInGvE+HdzJSGWIM1ffDNL+wKHjii9LA5/tqqPnvr8UTs/\r\nZrjUADhYie/57376gpj74moqUsTJQqKCfA9fPA+GMfAaI9195yQfTai6NF+u\r\ns+NTV38vPkjhwPfg5OcvzaIlhS2rhROi84LdlLrYwjM31uca/RILB4FrtDvS\r\nZ68vUmBiagB4PxQ1s7E/WQ9RT+f1qrgYy3LU+JSGXjchcaL1RWuFdTZv6J8s\r\n3L6xDmUuMC9pYelyk8G1DSBkbrkqQZaCMRyr/dzNDzpF6yWJ94D5yR3mHP8e\r\nZCgw++q/Y8oDD8vIcgiCU1osXrhavo5IXTZPMeJEXvYTEi2ALldMlZFJ1vjK\r\nDk2y+HXjVxY0TCK3zxLXTu4SPYhVddb+Ltqdki+A/BE+rGhM8p+NjZYTi/fb\r\nY8WPMiiFqg4hrWevJymEP0Rw9mgoS6rB84hDQp+YLbHpVBPAS6KimYFfCOul\r\nGB/FUR65DtFvn7GTos8Jp5acXqxkzrXdULfkYjqFkWvQ/pZUbc2p4NDaDkKh\r\nmkrVHZQ3vwdyaAfDMMfdjd0te3TjHD7IQjmNaO1+6MHpn6G1LbHnFLjp/6IA\r\n7tBtDDBbslR4jMcCpeVCnvfRWq21BA6P4f4=\r\n=tMgw\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230110170707-c844956.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/4f36db173c6ab9fedfc8deac070d32e4/graphql-hive-client-0.22.0-alpha-20230110170707-c844956.tgz","_integrity":"sha512-4SFfFs0DQBXOQkTzzMg/8gBfg5lcF3ESf7SNbjhDUSVpbjYWpc3G+v7tzHewGfY7+ccHMHlJ7I42E0S9eZGN+Q==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230110170707-c844956_1673370468530_0.8998170594165718","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230110171235-f1606b2":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230110171235-f1606b2","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230110171235-f1606b2","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"43646a5f3233617f5f15874247da950e9e32453d","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230110171235-f1606b2.tgz","fileCount":60,"integrity":"sha512-09OkUyspWlRkGDnS7mmoAzfGgxFjb+mM34ZFNrW2sdUFwUUXLy7RKQNodF2Q/JY7mWh92PPdJAQ8ksTC0aZT/Q==","signatures":[{"sig":"MEUCIQDfi4qqtpKRrOk0tEmcVTM0JIsOw/cDhJu4GJU7cqJL0wIgSugBx31qM0kyc8xPzS/S/FxyJIFqkWe1iovcQCI7/QQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165581,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvZyrACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmq7GhAAoMgwK/L89iojm6lGwWa2qFnO2WBr40LhxLzJERSoQbsyshmj\r\n0HpEocjEkuJcqBr9ZvH14AIfy5AgWfhXWXaf8v9D6OS6dz0g52vQVMJj2Y22\r\nay+7Xr3CMUnB9uvk6Fpchkkh9SroyST1VxahdcxMCCspFCyE4qbSCepU/Pwq\r\n02OkPbrT+h/R08NcpNXK2om9cg5FbDUqu3xVFczmhFdBiScblW2Z72fmHugH\r\nmW2MOtLHCFsvF2v0TtkEb+Boz1fsnqmPH2/yAg0qvbgkgZv02akvb/MdSiPH\r\nYFsCFBGc+UzeGkq7VAi02Cpw6z0eiWBW5spN3h12wTIlRjIHecfo01eSDART\r\nrZxW77eDmUJ5iBPu4RFoipYScDg7hGLfbkPXttgi8X+etoTXa8lO5Ak8w3l4\r\nwyLHgkG3dBCBSnosWjsgY1o+NsDE/Phrn3XVvmKpOOionWTBoXhK4R1VQHo6\r\noTG1/V5EehtTCsbbd++sU+UskJDO2IFlYJk/1/5ML+xBCOKLIiTikWeLn03b\r\n+QXaKZeC0wPGwV87eNykwMYtFf/1Qx0iCQwlJLOL0ZoS0SSR9mniKFAzoJlq\r\nqJgpO1e3RV3Wu4QNOBslBf5lVbp261Oy0rRJCmrcDMrOfCvY59NhhLDn3ZtE\r\nEzqpA7nXmwLKgNo4Du6ktJjUmrOxErGzkIs=\r\n=Q5l3\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230110171235-f1606b2.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/a7101461e0f948703c4a6cfa9d30cd70/graphql-hive-client-0.22.0-alpha-20230110171235-f1606b2.tgz","_integrity":"sha512-09OkUyspWlRkGDnS7mmoAzfGgxFjb+mM34ZFNrW2sdUFwUUXLy7RKQNodF2Q/JY7mWh92PPdJAQ8ksTC0aZT/Q==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^9.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230110171235-f1606b2_1673370795341_0.42952420834248173","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230110171746-02bce0f":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230110171746-02bce0f","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230110171746-02bce0f","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"824ea25366a81591f7ec1f901aa8a8785da0f67e","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230110171746-02bce0f.tgz","fileCount":60,"integrity":"sha512-txpfv2D04ojbIQCmWOkLcahKNVUWdC9NfsJKPQnpS2AOH3SJLVsfmoDoScHMdrMi719mrJc9j6uKf2OBo07txQ==","signatures":[{"sig":"MEYCIQDjWruV5TjyzrIXpktbXpcFASO3rsV1XV/LE70n5/KHagIhAK1qDqXpXurLRm6UyMFz6mTInKzWQId/VZMsS/Cn7MfB","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvZ3eACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmqmjw//cv1f/de9q09aUvMa4JXtdahuIAQ4fYzUMR+CD6cKK4LdEnU2\r\n9Ql4pR8kZ+kCvDWBxH9Ft+LS9ebVcd0zC7N05r1U7/JFNXaACN5TvZm4YYgB\r\nTsuVGvvKcWJKQkTnaSFjLZbqE8qHHFzaofREadJEl1ARwQxaiR3i4x41m8Wl\r\nX4EC4Vf9YNot/+pmvNPuCGUx0PlN/8eOHV9dqsZsYXEzotj5EAVGnKkgNYyM\r\nCjvWvRohMbTgnrzwWX2D4z/LFLOBkCE84goXsAgw8IAjS/cCO4C+rpHDkEtS\r\n+sifV4RIJRCWVsVd7x5Qa1O/pYXy82I4OhwWJSETdMsPC4TLC/NTpjwpGNhM\r\nSFRi8/ulK+IwhbOFGS7l0ZOWfESiMhpWxS4YntWX0VLp3kAOl2o/ut1qj0z9\r\n3cpVCdLu/nIXEWflyEerw3GtSLyDpTS8kr89hKgn7ZsSoA3Ad5yNjFUTlBUR\r\nR/PrOI5+YQIjr0D57cbERMP8WkLUaY2XT6s4MvRPOK+OwUrANbIwFsObdYHe\r\n3VXHQpONBirfvjn+c52hlEPxNli0MS/zyBmZqkz22mRa4zWOvjT6a4CWeDdS\r\nkCYBNlCl4pW443xz8iL7VP6rdyhxMjDMNzs5NRvdsc85Cu1qQbw/iCkIrg7J\r\nbmm6KlUvWbFfglcReXuWrYJJg4v2VZmHnkM=\r\n=2wfO\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230110171746-02bce0f.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/96a750147c22ff0f897374daf4ddd87f/graphql-hive-client-0.22.0-alpha-20230110171746-02bce0f.tgz","_integrity":"sha512-txpfv2D04ojbIQCmWOkLcahKNVUWdC9NfsJKPQnpS2AOH3SJLVsfmoDoScHMdrMi719mrJc9j6uKf2OBo07txQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230110171746-02bce0f_1673371101948_0.3381000530598799","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230110172240-7b38213":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230110172240-7b38213","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230110172240-7b38213","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"26ebe68322effcb335d29cbed7ac8d0b022d6d22","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230110172240-7b38213.tgz","fileCount":60,"integrity":"sha512-C1eCS0GdHuZSM2w1M75M2X1NK1P2ephNWyyUBoD4tkqxKjpd6K+E0dz8hqe0Mw5YvIhghlkxNy2vja7EUbznOw==","signatures":[{"sig":"MEQCIDbx4420geKAkJMHVMP+4lKZA8DC2y23PvzTjgOUJ7D6AiAK8XA3c3wYem8ky2dChEc5BuSYR6zRbNRluO2CkJT8uQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvZ8OACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo05w//dOi3sCcmP5CIk2C08YvCxdlD+wtZaDZxe4S4njoDfALZdi0m\r\noLVEG3rkcuHJPD28VOw6t7JaoPzBgMPHZyezqTEH2JIJLJewiDmHVkBjqzx9\r\nZy5gMoWx+TjQBP3LLX3m0xLUFlDeOFF3qD9Dg69hs0OMf6B/nslrOyaWuSwB\r\n4V26x1psRD2ut+9WeelM6Vhr7im1wV6ahjB2id3AsfSLcyQhE0jwEm/nwRff\r\nY7eWYlp+6v0zanWrhXpgNsiG3PA8/FQwLixHLLds9hzbFVqkq1XzstE7bAa1\r\nZf7lbe5LjaNMjVSQp20iIGv5EugSUFknOlFXXK+JntYBL36a8Y7WOo/DrW+a\r\n5TYWg/voBtnSluUj6u0cJqGO/dX28GmM4rfiVlpIJGgLtpVs9gwOD3GJcS1n\r\nYhLAY3d6l5ies8ilTFzXKx6drHm0Vcy8UGI1AjNk2UriV8XOG+TNlfr8nQMp\r\nje1Mdiy0v6GjZxAf4wwwbQeqJJdnYOZHz1IKULR/w2l1f0ratFGXy78XuYix\r\n2hkIgUd3VGmj4wl5iKDlUC1WR+ij6oni02FwuOuBZBsJgwyeGl3BQsqsntD0\r\ncqWbmfTZBY/OtwF17Q7HXxHUxa7AuZoyJcDfXlL3eM+gh0U5h37uO1IPAAKt\r\nQMaX2HpqxtsDKeT4prsmDyFgkGKUXIZLn+Y=\r\n=Ks/s\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230110172240-7b38213.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/b76d70b166182d0d3525942cf56a6874/graphql-hive-client-0.22.0-alpha-20230110172240-7b38213.tgz","_integrity":"sha512-C1eCS0GdHuZSM2w1M75M2X1NK1P2ephNWyyUBoD4tkqxKjpd6K+E0dz8hqe0Mw5YvIhghlkxNy2vja7EUbznOw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230110172240-7b38213_1673371405799_0.3963726985228553","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230110172711-8406a55":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230110172711-8406a55","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230110172711-8406a55","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"99abe3197f867a6b20d853a6b2f985f7069e4fb3","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230110172711-8406a55.tgz","fileCount":60,"integrity":"sha512-YLHm0zgweREBB3Pd1w7/nXfWLDVFG6NQHdhvRqExypYKLM5SkaSgSpqN1w5dakUzV3GG3Q86u25YcRZtEqQ51w==","signatures":[{"sig":"MEQCIAdq9I1z5HB1ZT8CZKdzCRPJ5hCb3aQAYZLSBmagA858AiA/+tL0kjJ5VfGkBryN0vLOWHR+OOF438f2VyIiX0VrPQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvaARACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpkhQ//SH7Zwp1FQHYDZ4TvHm0HtxSk3aT85/LA28ZxyvOSZNl+dPkE\r\ncgVE11FvohTqcDaP13A2dRVXapLdqfhXp9d28OpIKWxb8x56m5U3CpVXkQav\r\n4xgF/GwyONTCZpFmwJo5Mz1kFfpD3c9iqBgbfZlOjQhZTOkpG4aE/TsbA6aT\r\nblVrq7y2t/Ec5mecpnp44SJVo7YR4wR5t0lLvtQNuO6zlz4x55F05o9haHyt\r\njcFYLSff8abasgV9Srr/HySNRD1xn1FljMM26Zegg1FWbtfPkVQOEJDCE++z\r\nrTp65AAGX36KS5TDZ9T72CxRQIrrp8SYTgYJgB6Cg0hnZLlgpnx+QRFcqFHD\r\n8MbPIwDsYsRRQF/mYhy2X2NzTLbc4cq9wJ7e5vHLMhUACa/EJvb9ni8J0p5M\r\nQiOKJ++DJ7variL5aINKrNwIs44Uijk2ReFLwpyKnG1NaNRA6OiBSmDoEqv5\r\nxiH/E+mZjV8jwMiI5yZa3B8ZHtsyLrHvbyZVgmUDmvn4pxMqwffwGd9hBTLs\r\n//L3QIdkG6OmGJK3sFEpIGIAQeZRmEEKD1/BBBFTx5qDmXWpnkbNfQkH/Amf\r\nDQKlSHlLE9MwrabzAZeVawXTXPtexKeLITM6NnWhM0Zj7tBCrNiR76axe0qG\r\na5xfjmnbXRIzZ92g03x3C/MAl5D0iHD7sYw=\r\n=Ep4/\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230110172711-8406a55.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/c4ac8e2009087ae7f159f939c9adef28/graphql-hive-client-0.22.0-alpha-20230110172711-8406a55.tgz","_integrity":"sha512-YLHm0zgweREBB3Pd1w7/nXfWLDVFG6NQHdhvRqExypYKLM5SkaSgSpqN1w5dakUzV3GG3Q86u25YcRZtEqQ51w==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230110172711-8406a55_1673371664886_0.6349895623291069","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230110204151-484e449":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230110204151-484e449","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230110204151-484e449","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"b9b6eeda308859bb267fbf1b715a83de0f582526","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230110204151-484e449.tgz","fileCount":60,"integrity":"sha512-5wy39/pOgkjjExSD5ZMkPKqeL6UvHlmArNPDQtC6+0i6nRuRzWxlkJX2GBTUCSi34tXy1b+GrVKGDM3VulvD6w==","signatures":[{"sig":"MEQCIGN2r6nvpNedpXXyD3JvlXIrWhSBIyDhEtiThF2iLfvVAiBox5Mk8G3nRWnYN6sx3cUnSEWiPKZZInquQbey/D74hA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvc2yACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo5Nw//SjtK7+ogVa4lfu5AmLqc8vHMu2+6bSG24DNtQpFnGt1RU8qI\r\nsH4iZVM5F9+Wn5VEcL3M/xgPkoJxFvWgNgkXt5GICW3Yq4MCMqN+DRn60Bhc\r\n3teQAU5ZYTd+SoOTMPYfRZuZd3OGZfwvek9V5ZV/7NxTOqESzjf14VoQfVfI\r\n5/EVmSc6zeNKvDHd+AmOoK/O0/tgCvrX4by6yYO8K2w+ZQdjb1GeBaL5ANyV\r\n1dA8LB74ezRhVjxRZCN/F8/Ms+OKrlYA9Usw1XN34X1tTnFDxLq1ftJfqvjy\r\nq1NC54fVClVxU639noGXITS4IKBy1pBbeSumslv3zYN4VK6N+batYJeefuW8\r\nmjLmZhccrgMY4wGmyaBAultm0aC0Ra6uT/dh3b+jYK1JTrp4fLYsLQF6CX+B\r\n5hNwDojoDtoSyomG85mrQYNCSRD6H//PaaZZlPXUILXUvsn3XbegxlIDz/Iw\r\nz7WLZH8QW5H+hbCH8PJsNf3ONueJvOqpoIJ9d0EUDxRct9Y71GEiMxTfplOq\r\nACNX+HhElD3UlkXIWHbqSfOlGju4yzwtFhGoQ6cayLbAF0VK7mnc/xJY3U5Y\r\n1C4y/WqpHHffqoC1rKa1mdF2bsvWP61N+0av7ImIFVqR1CN4Apa5iWcqC+eO\r\nfTS+yvhbIYWYUVeFBrahdNp6WEMMnN4GVpM=\r\n=yYGv\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230110204151-484e449.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/0475d26f19ee4f0b19878fe1010bfbff/graphql-hive-client-0.22.0-alpha-20230110204151-484e449.tgz","_integrity":"sha512-5wy39/pOgkjjExSD5ZMkPKqeL6UvHlmArNPDQtC6+0i6nRuRzWxlkJX2GBTUCSi34tXy1b+GrVKGDM3VulvD6w==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230110204151-484e449_1673383346472_0.4686851377815535","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230110204809-64c6a96":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230110204809-64c6a96","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230110204809-64c6a96","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"7430f7be1cbb8f41644ec8f0ba0d65677b81c8db","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230110204809-64c6a96.tgz","fileCount":60,"integrity":"sha512-YZBpUWt7rR94yP+J9K6UdJ4APXcMf+TMzKz4MwMREsxMsmpcqAhRQCGlKdbnt3HjvE8bqfdhPeTWjuzqPWQsaQ==","signatures":[{"sig":"MEQCID5hIgaWxNmLMfgFy4sy2eCSFwi0rpNvcAWQvXG6ONdFAiAEPmEIu+XWYtXRv5n5yq92nhaykQXzybo4dBtSkWHiUQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvc8sACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpWsw/7B8cUPEe1prcjp0v2xZ8dJxN94IvKYCIg7+8DmeOlad4VGWz5\r\ncOxQU5J9jN9kb4wFNX2i3yoQTjLwP8rkY9OHwUaQqCoJblOGfwV1ylmSgBB2\r\nKvrDIj/969a5hYl/SAAWwsP2LwuXTKfjuLLUZuJMoccJApIa9zzJvFSrBLAM\r\n8cIwbJE6RWE+8sjwv6NHHYv+dhFM7h8YaF5WbZtS9bSTGYv9PPuZbpg60D1D\r\nnJSJWlbBRLeEcrP0O4i2/bXTBqjMpkuWNc84A7JH/QvGuW1rtm6ElABISi0+\r\njO79Necpt0kwsQhuhHWPHHAwDe03LyGwbOSZPD+OxVjKEPBGWMscfiN1m5eX\r\ncHPhjYdpchYkaHNGA8c30mEGCp6uYYuUGLOrvTgjWKsWw9aDz3g0IhG88jvo\r\nFtBH27Oip03NavJNQEG+vtV2VBjidrBZ4LYAza5B6ZA6zpFPMLI7k9oX1Q0F\r\n6zTXq4yN52c/OfLKPiw9qtFNlxbfmItt6uumiipEQZxixJgkp0jSvwuH92pl\r\nrexCeQ5MxUJ2wpmNjZ9oirPLK9gtwwrRkSu6drbfaxfC4vJiaxd4h81rak2r\r\no66H1oauHEp22T/QsMUTfa5Fq8TolSN0EXp1q++lVEv7RPHPYhXJuBXGvtnZ\r\nTF+07uwEupLTqh+3ybD7BI399hytW0IhXOw=\r\n=9sng\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230110204809-64c6a96.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/1914597cb9530dfd2c9b14f37404565c/graphql-hive-client-0.22.0-alpha-20230110204809-64c6a96.tgz","_integrity":"sha512-YZBpUWt7rR94yP+J9K6UdJ4APXcMf+TMzKz4MwMREsxMsmpcqAhRQCGlKdbnt3HjvE8bqfdhPeTWjuzqPWQsaQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230110204809-64c6a96_1673383724253_0.7180226928152511","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230110205315-b622230":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230110205315-b622230","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230110205315-b622230","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"81ebebeb58b7ed311e5fb9a49703b2bf2bbbfbf8","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230110205315-b622230.tgz","fileCount":60,"integrity":"sha512-0JugAAjL5nbP9R3q/euPLhXfBvYe6utmqfUuwsH8j6ZQ7u+mHpsO2qAFseFSZdskXWapCUP15VvXafFjuyND0w==","signatures":[{"sig":"MEUCIGWdJiZ6ISSGocG2WmeAcLD+3agYwEdy8LtIrUIvlrnOAiEAgHaD3s1B5RCp+2tZ27OTGu0MouY+gIpNfdhMmUz2yK8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvdBeACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqryA//WuB5S0FQNPfoapjkHFGVyLi8XbnlBkgsMqq0C5NOM+XV/wcE\r\ndPG+DMvZe49xh70olY+1izKxK80Lv+fMKV0XZFnTQaikviUGoapqN1oHynE1\r\njQNc3GL8gi9v5ujv+3Mdb2gQ05XwsrfNLzsFNBV43EPADRNQkFNIyADJKZNJ\r\nPuFMlQpFuqwHh6DfPwWx3OpdB8ZuNXE/9BG9Fq5rCEJhcKaslrv42HX7VpmW\r\n7LPOdPJzoDXp+L2u7V6DmnufTIcsSFrlHg+AbQfuuNlKF2KW66pX6j1SMR5K\r\nhONuUM2IXcAuBVo1YUebpb03gq8+HfPm/JfFlk02fUU6q69gkCckINJqfdsf\r\nyuso8NZrEu2KRnUYp7KNfZjaU256ln84eDZ371ysXgw7mPDd6X77Ezw/lljf\r\n0cNa7Df3MlpJbhsbFYkTIJ8oZRDDxFNXzKiYLlLQcgWT6TUnEY/Mq2/V4OVC\r\nz1059RnOpVB6jNpUwruXDjHoYoDE5UQx3YdpeiyUwCy9J8yQ2bCdO8WxqNRq\r\nnZ5dR8ZgtgdLXweqtLoceVnXCdBw1187z/ebxIniqLhebii4xr0ZODl//pW0\r\n+aW1E6HGjHRqL/9O7z347YLXcKm9pmyuN2UGt1w/tjjIEbsE7H20QzmXmHTv\r\nihPfPFgRSXRUPclo/g7wDc7hlBSvxhGIzDQ=\r\n=cpdA\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230110205315-b622230.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/c122520bf445252b4404c4b645394c6b/graphql-hive-client-0.22.0-alpha-20230110205315-b622230.tgz","_integrity":"sha512-0JugAAjL5nbP9R3q/euPLhXfBvYe6utmqfUuwsH8j6ZQ7u+mHpsO2qAFseFSZdskXWapCUP15VvXafFjuyND0w==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230110205315-b622230_1673384030526_0.8644104383703624","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230110210325-c9b102c":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230110210325-c9b102c","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230110210325-c9b102c","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"7705da5c20dbf7f4cfcbf6e290e4162a03bc15f0","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230110210325-c9b102c.tgz","fileCount":60,"integrity":"sha512-YFVR2mr/9DmRGXohRRQNUwwyDqhaDBXKQ5kKYbeguXyHg57BpHNsxFT4TQAYVlhAKpR++IobNhJgHptezU47qQ==","signatures":[{"sig":"MEQCIG38xuNR/nXB7lxRYXhl0D4ufXvbU0klpVP391hyhW2jAiBXMRgn/4WN4VLfCd6euT/2L54Gj5Mn50fnLf+wIp3lkQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvdLAACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqIQg/+LVKqAYJqicqE+gUtT/hXNUNTdbMdfqMqYvi2koFbHJ2FudUD\r\nTd40x4yypVPYTJwF9mBnsM7mO86iBofq2Vewuo6BhjckwobPUuy4gOF2lqFm\r\n7ZttZcQJO9Z32yaKskv4rizjJAHvRkJieONZLliuXKAZW3RBRC5UzQomx97x\r\nzSUcaC7YIB051WJF54LWZIM02VLG+dykmJ/hEkPu34tX/wkJZ02StmKSiRiU\r\nP7KBhDRzZE2JxO8p1SygNnUZsmbsAQgD/zgi/kb4QNmKvi3816sX77j22bKx\r\nJQcZ4b44sk4D5JS/AJ8eGRXwLkuQ322mbkX2HqyMzZPPV1m7gblRhxs4zCwG\r\ntav5eATh8VDbuYgzJ5o6C+E6y7qybGLaJDreOSkG2DjeG/036UpeBSWQbIHm\r\nNmks4FE6kjF/ZB4vhUN7RSNNd/kwqK3TuovcHTMmzj9+s47h84s1dzoyn2cn\r\nw2GaZ8JrMfzXy4IDfS5Chzvoqz4+Zw4tcQefd4l6OcSu2AkI1MjaUHdQoiNA\r\nK6bR+MRKsRviEecS3I2XLMaR7frAJZ2wwur7Lou2zHvmlboiaz7pfzosyUBj\r\n1TSo3lSYdzuJipPgp9iSCMzLsjpN2QaQmbY2jZAfgPXwe68Wh1o8cROa7cJL\r\nnZAr9CBK2zC85YrsL3wtS+60mlaHarBKmo0=\r\n=8iYu\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230110210325-c9b102c.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/d1c4a7325dcb50e9e1178dafedd40167/graphql-hive-client-0.22.0-alpha-20230110210325-c9b102c.tgz","_integrity":"sha512-YFVR2mr/9DmRGXohRRQNUwwyDqhaDBXKQ5kKYbeguXyHg57BpHNsxFT4TQAYVlhAKpR++IobNhJgHptezU47qQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230110210325-c9b102c_1673384640239_0.6128314324219901","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230110210851-0a9f206":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230110210851-0a9f206","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230110210851-0a9f206","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"31c6b1812d90f50469133f2ebf7691adcaf4c27b","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230110210851-0a9f206.tgz","fileCount":60,"integrity":"sha512-DYCN1hnO4bpBLSkat9GVamjhgwKmAmKc/bGt080BFohhYoaLswXaNPKiaSAtV3QE7B3y+oQHCcc5jFPG9umQCg==","signatures":[{"sig":"MEUCIDz9E5I90BSlRr211F6cMMX1OpHmPQxolcdkXYNJNTwTAiEA6dsR+NpquBeghD+FBtqLaD7yIdLrAuak5qw0/JdQEgo=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvdQHACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr/vg//Xoo0Wl2W/2VreRYwX6llNfKqoXrDFmroWyEv6IcrJvB/K3AJ\r\n2tf3mkbfIW6/7jDNAWu62ePKT6b+wWu2vh14cW5DTLk0P4GQrG9uV3N7Ng/w\r\nyq3Y8aq5WR3199FQgX3jshjgONNg8O7p8/c0okcMRkT5GhTGgKb6v6BmoIDM\r\ny2syGuD8yOT57mUt9IO7nNxKWYsHAv32tB7QhBKJKrl2floHDNrcMhJ06Q+X\r\nxcDQBphvypKyt41Be9Q4vPMyAIA+wQx1uizlkGOI/OMIWM8kJunkt7hhV4vN\r\nKQuICFouFJNDMT/EhLJKCZyIcAvksYxmZy86UflGKAFF4YQxIX3pyFT/TVM9\r\nCLC9qW+7rOISguyW4yHo7b0plzM0Dp2Pnklr5n+oIpg7/HYF2x4KwfiRXtHZ\r\nJA9c51E+bEa8r7sAvPkgBDQD7k0bWzMKd7VZuD9w9ZoavtVIj0GZ58jSwKaK\r\n0W98LQQQQsJFdu7eEudNtLOsiq3bc4Z4WlKEYHzDCXCFDBv49Ge+z2q226WR\r\nWn899l4tC1GsPjIaHTZStPSDkz+B1JW2k7bswPWQyT8bg+wevoDywZJW6NCB\r\nYXd27kof2FvTDOpS92vgxSSpPVebiqZA8BgDUx9F14SA1QrvIK1Z6fM6K1Gk\r\ngncW7k6Iip02/jG39o7woZVup2Mpsk80X98=\r\n=cK1n\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230110210851-0a9f206.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/cfd514c46c29c790d3bdb016d6a09199/graphql-hive-client-0.22.0-alpha-20230110210851-0a9f206.tgz","_integrity":"sha512-DYCN1hnO4bpBLSkat9GVamjhgwKmAmKc/bGt080BFohhYoaLswXaNPKiaSAtV3QE7B3y+oQHCcc5jFPG9umQCg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230110210851-0a9f206_1673384967383_0.5252715916228778","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230111002210-90f084e":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230111002210-90f084e","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230111002210-90f084e","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"cd4a8228ba45fea993d95add8b9edbc722b6ea35","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230111002210-90f084e.tgz","fileCount":60,"integrity":"sha512-U/nDX3h16ymUAo901Z7Gco2I5B63FGpCNke0oxgZ9es8yVOxkHkKVyxubwWPlkWhvuukH7hamHzjAVNTqxZfJw==","signatures":[{"sig":"MEUCIQChiiXC/xicK10wM0XDYYQII38Am7lB+ltHcY0iKjjNPQIgPIGrN6Gy5cWgw7RkD8vrpVeU79ZLlH9UnCjED5L+n/g=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvgFVACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrVyA//TbunPUBJGJmxQSNTjPuV2qvuvQ/Impx7RnoAKTSq+P/XslF/\r\nonKRT/LlHrsEYBkPbmNmi+YIY+siDspXNbvxNQQc+QdyBkX5hEYGhMEUVErz\r\nXEACx9UW2PTScIQQJ+a+mNZZrQ2a5puz9nZgxh10A9FSKbQfMbF1uW6bKaft\r\nw0geLzENef0oDIVHOW6TcdKOlh6153JfuxUhSaSnZ5qioOl5CF3WN4bw/h5r\r\nDU/Nqxnd4jsieHRgXm06eLk+RdYrJLLPTw/2MFcc+eJjOhNjoZCgORhRpX7b\r\n8pbOw+2175c45DzZuZyUMhhjkMorLGpGDY/0PnT745lPKdNhjhGJddFJaM45\r\nwdRbF+o7DM4cyDWOZeDsB8PMjO8cAVfxhObX7yI2SJnxql41FJ4Kgybm9knb\r\nkgpLE+7Jt2om8p9edWmFeHrtRMJOcGY+F7bQtH77hAsJSTbMTI0Jc1DzaBX+\r\nkD5hFt/mf3a41RhB89ewcEH4bUsVu9CZYuIQzy0kDcT/YOT2UTmpfdIRUqrM\r\nOy2e+HByZa23Kjl8/O4MciDSk4L/9UstXI7kn1wjIqf0wl342PXo6KFQwqxd\r\nCLpsQ9nTGvGKnG6S/pF6PI9BE7nE3Hkr5KJDZTWpbUA+z+uF+SnlMdefQf6/\r\nlgTt9rVYlH4mD9WAi44wdtla83ithJvsMAo=\r\n=Fu/1\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230111002210-90f084e.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/a938a11ed1c6f1bca7e5fd1f049244af/graphql-hive-client-0.22.0-alpha-20230111002210-90f084e.tgz","_integrity":"sha512-U/nDX3h16ymUAo901Z7Gco2I5B63FGpCNke0oxgZ9es8yVOxkHkKVyxubwWPlkWhvuukH7hamHzjAVNTqxZfJw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230111002210-90f084e_1673396564916_0.15758782827785045","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230111002811-0c0e592":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230111002811-0c0e592","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230111002811-0c0e592","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"13faefe2259ac7e6098214fa305c66bbd53c6ddf","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230111002811-0c0e592.tgz","fileCount":60,"integrity":"sha512-bsHD1krWWL2OL6oDVavON9DZe8Dqfb774yK6td+HNw66DRx9efszmf24Ps7eO3igRnRhRqepMtkIGAzQ1ekhWA==","signatures":[{"sig":"MEYCIQC5mH7bDLzCRXUjvOkFDfGtvNztdkWqmnr3XS1pqQMCOwIhALa4lHrD6MrHjfXCnSYSR9dUWQaGHkF4e3yvQkW/Z630","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvgLKACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp8OBAAlPGTpbbOiP6jZSACVJ+nZswr2HB3sDq9JDmZaD1ldh9xo3Yg\r\nfaVOKnW2ISsX9YSWa/GkM11LNZTc+agSnZssn/JcMVrv44KT0wt14QcqtV3Y\r\n+JCFSOsmDeXQcKE3Hh8ymcpCEQKIhrl7qg5fHnvTBU5trHIVEMXA1URcQqU9\r\nf0aai7vZglSTfZYJau0onefftLphA8qHmSP5YE1F9DOTNqns9zl7Trdo/Vb8\r\nIqVxcMqIkXYEmzcYqzPFtYgZBWVcK7eYups33ifQjFdOOzPk8BtUbHIc3Qk+\r\nUnAHaY3FIj03vUUAS3TaWSCpIZlKcUTlhXeMla7tA334bGcJvfHqZ5xta7I5\r\nFiPemZM7xNF7+Id67RzqMxGoCtkaj3l+tWWIfMtb7IU3YTxEjbJPISrJEcZR\r\nhAJwRzznHNXQthqW8vvWrY3u0I+pc6uD8aSwuNhIwl6AcYKCvTQnUHPzkbVy\r\nQiaTEL8xpWt9QF/dEfYlmdqLMXAf30gTgHpaBBZZ6bC/nbF6cgkR2/I4jzeY\r\nZQ5nlEdmLf+lE2oDSE/wzC65/RIkihTCXs2y0rwd5BIj73mIYr3dlM5g7Zjk\r\nZo1BtRL74gBRYkTmiVVBlRQqt0EgGR5YLjUe4VvozFKUvAcp1PuHxw4WMo0t\r\n588UlhYJ4sLbBiSk2q1wRS3In8dR8f174vo=\r\n=zMmh\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230111002811-0c0e592.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/4524e6a3af293b9b9f76094d4d0312ca/graphql-hive-client-0.22.0-alpha-20230111002811-0c0e592.tgz","_integrity":"sha512-bsHD1krWWL2OL6oDVavON9DZe8Dqfb774yK6td+HNw66DRx9efszmf24Ps7eO3igRnRhRqepMtkIGAzQ1ekhWA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230111002811-0c0e592_1673396938229_0.5696090783333014","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230111084211-d37acf8":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230111084211-d37acf8","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230111084211-d37acf8","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"d65ff4448fea8663aca878bbc6d5cbf4bd75be5b","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230111084211-d37acf8.tgz","fileCount":60,"integrity":"sha512-EYH5jlXNR6jYJbqB8JLnTnD4D7XGokY4Y83YeULTY3idr2EjJ5YdQJPFvWUKsxBJYEmoIOU1XfOQfKMGTmxmbA==","signatures":[{"sig":"MEYCIQDWru4E7b+9GEx3dpzcQwVFuw5NW49oXDkH7BU5wtPyYQIhANF7HDX4bRkaq/izyjTsQrxN1qcIy5xZ3dWSrIw0Pdjk","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvnaFACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp1oQ//Yi1vv0DypMUWUNZhn9U3rM5qRfYDYsjg2A5kP/ydCZaKD4nA\r\nh0f17GJez6hqAqMYOfzWOsa5KktdM7cycB3IdJZYjQP+ACs6MyvSRniScX8/\r\nlIiN3trj8q5Hi9nfnC8W7o4QJ7bleEoCJOuLaCJE4kqExLDapRP88zBoZIkZ\r\nsfDU0B2F/btNu9a/+wJDLzUdYojlYAwhgzCjNTqSMoHMy5YZDp/8AdEAHdm0\r\nU4hAt95zKGGrAiBaKryA1llxXV3cCCJLYf8Sv831V291blxqkABmne2DqhzP\r\nSUdDnjEhU3iM9urqedbig/KbKsj37BYHy5Toxq0cvzJ8RSLrU0OeHV1uSF8X\r\njwUuQeBW7ZrEBn+FF3U7Yt1L+qERKhKCnBvOlaIkpo9QafBHpGHpF+E4QbTd\r\nGXBsKa6GTU8IO2bv/PPUrieFy3svVzU9qvtjH999RQmKkZIKhvRAyRl+YmMU\r\nQFMoWE7R7T7eYxBGSTZkHuEQAhi09Ar5U4k0zCJw68mw+4geARKXS1UBbPvO\r\nWbGfTPIT+CBUECMRtPsc2LeAnAlzY7v0ppV3dW4Q9OGWw1QPl6glhgx7A/GY\r\n2CcLAB2wAJXYQseOUMd1vj2tkcpqJh32COdUKJEesxAOuULvs75gy6K0dfaX\r\n94xf+yfiwnhkXMY+wncB2HRCFpzmG7G9LCY=\r\n=qhmt\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230111084211-d37acf8.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/4415d955e46974d635725352aed67962/graphql-hive-client-0.22.0-alpha-20230111084211-d37acf8.tgz","_integrity":"sha512-EYH5jlXNR6jYJbqB8JLnTnD4D7XGokY4Y83YeULTY3idr2EjJ5YdQJPFvWUKsxBJYEmoIOU1XfOQfKMGTmxmbA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230111084211-d37acf8_1673426565106_0.6607700689681033","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230111092159-c92ac3e":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230111092159-c92ac3e","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230111092159-c92ac3e","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"903eb00c34f6f223dc80dd98f77a96c0fa7c5745","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230111092159-c92ac3e.tgz","fileCount":60,"integrity":"sha512-fVj3lmZMro1iUTfKbBpsUvhud2sG2+NL4wypdPnfCp+3NmM7rjt8enLDjpefp+7GDH3X1C7QElpVvHJ14pofXA==","signatures":[{"sig":"MEQCIC2BdSI4W8Qnop2ESe4SaXDzClX03jpZqNNIlfiU+PDvAiBKK0Qr3DoTC0dNvZWciXgktM9KwjE8jy5NyW4MFxoRJA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvn/aACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoZxRAAo7g8jBM+9qiNoDZMxLL0BWOMxUrstNL7dO99lHyPDAF6kth7\r\nGnYTPmtXQqx006L5hsnq2vuhZPG2ENVLew87tuZNWyhApXVYDYnCaCgQHPJa\r\nW1CmlK3+CKZiH3Lj6m678WFhW1brZaWZVMJWPOWIboqNsmRLRiFkAKRRiH+V\r\nDIzadqyCYvrW5TezhnczMwAxpxsp5E+tVDVzBHln+jrsyQolhQ63aYfNhNXy\r\niQE4wZ4XuHaHZ7e7gYNTZ0R+S43Bgd8rhuO7ggnuQjlyWwayLXKMCX4m3d37\r\nD1oQkfttUBEia3maRKvHC8DSmh3arXuoeTAqVncIdW9zi0lzKwX+/8s//LwS\r\nGYzGemZ37/TmTy0k2ZqYZ8UPetJOfKES9J/sdSmxzlRvppV9WXqpf548jinH\r\nZlcpIUUQRg/Cg+IwvgiGFDGEJbRgKbp+y+X+F9BfkPjDR6VvhgLUEZzcFZK9\r\nYVDRxVmrb0XaAorSzjr+/7/oEpFSBX5OaMK3ZtiijuWXrz4j1eF0ua4HEk8b\r\nEJImj6qUXkWtdeVd3dW9wCGXKAHlFR4m6Y+1CxVKa8bb9EULerhX/REAgAo0\r\nD62zi3DYXX5O9qStHT5QZCDpZv0xE8B7uGfNeqGN2Df0Rsh3fBptk8FdWd8E\r\n570FLAM6e7gfwN4MpksN27UPlLW2phUJ284=\r\n=IcLL\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230111092159-c92ac3e.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/863fbebeb6da48ca089a25700485c7bd/graphql-hive-client-0.22.0-alpha-20230111092159-c92ac3e.tgz","_integrity":"sha512-fVj3lmZMro1iUTfKbBpsUvhud2sG2+NL4wypdPnfCp+3NmM7rjt8enLDjpefp+7GDH3X1C7QElpVvHJ14pofXA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230111092159-c92ac3e_1673428954553_0.2988496718674971","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230111101416-7663df5":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230111101416-7663df5","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230111101416-7663df5","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"8ae05411bb4665c93ef24f351cc832706c40ea10","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230111101416-7663df5.tgz","fileCount":60,"integrity":"sha512-ilNJ+D+gNfEcP67QzM5/SctzajD0XylBTSmymJ3tJGyrKX7PAG9I8QBKwiZcmnG+p31CGt+9l0RbVv8sY2it1A==","signatures":[{"sig":"MEQCIDtJ+n2U7MjaV7RbHSwZItArbfWK5sYf53V6xu8W8gQFAiB5fZ4DAf1iwtIqjQUyd8O11LDK3PkHJaFUJYmy8W9/HQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvowbACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmolsg/8DPjy9+ZBAL10Z6zSRmq8grkUVEOLYzZ8ZhPB5O8QcPaxh295\r\nmO2k9sgud3ciLT/oz3zBityG6kAHUp8e+m/4Bw2bvl7spxbmGWRk0wlemRBK\r\nN1kP8TFHujUwk4zsfFXdOP8NUWhLm62vVznMuCYz0mKHim90ZfOX1TXPT7L5\r\nXJZQmNmE2NdXbd0ccjHFxjS6AmH+sS641/Qd/+6/WBAaG2AMpR5ClV3tv2TM\r\nLcS5alVyUv6Kg2y10GUp9xuBXd50fbN0RAApEX2ClESjFHdtwrU8+DnSimBg\r\nWEUNKVYaKtoOkoMYFK2NGcxnzkBpqvwxRdsGQ2hmZV/Y5bre/4ANTY4isdvV\r\nOvo+V6uuUH/MGEA6BZqwRkIHhGRGonB4XXzuXf4pOFBMphPuaG2SHYzoulXL\r\nM4/WGZFDeQGi8b0fJM7C/X2IV8AXUIMmCetAXjqvXEieF1GuiZFtMIzEKybT\r\ns007jYAMnK+eZT1J5gc+7hunr8icd1umCIkS8ErscEADe/DDFwcrPwYgTRMo\r\nSIxHQanOiyJxlaITmVxo5gWbw/Ne+6edy4JVDMscKHlyV4x8qlM5r2DmZf5T\r\nddqlVj2OjwbsUeRdkg5m1Up7XiaW0ELsbOeg9+dfoc77PYEgBoXccrkq7fj/\r\nRjWkQehybL/jG9jX1dbOMFWfcu5Bp7fEJHw=\r\n=BQgN\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230111101416-7663df5.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/6639ab1bad28221857e9580e292c77d7/graphql-hive-client-0.22.0-alpha-20230111101416-7663df5.tgz","_integrity":"sha512-ilNJ+D+gNfEcP67QzM5/SctzajD0XylBTSmymJ3tJGyrKX7PAG9I8QBKwiZcmnG+p31CGt+9l0RbVv8sY2it1A==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230111101416-7663df5_1673432090849_0.7987653577050953","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230111101824-476ab85":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230111101824-476ab85","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230111101824-476ab85","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"c9f6a4a61b31f22df8a7605a4829a75f82d351ff","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230111101824-476ab85.tgz","fileCount":60,"integrity":"sha512-xgBHYCV43krC3vJ8CHIM3S1PQQtLwnRjJIjcD/+4DqPjgnUbYVwAc/iC1W+uOmuebdmZvuPCz5/iBNw1rAXYxA==","signatures":[{"sig":"MEQCICoRrsVdiOPgaEESSD50LKsjG61y93gcz3l52G8P/pLhAiADLxQtHoIKjIw3sQY4KEgJm8EzpjlZrSF/KnIbb4iqwA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvo0SACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrmCQ//UesWsHRpVgHlWTFirL6r2Op6cQExB3SAOxyiKrasoBf0KVVt\r\nSomy8cTIvDmsk2GlO7OYpi3p4WFJT78z7QuUU9EVGoH6aA6OqIq6erfbSPz/\r\nUHwW5pkG6PYpwVJ948hKVtFjzTzbZBPi57RJZ6jzPLsl70nfpX5GijpSgUDQ\r\nvEsaC9ddGvyFWMowDZQJGX4Lq/udCoULOzgSVH6s558FIjbXP5JdSYk/UOB0\r\nyeAcBE9G78sT9eU2EWqdcKqCVhkdcUuLf+FLKD+6TdAbrTMCjfVyXjjzzJ7r\r\nWCEzmsiRDX2Ihjd0AuWqTEVcfi3OsE3bvH6f8iZaHZ81SUN5YLtgxISUo9a5\r\npeqwYl2vfPBYywZ/aCaVzpWOQMSrQPca737F+6+M2F/sn+C2Olq0s5uZSLqB\r\nZkp9FmyXlaFVdjxp68OfT0eZZvwMQn5zT9EfpHDJiGLCQ+x/Qt+ZnVRg2YQp\r\nosLLXnVK3vVSMQQGeixDO68/ItxS23OYnj2zA+T5TlYiPP7YvelAb5xluazy\r\nJw+k3DazyhEQcOwFfPh9qDAJzjaUDhF2r4W9zxb1JCSXGwakryel+T23ZxUk\r\nvMS1LJRNP5IvgH6jIzzGT6qsIlsHPUii+rmPONxwcBgEVKXtsBRfdM4qPNwW\r\nvIHD7TMEAC+8inrKUE2LAKYcTQuL5vEVdOw=\r\n=leMj\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230111101824-476ab85.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/c293467a8fbaf72c8d112bb9770b984b/graphql-hive-client-0.22.0-alpha-20230111101824-476ab85.tgz","_integrity":"sha512-xgBHYCV43krC3vJ8CHIM3S1PQQtLwnRjJIjcD/+4DqPjgnUbYVwAc/iC1W+uOmuebdmZvuPCz5/iBNw1rAXYxA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230111101824-476ab85_1673432338720_0.5630809785270547","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230111102130-8567955":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230111102130-8567955","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230111102130-8567955","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"80119e3b8507ebcc8f0feda2485d4c4bcba7847b","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230111102130-8567955.tgz","fileCount":60,"integrity":"sha512-cy0c3LsiLZyTW58YyZCA2Kt0ZPTi6oglIYvTNc/h55qJdH9ejJJll2aljWgY42rfTNS+M+dLnq/XO9RhH2/luQ==","signatures":[{"sig":"MEUCIQD8/cukbRwPQhB8qYsfKUnVJN33d6rji8bmY9A/kno04AIgNAqeCS2TeejO0ndVbtyebjA7NZcR9iuEGY+uAQd+iuQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvo3VACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrPPw/+NGb2P1G6ndsu4V62u7lAM48bEUJDGSY21ZU8a1iUqhIdr5h7\r\nkdD3lAR7zpohjMXmTCW5rGrzUQJ9s9tgsbQ3gcwkYa//hQZvOZi7iAnqJGiz\r\n4xyfOklMAtgWI580SU10tk0RDGT3gfVHXNGf19/6lbaTaJjYtgU0PcBPj6Kl\r\nhifIX7BV4ybairjhXkc2ebt4vLND0KBuDstY8Vho4T0tzDXwWpSxiRQgyBsr\r\nzebrSCntJOTOOtaGvhhnqR3sGPvornsu1vCW4M21scYHmMXjYvJBKPiLasYZ\r\nvieQ8zY3gwIwOne8fh9ILjXpWrFXj0o/rqvXY8Nq7l8zBCgiB+nbzLMDDenT\r\nbrW80sZA7TvqA+gKXT90I5WSQCmTiAFOAtWXIWG+qxbFkrDF+gdrYRVZ++ru\r\nKjPTLGUhUZ3J8/+dbMDmjXTYozeuBWh122rAxBBFzC0Gm0RgPvL6HV2wqgvk\r\nlP0HTHAYZcAvaCXS8s1UGO0Bj0ZfaxwoMsxXagGZS7J6pzJTDxCEk3OkCJ4a\r\nbwhykBXMQVHt+v3NHxxiKtgIHzufyH91QI45Fpt8ELQ+epjjpUGn8nbbaTjZ\r\nRlqLxAUnAI0Ndb8zzc3+t/xBToqdQIYsFhhTeM5MwnvlXWymBr8YqXhqRWuD\r\nBxdkP5A/tPSJT5aeFXjHggeLpHDXEIo2nOo=\r\n=JvYG\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230111102130-8567955.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/aa23be0197f888cfbfce9f4046b778c3/graphql-hive-client-0.22.0-alpha-20230111102130-8567955.tgz","_integrity":"sha512-cy0c3LsiLZyTW58YyZCA2Kt0ZPTi6oglIYvTNc/h55qJdH9ejJJll2aljWgY42rfTNS+M+dLnq/XO9RhH2/luQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230111102130-8567955_1673432533271_0.5389012709499357","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230111103636-c9fb80d":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230111103636-c9fb80d","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230111103636-c9fb80d","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"a1d935302239380e010d20cac94b7981b60eb075","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230111103636-c9fb80d.tgz","fileCount":60,"integrity":"sha512-5AI8FJ0LXZ5I1gBicc+o0Pa+RPepBK7KRvdIFHXoZxlrPUxdgbLllQMwegZOOxUyDnrab63kfH36Qx3eEL96Fw==","signatures":[{"sig":"MEQCIBO5CeOtRQGf8OCGZfRiDRJSGO5L2/7QBR7eqbhh44sfAiArzS3KkehabSfkx6gfgnfVZCc6yjx+y6lp9z1EBO17LA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvpFVACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoxDg//Sn7TyHkHLvEwWYQDuskauv+tV1fJzMBx+YN0JzZkVddxNprB\r\ntNU2Low6jPajSQ/NZiMUMu/8z4uFKGSRu/pAOt6g8/g0/YKLREIhPdr7RBHt\r\nBiwmK1apW4r/bKahinwLzNCnOpD+/O+uffR9O9XKcIaFQcAr4E/5MevjA70R\r\n0c37N1iqGQGEgfOWhyeaX8TMbgvRKYDwDw6hQO/UtxwSb2RmE+9dfEDqcSbe\r\nifgfkPUtRPt3GJaQady086rNyeiQp9aqGGwQ1dnvm/+QWIV0QFSyw0eFD67y\r\n0Fldsg/ja688PzeHOTyMIeA7JsHMs8z98N8XNIbcglyqMjICwZFlEbJbNnOP\r\nktRe/M9pimU7GBtbXOs/PrWBPA1l9oRtE5HtM3gQkEwXdcwidTsLEZndhbDL\r\n8i8hLpPP9/U0NgMPiKBHXouTnE9ppn5RwRlmEJrUsWx2MRq1x4YEG3IUdfsi\r\nrqJyLSVc4z9zcYNHIEIUg2l58RuOqwy1opiaJvt8nskx5COjYSbrVWkPeWCy\r\nFARNRw/082HsC4JhbWpmdHMCqYfodGS7NuIT2WO5M6dAfOXbG+1f2HrWYiyD\r\nx14mquTI0PPMOGmhYSM6S0fQV67+AF6L9klr2xTMmlFPNQsvrLM5UbAHcynK\r\n6VNc2KELiLXIwmk9Y0U1GTQZkoQFj028YzY=\r\n=sfLv\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230111103636-c9fb80d.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/070d4cb0f87dd4328f3b2f9c8954723f/graphql-hive-client-0.22.0-alpha-20230111103636-c9fb80d.tgz","_integrity":"sha512-5AI8FJ0LXZ5I1gBicc+o0Pa+RPepBK7KRvdIFHXoZxlrPUxdgbLllQMwegZOOxUyDnrab63kfH36Qx3eEL96Fw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230111103636-c9fb80d_1673433429657_0.644943093449551","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230111104604-0e52139":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230111104604-0e52139","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230111104604-0e52139","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"312c7cd0c42c67e22a8185dc82c7ad91188efea7","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230111104604-0e52139.tgz","fileCount":60,"integrity":"sha512-ebqjy76ThcDVFCt4HmuF+LiU24K1RPL/rqAxOIeRFcVYUgN3ZPYaUtR6OG//JwGZSQUO6jGtTMB2+rxsFRoRsw==","signatures":[{"sig":"MEUCIQC6qFiZjkjtpgtICjSJblZGoPeJHd7jXIKlajRoQi39SQIgcU31jpjxqtbQMhCgB0QDbmcwXfC7aBuselJjJ6KSQxk=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvpOcACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpoFA//aR9D5pNedrRsvEMAafqSHPp6C2hibG8NWMU/Y3bi2HUgdUr7\r\nbZalqYpYXDKc1V0pU8dI8yxyANZihC2I8+aC9C5OO8WeuR22pN0Y/rqINBcu\r\nK5UAmoUaigxdMY1evzoDLUE3tRbLyi9bcB6UmfZZyTyJVVHgo//I+Vpc58Z1\r\nsRNKSVmto1ELws5V3gLXWxEMbUXV/39zsq88312aLORFihBFAFmXzPXBGWPb\r\n3k0jI/Cn7riyENIZHXJXOywa5x7C/7rNkrGUd+eEd0JY3mIoFyR5x5r5iXtJ\r\n8tNTJIxf4lBI1XJY/ql2RKjqf1mpdjWJI93OEQ229brn1u2HPGyFZBiWPjGb\r\nJg4+pBozA7N3bLOkHbox2pxs+a2Izp8/BqWjv60IseWtzgSWFFSvSdegECeV\r\nD+aPhssMHPrsIFqYwmmGOV3Qna1Dy6F+Yxs1TVsDGtD35znWdHtGI3usLDuY\r\nLl1BF/s9U3b9DonFfIqmFzZDZvnJZ8az+HDycgDHoPNdj0VymNWeCb5V+GxW\r\nVD/y5xyGKGD02hGB5SHnwHhghlTuOOo08NcJJMLFrS2N4fv+Ne14hKfgDcAk\r\ndA6V5jiNAJP3ySG6vxGybNGeXSClaOIxMySmm5f2HIyPnqIL66pX9AhWTY/X\r\nv4Y4K1BuRfbxxJkHycHsqSJeKYLrnFRLLpE=\r\n=pfbV\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230111104604-0e52139.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/0ed8a70f57fee140bb653acbdf695c58/graphql-hive-client-0.22.0-alpha-20230111104604-0e52139.tgz","_integrity":"sha512-ebqjy76ThcDVFCt4HmuF+LiU24K1RPL/rqAxOIeRFcVYUgN3ZPYaUtR6OG//JwGZSQUO6jGtTMB2+rxsFRoRsw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230111104604-0e52139_1673434012609_0.6075566637784915","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230111105051-876c0d9":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230111105051-876c0d9","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230111105051-876c0d9","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"d7e7b15b6fd826db2bd303e10ff7344ebd390ec2","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230111105051-876c0d9.tgz","fileCount":60,"integrity":"sha512-DRB/0yTDAWV5pCfBqQlhFuL3wDOuKABRzmFIhvIPt1EiNHWm+IKumUfG1RNozkJNvr4hEpckExgNwiooI9JG+A==","signatures":[{"sig":"MEUCIBkJ5q/1XfFSl8dgHHMiIbPIZLDibuAKCqf0HFdRdMByAiEAneBzL8zk5mUCzXlvoUkVAg77iFTtokKdAa1RVN9caTs=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvpSxACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp0gg//ZPMiN8/6KFRVISfv6uvtmDGtubT//i707rwoDuvFFrIzcs2g\r\nxK3mvle94jip48nDlWh5UEKPT3rH0cbjJzz6a0q0QiJ1rtwTwOi/zuB8cX8y\r\nGws+lwngTSOypvyoFh299DAy/3wBCJkd9Yd0UbenUmWCgXi8PE3kduUd2fRG\r\n2G5PGEMgSrFMmrupBdQxzmibBqFqBHJwMa1oPshkHa/bwwXkovyEqc7HLltt\r\nELMTVhlxgiheUBoj9ta0ZEYaXf9TerR4Op5ejpY48j6DfY0QrKFU/WAQE4gr\r\n6aRiIxEgCvJ868R4tSLIp+vA/bAG3k6N3BPVyQ0FqHJC80ykufgkOJh+Bf/Y\r\nvG9OwHaHKYzMSwxceWjLhMg20T/ZHxmhAKYE0Ajz6dvEOnyXbVcz6ZWKhjYO\r\naRUV+y2FJw5N51Gf8OiYt9CewTd5Kc/pmCeTfzBcg3u/+oCrUrQx/JuhR7Zi\r\nhvZ95KzZWuKpVZvteeyFgEUooNC230BcfRbORmKRz+SbflGWMjdibCByCwOP\r\nEmpqFB1DhaDUvy2ZSLCRVMEAIVApS+NCxdA96H/H+SnBGe5o0DdxyIRr06Yz\r\nux9Ghw3JudwbT/cErGQIEP+yt23g4Dg2DCe6yL9nikqwSo1jZYSGjfqmyiw1\r\nm0v4eSj+p1MBsbU07lKVyolqJjVY7Y1t7Y8=\r\n=H0cG\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230111105051-876c0d9.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/996967af7ab54c7061bc2efd852900b4/graphql-hive-client-0.22.0-alpha-20230111105051-876c0d9.tgz","_integrity":"sha512-DRB/0yTDAWV5pCfBqQlhFuL3wDOuKABRzmFIhvIPt1EiNHWm+IKumUfG1RNozkJNvr4hEpckExgNwiooI9JG+A==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230111105051-876c0d9_1673434289079_0.6043285775982556","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230111105644-b35fa9b":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230111105644-b35fa9b","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230111105644-b35fa9b","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"e737885b8f2f5f66dbaa091f79e2b7efbcc0e1d4","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230111105644-b35fa9b.tgz","fileCount":60,"integrity":"sha512-hrMa1FR/LwdwFOZJj9kEnJ3JuRfCO9nrwjtjifwFgzQFBeY3hY/DCyUrnDg7VJTBHx5rPoLkHkHM3uSX8ERwLQ==","signatures":[{"sig":"MEUCIAXUwzIrq0CHtW8WkgIDFIPUr2GnHczusVtADu367Hu2AiEAgOM6GjAbzSv5tiRAMQ+M2BP0PoFhiGOFQpiOdaIH+EE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvpYSACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoOjw/9Gk8F7rnZaNo5p2atbI//t+Aetc26iKiA4Q1XYKCl4PZhzfF8\r\nyAlp2KE6F0s74Mh1MjOrRWmYGAEBQFKObRohUfI7dqcGiuwgmMQujQxNzNat\r\nH+IulDuK/uJVhbbjBVVwIyvBqsv0s4DEDm8bY5fuc6kzS6umpxHx44lcLA/4\r\ncvb1vBlWyXlLa26BpDcS3VyMA6+bdNxwQVxZErNrAa0ovtYD86ZvVaFgmyIG\r\nhvjX3N0HJyEa3qLbQaRizb26cnaUuugnpTx6teQUtwFP6/7gAhJt50XI1L+R\r\nkUnAPlfPFRGyYS4ic42jA8QrGWpagfdCCGgh0Q38gUqYdPX7nV4Hvmg1Fgcb\r\nhuaWF2OroegqkZKiv8ICrnGUmyoNhjXDWUVS4+e7R9aPZEQ+MLbeTTVFwCJK\r\nIlenXwY7PfP3EDg3uLL8KZ8VmiKi/YT1XoGfs7OGzay/kIvBZH8U0kx5gl8K\r\nKqsLsbNsAOsjTYPlGRW2Mj2yUCo6vO6kH8t6DzwjCzbQ0ffyTJtFQp72N4qV\r\nP+MOWlkE18rqub14d8nueoWD9KRuuMVD6AbdeR+j5efQlRRO/Z9XkH7zU4MB\r\nn51io0LnxA5cSb/+hoiKBKOZGoLsQ64lfDvQvFq29yYH4sGH3jU84ZooMYol\r\ngelU+N8sgT6oPduAAQZMFFUZI9OQ2Suzjv8=\r\n=mJRr\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230111105644-b35fa9b.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/268b6e7f1049642c94a2766468806650/graphql-hive-client-0.22.0-alpha-20230111105644-b35fa9b.tgz","_integrity":"sha512-hrMa1FR/LwdwFOZJj9kEnJ3JuRfCO9nrwjtjifwFgzQFBeY3hY/DCyUrnDg7VJTBHx5rPoLkHkHM3uSX8ERwLQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230111105644-b35fa9b_1673434642188_0.25508382012413944","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230111110136-6e95d3b":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230111110136-6e95d3b","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230111110136-6e95d3b","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"c5d678c7260f5a065c7c595f0028f201d69276c9","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230111110136-6e95d3b.tgz","fileCount":60,"integrity":"sha512-WhWQp8/xJQMRhnu9NzH4Rd4ZtT39Hw4iesKPbQZU0DHTsqZDDbG5vwm70JfTS934mOmtRRUNjhzlMSfesjK0Zg==","signatures":[{"sig":"MEUCIFJ9QT8/OTCaDCRRKhNaDM4XuGni+ZYkxrzKPGXQX9LYAiEAqfsUwDfRS5Xqk4HY/Vp5u3SJYN6+bPb1WBaOXNdR9uY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvpc0ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmohdw/+JS50WCgWFnTvHO04YUbCpHUI13iV4N8kzgT1sFzK56qYSvmD\r\nXzLXVUKODTzPcJVzv+KdOBuqs4Q5IVRC00la+IHhocDWqz1gE95MhtVOVb4z\r\na+oJjECJx1sHhWDDrwCWC8ys39jXGgREh2vaXLpCITaavth2MsX6WS+dS3hF\r\nPbCYbcp6vElMBdN92pqh5J9HY5Qmntq1+gdQH6LMWst2CUQrER/MYMjnZxmr\r\nX7KFFTqk2ehvb+gGvtbi4Rp+w7p2+O7B6tDau86Lcy83SWvAEQRvnflLURz3\r\nLa/3/HwY9ucRB6yCUcKEkIiPr8JhPAp7OHfEpRfX2SxphrRgIWRlY3bB0wzS\r\nqSUt0LWtOEpsbpin7zhuWHcipMUbKLMeAg88Xc0m8Ur5V/Uy1ewWCvfth/zZ\r\nojDZ5HbmN4N5oR+OJKipmSbr6DrUUfQQKxVerb7FAEGLUhy1uNIfxcnkySAl\r\nFxqjZhqvncxYTImf6kOm5dMzkjXRmtfmmZy6fUO02ZRRJep2jOk0uLLWgcUx\r\ngYlWbT/MePv0Bk5Yktby1SglBHrv8jNcITYGlMrJiaE9PAXFy9Fs1nGQs3UU\r\nVe3tYlLGrS/mzxBl+G0Wv2YrqczUJXrbifbW8nFaBEykS7bf7AJvUj86LWI0\r\nRMycmmUBmCGjXS2ND4RfUBNaJsLsF3j1i48=\r\n=sOuR\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230111110136-6e95d3b.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/1b963c48a755e78ced249043e052da4b/graphql-hive-client-0.22.0-alpha-20230111110136-6e95d3b.tgz","_integrity":"sha512-WhWQp8/xJQMRhnu9NzH4Rd4ZtT39Hw4iesKPbQZU0DHTsqZDDbG5vwm70JfTS934mOmtRRUNjhzlMSfesjK0Zg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230111110136-6e95d3b_1673434932494_0.3995858363407174","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230111110339-c9ab272":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230111110339-c9ab272","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230111110339-c9ab272","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"2f05cb3404b1323430b52f9248caf6287b07e9e9","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230111110339-c9ab272.tgz","fileCount":60,"integrity":"sha512-wMbUjOjpSAe5DBaQO0QG33drNzntDlIUOjb0zx0LSxzwMrwQgG7Lcljq6NM6FomVirKqRHEPZZy/lhpKAf1U7w==","signatures":[{"sig":"MEUCIFlWaKEmneNBm+aJ6I/KSz6rRvFNF3ZDeG1+rUz2Gi0LAiEAuJfZWxiWs8ntlVkC9bEdjBUcJoMKeNWcmbOhbQL86dw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvpeuACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoJMxAAmAdC04YvOj/ErBZzaQEy/rUdSpADqA8vvTBNu65kenJi2AlK\r\n82guOkw4V3NPaN/NF5ubi+4Y4IYv+qn1hPNBtXtsH/kLW7xt3DIYEUEcguen\r\n+PaKwSo13W7RuBRzQIwwxs8NPahN7QWI+LK87vqd1YidDwUxqRwh+usKkOnq\r\ncAt85aocDXngcISvBtwmcvbrG+qG2mY01eWXzGnkHqSzwP3/o6gg8KhQLQP9\r\n1oMUzHfNHmys3jxFQE/e2wg9g7RyRlJWdbnBRtNqgILSLI7VnNzkP7y0i7Ji\r\nJmtwfJI4/Z0F9Mo3TWZAjee+J+952pvxAFlhDYsIDZvjydhMvvRfnb7wouP2\r\nmdBC+XNwRmQ8OXcNGmT3oJKx/5K0EIMWuxN0fIwEkspOS2Ix3cEjm8z5/LvF\r\nnvAU1dolYlbRfuh40+wUeObpOk+5yZDkmDJU7wYChM2wvbwD/Y/+jSU0464L\r\nr6dl5NpOOZ5X/KmF35yQeVSRYznFCkmXEWs5LuXIz9eHFX8TxRKM/uk0vTac\r\ngtd8htx47Ca7CNVVfIDLvUmUfIwKbklWRjVU4pY/pXblRlLrGzUAeiOjuRy4\r\n5CgpK36l21w43EU6jvTsHA2I+AdOx4CegZnLu/yZYv+Sp8My7XdTVJCLt7kK\r\nqOmO0st1JoZHZA+65ASsoAIWBgIs3TwH83g=\r\n=dsI1\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230111110339-c9ab272.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/f5bc216f71625dfb49d06f3dcfacf1e6/graphql-hive-client-0.22.0-alpha-20230111110339-c9ab272.tgz","_integrity":"sha512-wMbUjOjpSAe5DBaQO0QG33drNzntDlIUOjb0zx0LSxzwMrwQgG7Lcljq6NM6FomVirKqRHEPZZy/lhpKAf1U7w==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230111110339-c9ab272_1673435053845_0.5426449695110009","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230111111329-295c9b5":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230111111329-295c9b5","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230111111329-295c9b5","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"5dbf0720da37860591503937b394dca8ed8ee8d2","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230111111329-295c9b5.tgz","fileCount":60,"integrity":"sha512-0SED0adMpWpTt6AHAEh7+jKJlhHDJAb+/aSeiOsP47gbK4OifpSUFlqIwQAXdHTtayHspc7ut5jSRwmreZaRPg==","signatures":[{"sig":"MEQCIDYRaeKSBC1SJ+OKY/otcg+QXQ7Xy/eF4PJVHOn1FbC0AiAazMQEUuB8/HHcn7iLp1CX43tsXIXE0R4xd55oqX/9Gw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvpoFACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmqdig//Yfrf6omHOrWg9E4R61Xjqr0B8xEgd4+Lix7u3SmyznM6Wd2Z\r\nLkwqWSaGXU49fBCLDZMEjOSwy38RiiU+7zyXpI0mGtxVrlUsf0z7kgnF+cbO\r\nik6WKVaYgv+zeLnguYWcBv3qmqRgtXX7DM4S+5vkTXBMoYQtpUgQNKP87iov\r\nvngM4q3hnAX7mArSYvuzkxhodqvoCLQyRMOzJXJZgbqDHz0kQI3oyw6JVBII\r\ne/9MoRqEfYcd+66VeWJgqURZRg1yMwAk2YV80+Vf/DWB9ZckJzc9BqBJZOyp\r\n06ovUcSwvxrSGa81CKdRG8u6maQvp4ULphb6a61TI4+axn+xkH1zo4pDncIy\r\nqExQ4/l/kjIqlcza+cEkWiVPDXh/lbw6oeSeWMyZV+0SoKmveOGBQ9c4xCd6\r\n29D84CBSEmCAoszkbQ4sRdxNAxdgBSgJfe3IF2FbFv1cmOZdnl+IareeQTAb\r\nNh3fmAHutdYMdT3qN25yxKUJ4Ww6jlGKOaYPVUf3yCY+y5hrqB5l0j8UFIpw\r\n9tsGGxPN72oGkI5kVpCMoeIg1LsPsIZes0lIGiJ9B8A+nBu9a4n+fs3SAdwb\r\nJuCnba/yxz7pdIFphy+TrZAdP52ObAz6o5j3UEvTsR4n0unw5h6Cxbx+orY8\r\nXMgXhAXWawxxeTnELBScAp4LF3L+XFo95S0=\r\n=9Y4g\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230111111329-295c9b5.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/9d83c20f4fda0c04d96d2c38853bd645/graphql-hive-client-0.22.0-alpha-20230111111329-295c9b5.tgz","_integrity":"sha512-0SED0adMpWpTt6AHAEh7+jKJlhHDJAb+/aSeiOsP47gbK4OifpSUFlqIwQAXdHTtayHspc7ut5jSRwmreZaRPg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230111111329-295c9b5_1673435653322_0.517066994535377","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230111111339-3e3077f":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230111111339-3e3077f","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230111111339-3e3077f","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"91cfc18122737e292ee32cefd0f0c7629d61b2ce","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230111111339-3e3077f.tgz","fileCount":60,"integrity":"sha512-680VQ1eEmpRxDYn5CNeBUvN61KM+Y/b0kSZduniucdBdRvG7GznTsnJNvRrc3u/o+SI0KSVDpYUszqF6tgjvKQ==","signatures":[{"sig":"MEYCIQDPEqlnGPLeL39JVOj1Ui+VfB0DYH9YL9ROxR4UhZ47vAIhAOitDAMNIjOaVbNHoVxRVM3J3eex+0qtR77r4mbyQora","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvpoPACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmrnig/9ExiFTtBtUO8x7qqYete25b0/3V7VaCQLLh4qxInxNfABer81\r\nX11ZP4GH4j9Lg5Tr9uwmD06UlUVVN/xLnatsQynGdAGp1PaKGeWyvXChqMbV\r\nqiBdkM19hwO5z1G0Jna1fJ4Z+5Af+gahtVW6t0IpcH99EM63TP+Btnaxfewc\r\nfAXa2lxt/9hl2rt4aKi/sBrj0jILtxrr2yDsS/Xe+G3WvbQlYf98ClTuldQZ\r\nih2keXf58Y5Au/lg+4DvY7okB9/auEIaVyanIhJ+E0hkn4d/XcBSA3DL1niG\r\nxlQRm+OZ5WSARa9Q/g6JO2clC6BwOxtY1TPaqD010o8ha3h1p7dyZsLqb7BW\r\nm/TqIl102nhLzgYe4kF/zqw9GRbf2Dw6LxRO9ZTibDFbHkY7hYzMdGRVe+O/\r\n5HulUURrIDfCBkqv6R/qir5/vkBQBoGdUx4gqARG2mzWK6RUqi9OApjVj7HB\r\ndfiMKwR6AqBZxGIMB2hqghcB0P3Vg07Vj0rKzILdq7WHEAFG1gvUQ1p304u9\r\nL7eqqBboY3LC9t3JLq6BYCrZZUVfiYH8T6PM41VKjlpL45DlmR5fZmQvxy/2\r\nVorxUfN1Tw1oIU0m6IsF0C2xXyIPHCi9mE6Ijq7858Q/graNbdlC68de6Lhr\r\nypYItkirfMurNc9WuFed0QYtUhCaL6SYbP8=\r\n=tMJJ\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230111111339-3e3077f.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/1ce5ac5f2ccf891111e53b1fb30079ff/graphql-hive-client-0.22.0-alpha-20230111111339-3e3077f.tgz","_integrity":"sha512-680VQ1eEmpRxDYn5CNeBUvN61KM+Y/b0kSZduniucdBdRvG7GznTsnJNvRrc3u/o+SI0KSVDpYUszqF6tgjvKQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230111111339-3e3077f_1673435663577_0.4224051196337322","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230111111758-a084ea4":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230111111758-a084ea4","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230111111758-a084ea4","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"42ff4aa40eab3d62de19319424fbb2e0058d5b41","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230111111758-a084ea4.tgz","fileCount":60,"integrity":"sha512-dSuWvnTI4cKWzluK5QJMZmVWUnsy3fOeFg9QDcfnQ0M3R3nPO3uksDZA2JQhaKh1PySxRTrT4zzu8riZNxS68Q==","signatures":[{"sig":"MEQCIDiGKHqKXPCMvBvQ7K2xmP0+kMLwrfzbOfF+UAJSU1UlAiA7N3TIEyMn3u/zQKKXHNvctUem9hcrf3ZsgO7LWPGZUA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvpsJACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoSZg//aJHHCCU5S2VeIFJz8zLL/3NFtvgO+J56MZLJ4IdeOPC0k5Kd\r\npBnW7ANACSDqczwUImgu6jWTeIsS8ZfY8lmuHsf7bJd6oGsw4omot8KYmf/C\r\nj6XscMZNMPSkhFk+wSw6vhHgqRyWkt+em6duzllnknnbQhHrBthRqUUZi+Ks\r\nrbl6ZbXBbHW8TnTWHvaDVjKA4lhiwVWIZOPfs4KwbrwuTFoNi0QY23/QTOSK\r\nUQDZq2o9k/OM6VFKDWx1D6BhXR09pNN4oBRNlEEvjCO9iTCrNxyXMWu9u3d0\r\nDUiNofTFxsaInc4vzOWE66UVQIgeYtVWV5eClvG2snQG89zDDeWC9CiqLqbB\r\nWN5NIAT1MYpsJ//x6lsdENfx/kTR2opcqJ9P0njQB7cq+KWMKIt18OW9XlrO\r\nlLvFeFDhOfr1mbmgaRMI2YpJ6o+VqDbXPC4ACPCPGBjSpzSwD/Oy0oX6agp/\r\nJ+7L5/6153U6g43fyeo5eo1RoGuKk+6U4h6XCktZ6Eq0JQAOQHoI+H/CQ0NC\r\nwwawrH+32jYQ4ex4B62htrv375H/ebWc5S+v8p7QvffrC7a1/WqEj3aZ8d9Z\r\n/iwGBdgOn44pP7nczb2Ca7tbQ0WwwVclQCQlSilKNStvlT0pfqEu7El7DzOJ\r\nsHk7EMkTB1Y5UCcH2aXNhVeWhlYrrKhm06o=\r\n=SwFs\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230111111758-a084ea4.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/2b9a2fc93fb26e6d977a367b08db9378/graphql-hive-client-0.22.0-alpha-20230111111758-a084ea4.tgz","_integrity":"sha512-dSuWvnTI4cKWzluK5QJMZmVWUnsy3fOeFg9QDcfnQ0M3R3nPO3uksDZA2JQhaKh1PySxRTrT4zzu8riZNxS68Q==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230111111758-a084ea4_1673435912830_0.19920754838881427","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230111111850-f470068":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230111111850-f470068","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230111111850-f470068","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"785639e275b1a2c9463b410128ad293d71f73d24","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230111111850-f470068.tgz","fileCount":60,"integrity":"sha512-oFmMFJbNShNr8fs1UF3qsRdJ9megn3sBuHqYhCzJ3rDN9adtbY7HbiQxQkpG7/vZXEbGEFvVdZXyc83ofahGWA==","signatures":[{"sig":"MEYCIQCi0mSLARAj9iRba/g7NZLAtWjTuPZRHR9YYuhVSA6xNQIhAN9PykoMBePN30nQumS7uqf5mE+aKAe9jyryjOuBn7Gm","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvps/ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoWwg/+Ly40NbYiMXY2XJlH0e8+7xPb1K8iAHH+mI3oizlgcuyE/2kt\r\n2xK1Awg2zczaqkr9ojq67y79BUXOv6H4naxucaYtQNv4RSf4OxIf2nKXy/lG\r\nnWfAkrtf+BBfnnQ3q2AQ2IFOyCQ8sfyKIYBZ3qVeU+WFcKXBtso+nV2Zd7Um\r\nggtn+fyr/ctK9/yPqAHABgU11Bdds/SglfQiYjzYEdr7OdShwm3VMi6RO2zR\r\nRl09neJUrA1wlYrnXRukrXoKRFpgrBd37nb4ZiY85NC/NIpmQQTNBqainskD\r\nrohGvmMCjqLmySfFhSeSIEZYdF7TRiZRHx1vxCTca7YDQNhTnBEqyY4fQ9H7\r\nRZ58+RKowxYFhD+N+b+y5JNEEc/FdnomCqAi4ZpKkW7lXdy8hIE2rLthH5Un\r\n8OZ0jMjrPWE6X9j+ydN0WFMgZjGuO/ajJRZRusa2GGTrgqI7IVx1r8LNuDYc\r\nlJtIQCUDLis+CYvSYJyjcvcTZ5Lmt2Nm/nz2mszLH+SCyy9+skc0ena7zXhO\r\nGeHvx8JtHo/mtSelb9eLGuSMVkXMcrYIKnlyyyBRGPQUc7rPWRep3eU4gl/Q\r\nGCBPuuhnWF6vEefI7DgCcghIRd2CyCRDsYHGXPpWOhTytd+p/La/HSFIlhh+\r\nDbGNkUA98zD5zdmSMhlt4PjyJIuZ2M6bLcc=\r\n=/tYS\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230111111850-f470068.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/8b8ba2917738018773f16a234fa4d3ba/graphql-hive-client-0.22.0-alpha-20230111111850-f470068.tgz","_integrity":"sha512-oFmMFJbNShNr8fs1UF3qsRdJ9megn3sBuHqYhCzJ3rDN9adtbY7HbiQxQkpG7/vZXEbGEFvVdZXyc83ofahGWA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230111111850-f470068_1673435966862_0.5428045759800857","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230111113243-86491b6":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230111113243-86491b6","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230111113243-86491b6","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"abdb091db56218bb148bbe4eb96696f85678be0b","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230111113243-86491b6.tgz","fileCount":60,"integrity":"sha512-DDx4kLY+XjaqReDTVHmflFMh5iYRsdkZEVdWwFiq7tdJrSNEXjD+xfG1fHzW6V8zSf5zRC9uriVlZJcp282KSQ==","signatures":[{"sig":"MEUCIAulYPFY13MvuKaX8eqTVG2vpsXjFmfPPn9nMTslwjKPAiEAjTw4ycf3WSMk4DrmckluY+2kHlIKEqhs2K6EJmUCuus=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":168424,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvp6AACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrtNg/8DYRuKpHrNBEIpk2d2bd0WjxmJD6znVWN8gI5IubmdzAN7RzE\r\nFAT2b/m5KcCaMSU7V5/NzbT+cGerrkC0sc7+gSE3lQhAaenBhjkz3ZWYNrf5\r\nszdmQCDrSjC8iKCng7Rjkq1IZtbdrMt1ah4VmTLvrhXyZ6w42ASYW7XULJ2f\r\nYcqGQpR311BKKaIbHGe80yySRuFV6pFGFdn756e3NcKW7IxubWOBoxNL/zjg\r\nwspQ7dQYbPjk8L9VN+yVGgDzqgEPrhCd+qhPKqh4eMmpYXwOOs147kbKUUDQ\r\nz8qBmAUjEaRvdjeSX/G/SEJ54CkCcP8X/D5E0PlMS+lpa2d/kh4HqI0fYNML\r\n2ZyEN7j08l0/FSkj3+tRhTqOz2Xes4zpSOYhsWZfgHivNc/GoRSlRh0ssaYg\r\nZACo+8GY9x+BvlX4b/q2xAesGb75SK24ZNeWhEkRhMUWnISAIOF9N1olywSg\r\nFcWa4tfqsv+cDz6ZcaSIiqYEyHLztYhMPPTklT5HUP19kmUEhE6v6+TF7g0g\r\noShseAzN4NWEsci4aKqVl+E8QEgbbMd/E3mJRDtLN3DS1mavihbf48+sThEl\r\nBusjecmzM+PQP/ic7gkEJmgPE9pRAn/XFj5iieg2r/Ae5P91duROtJwmnLaZ\r\nwu+N/lCFnX3Le3qt0sT2RHd5sFo16f5L+0E=\r\n=DOvM\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230111113243-86491b6.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/87317b3d2f2cdc55abdff5a52bf297ff/graphql-hive-client-0.22.0-alpha-20230111113243-86491b6.tgz","_integrity":"sha512-DDx4kLY+XjaqReDTVHmflFMh5iYRsdkZEVdWwFiq7tdJrSNEXjD+xfG1fHzW6V8zSf5zRC9uriVlZJcp282KSQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230111113243-86491b6_1673436800468_0.2011431140064488","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230111114041-d3203a2":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230111114041-d3203a2","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230111114041-d3203a2","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"59807e3f6ada17f639b89bf4e955e0f81de60c53","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230111114041-d3203a2.tgz","fileCount":60,"integrity":"sha512-Vf8zyBJa+MlNQjWGOZlc/fxTWLZn1vbnYUMwAOcbyS/Omhiwz9nbhOb3maoLY9o3fw6MSrGhZ8exlvf0vCIYjg==","signatures":[{"sig":"MEUCIFoHMr6vDJEPMNxP/RGjf6pcoleAPQymTPy3INqZ9qq+AiEA+2XNIUQjQYuP04N8O8pp7PRSTdRujAmqq0wPheq7iuE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvqBbACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqTDRAAndX7vKTjbfsqUAcyDA4V8YG8Ogt7sD3hR4rWR/p6Wmsfwr1y\r\nZWGGWDGjC4iwuE7QF4kpKBzHoq94nDUjpwFERk37ddsI5QKL/HhfPD2kVNvb\r\nnfH56sfS1bS+2Vh+5u4LispMPSXQDVaChZeRWXZ5IFRwrsTU0yWeit23opYV\r\n+AVaDh4ORDauvWCOrDkZXmRyOkXSEqcjIcpTzKkX3GmrGyaanVFuEHeCuVyt\r\nfyXWK+AfZpwUPAUSFcJad7jpq96XOaeGTyxS8+NzickNkC0v73zAkxeWur2i\r\nQYNo9m9tmwQREnq9/y/GXM0XwHlWdd/j02kCCjiHLLVz96v+bJtu4/wnw0CT\r\n/9y4TQF5cLPoskTRg2pCYBdiFjZlXj2gaFXUiuppaokXNkZEKDfawG0Lz8Sq\r\nYAMjAP1/O/P6s5kwrBGmq+p63ki8aENpo5q7bNe4Z6Vqyg7Jo93ac48KjfDs\r\nvs6hyXSn+5IzKQzA4RTpNZLJ/IwAd+XnM9sXeJa+Wn9fUz5w+Xxm7EOZQmj5\r\nt4lv7sDmQpDk0FwsaCInoKuR0KwzXSa9qvclKRqo3TnIPmRm9DuvGZv1PsfW\r\nUkRvKYTUuYWWPFFpe1qzkKGdjqDyhWK4wpnd3gcgdox7PHr1DrW2Mft7QdMw\r\ndJRY+1xsPi46YULw6VZIXvvNQE+uYjA9zU4=\r\n=msh6\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230111114041-d3203a2.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/8d2cb0f59a981e9709164cc6be9e18d4/graphql-hive-client-0.22.0-alpha-20230111114041-d3203a2.tgz","_integrity":"sha512-Vf8zyBJa+MlNQjWGOZlc/fxTWLZn1vbnYUMwAOcbyS/Omhiwz9nbhOb3maoLY9o3fw6MSrGhZ8exlvf0vCIYjg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230111114041-d3203a2_1673437275703_0.6648021333291765","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230111122500-0aedb08":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230111122500-0aedb08","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230111122500-0aedb08","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"71f23f63a1d01cadc8b0de160ac6d3cdcad7090a","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230111122500-0aedb08.tgz","fileCount":60,"integrity":"sha512-TbRZhntRuUNPBxVKABecZ7Uea+9jiYK7xQUsFz7LSNobhmetxTo0RDYs9bET58jdo4QcosrRxD1FC64vmprxug==","signatures":[{"sig":"MEYCIQDvBAFoczsksWX7AWOD/JcdKo9j18W1RA+o6qTjTZe1owIhAMrtVY89qe/HgewePb8PNlkumt92vaLZbq4HtNmGHw2K","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165664,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvqq/ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoCgxAAn1SqS5xLxGpMKBkZ0pdW0C5cGs5Z+UGS2jfkvZKc10KrmaYe\r\nKQMYrPJdA1l5/yWia5YOqX7g2Sd1ncTnfvP/XoxUfiKjKoator/nqZPHJvjx\r\n/3U+w+kC9whEGitkD5DAHFvwR3nylmeNQLFSuDVaMFLhkrY+sPHUubOzn0lI\r\n4lvE02Yrxiu7QfpNZxVPMw1Pjix0cH3m1tohCljm1GSwpdY00mgDs6FJxkWe\r\nlr731ogVI94bqBFJzuPpK0IYbS0CvI5DIqYsN6PG09kZex8hJZl1mgGvICsc\r\nARcFajL7jLQEfztg4Uqh7sgKUZZn5Ymg50bQMZqVXszAO35QxH/sYi22GJB6\r\nQnjHZjQu6sdssHBVaXjXAUWHld6TWM9CWh2IasUFjG7T2Pn2fs/WiMkZ93+t\r\n3GAOifgwd/7yEZ6YSfuCOspsRw0CaH1xjgri9HUemaZwpNPvvVUB4Sd93Yga\r\nbI9u3iazt6SJk89duP1x0xHARjD7a2XDARjnDMKm1mTF+Yz8ac3HT55aw/03\r\nJlAV9Hf8gII0F927nB5oLJy+trqepw7FClo/qINvL0wXe90G1PI2N88XhCj4\r\nW92jvzlrPBZK7uje878gg93hAeJQmamkWebBtLU3kr0dpyqb9pltFYshLc+S\r\n3jirsEkLNtvPJ7FVzy5sqvuzzTTeW+0ScvI=\r\n=hEhw\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230111122500-0aedb08.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/8d1a9aa9617fe4263bbf2897613f4d63/graphql-hive-client-0.22.0-alpha-20230111122500-0aedb08.tgz","_integrity":"sha512-TbRZhntRuUNPBxVKABecZ7Uea+9jiYK7xQUsFz7LSNobhmetxTo0RDYs9bET58jdo4QcosrRxD1FC64vmprxug==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230111122500-0aedb08_1673439935041_0.395723438578103","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230111130531-1067cdb":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230111130531-1067cdb","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230111130531-1067cdb","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"d02fd44fdb056fc3ab5d2216f48eaad3ca20685c","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230111130531-1067cdb.tgz","fileCount":60,"integrity":"sha512-eSjE8RRlJSdx70dK5WwT/2Occ+gHU+7KUxuwWA/RAFk6pySNb8uqR9U4YavJhvDzcJQfgujtDwKXFO0tNW8i0g==","signatures":[{"sig":"MEUCIQDnjDgysDvs8+XsTcVwkuwGQC/GfId8Vt0W6Vx44STjIQIgdGZsTTyZ2QRH+ducdgjtCclyCOaAslQhcSV+24Qk9/c=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvrQ/ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpVlRAAjxvY525qRR0Bt/CpR9kfYcQBTf9F5RHWCrp+fXyifwaRfkLq\r\n0nWfngjmgCq/fpTQxnxjNH7GDa1dMA4OM3IuMWBUDtI/i/SRostL8hszTxfM\r\n1UQS1Yy7Jvs0Uv/KSTkQqSJB8jviHB0qKR096Yc3fT+IAxEsVEBXPjneM20a\r\nRHTQrDDFg1xjWBS2LpJNpds2rEoozZqkAuSG5Lw4WoISPcPPx2PkALQJtr2m\r\n5QEa7I/fbp6R5tGtwFgBzuufRZp4JkxRw/LHruw38R5pd05iadsHXlNMN1xq\r\nwPqOho9dnl37CBU/H9EnpkNrOioWDGv99vGC/fc1561yyu5V0pFu9S5zENxd\r\n4O71ySH/TF1BbJPh5NTkpZGzxMAHpcNzKbLvGEHxyOvcklPRNckExLQQGrRX\r\nESWEpCuhe9CPNjNwEpOM0tnTR0UwkUTW5jmxX5vBkSghNhgPDrRqQPyisGfl\r\nVJ5Xd0OVga9GT1NphrfBCyYY6OJgUVIZSba4mHwhoAIMJSjUhHXsRYGMw/Rl\r\nn1uCgUM/TjiAbnBVM8oc2ky+Cs+ayNe73o/taGUH4/sdQ0lfdYxT7sFbBEtn\r\ntp58vHx28fgUOKo4QDCQ9CuhhD6pw2vQnDLC5y9GzlNhZamk2AJzAC2Wrrhi\r\nq3jALmRHGgU2tpBuzvbghYR9lc/112GuJKg=\r\n=uHij\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230111130531-1067cdb.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/5dad656dcd02caf05a373b2a13c34d19/graphql-hive-client-0.22.0-alpha-20230111130531-1067cdb.tgz","_integrity":"sha512-eSjE8RRlJSdx70dK5WwT/2Occ+gHU+7KUxuwWA/RAFk6pySNb8uqR9U4YavJhvDzcJQfgujtDwKXFO0tNW8i0g==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230111130531-1067cdb_1673442367120_0.4343387901827407","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230111131417-a3c9055":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230111131417-a3c9055","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230111131417-a3c9055","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"fddeddc8952eb345677a0f6e247b66107b4ae045","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230111131417-a3c9055.tgz","fileCount":60,"integrity":"sha512-ZEj2l+AI24XINriQLHJG8J4qnNXyRl3NkzlZaP0YJMmsPthS/E8/rQKcxZWQ+P92QfWV5h0f1E4iw3nV+ZG3ow==","signatures":[{"sig":"MEYCIQDYzE+4TAC8lSUHe15vin5VNO2Tb7CV2LP/Y7jx4GwGIQIhAIvNSnqjLV09xGOpc1VN2NhYEiJVg5Ky419rwk462gAU","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169566,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvrZTACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmopAg//armOeX38hn/F/0iZZE17323dnkNmBJngwZLS83arua8mQFXd\r\nkdXecbmEi4FpesxBR9KCamIkG5OXZrRkMifCVRRLc/x7vIOUPagd4WDsr7H2\r\nPNfUFw1BnppHkBGE5eFaPsPSH2Nacp3daGr2Jave8X/LsM12hAmEHUpTnUX5\r\nuIpc6pLvg+2VP9lrnGOIgDNwIutiH4g7cCkrYM97BqmxVWx+sMrSWmFlYqDu\r\ncojqirqmjitVDKlGupV0MNcrq++RpdNzRmaz/h55utc0Z1i9q0uG/z8jroMp\r\n7A8j1uZRoI+iDr+7MbxnTTb9iRlPmRbeET4YYA2ALMTLF7C6zKiKw3pOffX4\r\nRJWHOn5BPCdBMAzp+0n+xfZMCWBcfqWE1Ubc443dI5yTvDnvKDG/msseddX6\r\ng7AKGSzAQs/5JD1ogVsllIUGnF1z71ZihfV/+4SzW4IPQkFD3nPh2glP3gaU\r\nuioNLdj5sXtAE/46aNYsWdbilTd/l9UWBMfE/eA379bRo5X4xewp3N7kirek\r\nzD/FLox72854t2yOvlOmo5636E/MKpZ1eniZ/XcVfrhh9m94PmbnvaxSwH1w\r\nPdMoYmquN2BWZMXyh7H9IW/0LhFflbCDl4oh1cr+Q0E3GG6pkY7oq3L6lZ+G\r\n2PiZLLATkcLVATekQCpUPIlD6dcmIsfihAY=\r\n=+Pyz\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230111131417-a3c9055.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/5c1658e0e7584fcaacee34a75fccd21e/graphql-hive-client-0.22.0-alpha-20230111131417-a3c9055.tgz","_integrity":"sha512-ZEj2l+AI24XINriQLHJG8J4qnNXyRl3NkzlZaP0YJMmsPthS/E8/rQKcxZWQ+P92QfWV5h0f1E4iw3nV+ZG3ow==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230111131417-a3c9055_1673442898946_0.6939354498899759","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230111132355-d16b423":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230111132355-d16b423","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230111132355-d16b423","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"11e78bd37639d55c133d2088fdf6a7e12a05119e","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230111132355-d16b423.tgz","fileCount":60,"integrity":"sha512-1jr5cBBlzlZg1JVS/sC9TG/SiWzcxvQOK1Zg9H5AqtIXlEPun9KIdppRkGuq9UA46ahaMgtszSSC5gk8aHacNw==","signatures":[{"sig":"MEQCIDTFIskhcVApfZEkoOQX5QWO2Y6SKG7JaDHUGAh4j8iVAiB8NZAhHv+9iSKZTL3ZEkFKpx7CAE5BKwZNDivJLmW+sA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169562,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvriUACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmq53g/+IHyxINic0o0Yv/zIgG6MF5kiCuboL7ZN+h7Qfu1p8k3utAIm\r\nbz3TAWGngsDYJUzkVaBQj4DIy+OLYgd7sm/lwgeK+5Ox4TJXJuM4PZ05MNa/\r\nSg5YPAlY9TCoI6ysu5jv9hEYQBtOGFJQpjAMffqL7X0ujwvx78BL83aTU0i7\r\ng1lbwsIFmag9RzM/jJSPtP+fG3UjWF2z1CAKfbQCKTI/hev9gtKO24gSubxr\r\n1bLZZmG2mMzU+0Fi/GHEiBaAyIIXXZ4zVbw9ouEG/YEcJ4+Rw1iqZcyI5Zuj\r\nUcE3sbWD4Wo62F6nrS9iBWitsM3F/KbHb3n7GhPzo4pZpjI1iGaVqG8hysrY\r\n8SHnKY+rjjJ5yT5AiA++UZNqsHJQCMYZ+89Hyfq3LdknxnGqJv2xhZ0s0UF8\r\n6b/tiHLYhQhT1IjSI7uF9SFxNpBiity1yTOPpmQamcWv3jqrYK+ELneqrnpq\r\nzOPpZn0+xXCppF9Z5w5yprCvXy0fHA5nXs5m3gw99CgwSgHfdfK4Nis9sc+P\r\nYKjnoPdlD9ZeoarQ2U7NiLRfMNJQ3oovrCQlcjwRFbmb1GPBzAR1DfhWLX00\r\nodPlJBbWJ3e/6njOIEPSLfE0OrQ95OK+8/VYoBxeAixfMgNH0mhvc7u2nBh7\r\ntFB8NVGpxdOLInNxDuzylWymyR9k0qkpMfE=\r\n=Whal\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230111132355-d16b423.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/ee50ed5c84c7890f6461de97264fb76d/graphql-hive-client-0.22.0-alpha-20230111132355-d16b423.tgz","_integrity":"sha512-1jr5cBBlzlZg1JVS/sC9TG/SiWzcxvQOK1Zg9H5AqtIXlEPun9KIdppRkGuq9UA46ahaMgtszSSC5gk8aHacNw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230111132355-d16b423_1673443475844_0.9593648478214327","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230111140802-acb015d":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230111140802-acb015d","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230111140802-acb015d","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"2fc213602ef9bb0955e51c4f5cbc568523f4b4f8","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230111140802-acb015d.tgz","fileCount":60,"integrity":"sha512-9WKlFgJzJ1PoOhVM5pXVq24Mt1pv070TLU4whsVzxP0fFepcTTuOjWo9D8KXm8LDu3tWXLoYCOcLKtIJqGUQZA==","signatures":[{"sig":"MEUCICbiGiC5MTeQRi9I9lS1SY2Bf5htmJ8p4jtw5XrPRny+AiEAvi2xsEi984LPLi5KxySdKcJKe7fYWWnMXplxbBLpc0A=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165582,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvsLqACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrW0A/+NZ/q45YAnjuY8Y7SbnpXwCEGFMjMwhB4Ik6DqRMkzTWssbIb\r\nEfPOBU9Qymvd7KBZ2Os8JGT4U5I/hLBMTbdniNIyvmb+IBKGCwtr7UZPz/ha\r\nun5YD/GTc3zQ2neV/BMgFAbLKj/bJBp/CBNzaiimjcT71tiTC8f4DETWiITu\r\nUJkcPEzELRRWD6Omwff7jokJWexMhdz3jIlNfhpbPCiyNmCW44T4uUw2vG3d\r\nsKZE3liObxeWYpQ5IBMvx2dUGhT0pc2LuUe5NtMUUtW6ni3vefb0Qcp8GDF9\r\nMnKR3hFX1p6Ny2s5DG2TfueKRmsAiFCudZ/8qTA8txUZ/aUFoQR46TRx75K2\r\nxkyNIfMgg52bqAz1aTZVz4CYNRt+WkYHa6O5VJHIPsSdBfuwkXJ1TQTb8JNS\r\n59BMedcUr4pPa3yo0YSvdqyHbPu/IfgTLr/Bdqzl7Ny0/G2dmbZoTpkroxhT\r\nX0K1V4IPtOGjhdSklRKr2Hoe993ItL13APmQQQdXfmzNRl+J6MzTKlsaxAxW\r\ntroscy0W05x9P/8xwPDrUU+Nozp6R0rDjPLqK9s1OcjeK2bPBCYAMvlwHlL1\r\n76ARzV/KvHQoMeuKP269u1VXZ49HogUhT8roqYHdcE/EBkHhdvAK7aNk4yWN\r\nNM1bOH7r32h8gdZzbdvAB9NIcyNIWu/JOOE=\r\n=a5re\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230111140802-acb015d.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/8e2fc6632f6d298460c7c533fa10c29e/graphql-hive-client-0.22.0-alpha-20230111140802-acb015d.tgz","_integrity":"sha512-9WKlFgJzJ1PoOhVM5pXVq24Mt1pv070TLU4whsVzxP0fFepcTTuOjWo9D8KXm8LDu3tWXLoYCOcLKtIJqGUQZA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230111140802-acb015d_1673446121873_0.6288908370982118","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230111141059-415158b":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230111141059-415158b","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230111141059-415158b","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"d4b1e87fda3ae402d237dd045511df56f5bdaaf9","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230111141059-415158b.tgz","fileCount":60,"integrity":"sha512-FuW6KYL8Ckijai/8CmUyN3l32i53nR+ddAFMOfQ+3PyjHpDtRCKq32tDHInI6xPQhXyL0ujczNsVYQItB3nTog==","signatures":[{"sig":"MEQCIA0ks+r1ARW22+RforhkvNVyXUAcs0t2ahVUsV0cpHxSAiBbt0Tq9pIgcmis8Bfk139kvxLgCZuuXSCGsrxtjiP0Yg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":165664,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvsOWACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpKRw//aVCuAncDH8re9dOmloVh+BOCX6p7w8MStv5SOPh1FRsXi0fA\r\njbswUN0NdVIypKWNrKb3m5WYzwQmt/4n3ip2kJ5mH0szh/xDvSDnfSftzPma\r\nq7mK8KLfUXc3Rcvw1I8EcJotk3x6H3LpKaovod+NdJcv+JyDhDcJRxBsCyhG\r\nB8hfnvxol4gfgQ1hSYC4I45ibKUkXWyErRuMwrwNIIy3sLKiN7hOV783jbOg\r\nMKdHA+v11cSRcI2A6lyisEE8SMNE2uncPtiHPjpzFQcXcwb4Ewohmu69JzK7\r\n3hNso7eqDxiV4gQzkEiKlXDD0sve9HLrgZ1PKvDmhcFjHZy2x7TeJ3d7iB3I\r\nJb+9BDxNWqnENg3m60Sr4ofjASxwatDSDrY+pcbIGllO/Id7vcFCYbILcihV\r\naWxASVkgknm1qMvzbM2dwXL4eIhkchVDXAaAv7fsjgcGpZuQpv/l8ETSBLf5\r\nIfXKsfJst0yYp5ZB8JRE+BwwXq6VmQzv9D7w8prxHNWhn+Lk8SMI5lD2xPOi\r\n0iG7CXV5XYivAhYnPQo3F5uNgME/jgpEvy1mz1G89FgasGD+cEPfDviTLQjo\r\nvwGO6BLXsxVpMSV07x2TrmX7sxI2XyEFm4HIR+vxKna28nuMT2EyAdosTR53\r\nDu8t+m4LpzCXNh7NIt0/j97ZJ1U3QIHArUk=\r\n=JTW7\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230111141059-415158b.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/91de17c1fcf0568363bbc520e7cc1c37/graphql-hive-client-0.22.0-alpha-20230111141059-415158b.tgz","_integrity":"sha512-FuW6KYL8Ckijai/8CmUyN3l32i53nR+ddAFMOfQ+3PyjHpDtRCKq32tDHInI6xPQhXyL0ujczNsVYQItB3nTog==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230111141059-415158b_1673446294605_0.1560320539365163","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230111142649-da13515":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230111142649-da13515","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230111142649-da13515","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"74e6fb04edfe0dc655b3c044cf58edeaa9848338","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230111142649-da13515.tgz","fileCount":60,"integrity":"sha512-8KxYlOhCGLffkX7VFfS23FzOs/JITZMihJ2xms3gj3FqXNPyajQuCKCakgYv+nx+ZdkF4NIxKZ6f91Ci43+B9A==","signatures":[{"sig":"MEUCICja7n3dtCrCHBrVx72kRhSyb60P0Zw1fzldnQEZPVWdAiEAwhJ91iQmT4kMH9vrduFgVhYL0tUTUhubBoKP92wWyT4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169562,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvsdMACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoOMg//XShK2Dt2FJTZbjeXgsZKrjsAr8NEvCAYnCB74imYIua9L3lD\r\nBF3zHA1fMvozUHaeDXJXNZsDr0G8mwyLauU52YU1M9ezW2lcoA5dqV3k3KyA\r\nLhGxdnqazsUA7EbrajlMHzipMgRTBViTbeAGDVhFK/lMpEfpKa+1ybvpE7lf\r\nWSqSI/7/v5gD2w+CzHGZwnXvQywDGx8AhNGnjq4PcOvxte9kKmt6b5WbSWod\r\ny5fqZRN2cVneVYeQe5Xrs8cTmLVBN6l64SAzmN+3Ua5gm6UtnW8ZdW3WOMcv\r\n5hpVSAMt8rJV+KSHaV4wwCSllk0oUnp8OOWetWGdGTk6fOYdLFUekJDt1DBB\r\nfxdE2DiqfLUgeDagnZlZVNTGCzH9htbjP1FbuzLkvtHzlOXSGpnZByC0o0yj\r\nJTLa/K+PE7gtCdlod2pXN1UzGOwueMu8MmXi5TAeR1RK9GYWwna9hT8FZZDn\r\nKtbSd/MOosz0UJ1eq50RG4lWL0C0xmUZT5cZnozw5N8RbSoSlrx2KGnnZlrH\r\nZ60GsgfjJA1yuv1GH/nObloQstyzX0ld6au6TOtcVhIDHcGvawMrC8kXBvBl\r\nv4zkw9K6nQxQs1UxlqX2x9WHZ7teTwokx+PismTirsOHqkfvnigHRCec8xQj\r\n2ZXL7ti9xi5PdSL7P6a633G0fy0gEjqS2Aw=\r\n=FwBu\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230111142649-da13515.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/4fab94813b1937de43c1098c0144fe8a/graphql-hive-client-0.22.0-alpha-20230111142649-da13515.tgz","_integrity":"sha512-8KxYlOhCGLffkX7VFfS23FzOs/JITZMihJ2xms3gj3FqXNPyajQuCKCakgYv+nx+ZdkF4NIxKZ6f91Ci43+B9A==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230111142649-da13515_1673447244278_0.2623597958086994","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230111142852-6d03000":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230111142852-6d03000","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230111142852-6d03000","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"6fc07760c0f7ccfdeefbc55cceaf2ceae6adcb6a","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230111142852-6d03000.tgz","fileCount":60,"integrity":"sha512-1Ev6T3YWQUHii4mW9s663S26HEuGrxybXvF4l2FQV/oRxzAU6ypsMilDa2dbQJSgwQo8QynC+oPmmYcXnFDRHQ==","signatures":[{"sig":"MEQCIF37tRTktseIKa4t/x2au2x0mziNqOEiEfG6lWe+GVtdAiBa5WJH5QgpOc4dThNe/IurSFjo82KaZJcqOgIUXKtk5A==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvsfSACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqcNxAAmb7qmm/zg00Qdu4V9skcuH8odN2EkiVjVtuohTCPVbq1I4yf\r\nAo7YpSDjS69t7puepp58IgUxvwdJ4PHbBmhjerypDBzOchKN2zAcDBRAlswf\r\nZ5TIbAeq3h9geRV/Xwird5SYcfkJElKTFqjJdClJVIsjoxHK2R6wXnzxWvnv\r\nRxzGWWEyK5CVtSH3qw0ygwCI2QgOC+iTPH3iZnpj3KJD9EgcwW4Yu0AksC29\r\nVKYeHKo0ofby4bXtt8+eLKEgrC11iP4YmvpARy3epOr7FIOvkYTHcocUKAlg\r\nFirMOin+nQNxm+8QUbk351F5iXfobBeCGir69Lr/JdL2+RS4YK10mzzgSs2i\r\nFPInh5kxAoLjleGVpcWmygxS7rzO88dv8H5V1b6JpSYigkBG+6C1J+2nd7bU\r\nBaLMz4be7w+eyjunibTiogKtqe59sqIqrjvLl1VMSMWuOY1JDJWiQsIsqMhw\r\nO11Owbb+DsLfn6FJCeJk1zLsTErER4Y/om1MWitKUx/whuH/HceU4y6H8vuv\r\nEkkIwXst7MKoE8sCgiRdnCyheLDcWQj4JlhgJ0uPSj65aZhsfFosbjnM0pDP\r\nTTM8onNTmuEqdWbE8BZ3JBEO6yUVuRCtBl35WBXlh0ZUgMN5gJXEBo0YjQMS\r\nDBb2EJI4ugpsrT6DNphG+JIc+xR1Q/JjuoQ=\r\n=G7bV\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230111142852-6d03000.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/44fbb4868adb6aa5eeb72ab75ad3466c/graphql-hive-client-0.22.0-alpha-20230111142852-6d03000.tgz","_integrity":"sha512-1Ev6T3YWQUHii4mW9s663S26HEuGrxybXvF4l2FQV/oRxzAU6ypsMilDa2dbQJSgwQo8QynC+oPmmYcXnFDRHQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230111142852-6d03000_1673447378133_0.5196206569704911","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230111143717-be2d5fa":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230111143717-be2d5fa","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230111143717-be2d5fa","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"c8d6e7ca3d964fe9a961ec5f72641e0cb8100887","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230111143717-be2d5fa.tgz","fileCount":60,"integrity":"sha512-rxB58+61sPMtgDoob4TfSoIpvXaFMUOMOhVfLDIoQJEDfW7ZmzCJQVVYKYa0Kmed4Mf6BzF4khsLBbdnOURj9g==","signatures":[{"sig":"MEQCIA84v3uk4+3K8L2evd0TdC4KbYSsO99KfZftmYYk9uwKAiBZEuNQX+frG627rCmjUp049lUwPTe9xQ4slD25HXdwUA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169562,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvsnJACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmohHw//St7Kn0YngaGsO8sD7ioFoT/27KOzQ3iqGSafXihZH9ZV81b2\r\nBnIcyCwrP/XF8WMwLkp5r72P/Fz+tUaZ3hGmJXlI/p7bhz9Zmb/4kdiswz4S\r\njJ7ZtBvCOZk7b0YLfgTuVwpFy7GRrwR568S5ILI4F/NiLUvgGBv2JvS+ghPN\r\n22YNtJH5Ay6yRt6Dj6yIp/JZL9r2FrPPzES/RDPsWJfnNuSoaIbNFCN9r/Jn\r\n6Cfqmm9fk3emYJ9NF8AfyXU/IpqgoDXwffpXHmeKrzH2le4z2B8nek7csgK5\r\nle8U0ur0D4IiLyFdmOeMhE77BCmIZBFpuN7JwXl5QzEqBGYYW53cfpiLKis7\r\nlMnjWtxaeRZ+e+zXM/E7AadJ+aR2Ami+WVPOz7P3+7AkCQZevDSQ8KBC3JrI\r\ntIFyyzn8TuK0ORc6d/oZ/EKcWdoAsAoFEwA++uTG0TVS0jnTmE6/6a7jDHUF\r\nYuxq1z4w6KELcHLWbnwpUIlPT2EPECzd614aERrC834V4TktGrTM0bd8rrBi\r\nOipl83h6ZmpukwN5XK3m2/uMu3Xuc1rxJAqieCA+cT1nNjNSPALrCxBR66hz\r\n+KD0GkaEFpNyBiRMGL2mD/Qk606LVMxFwMg6oZETCEUIuk3Xe4tGvPCoSnst\r\np4Uxa8jwW2z7x2U3hm5tl8uQR8sVmRcT1Jw=\r\n=3Yqy\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230111143717-be2d5fa.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/97c44769fa18c253a2af71a45d2f333e/graphql-hive-client-0.22.0-alpha-20230111143717-be2d5fa.tgz","_integrity":"sha512-rxB58+61sPMtgDoob4TfSoIpvXaFMUOMOhVfLDIoQJEDfW7ZmzCJQVVYKYa0Kmed4Mf6BzF4khsLBbdnOURj9g==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230111143717-be2d5fa_1673447881399_0.4045262414160602","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230111144210-f90f154":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230111144210-f90f154","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230111144210-f90f154","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"c25ad9cffd1d3f31f18ec3a6c97e59cf4580168c","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230111144210-f90f154.tgz","fileCount":60,"integrity":"sha512-UANLnNtjqB/xjI3aM9lIyrCkgAD41LjHtiwmIs90nqdGwUmhU5VbrdMLWSJRY+BwbZsF9a+nSHRi+Ws+uduRJw==","signatures":[{"sig":"MEUCICbVp0ebV1+SugTnojdB7waRblKhN0LMPca5PRhhIqakAiEAgsr7woprLVYBYHzQgkO9p3H++fI+rtZeo+O5JTGaZ8o=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169562,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvsrpACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmq+aQ//fPVpSna2gWVAY+aUSSaK1LjaA9+ZdDG92b/y7f6HKsGegs+J\r\n4TNZpD9pPKkPyv4Yw/OW7gJJGf6Xt9MzcXDgQNbBWl38L/OVV3dObZ1dOzdO\r\naKXoCJigkJXRdpy8W/b93xT5gdiJURDNOzkvDlhPYbicdEni3M1p5ICvnXnu\r\nWX17TwQcJxlLWUWISe6YczeDyxBM6qFAERSB+1WK0UDGlFVVzo80Xh3RBK8J\r\n/b/7dZVjZgPRRtaU0887mJ7an207VVPq5xkyszDijb9o56/UULgEiW6d92N4\r\nTR5IfmnpDthu5SokvFQCfNnjH/NRnrFdIMk0r5ZGmFgRTDQ1Oxt4BM8Q70/q\r\nkFwuoRSimoCQQVxPh1QD9s/EwgrzGlQZLjIDH3Rx9Rml6GmST8BFHEHhQBaS\r\n6hyojfELzJMuwDMTJpX/tafIvMrwVNpsHZq7iINTkUbHwMC2rXKbphClI/JI\r\nQof5eY9twGSHdMw1CcTuVy93kzV/DwcJ9ujYy2AQhA/3VKreU7VWniXH0gWZ\r\nJXQz6qjYEUbcrD0DeotUf8UpgxTmyOJ9dw7I6gwDKHzirj19ZPh0UnKP+Qj5\r\ncRLmV6cLfhodZzLrPt0fBuF9vXhSWlUJZv8KDsUiz1QkX0ehplZZuXD5Xli4\r\nUcY+BvTzC1E2oAIcCQF7pF3nfyZmu98njd0=\r\n=1Uo5\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230111144210-f90f154.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/35e97303943380b868d8c68562257f58/graphql-hive-client-0.22.0-alpha-20230111144210-f90f154.tgz","_integrity":"sha512-UANLnNtjqB/xjI3aM9lIyrCkgAD41LjHtiwmIs90nqdGwUmhU5VbrdMLWSJRY+BwbZsF9a+nSHRi+Ws+uduRJw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230111144210-f90f154_1673448169150_0.912941129104675","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230111144718-e755fb4":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230111144718-e755fb4","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230111144718-e755fb4","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"d90ce84a409a0113e59a28da3f8eb084e576aecc","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230111144718-e755fb4.tgz","fileCount":60,"integrity":"sha512-hZarUbX+M4kKsW/YbUcvz18mLjKzYd316vSd5UjjSUu+tv8w788tqrnmcjJp1yrZFYEkwzMvvbAbHEG8Zkb3Ug==","signatures":[{"sig":"MEUCIQC5+WrOo3aBVp4wuP/UCa7ok10609tvcDijwCrP0/2NIQIgLlthyufvVInEzmA6gzYkVTAjerJcHJ9gScxqZOJKcC4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169562,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvswZACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmppSg/+JKhx+0CHlvknyrYrp65sLECwxvTl3c776PYAiDFA9G85vNKi\r\nlOJk7/kyV7wYYN8mnMteTxAsHsz5zlZw4O+qD+bC8JtDzDec6WhmOb7c5Ocv\r\n+FYnLv6EExb45jtrvzYrSe6d+HcfGfblLepTWyRG6TAAFsALQpjrounopR+H\r\ne1a+qUAIdKeomvOningfFtoe4nlPO/XjsA3KOykjrfjqueT1o3iQRaftqBMA\r\n3hfXmz+4NSiHgfJiixTYubMBNOWg8Yk1PrWyhkwfT+HdkH/p2TQFqjMvgHrp\r\n5wV++QZXOsLKvo5lPfC7K7Vhy9RwGJJEEIuBd56n5HoymxmvY288m0fxGQtS\r\nCB/2ied2+UyJyEiKh+CoUtKpslmHqGGSSoudvy+MDVbPw2PnOUfN0WzsNdga\r\n7xgK1IreR1Z++7zuCVY3HsTHzjWLmSA4+HGV0c7lrgaL+6vadOZS72dGJEGs\r\nSd032+NQUOnW9Z8VqTeQO1d5fGhyPzUWYYqc+u2yeHap+1/dp0aYREzjpRY4\r\nPnE7TkjUtBEiw/c2QzYm0k+ousY42x34uJ43MSILUJVFCURRwkdHEtmP0xzL\r\nX7mU08J8u04twMBitmzvtehoiTCBvb4hCAZ1LGll+EX5xXYV7IG7OPeTD9JK\r\nZiAkQoCWXWFmEW5fWuW+8/THkEUECyJBn30=\r\n=yw4B\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230111144718-e755fb4.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/3f37b975b12c779c2c4e898a99e82ec2/graphql-hive-client-0.22.0-alpha-20230111144718-e755fb4.tgz","_integrity":"sha512-hZarUbX+M4kKsW/YbUcvz18mLjKzYd316vSd5UjjSUu+tv8w788tqrnmcjJp1yrZFYEkwzMvvbAbHEG8Zkb3Ug==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230111144718-e755fb4_1673448473001_0.9639945821960039","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230111145251-6b927a0":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230111145251-6b927a0","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230111145251-6b927a0","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"5b00823c2545191f80a10f470c9ec22772bbf160","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230111145251-6b927a0.tgz","fileCount":60,"integrity":"sha512-VjVNYoU+DEFZ5XyUQo7G31hkvnuoO7b5k5N6QKr0usYGQJS75K60WV43a16eW4EfKyitDGq6xqPyfXm8YKQLSw==","signatures":[{"sig":"MEYCIQCmkd9x3EXnT2ZsYPiHikzaQW8JIIUi6AkI/oy2cHuGDwIhAPDm1ZMOc13bX5oUWEsgQ+YflbghCEDiDivoZ9wtML9z","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169562,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvs1yACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrDzA/8CgE9Vx9WbinfM8jG/7m9PUkY1tVXOdrS+DJLU4i2Xc2dWhfH\r\nx32rdjUxx7yp6CxJ3uMljmVX7DTubCzfP/LhO/LXgeWhVvE96BWNNriH+CbJ\r\nDmia4nKAAahEqrLDiEoYnhAQ0dcF/e38P4NsbMYd8D5NGZ5uVVJ2SaMdXnrf\r\nmu7/CbzQuYAd2va4HjZNodiCQq5RFOP0x8XCEs1XhxfHEQTAzb8egEPGbKGY\r\n2veLEjBbPJZvbIlmZ5cNISgrJxOhadsYNNpf1lZTRYk7DBBjHex4cpGbDYDN\r\n8xqHupgzAbF4dVC0LtOfFSv3DpsX1z1dj2NfH7hxMYhbu7cB89oAz4yVEmcN\r\nw6HK6gQp4hc64ClT14MaMO6bLATqHH8PbRy1U10bOV4l6GxFabYBTqE8AJNo\r\nfivjs9Md86l+iqrfKQ1MlX/pD1u7HsF8VQzI+UcCMTZZYwREn8WQDHpc/7s1\r\nNr7kiZ+xPQfIqAkyYMpP3EiXkL1GLRouNOJMk/YqI/YZgVvwP9w4dGQLXiZY\r\nuwSxa2vAQIpvciHU5pgk7jN9c6fAZZ2f/xIzv6XQ2lYqo7DhJLDSvv/yfjZU\r\nUc46BpCEjBocjnkmale8NIhNxzq3RowMtxnXY30m6DujheRil7+8Uu9RjMZB\r\nLELdvoOBUTgG/131piRpGsRuhGpRaH9jsPw=\r\n=JR/Z\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230111145251-6b927a0.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/24d26f41c2cfeb398fc4f02d89ddb805/graphql-hive-client-0.22.0-alpha-20230111145251-6b927a0.tgz","_integrity":"sha512-VjVNYoU+DEFZ5XyUQo7G31hkvnuoO7b5k5N6QKr0usYGQJS75K60WV43a16eW4EfKyitDGq6xqPyfXm8YKQLSw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230111145251-6b927a0_1673448818538_0.06425510588834227","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230111145546-cb568ea":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230111145546-cb568ea","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230111145546-cb568ea","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"5989e9cbd31e9b3ee285a836c4c74dd920db2d6e","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230111145546-cb568ea.tgz","fileCount":60,"integrity":"sha512-GGFAy1aL5KI9WqTA+gVaSbsXa9/bNHkILpat2Gs9QDF+MGvnsYeFv7cRZIXITOm3vcwGYUiyAvsRcUGjIjK9Cw==","signatures":[{"sig":"MEYCIQDwxBEkpZIfEygi8bSgAG/7nT4R8V6RLnMTUyAnc4jorQIhAIq+FldkNxri/D4wPeklkdGuRLAWdteDdXFGHT9vmFEz","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169562,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvs4cACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmqn6Q/7BULYr5eGcnHUoySRAae9OGZ1fZrMJjinRvIJzGa6dw4vI33t\r\nulfyxtZvjGMCsKCimHX5zMI2zMYLHT+hmizY7WfRr1tNR3HptSLL4j591x32\r\n+qkIbZKg1QWRelBNHiA8r+OStsm8HgwsY15E29BTWzD+LLzAAlDPj6ER0TAt\r\nchrtLZefx8zvDxFohB+840BOlbXEblhYigA/QO3/ZPHTDA0n8UD4mWFPL3Mt\r\n6s9yfXLQq4iuQE7av3cS5dGS/ZeYk6jbxsaC0voACK4rWndc9ppMCGoF3Ydk\r\nvIijq0KCtpjao97CmEkfRNeurheKYmyrwv9SP/UPzatrnkzroYJyVbBRRzzX\r\nlSAZ6+6ZlKLQaNrZWTbmw0HAKzrr3Lwarg+25xikhyueITL+pIt4Hrly/MOS\r\n2XIGoQu3RESMk+lF4xURazQzz07IR3uzFAtIuVfQ/FvZTWJYkiRUmcTTUXPL\r\nSB/5Fh5tUT0maWUwa5ctPDjB9iwIeeldLgvs4V9BmtKvM72F+D/F6lcaJasI\r\nAAv+U7fZB2njNE6rT0o85nbmfZP+fCvgnOmhaR7SBSr99ButraQO6ZEdiF+s\r\nXfHqna8xXSFglIUAmOqU14qFT2mxE0jp1h4VKH6afeE49i+mtMBr6mM9Ohm9\r\n31snn91xErhSS4soVxZ6LCbREKxDYvT+uac=\r\n=cCsL\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230111145546-cb568ea.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/8d74f8a042939662f0ae21ab2295ad4a/graphql-hive-client-0.22.0-alpha-20230111145546-cb568ea.tgz","_integrity":"sha512-GGFAy1aL5KI9WqTA+gVaSbsXa9/bNHkILpat2Gs9QDF+MGvnsYeFv7cRZIXITOm3vcwGYUiyAvsRcUGjIjK9Cw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230111145546-cb568ea_1673448987786_0.7625124645219661","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230111150116-99309ab":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230111150116-99309ab","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230111150116-99309ab","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"cc9293fddc9c96076f74d9f341aa82d265f6de88","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230111150116-99309ab.tgz","fileCount":60,"integrity":"sha512-SrfEzKEbbF73+BvP6ucyN7Zb+/wtO/zyujRkKvv5nGgnjRTG5MRjHHYwj/o0bMTGFnY4MdmINMUUeXptVeCr8A==","signatures":[{"sig":"MEYCIQDTTmV5FOjexWuhwlCGEDR6hF9RbzagQRsYfLjcKAy3ugIhAK9jVGGzLwjRVPz6t/v/DaBMcvgEhVkMK8OUq9rj4KWR","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169562,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvs9hACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqMIQ/8D6M1Lm6XwqnZfVoUfh7H8CP+XhO+7x+Vr6OoBvKDUoiZzhug\r\nqmUIMtewSsd91vUdSf6eltCUqtD3VU9NuIDdAf9hVl9tUQNaNsL8aAtfXQEj\r\nlljJ+kGtmJx4smNRXIrcNA0eGaIWmhRtqmeBXEjua18+fTyLUTXJAuCcw6Ni\r\nO56RuFGIuKw9Mxr8zp/yxekrYZ0ovCr1+ahQfAM1I6hLIPqeA7SbV4GWm3L7\r\nzwRpSpaeLC2HF1gnF6plvQ8oYBr5pp5EOQzGxJFn1d5LeVKG7+OFEav62vlg\r\nFSNq/FNJKg+u8JJZ5CtZ+IFFf7q/ZVSwhX+TPmzKX7iLuL/P0hUafIyZfTdL\r\nQmfaHnON+uAL1+edd5xZH36lUUEvSCO0OsBhpWzq8MXs6+vFMLZxAfS5GFky\r\nr/ggTc2L1X6L166r/3GsI1KbAC7tvI6aRusokJVXv3btQyAKWIws5rfDfVUV\r\nGctU9W742J/tqzJLdKTxO8FexL30E0QzNYWSUYgpENnnC2fMBvTBmb5ZuzKq\r\nEqBp13acu/hHQS1EE76t5NM/AMz4p6lYWHc0WQ1wsEvNjL0UIGSmEHq4IOUQ\r\nHvoEpq6mEpl4MYfMQhRL4A0CP8uRktlAn3HGQKFUeNTmsPR+zxf1NZzqae22\r\nLgZCLLi7Eq6hqWUxxci2DPi9wSZ/pMdB7a4=\r\n=CZg7\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230111150116-99309ab.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/744b7e0db4a802233ad5d06a921d3b01/graphql-hive-client-0.22.0-alpha-20230111150116-99309ab.tgz","_integrity":"sha512-SrfEzKEbbF73+BvP6ucyN7Zb+/wtO/zyujRkKvv5nGgnjRTG5MRjHHYwj/o0bMTGFnY4MdmINMUUeXptVeCr8A==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230111150116-99309ab_1673449313749_0.8307422321613949","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230111150433-4aa503b":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230111150433-4aa503b","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230111150433-4aa503b","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"d8de02dceaf0802fb3b751112f08420a292e17b7","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230111150433-4aa503b.tgz","fileCount":60,"integrity":"sha512-6skBhkjeUx4jyuuoiY9NipaSeOKzJHzJTHDrh6c7glvfMAF1VlFQdAtdM+BBNzsosoeESPqtr4lprxl/O9YiFw==","signatures":[{"sig":"MEQCIHJltq4ellrC5uO25fbQ1nAOaIAgCoP08h0+gMF5X6WFAiBl5INdJ/p3g5UQS6iXgForbioszzVsb8PU3SdUS48Eaw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169562,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvtAsACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoY3A/+Nzx6UordmrpohyIj6SuFNqapGAGj7L9+GChDMiZzLs+6m6Qb\r\nsUTvJ+MjlmVtrxFIjhgFXo/jqQKkTKWcZl7cHjQDnYjCg+uYrLQNpMziPnt4\r\nWEgCzcoVme2jogXYBwxYW5r1iSWa1cvL3KgY3eAfv6s0WzvGxmzLcFrEtW7w\r\nY4ePg7bL5pjp/u3jeQ/HerSResYksZP6+FNnlgAjc2CP0LMdQ24nI7St9yNV\r\nTybU6zNElHQMdUU4oE/lL9W6tcrBB/foTrEnKY4Td8SxgKvC4iaJfnhYz9xf\r\nfCMJjTTQYQR8Usc5xIePUMznzPU++ShQg1E4w/4pqtKkKk0d57XUYdADIZJD\r\n9gvTxmO7F0UOwbF74DsMMt1fEiGxRyYLlEGk82rLYhLsBQQQYySL2i0Tgb5J\r\ngwDpP4RAHt12OQgR4wjoszXFAMyTKEe8ZYEykWptKFhR9rtE/d/JUauykBm8\r\nT1jT5wUqHtWxIjEQqGuCF5KqB+L2LZxzFfReATI2zId9RfS5y/1EvOaiBt2Q\r\nHsHW4QO6Yc+igiyMUkAWp4PGGZCWDzU9nHh9H6HeeaGANI7rVtMIABhQK31r\r\nuOaHTiYlsfXFe5XQv1pDtOVVdwlvn5tpd40uRS4dqWjmWuxbck3+80cXVtaR\r\njh2ayB+5bNulY6Ph2n5o/vyUZuVSzz1AurM=\r\n=QEK5\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230111150433-4aa503b.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/cae9fd772efe34941d03ad7d7781b7ac/graphql-hive-client-0.22.0-alpha-20230111150433-4aa503b.tgz","_integrity":"sha512-6skBhkjeUx4jyuuoiY9NipaSeOKzJHzJTHDrh6c7glvfMAF1VlFQdAtdM+BBNzsosoeESPqtr4lprxl/O9YiFw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230111150433-4aa503b_1673449516677_0.744455200421446","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230111150446-517b045":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230111150446-517b045","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230111150446-517b045","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"ff01923db50aa082b6e39468e632742f7ce386b0","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230111150446-517b045.tgz","fileCount":60,"integrity":"sha512-+YimkL95gqcnJjq6Yhmz1m4aovsbYhdK2H7NaA80rvfIoho8WpCs877tY4faLVreMDvTmcrH6BPNuiwSdGuIfg==","signatures":[{"sig":"MEQCIA8CzaYtO7DHoXAjmhivC+AagLX7DpuOyDUkJibs6tMvAiBLVDn/jo/bOrt7d4VQJLlNfPF1LxYh7sKdNaZvIxp8uQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169562,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvtA3ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqI7BAAgzPUASSyzFNyL9doZNWxEA8pZd/Ff0KRaMYP66+MgsOFYq3P\r\nwYy1c/6vpIut9gLPUt5VhVbKgC7ychjXxkXzJObEH0PaaB8GotmHXGxcwBWF\r\n0v+lwW5DovMskgGW9ySQ0eqKEzCEjfh0wbM4Omx1nIwxhr8vzS3HF0OlA8xQ\r\nDd0eyuRIHp8aKNGD9Vwv8lbW4wIzvLkna2cyrVTQlkvi1cKmadyiDX0wJWPG\r\ng4o30ecn3V6kLaWxtBF0hTPnrhSr+UJ6d0mBeYcCAyHnxMi7mQ4m03ZNOmIx\r\n/46Rtle+bJjlyAGkPN/b32DsDmIWt/50RL8lKh0tUA/ewoQ2cNviOVdevtPy\r\n0qEHekfm7tnWNi9MDeR6ZKL1ZqYEskcrTU0Y57EPzuz/FAqSV0MuyibAHPSd\r\nrrp8WcZ7RYkOF2f21D1WLPRDNA436XBCxvsz+piDQauyFU+pIiETyhalkEAK\r\najp9r1FFg6F2y9hVUACiGZkLC3DlE99tXRwSybev1WH7D3N77mSC2xeTK4/+\r\nhORXWZcw7g7bWmvuMLBsGfeH5KEhgaXq0S4gy6AKYSwH6A7SVmdQA12xWr6c\r\nh6oV4/GndzulNVhIgiv+shse51pEs52jnFdh1b/3aguevm0gzTPJ4iN9GJOR\r\ngogiBM/ok5hLuRjmrgSxcUHtx/7B5ffNUvQ=\r\n=9kpk\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230111150446-517b045.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/eb8591167312e12b44f6bd489abcb0c3/graphql-hive-client-0.22.0-alpha-20230111150446-517b045.tgz","_integrity":"sha512-+YimkL95gqcnJjq6Yhmz1m4aovsbYhdK2H7NaA80rvfIoho8WpCs877tY4faLVreMDvTmcrH6BPNuiwSdGuIfg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230111150446-517b045_1673449527316_0.20985096565329608","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230111150947-e366421":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230111150947-e366421","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230111150947-e366421","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"466c09bbfd4b5355a34ed359df8f41244b20d929","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230111150947-e366421.tgz","fileCount":60,"integrity":"sha512-kVQs0porxttAPN9Qn6Vv0OHPIcMea+xId/iYmVSwyAanUsNoPVzTa61AtFOeTXd7B75LBxC6mKdj2RHP/w0fVQ==","signatures":[{"sig":"MEQCIEhpXjOvM/HGH6TgDI3ktNwISP7ufAhzOWV4gvliWeEuAiBD6fu49cQdU/Ehz/ocNc3t5Q+yfcHqX/g6bUQDx4cSEA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169562,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvtFfACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrSWg//UiuI1dupTr28E0LqjtuZObCLukMe88Hgeq6jC1STMlpu/dQd\r\nEuYGsUNGnFT2cfSMU5xv10kIQ0t8yzhBWfhApj49bbIFK8EgFqqvqDZvrEV0\r\nNthIikEyOYZSSQItO2ihFaGwzcwjFk+smE98ANd1EEoUOwZgKckEcQCOiGKf\r\nGz0o3pcL64bwW26r513Z3pcsQhNwscSX5K/LGejYUHcwQ9TA14EzeL6aJLdV\r\nhgOHc0/W4BP3AAs+b2i/l5xY0aLZidHnLbAkuLCMbtcMr+6/lNhL9jz5Gvvw\r\nmUZlXf/zYBwTAUPOGExidQZAiu4jdjcbQrBnH/qJD1uAngHnRHglRV9EhHk9\r\nzWm4bSaX7QFolk5i7fEBFb+y7Bwa7qaHYwniP6tDnfe+NCNP32wjeLBl4tMj\r\nRhbU3u88yWBDWiEOPthKJeTau0peNm8qOYGJFBtpJYbOvQId8pVaQO93U/f+\r\nC5vOCCGQ6B/ydJgZFg5STx7PJj3iG9NK9kW3iTMgjZ4X7EQPZn5Ph35/On+q\r\nDXNGFGC5EmYz9WQl/xB6BKaACClvm5r4HEb9ZJii3Ph2q1hazaQZG3sEXqaY\r\nOpj1hbO91tj/RtQlq0NhUnxmRVZORQMEugYUBHdLMBwO0fghvYd4sUF0Mkk+\r\n+9O19dFS6YZlR5vP8btGXS4Xpznh8oAskCU=\r\n=bWnu\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230111150947-e366421.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/2b451a9a53dfd60c7c62e3b74261048f/graphql-hive-client-0.22.0-alpha-20230111150947-e366421.tgz","_integrity":"sha512-kVQs0porxttAPN9Qn6Vv0OHPIcMea+xId/iYmVSwyAanUsNoPVzTa61AtFOeTXd7B75LBxC6mKdj2RHP/w0fVQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230111150947-e366421_1673449823549_0.7941519309816361","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230111151712-93bec25":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230111151712-93bec25","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230111151712-93bec25","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"89e81b958fddbae2dd58603626dbfbbc5b1c8325","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230111151712-93bec25.tgz","fileCount":60,"integrity":"sha512-0pJYQK1OFSPtmwNiAJ9ns8jDqycqcMm6JDYsDGsFo9/w5b9T5bTpYonioPMJfgX0J1TUaF7hux0DB9yPz8n2Ew==","signatures":[{"sig":"MEQCIAmmP7MwaKX1/d3hykjQm73m9oChvMq65lun940nzB9QAiBThNEdKCHgJEgCOU69T+47FQ5wstu2YLP/UHhW38S6Cg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169562,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvtMgACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpqtBAAhNrQc9bmJulC1a2Bo5abVOl+mSZHCOtyxJ2wdz5FIhVD1AFW\r\nkdbwXY9j9aOKgWdtLtPYxwiAjuhjCp6MI6npZwfh/6m44Gmd0P6v8Ib1GyMJ\r\n5/fMFcgQM7akm0bwscZJge3J5MV2JWFQaKarkVTk/NafvwsNastpj+9l/vjF\r\nQKBY1YtKpCYtLPcq2Oyk0rwEVYNs99quCq/1vvZNAYhgqT38fUuMRK0hxDm0\r\noOXLKNMrLMrhkUg0oIDEpVt+cJNNW/FaKf6LUMrnS3k6zQIkDGZhHbsCcJ3c\r\nQ3zL50eyTG98tv3zywPcUA6fv/IS/s61vZ2ZgZNEIIs2nkODxjNQN9PZ442f\r\n2OzY6UoRHkEOpNnnLprqOKSt8M2gntkF4ROrTEMx3wsxsKJdGNZkYrVUpGUP\r\ndKLa3ptM1Qu3pKUm7GXuxYrONsytoSg48hmdPSfnaWjYsX4je/W5KhJrCo0S\r\npVKQAPbk7By0ACG6CzjJHzbeT9UzwgJjjQgXr01m9KtHjx84FLXuTUqeEy79\r\no8Iry/ueV1Rp/v8HRzwPbepo7TPx66LOKiky4D1WnS8vIBoDfk1R0GGZ8RQt\r\nxrdftGA2wgBlOy7KCL6GxMhlOJ4Gw5DXwoxwGtcuhims3fX0wEWNbP5WGjTm\r\nrbiPj4+PWdccxP1usNo56M77xM2k+sNobR8=\r\n=OIrA\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230111151712-93bec25.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/249cef5d0cc8506b96752d11faabf448/graphql-hive-client-0.22.0-alpha-20230111151712-93bec25.tgz","_integrity":"sha512-0pJYQK1OFSPtmwNiAJ9ns8jDqycqcMm6JDYsDGsFo9/w5b9T5bTpYonioPMJfgX0J1TUaF7hux0DB9yPz8n2Ew==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230111151712-93bec25_1673450272416_0.1865821438601114","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230111152253-f596a76":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230111152253-f596a76","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230111152253-f596a76","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"90ed9d07d6ecc3928c26567e66123be10f251b35","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230111152253-f596a76.tgz","fileCount":60,"integrity":"sha512-cnbJYCbqAsHzJIGshGk24ow8Iw5oOJyCqLJl2HBlXQgXQC0bDX0Ucfxg1zlZ59SWpyJSTx+/t8vj8YQcALLWlw==","signatures":[{"sig":"MEUCIEPHYuQ3DL9gUjh0l1IPWmIdFjUKE86zwMnxJ3lPsmvfAiEA8mog2L6B060JuK5Jw/CC4I5VFlY8sOtyUzvvPSvFkDI=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169562,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvtR+ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrGNA/6A8AuezEfizgycHKPh2IMPiuXBubnfygG1tYODcyVq2bke6Rp\r\n1LmrFvaEbG8AASY25cNb9NclScCRtvJQU0yBGl+EA9/kLbGpMgsrYBq9xY/v\r\n42uJuXCW38yHmsXR+JLVy49Kj1mJU3PGG10dH+RAS8Xb0JHGwlM8YQM8/D0S\r\nPVgLwawWaq2YE8NVbzgqrVPpiEhP+R1jJmPQG9csBgCeWiMsVCfRucDLnjE1\r\no1kg9dyBo2+DebNor+b2pkpdV92QsJ2NpOf57HN3XBomhpgbDarCbZ100MbI\r\nfg/vMv71EKt4N281IUfi84UDvdl5+ZEzVGW0TyxEt8pnMH899ZfgMzDTHp4P\r\n+DqzQUfhBUygRMAmbnjItBOsisCiZQjs+gXXtCsSkq3983jSWRkFL92BOubo\r\nylZSxiSenXntyT8TE1CBIRYxxof+dyvfk16roIx9nAeVvQuY5wT21ppe/eQj\r\nXxR5Gy/k2HCzzVJzVMCbEyrIvMtsdi0TtZxEUgarab9G2asjBfQw8Z7b1vWf\r\nIJOoHn7h+5U0xxk5J8Omypn9FrSOzk68byXNvnk19mkCG+92Uykfwz/6f0GJ\r\nfhkq7IETWxXzbajYgAEF/UIU/UKDT0EPo4Y+qODP9rCyqH7hoyhnZAqk8zVU\r\nkEPRP0NTrcnqqYyngHNLEn/NdvIutOXfg14=\r\n=HEax\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230111152253-f596a76.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/5af34bd4c075975a7779d8bce15937ca/graphql-hive-client-0.22.0-alpha-20230111152253-f596a76.tgz","_integrity":"sha512-cnbJYCbqAsHzJIGshGk24ow8Iw5oOJyCqLJl2HBlXQgXQC0bDX0Ucfxg1zlZ59SWpyJSTx+/t8vj8YQcALLWlw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230111152253-f596a76_1673450622361_0.3647468093288406","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230111152441-affcd7b":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230111152441-affcd7b","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230111152441-affcd7b","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"c07bafe77e8d8e4a0ac0d0834512549100862f0e","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230111152441-affcd7b.tgz","fileCount":60,"integrity":"sha512-e1zbkJ76bLIb+7/a3VRkjYyjBHAhYftMpOYOnsUeghGh+RlhGNbtB9djCya+AMAX3loSaHjf4XPo2CIrd6azqw==","signatures":[{"sig":"MEYCIQDV1rzKDZyHDkkFMglVTOYJluHfplDr8x6adSw+kfLiAwIhAMgi16bCeUFnQVdAJN19hta7MIjLqR/iE35vQjNZqwIZ","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169562,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvtTeACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmozcg/+KJl+Dw8LpyfBy70Eaa1W8u8VrJRlLFREGE2Sd+k29zNWiMgN\r\nQ9GKzgZyCeFS42K4chGSBPsjfcokjsnfsuiOYvKFpqnPs83mH6dwp9Vqr9B9\r\nhj/Sx2NUmW22vWmrwgBOmIu7Wg/7pgW1DyuxkzKJ2K/ir2IWhO4zmhKFaMQy\r\nf/Wf/4KOxOzJcpDDnGC9uOxv8jJjn8ZMXyF21J7Pi20w9wmjc0fVN4FYslmW\r\n8fwn98Y8KRYxHoxEgmOm2zZV2HuSlQNHWWzXHeB4PRhZS2fhVLUWFiFkXsCk\r\n/H09GfRavblW88rHr1utsCjlDLGL8r8QG2r+W+2RMUqdkWvfndBuZ6+mDAeb\r\ng2zQHYHHleTlDBt50wdzeJmyMuJY9yEfyx8xOU1Pg+UPMmDAMLKp1BebnEOB\r\nrQj2JSqlXYdDsUBq2MiQB5+4A8mvE5PPyY7CnpqhXHELBh49L39iyoahqIH8\r\nzrTDDxPlWkBLloOxOefc4QZaBFGxBwg2KsVGoFs34behCQmQk4bCuubnUDdg\r\nnbpih7IkF13JCHldokZAMW/Er4apmrfiokFFPdW5L8gi0B/dlAUzkkpdWsYW\r\nB7+ZqFvK3iy2hHnXylU4hkbhVqp0FLkOHVhrpOOr0V9kzl1czC82PT9BPqjA\r\nlwi7dgkCt75fORyN1U63m5506mFbHjLZMAA=\r\n=csIw\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230111152441-affcd7b.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/7e21092c3a36b4fb3f55ad8b24f8d1da/graphql-hive-client-0.22.0-alpha-20230111152441-affcd7b.tgz","_integrity":"sha512-e1zbkJ76bLIb+7/a3VRkjYyjBHAhYftMpOYOnsUeghGh+RlhGNbtB9djCya+AMAX3loSaHjf4XPo2CIrd6azqw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230111152441-affcd7b_1673450717860_0.5825562730979732","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230111153500-62e077f":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230111153500-62e077f","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230111153500-62e077f","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"07dd80313055ac8a584f93d5781fab4057dd0bc1","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230111153500-62e077f.tgz","fileCount":60,"integrity":"sha512-rF/Rpun59uNOhwVqq7Auk9IobjTUCJ1b3mqZOYhoDvG2R2LgmispyD1uS4EjBNPO7oZkKJslvKLLBjDO1YnF0A==","signatures":[{"sig":"MEUCIFm/sqTJWgu6Su5dHApzHNQP12lPtVmKtNtTChsc8RPxAiEAoWNeKZBpigMjlmYdanV6+nu8eVLjplF313dV9MBcOUc=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169562,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvtdJACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrLQA/9HTF/sUXgiwYG7BamtxkAgQfkJ1zCKx0MKm3GrZhhHLHP1dzu\r\n7EzQdWxddIeckNq+NJTSYtaHJ5rNic9o5D9SUOrNlG5i+fVeloKPUJa/I+qg\r\nppn/n5dMyLGyNLRpaIKHUJp+3psX58SCmEszZcYFNM2UmNTlPi3IktvHspqg\r\n6tyV3mwb+qyJ94WMB/scLkewtCfS3cqBg0aDdKYt0dSMoKH6NHoUO9pamXtp\r\nf8a5/b7dfDKaG40WLDe1pZMVwvELsk3a4rpe0ZEqrdD6hoYIiNamme7cigZh\r\nMl1Z7hAbq23dzj+Xcn3MIQzMW6q/J4cLuzOG/mV6zaoia/BbYM9nYWqh+qHD\r\nfmwI6LndOyKLCVO+1PZJZR8EIjVwVzpltJGBlvBycfPstUHCEdvOPNuNm9Nh\r\nDAJVX7kJUG8d7DmcTS6/BKHryfZIY5k/FHAYwrgAkvgFxMm8JX0ZINhjR1Yr\r\nxWKqU5jxI/aMDHWqyZ7VA0b7+h6ZPfUSHHyk+zBIYhPhxhsVUOXh5mGt4Dy4\r\npRR2e7GqNn2ULE1he6oPQWbxJenohturyJTQ2TxjN4DP/aPij160o2Z7obTX\r\nOtzfG91czkSiZgCFuTMt5PVcn1fovw+cjxlWUhotlb/+Erx81qKP3fGiWQh4\r\nEAf+MSoGExj/y7pm4Gb/KcCKvOMbGheRqWo=\r\n=MlEg\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230111153500-62e077f.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/ae363daac3f1572bda1f076cec2ac388/graphql-hive-client-0.22.0-alpha-20230111153500-62e077f.tgz","_integrity":"sha512-rF/Rpun59uNOhwVqq7Auk9IobjTUCJ1b3mqZOYhoDvG2R2LgmispyD1uS4EjBNPO7oZkKJslvKLLBjDO1YnF0A==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230111153500-62e077f_1673451336744_0.46967515061808784","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230111153541-beccddd":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230111153541-beccddd","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230111153541-beccddd","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"23c392d5634e326a126083d95283c838ba4fbc6e","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230111153541-beccddd.tgz","fileCount":60,"integrity":"sha512-9Q+qw6vH49VDiqc7u92kyHLy2+xNy18y7+5sYMznwuYOliAJQ/Ld0IH0+Fh3GCLQiBdT46LB9kI26VWC3ZA/Jg==","signatures":[{"sig":"MEQCIESriZKZliNtoIwnw6N7yThf+omV4jy21cb9bRJ2oQUnAiAhlH3qBF7ByncecL57Xb+CddFR2HBZWfFwK9L6r8B3pQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169562,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvtd7ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp8sQ//YZUoi0mvF+I635V5XuC5NTPjLYJLD5h65uK5773UBH0EI7c5\r\n6nW01FNLfmhfdt8cO8ydUqcJHCgvA/Q/uL36dh0/nLnPFpsfbuj5hsfj45Oz\r\n0OEjM4Qieb4W2dXC7k+p66Ed8pEGAU+aUgep/0bevAtTUfvayu81Xr/NLP/v\r\n5dor0+tbcXVNVGenLqhP66bP2zdFjF8XLKfCdvz7eI0tpe8kOBdir+3Qf9iZ\r\nCzdgUBOJbUmtYfLUlp9C4zrpk/oMqtjQzSPXGITVs8eblyNmtlyX7nU8fgcX\r\nDBDRp0fia+BuGLayiYikm+bKPXNgh6M5IxzUzaoTUtggUofZX8ViYayXhmn2\r\nfVfPi3npk44tv15h30pgDwyNpAg0e1rut3Gy5xQn95QDSa7CDg3F2QVY1kfv\r\ndEGGhNM6VT8jpGJFU1s6jpUPthCsu79km9T52gm7xe36zoiN/Bx38u/RexSZ\r\nDVpP+d8fFqAjcFMrksvs0Rius8wKSWG1E6gsCc1twpAqT4n06SZEX0X4nscN\r\n14S38UGiKIp078PKpByfr/HdJN9r6qA2mNYwo5eme2V/dxHlTFsFx+RFZdZr\r\nFzdesCVCw3LcV/cIKS9MnnwIuQwT6lZQBlt3oujXBwnYUf0vqWTOzcHJp54n\r\n/kytdZdUfO89N5H/OZkY6mMkBtJgN2uaKYA=\r\n=/x7q\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230111153541-beccddd.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/d4290043a4ada848509ddbb0b22f5921/graphql-hive-client-0.22.0-alpha-20230111153541-beccddd.tgz","_integrity":"sha512-9Q+qw6vH49VDiqc7u92kyHLy2+xNy18y7+5sYMznwuYOliAJQ/Ld0IH0+Fh3GCLQiBdT46LB9kI26VWC3ZA/Jg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230111153541-beccddd_1673451387474_0.9312725045387968","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230111154136-e6e7267":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230111154136-e6e7267","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230111154136-e6e7267","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"1676e35103340fd6ae77ccf65c0535dd6b9cb9ab","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230111154136-e6e7267.tgz","fileCount":60,"integrity":"sha512-piSF+bC4ju3N3u1/IxLbh3tBKI72ttuutQo5YFOcbEWuKJ9hLMyfXyTyXWbVLFGzwSls3V4m0KD7voOT0dsTkA==","signatures":[{"sig":"MEUCIHmWLSF9FNgrm5b3ZOHEE9ycB9kI3hME4lvrCnMAGURlAiEAqIr1XqbZDiDnISuPpeXxt2j6N05AAI144D1q4nb6J30=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169562,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvtjhACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmq6UhAAjuYgZol3pMwCqBY+nqqcyywXNFVMEieHohEgZB9PFXtDZGh8\r\nnLj8lEuGxDIlAqP5bB5o+vUWFOsAK7hqbGrm1dyZ7t34oLJcBVzL0Fcd3p4Z\r\nLFtls0qRGUvdOGz5bKIawP7Q44nN9CVUeS2tmZk8TGzjzO0ycmOQtWH/6rsg\r\ngnKIntxk8UN+OF0tHbuJTvxFCD0IbVQY/52KF6NxRzCUPE9aN7a805CUjZ2t\r\nma38nnRPJ7QG8FrgBi/CwUkMdBDNEQANWIpovUVXYTKCvOPr0vnrIBMTX8y9\r\nXQETXyf6DRsNXz+w2bn1gUWzCdodFSwLLkIjUUM9141fkHjrq00E6LhSrMHg\r\nxl43vuNMbbsicpHfFNin21muowvmktaA9cUDO2eaBgmaeoYfVEVfx4k97Zey\r\n7SLukXW7dRp+0oKHTfLOryupxvBFfG6BbvbWk5pFSMLvBKte6KunQvVgN/Dm\r\ng+SxDYiFUFxH1ae7F1/iLL/83xaye8Ivi7aJL6rk/6+aBFxDDVLCnuS/PM1u\r\n2McqUx9sR0annKBSdFi8ebVlUsmkS+W9pRTrmd/TdoH7QekzMHqLOPDxLjjR\r\nVHGSGnv9toc8Rys8nuSEDdHgYcOvvLZOmpkmpGHIcqGUziT26JO4PRH6l0Fh\r\nc/OwC5fONdl7dhdRPNZB9vLAzNGwI0QbZSo=\r\n=1nqL\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230111154136-e6e7267.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/b7be039df98c3aa390e1ade28a948220/graphql-hive-client-0.22.0-alpha-20230111154136-e6e7267.tgz","_integrity":"sha512-piSF+bC4ju3N3u1/IxLbh3tBKI72ttuutQo5YFOcbEWuKJ9hLMyfXyTyXWbVLFGzwSls3V4m0KD7voOT0dsTkA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230111154136-e6e7267_1673451744743_0.4022220404001686","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230111154420-69b89ac":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230111154420-69b89ac","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230111154420-69b89ac","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"2a1b3990aef3812d3a3360f55ada31d641e3c578","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230111154420-69b89ac.tgz","fileCount":60,"integrity":"sha512-3HMF5B0grBK0XWYmiNe0HBSQgDBcUu/jYu89ARr/it+OZYyS4E8TYmUswnwxPux3OrXlhyazq0UPL5aRj3yyeg==","signatures":[{"sig":"MEQCIHiKKFjGAQ1pzd5xZH4XcrwdZEnu3f6/kKzhDYnUJlvwAiAkpWnBZaBr0tdbWFw6nc/Px2yYIO40A2vDQjvW5o+CKQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169562,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvtl4ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqLLg/+K7SZzWWar2Lo0am+2sa+v0bBtr7FLk3NucdxC9l/U/vzgWR4\r\n9sHDKX8gEn9kKoiav3uD8EUNEh04SXd3ftwzs923mVAPANUp5A0uEV8wcGDh\r\nth/uimNL8DtJQVxFJFuW+CAs2vFIn9shn7XGd5k+wXS07OJrB43doFkV8L6f\r\ndXJYp27QdweuscLnSOBxpSmOGhVltlXBuvxyuE6kg9p4+zHh6o+p+uZQNsXS\r\nuMxfEvWgrdtbVrxxrXAoJ6Iz47xIBciemFP7yXJBJqkDLTsSK4rS6+a/dT0H\r\ny9DUDcsGwUOP4jmScRaZm+xSRNBb26AcuW/0nejiYyvFxbREQvkkmfZNJ/Vn\r\nxJJtaLhQ9S7kwURyYeIfkXdWw2cfs9K3wAoaTEkvr+JertLcOgD+eLVyfyEs\r\ncZquTTVkTQskqBXuLZbQOX6JC/pyqQf2DRYPNRHytXN545IuODt77gSoqok8\r\nRfpyZsaKUwRnsMxf8H2SDeLLNI860y7wN4vjwumnDC+9AtcK5W6NgWkBDrra\r\nyfXD5mm3EULmQRDlXC2NlzNLD66E7Wq2ikUgu3cLJHu1V7tN0LKlnOyzhpUS\r\nZ1eTjUAsKYyhhfEvhQ159BoFB/Rg3eE8iZqIBNCPdLV+HO3xstT6GBolZXIp\r\ntiHc+ZTIpjhDcsXEGMsmZqETECwCAVFCBvs=\r\n=+j8l\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230111154420-69b89ac.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/434d60149fd9447908e6de6605639341/graphql-hive-client-0.22.0-alpha-20230111154420-69b89ac.tgz","_integrity":"sha512-3HMF5B0grBK0XWYmiNe0HBSQgDBcUu/jYu89ARr/it+OZYyS4E8TYmUswnwxPux3OrXlhyazq0UPL5aRj3yyeg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230111154420-69b89ac_1673451895883_0.6777597720358044","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230111154656-5d43ed7":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230111154656-5d43ed7","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230111154656-5d43ed7","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"cb4786e596776c6b0677007e02d1d89088d76c86","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230111154656-5d43ed7.tgz","fileCount":60,"integrity":"sha512-CsGKVEpZMlk9gCRHtJQQkP2JgSBP0HuulTa4xkr++83NlObASvgIlB7ogdtzSHBAs2WUTzXKEURniolcExvezQ==","signatures":[{"sig":"MEYCIQCxFFq8VBacM3AZ1ZtvRtFMzRJC8tlhDj+5MgWPml7ATQIhAIBec2kl4lyHRJFHB+ClDu6k42041ypMbQNWs/rqQvZS","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169561,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvtogACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp1Jw//QugHPCz/UpuGtoFR1TVkFmY8JsbBa0AUNyhaFSTwPyrwzK3q\r\nu4I9El/cYXhm1/CdIAfkJGj6BmdiHglNmTKWbpqzHHWv2+j6u9WT/vOLlf2o\r\n2xa6PuaJT+5eiXuM77nu/3jAsBXoogfQvk03QH2c1qV3LxHEmo5L3xIh6wXd\r\nz3Wji4W3hPz0HaUWhV6EI/20S0t/Qw9SY+tPPYupI41QM7aYb5r5eOyi48nz\r\nqNxa98LOwFfWlo+OH21DH0Y6cfTl8A/L4hPkE+yDtW2Fw8H8Qn5LOAD+TUQP\r\nKFJJpXY9sBsSOCpQcEOH00+vuW1sVNVUMQUcFWDtZR3jVS6pYmGBOrK1VWVa\r\nVsI47rTO4SPIb+dF0kF0H+9a8wAl24N9HXafeQsiZcu8/JOZvdIALhhcLriP\r\n0zUPmWszOCfAWYzlrT2XLfoiprd5BpD9sOQtuAcAPAVbnVqGNpCIt6wb4U7W\r\nm3SUMYnOjfyqunJ3FIB+4u5Ia1R9k+XwM9NvAuPFdInxfrH7BX4WEAUGpRER\r\nVfaHYklKZacIUnNBfXL6QPIP4OuWDXj62aAa3YHPxQyHWXhGtIl6H6DGnRNA\r\ntnS7DKfk1typ2/V3heiHRpSHTkJiNh/D60lQfkoBKcGdIE1OMlnVFXPoLz90\r\nybr4VHI94I8lAzrS5eUhDFSp231uMIc+UX4=\r\n=VvEP\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230111154656-5d43ed7.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/3ebe92be1aa6fe91810e5ab308feb2f4/graphql-hive-client-0.22.0-alpha-20230111154656-5d43ed7.tgz","_integrity":"sha512-CsGKVEpZMlk9gCRHtJQQkP2JgSBP0HuulTa4xkr++83NlObASvgIlB7ogdtzSHBAs2WUTzXKEURniolcExvezQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^9.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230111154656-5d43ed7_1673452064269_0.612255690172256","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230111154727-f4de89e":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230111154727-f4de89e","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230111154727-f4de89e","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"4ab5fabe039bf643d1f2014a0f5fc93ceaadaf97","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230111154727-f4de89e.tgz","fileCount":60,"integrity":"sha512-qnWErBHDNpXFwdOsY68qhHvMg2949+3s/hjsQIfE2iPvWDAss0V3dnEOVDF0EduLV7HkzcVyG8fcWr4O+x4JQQ==","signatures":[{"sig":"MEUCIQCJToNi3E9f3wmO3elYqalA2kHq3j5n0meQIZZWWIdARwIgOGkOzh8Xudk6KJ98GzfQtTBDvrAbQbuzVqjfnkiCzLw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169562,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvto5ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpC5Q//SPPgIAhEjGdQAN+t4FfDdn9ZIeu67caueIXSUJQmX6kOC++d\r\npWTyUVQPkN58/ec4z5rVYo60k3TkQXqgpCP3oHa3mBC/uTup8r9PT1ZyBHsJ\r\neF+hF94WcUXcbYd+2Khpag6xt6zkuPB6Hvo3U4bMv58+BxPvpdRoozWFYFIF\r\nStDsag5qgEGtugNw+fY0oE90SFwMnvN4uasf7wSOw0tNZZMoOFVxJ7PrQ7A4\r\nOBxC7fnabY+GCunaHQPwINUnhDUtFYeKDXOl5xqpxIPkzGp6VnRq71+Q+j0s\r\nA4IHTNgSCJwceqm18rQP6lQoPuhQMJ1qBLrtRX/5/FEh5dHOFefLffEJJB7C\r\nTA1bfUAOGSba1fO43vpalFHzc9KpOMpehWuLYbPAW5xNmRP9e8g4f/l0b3aO\r\nU++g7mPtDqPgQkwTrA8uxojFkexkIPcZ6Twiz+vrv87TS/ZP1JcC1LJQuVmK\r\np5TjJxOC6OzR6tZWKBELI/EPTuCGNk6oiuMuO2TsMd4oq0ByGeAwaA4+AbXx\r\nfra5W2fHANzwwHf+NDbj1YXNp3h4LVRTeS/f5U9XZ68Kt/UCNOuIibfCXaN9\r\n7Fymj4M2CSUDouBkj4zeNfbOG552vf7qb00w2rmVg/2jQuUPY3nkaYQT7zJ6\r\nqSJ226kou9DVLxoR07+48EVS1QC7QR1KQ+U=\r\n=sg7q\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230111154727-f4de89e.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/9d87ad799486e0dae902d76287c96ce7/graphql-hive-client-0.22.0-alpha-20230111154727-f4de89e.tgz","_integrity":"sha512-qnWErBHDNpXFwdOsY68qhHvMg2949+3s/hjsQIfE2iPvWDAss0V3dnEOVDF0EduLV7HkzcVyG8fcWr4O+x4JQQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230111154727-f4de89e_1673452088820_0.41902902694686506","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230111155127-87c09fd":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230111155127-87c09fd","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230111155127-87c09fd","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"a0a1fe6e735db3710eefb6ef86573946b8ff4ec9","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230111155127-87c09fd.tgz","fileCount":60,"integrity":"sha512-i4b7wWEBhknKnWXmC+nyGf+YMXykxuAzzvb1slv/+Ks3d//j28TW0XcAUm1/aRbmdUAKgRfJkvWFc0fGkooj2w==","signatures":[{"sig":"MEMCHxOoyZAUxIjAKHmHBAsfIE8CXIH5ZsubhMZGJjZ/9SECIE8LqCBm2kORdpNGAcRODN+AQW07nAYQ9sCP2QrIRBHA","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169562,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvtskACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmrrxg//UOq6ZkbxxgYPYWBoBx/e3er+RbIav5KNCS4n0RCRpy2BMvyP\r\nKW5GEr3C9RSaUqngWhSGcAZvLkKcMYk0cWZF/ajDAW9/u1FvcvLFbgAyKkIq\r\n+fmFUwLtIYzYiKsxEXJtVkgnGQzqMyFyVuWs0/q4uATs4nxKwuAvtly9Vh+E\r\nSY4zU/aGnP1EfqaLe5SnVQBnnUlpE6ZVgBzdMD+hT4AVX40tw/d/F6ramM9f\r\nJ1YY3KCken1zBMVuskznoJmL0EmOwVlrIWXF2QRu/oV/737CSLsF98IgvtKF\r\n7dDwMRdDzRKuXG33euyU1YY5+6yMlQ1PkZeMptBY2IuXFc+CK9O9VpufIseH\r\nWMU6pm1AF6smDtQiYVenfYK+RCfcFa7RwMlJOr7uOhW1w2DOAGwnPqLVU5Bv\r\n8v94367TWYIyOhHDLfuB3hjd1PNH6o+4/hVngSpSFTszaMU2xjMYcZJ5vFuC\r\nME5y3FYaYny9e8u3+laO/5O+jf7tSQygjqe0fINoqZLu4/k75FEcc9pwjlRm\r\nF/TCengnFqxHZetF9J5xKG7+OtwgHPHCiL1sFeFiTzLOxe3ytLmXntqB0fl9\r\nXqM4AezEfN/sFmqg4WGafY/R/TBH7LyMSO313dj+IouwW91XazaAl2aD5ezI\r\nW9siH2JhsQTaK8S+VtG4MBZDauXssyR8EbI=\r\n=deI2\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230111155127-87c09fd.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/289f4648a42850f452064c75a649372f/graphql-hive-client-0.22.0-alpha-20230111155127-87c09fd.tgz","_integrity":"sha512-i4b7wWEBhknKnWXmC+nyGf+YMXykxuAzzvb1slv/+Ks3d//j28TW0XcAUm1/aRbmdUAKgRfJkvWFc0fGkooj2w==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230111155127-87c09fd_1673452324288_0.4640727227148673","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230111155631-c678b0e":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230111155631-c678b0e","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230111155631-c678b0e","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"7028a8c33543b8f9fc54e764063255f92e957213","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230111155631-c678b0e.tgz","fileCount":60,"integrity":"sha512-dSnfrQeKeW+7AChy1fpBlEJ0mq0EgPC5wUJR7skj6SdSinFX/hRUfKct9ERdlvbfBVDu7IS6ZKIOesSPIuI9Zw==","signatures":[{"sig":"MEUCIGkjVQUkaktE08qZnnphLRgn9VQsaPH55pExsk8yGIkRAiEAx+euabYvt14O8PjBfFZAIPP1by6wook4wcBtMhdLGaw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169562,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvtxRACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpU8Q/+IhZQCyIdgmyhuj0VC7JnuMM9o8nW3yBwT74rJnGUgaJArhJo\r\niN0uA2ocPV9uC1XkyO1r2jZm5OD2qIEbsmVqBty135KhmaQJjNiUT2TBTFsX\r\n4+GD0fUGjKhjeOydxqMtTrEDtTe16tsuWVcIOzN3/Gt80wZM7yaJysu1dFc9\r\nnmoJ1c7I8yyRZ0rOXFKC8VmZFxdgvU9nj61aHpMiG0BOzFeQSTZnm77tqiUJ\r\nllczRcIEdCMT9Q/vmI8aILR9KoRCIG/IlkpdmXyt/g7nQUeBnSUeJ0OJWOPS\r\n9rGlzFC+ZmCRNeVXoGBef4gXhujdIZ3lQb9lv/HpLAOPtt/bUbgtIvSrM9KH\r\nc2b3IvYQO0KwKbEPXBFAuI2lXgslbsYurpbBoO+FCJem5gm7v0xHDxvhQ5mB\r\nniWoeeyn7bI2k4hmgvunbpurzFt1hkMYaj3X6UCa16EUPkPyX4/xXJiDF3SI\r\njVCI6+rmBt0M+LsrokFr9bInGZ6lCBZ2pNMr0ZnQ8uOtpf6jckPXM4zCWx9K\r\nOe/j65O8Olysn/tmwC8kEO7O9fVH9d7caGfp00iYNwqP4FvaGZCbXSIgTcTY\r\nNKhJQ1+u38bokurLAN5QmTGOBJCUfYp31eqBTbEXTs5/S5hAve0Cwrek85mi\r\ngZBJOVv0e/1o1fxcs0M7Z9qIUPKWXsh2nEM=\r\n=SC32\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230111155631-c678b0e.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/36e1dc59bad41504bef3d07e488d7de7/graphql-hive-client-0.22.0-alpha-20230111155631-c678b0e.tgz","_integrity":"sha512-dSnfrQeKeW+7AChy1fpBlEJ0mq0EgPC5wUJR7skj6SdSinFX/hRUfKct9ERdlvbfBVDu7IS6ZKIOesSPIuI9Zw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230111155631-c678b0e_1673452625538_0.03581257596665255","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230111160214-72571ff":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230111160214-72571ff","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230111160214-72571ff","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"1ecf735fb8a1d395b8f3396d140c59b565bb321c","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230111160214-72571ff.tgz","fileCount":60,"integrity":"sha512-rL1bc9jc+Rn3wisxIvurt3NzDkJLNFLwdCUOqJiXQLGyW7ipbiu2lFnOzw58xx7JiOo/Qr+3WKe8S7VwdhFvUQ==","signatures":[{"sig":"MEUCIFqd5H5tsY8gCgQd4Tiruez52+tUqnEtNKzdW21pQ6QoAiEAjoXHCOhmotoHvF81LfzOL0FED7362y2JnLmDv30pPBw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169562,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvt2vACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoYMA//RRHv5L7A8S+58Q0Ki6/UJ+goBn/Jqna+zQi1w9rpmjSMPzx3\r\n/TDS8Wgcw+jIqhFTk1UCUXn1KxvtsYHtq9+lHYCFkSTWyby5t1GcVx5YB5rK\r\nO/rKZLIJCk6l49yvSWZKlcXGAjFu39m6VBdmIj+4aIgAzror5vUYa9euxM/R\r\njnNlgSmEKjPjj23eEJCIBvDRgh2Mtq8YVzdTrqD4fgJOTnBRHf60wN3GISJ5\r\non9PV9ijyOl2Gb5kyiWiYRWyMc80wvE6fuGmDuQINkw+sVDPwPYC4yRFuBJN\r\nQQdSnWjSqw/CPemv6OlAgmkdWrCRZKBKhdy5DXQJPUFYqJ4Bw/4drvnfNTcx\r\nNdMfWi/BcPZeFt+yWbdlQI4BKPL2rPQK+kgCe2veE2l8+AZ98OH6xWv402nj\r\nPq8uc5T8lFD+XEq3SDgSkjR4l/2BPjJoq42jsuaz3K4JmGKpvHer8smvj5At\r\ndfpm8RLZJKQ35wr+sSnA030nfUSi10j3J9jRGwRNNaqb/DFPpGqJwvNGuaSV\r\nUzjHciBNXpbGyVpxMU/m9N+POwwh2OdBrM3TzMv1rsNH8yZzJirI1SttNDSh\r\n1ZAbfed9okyy8F99cukUQGGlQMqxS23m3X02CcQ9XB0TY4TB9YbZRaP8r914\r\n8g8RGMYc5HJ1E7j9ciAxHjSU5VIh654LlfE=\r\n=nJ9y\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230111160214-72571ff.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/f19e8928dc0ebad6079501c25b1a7236/graphql-hive-client-0.22.0-alpha-20230111160214-72571ff.tgz","_integrity":"sha512-rL1bc9jc+Rn3wisxIvurt3NzDkJLNFLwdCUOqJiXQLGyW7ipbiu2lFnOzw58xx7JiOo/Qr+3WKe8S7VwdhFvUQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230111160214-72571ff_1673452975413_0.15086633677081118","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230111191709-5444790":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230111191709-5444790","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230111191709-5444790","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"95e5f990413753d4a36496f5cb9b5ef4a080be99","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230111191709-5444790.tgz","fileCount":60,"integrity":"sha512-yraaetz8kmHSiRsahfeviWV2TFfyKoAbupPgq9B0q80tPYOW/dk7ssnebW3Lp7+8PC9Y6YeMWz3UJMYTVOOT+Q==","signatures":[{"sig":"MEUCICE0kX3x4SVtXkIrhCu6+nVkQnbPYVNiwjxtqSGD0IZNAiEAytgFLkt3pngD2+XfRLqSy3v1R+EMN7UZ+rV6U88tir8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169562,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvwtbACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpsBQ/9ESSDmmP5ScLSIl+BR7ECrO1ZSwfe+wNSwRV/+OU1otC20p0h\r\nHtRV6qGkgmtSaSDhl9IJ1KfKJC4OS+hnv02z6aw2v8FayDrWnv8sxWot5czD\r\nDl/3gMOORGV1lxAcT2KA44IeKLxXF2LMpW3t7tUbEAVn3Lpbu9FhUYLGWTRA\r\nEIN3BU12izWRJElTEzjzmxEgyTWZ8xoPEhmNY2tPiZ43jeCgHTZoU4OOYt+y\r\nhH7yEvWPce6uVggOn3MKOdfCZ+Ug5PhmUMSOZXuvaivY5p/Vm+2C12mwxoE7\r\nOHoYl+pXzQWIO6gqBnplVfoA4eZr5jG/Jr2JuOiQkp+RHh7Ku8Qr+Vd1Wciy\r\neGUCdmeZzYYcCBPaD/0K5O4A5DpY1visFimSlwEnXhgLGJWGxU55MteIrgaS\r\nsDTIf+qkmv07eqkmL0LqUKa4sEZb7ggygCsmVIaTNFj+KjmuH9todjyJXa5f\r\nh/cnjWaLZqaDgsGpqqU/uBZhdJC4oN2KV1ikDEZXwQOlFf8SgWdJr6GQescM\r\nl1tS7ggiY1ysvzhiZT5wM4JVRoXF7K08PUJPb/l1zjyza7TesI+GCn3Vn0rx\r\noTkSLZ/blMhNLJ2lKrr9yRX+oViHapFxErcjJ25SeKF4oU0K2+x3kYQMoWnX\r\nJ9QLdHiWUgHbOKdYskOKORizNz8JKNlBLEk=\r\n=dHbt\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230111191709-5444790.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/2d18f1259009350c3fbe67683bc9b38d/graphql-hive-client-0.22.0-alpha-20230111191709-5444790.tgz","_integrity":"sha512-yraaetz8kmHSiRsahfeviWV2TFfyKoAbupPgq9B0q80tPYOW/dk7ssnebW3Lp7+8PC9Y6YeMWz3UJMYTVOOT+Q==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230111191709-5444790_1673464667272_0.29183786203553996","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230111192215-3301af6":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230111192215-3301af6","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230111192215-3301af6","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"86aee058fcaeb9e90456f2ac7adc2f5fb2bb21c3","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230111192215-3301af6.tgz","fileCount":60,"integrity":"sha512-449GX7bhJXO+BQLII8JUqdkMTCOoqE4qW6T23j7S8iC+H/ptUKb3G1sLguUYTh1IT5mrse6ACpzIOv5FfxBSPA==","signatures":[{"sig":"MEUCIBHT4juPmNDb1p+J4Q2DvpYznz+jycGknLaYIPOPpB0MAiEAwjEtl27hnT28YS6HTZIgPQEMKXWOENH2dj7PdLTxh10=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169562,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvwyNACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoE7hAAjhtwKv16vIZW6T8UGLtyTDsZE4kUSrjCxSxZy5JDuLqffg0i\r\noHO18psvKwomJCwv08WaX7MoOp1sai7byXhkOj22FNarcmrc2DNESrWduYAP\r\nCjkmDOZsa76xfEbtDg/20ECF6UEp7XHl+pOKx97GLVBw+yHZGZ5L9okh5z4I\r\n5bm12GGTYyMAla6ICv//MxiGZfG9TmjZpLYbR26brPNfLSj5nJWAPHqVEgcZ\r\nPKF1R4m925/C44XMQGQQ5HWjHPnfAe9syusCeJpSdyx39qUEOvZOZ8XBo98S\r\nShb3anyVbF7eAbWivjDiQ1ojqdoz+5zPBifSHR1c9E+tpdUyOULkLlyEvOgk\r\np76aBoJOp7mD4UlKyl/1HDrzD1i2j3uDXFjkAnOjjuOilBltYgbjAor5LF3m\r\nb3UQt0k6UWwRLA4ICRx7bSPUTuG+H1r1B4B0EpGaVhwFh6SahqkhV5TuKr0Z\r\ncZOx7HGJQgoDU4y3DA7psJcUfRIZdY8hS4PviFrKLxmCnmEmTiLoXJq9e1Of\r\nQ80EyYnYNLJWNz7ZJzuOfLLNbHG1AaBd5Q1Upvh81Xnip22hI7HVF5L8qQOf\r\n3jazw/w0YEBn7Dq7y+zhXbjCwa9xi+kBApkW4GLfJlL1SwzEmpv1tRi4zWja\r\nwJNZ7zv31NpT3oelwKaNzhmLagWfHAWs/ZI=\r\n=wx9r\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230111192215-3301af6.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/6e4696e5d7d7b945ab2c87852b7917ca/graphql-hive-client-0.22.0-alpha-20230111192215-3301af6.tgz","_integrity":"sha512-449GX7bhJXO+BQLII8JUqdkMTCOoqE4qW6T23j7S8iC+H/ptUKb3G1sLguUYTh1IT5mrse6ACpzIOv5FfxBSPA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230111192215-3301af6_1673464972901_0.6142987277127281","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230111192632-60d52af":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230111192632-60d52af","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230111192632-60d52af","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"fe0a2083c89b6598dcc4b9cd5c1ab8c32e39e041","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230111192632-60d52af.tgz","fileCount":60,"integrity":"sha512-Hw2HeUKEpzBDfoAY9z+zlOpDLZt+L6J4DxMEVZql5lPQ/XItSLTEyef8A+f6YWUGYbjoxvvZhTXjJaY/05eJaQ==","signatures":[{"sig":"MEUCIBrSFXoNAabrPRRlcuyE3uzKSS1VrQ5sdF3UJPbgTY5sAiEAw9dhqgE0XcFNAdc5A3Jd4+Vua6AOxHOnntzHTIc6fWU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169562,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvw2SACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpLPw/9HEYCRa+6xUrcSUB3GhEppZ0mGA8TlGJoKv9Mj08JVbkUhFVn\r\nxXwKYzU5kEyE0H07wJr3pThvg8rxo+NzEBqxN++PvGyPNEL5/7Bt2UOnyKvm\r\ngr08qQAUC6/zkoTAnOjidWdoHciGk3iIXj7ZDeNkAf+2tTO6diqkhaQmh3kE\r\nNny46wcMTSm1QAdUsthmCwNG/58KvKfaDlGJ3STlUPH9FDn8FK5CGfatdoQH\r\nSH9S9vRSbNbbIPmQGtnW11Yo9zeGNdb5YaXaaP05f7zIT+tqJirdBVai9tjf\r\n3Jx0FD7OoxQsLuI033TtYJ4n3+1IBKmiShngEeJwHllOqsi0663nbhDcY38z\r\nLYcFAbc3ej4OlZgq7uXsKDV1Ycd8xI2o9lGNVuemZrUOWPnPxs9AXyMJ650O\r\njQlZxt7zXv4iEgj6TS626+jlgjcrxnH2mYfHaMaJcpL6FgyGxeHRdNp/S6a5\r\n3+X0E+hoTW9hwcju8SefIxCTbpu8V8cNFMsbN2Jnn84h4e/wjFuUyPnaNcq1\r\nexrT65Zd+fWuoyXgbdKV1R/QpWg6mnh/D1j3JowIi6nBunAo9ZHoM2CHHYxO\r\n+Crd2CNwXWZkNIT4fU+usTwE0pUo2KGxPw85JTtG7GsQ7gzLlPE3WOIM+UrF\r\ngC4uS3o1axMQOp0B5BcMKLZ7k7GjguzUssI=\r\n=ArxQ\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230111192632-60d52af.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/a6360eedbe1104422a8023143efebe82/graphql-hive-client-0.22.0-alpha-20230111192632-60d52af.tgz","_integrity":"sha512-Hw2HeUKEpzBDfoAY9z+zlOpDLZt+L6J4DxMEVZql5lPQ/XItSLTEyef8A+f6YWUGYbjoxvvZhTXjJaY/05eJaQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230111192632-60d52af_1673465234107_0.5043183128417925","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230111192852-c7a503b":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230111192852-c7a503b","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230111192852-c7a503b","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"d4e68a9fc2c9744fbccb28873dabff8e3f84dbb9","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230111192852-c7a503b.tgz","fileCount":60,"integrity":"sha512-cVLiKuz9Jvtz24nZs/pAXIO3uTPfBgWxf1pRv7bV4Pn4WK/BXXeq4nO+NQqTVvxDYuIZfRiOrHTr6dmzMExzMQ==","signatures":[{"sig":"MEQCIDzrZUyGQe8zVhTW0rNv4GDNBJvV0A44K6st69uyh6USAiAXwMB8m8EKUFzmx9xvIq/cI2Ofp0W6+wXiDGPZ4m9r8A==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169562,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvw4mACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmolbw/8CZ2UdINX9HkKGckP1sNP90yqERNHliOdbEPjbHcSMvggWA4O\r\nfmoG+7THL/AzsKTrVCJU7cVpTjURFXcwgjdq5+6WcmGoyTSJxFR3VX0s5X6S\r\nb3j1/76yk/oSnladNSRVs/Z8ZOCvG4M3uzqRMHxfpQTjTvEWfPgOA6tzx/ZW\r\nOKtMDNcXXW6msQk0yqHb4SS6K5/WnGgJFg+aQLFrH6yOE5VX1Qxj85J+5skm\r\nufsh3mjfrJJYGNSpzfWqzXfsfJceBJb+B99R2dqk6vZmfWGXpKrW56QpK7Hj\r\nh/OpNB02FifiRsHYXcE3kdNde+wKOMNCnuif5yUoT3yjWN5O4Km2k9eNlIPm\r\nGq1KRNF1Nr7xAIQk5saZKJBzao6oCvAvu7xoEdX8hfeb3RdCV0VEXznWo31v\r\nDEjXBgXRxiMrd3au37ikRSSTXUa3+g0d5NbmJklKptS9dsKV1HIvJaSHjFaG\r\n3m/5ZxvHu4+HoKOcXP+z6P9wF25xLazu/pNiygsW138xLQuqfgIy27TYkW+M\r\n9ylcE3mhMk+onjpAw9/MP9J28rpCDM4AMSkDg8nO3qrhjhIWXX2lH20ypedA\r\nVINccukw+gQ2R3B3pqXjNXZNAkkADHIxlmkmBJxu1fZBmjc7FY/82kb2FNjv\r\nvKkKUObMvkT7uM/HzL6QAHYRNTqavD6NNyg=\r\n=Jhtz\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230111192852-c7a503b.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/6b159fbb0cada966b846cb25e1143518/graphql-hive-client-0.22.0-alpha-20230111192852-c7a503b.tgz","_integrity":"sha512-cVLiKuz9Jvtz24nZs/pAXIO3uTPfBgWxf1pRv7bV4Pn4WK/BXXeq4nO+NQqTVvxDYuIZfRiOrHTr6dmzMExzMQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230111192852-c7a503b_1673465382289_0.8836395115155822","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230111193821-9ee1482":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230111193821-9ee1482","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230111193821-9ee1482","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"958d7246b74d92cd053479faa941ad84f7d9669a","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230111193821-9ee1482.tgz","fileCount":60,"integrity":"sha512-Trt6wjYpX3KyrIRottzGQBETSvQSm88DX65DrTPf8qUXdhrhEz/O0tyPNUJ9+Kq+grTHEoD3XSqLBjJHaMScHA==","signatures":[{"sig":"MEUCIQCxOJ+wv4Yc4VHU+cvNEOSrYJAkjq3xRnK9flHm4g7N4AIgfDHxSVy40sF/VSORGXllomIufywhtTsZ0A6OqYMzP54=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169562,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvxBbACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmpd4g/7BDfnEoJFTJYQ2vbKSZDcR+G/plaDahQYb+M8HofyBLTZf+hv\r\nK0hinwy0Iu82u5yQF4mDKYm/9CU4H96XfC6iuUx4x8ecTBVgpyrAXdxYA6Ky\r\n8TtxSGDensWrmrxteVicASnU/IdE8tmPPUTg0NbYY84dnMRckEMX/gIXZqIA\r\nAJ20a9QE4bn60TJ1U1A6XNcHfx6/t8xYB+KMJbobfqms46b/JovV9W+IN2Vp\r\nqm7kDdVT3ipU0yQVRs5ZTbnny8cqlyZMTAi+yREVo7Su5HKWXvg0ZwobEHkQ\r\n7bIpq0ZfNNvR4XtUil5bCxf0aNNWyseU90FDbXVaP12lmUdm1QJihz4R+L4B\r\nrZOCAWR9bvpOWh2g/pD0AXzv5qPiz+E2g58MvvZzgVfj6N0GlU2eyRGzr3jq\r\nuw31Wf5xA8u+r4Su/1SJGxuUz4oNZBdQH/63Mavirr2FBE/wVpng707NQhhh\r\nvkq7X70iACjJyVsdcf4GTn81D6g98vzHSqlW6IYQDMAhApkai7bxAldVqBgj\r\nI2fJio/qC+0MNznrwXx9lHR+kMawh0zobvOrqIJeukfn2aOLlvIbuxrhRf3T\r\nbLo3Z/aAf5vYsZvws7nbLBqbUJwZ1UaJdg6WwCtrHvB7B4UxTtk4/+iF4s7Z\r\nmSWgzgMcC/1QZzqMuWwWdUEX/ijBeR23Yss=\r\n=8hta\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230111193821-9ee1482.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/dc86960cb57d771c48fb0067bfdd689c/graphql-hive-client-0.22.0-alpha-20230111193821-9ee1482.tgz","_integrity":"sha512-Trt6wjYpX3KyrIRottzGQBETSvQSm88DX65DrTPf8qUXdhrhEz/O0tyPNUJ9+Kq+grTHEoD3XSqLBjJHaMScHA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230111193821-9ee1482_1673465947415_0.5890515656497526","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230111193831-73e4d81":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230111193831-73e4d81","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230111193831-73e4d81","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"7d3892036fbac30fa9aec80a1aab7f31494d16c3","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230111193831-73e4d81.tgz","fileCount":60,"integrity":"sha512-BGfQ9/jFOVuIaDCkKEA36ZH58rzvgQUAPhsvn2bMtg9DZgxGF16TmBPqAETQwOKRiVUDqu1or5/cppFwnicCFQ==","signatures":[{"sig":"MEYCIQDq1eK09U3U3FB66ftu4it4+StQZ2rAPKpp/6E0/5gM8gIhAL3jeZNBvrwHpbazzMdxOdjufLSYJauD9R134xq4Ekvm","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169562,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvxBgACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmobNg//R7Rt8YTA6zgWRprYblUsBuggK1kCtdYUiaXGFvMqOnb/k4GB\r\nCmvkTMY5AP4NFHg488uVc+llS7gVUYHKYvgcFECtQzNb6NLHo5a13/unEV0T\r\nAvXFe2ISNXXAv40aFk1q658HtoDKvb9MrNPqUY72gcHflWSIn9MsNg3qiwvf\r\n+8xl/vrIYg/vfLhGzRYQ/KMdL+LJS6nkY4G/ZiBwyjAY7yjEfIIqT40hW1e8\r\n6mfKUof4+kjeCARJYrYinJR9uFsa05EsnS+WgLFh+pxixiMBOCy9GFH5lXT0\r\nGJKcLHO2NU0SymOSoex5bVZ6Q2DFdIN6/oym16Jt3LfDk4HAy6XlzLZrQtFH\r\nvNumv2u6U0uyyvrd9pDz2N8OHtZMs5Hsjp+DcNrEO3AJkghuowZWWIqdJSZm\r\nYOsaF5JA5kX3wnO1sxmsjHmAzpnwxh/BfqyiFrq7j4OilBmMA/CZGmpfp3wO\r\nmCjDhMqHuLCJ22a327gyVigEGFTiv/la7l5NF8ZpKojTeCHFYwxfuBDnEMBz\r\nwnsT+KM4HG093w5FyADm+q0vYalm17Fj+I/K7UbUc6Tlbe/dI3Q9EVOcNXqp\r\nExAKKW3YKfqM1IsS+t/Oex+f+HptTeGw8EJeZEk6HND7rJv+h+RgldyjMLhz\r\n/ihQvHCh/6gEl7qwLd9WC+ywQgUddzXE1TA=\r\n=08Ey\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230111193831-73e4d81.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/2c8b87b47468e989bd7ad36d25476154/graphql-hive-client-0.22.0-alpha-20230111193831-73e4d81.tgz","_integrity":"sha512-BGfQ9/jFOVuIaDCkKEA36ZH58rzvgQUAPhsvn2bMtg9DZgxGF16TmBPqAETQwOKRiVUDqu1or5/cppFwnicCFQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230111193831-73e4d81_1673465952076_0.437847956599585","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230111194351-265bb92":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230111194351-265bb92","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230111194351-265bb92","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"ae5aa683aaa10267e2d5d2ad62fbdb5db7c51a81","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230111194351-265bb92.tgz","fileCount":60,"integrity":"sha512-867jaNFEpnvfUjtZt861Y/M6q2NwGorax8nzBHSjuADAbfrLsuYj/J/zITSD4mPM73w54OOav4C3U2oC51aTtA==","signatures":[{"sig":"MEUCIQC2mFJmqFUFCHO0TmiRM3hG38n1rDS9aVQNEbDXLfEEQwIgD6Z8HX/vD2YbpBIY/53eu2GY0SExjH5bktyLSkRAuqU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169562,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvxGZACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmormQ//QAbffE/QEbijKkzqzNjMa92vXiw8p7GcRISkWsYcvOtZM7T6\r\nenncVs2tskpJZn3lXuAMz2cBLEe2iEAa/B9zC7btKTCj0D1jf5lhSZ/0i3mG\r\n/qYejgutsSLShJtBH/IbVnjR61NKdYcpZ0ySL17/lpxAtrszHCrjhgN/WZmB\r\ngjs6qAEZXlzce/WHqYvvQcY3bnNNhgU7WuaQOcQLvDuV3o2TTu4kC2s8rg0c\r\nK9y1wpUS1Hv90YpbjQA+uaLiOc3cmaMp7PA7kZZBAoga9l/I5bjEf0INzohu\r\nZTydt7QXv3Wo0JGm4iRxyQRoC4IlOZqPgPf4R/V6N9Gy8gYQZ/EscpC98omp\r\nHNKjiT8ZVd3UQ0b4N8QcBXgeXIAbO5MhmocZNTSR0ARLDMLhUxjgTEAtUlEZ\r\nZY//2EC7X2wxQKDQrLgjdTmwE3mG6i8CnhG0zAwGDw5mm4jpe1+EV6kLnsWK\r\njAzgpHNskw9L3bG0Icy2jXgMa8r2cTTzmlJ7rXTCqfcvqH0w0n3WrAPws6uk\r\nSWL6iRhb+gLIzBV+4rUPaHEOQ19aWMnxwbyceT6qae7r3xa6U9JJzU+Tcf03\r\nvGhEDhcr/fm6B00VZep5ndKrI6oytmI59Cu0fU4ihuA8qFsj9yuJx3nepONn\r\nj760xwFfrE4Z+RAqXX5Pv1iNwSWmT55dHYI=\r\n=Ay84\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230111194351-265bb92.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/90bbff224db70f33523d181f4cc96d67/graphql-hive-client-0.22.0-alpha-20230111194351-265bb92.tgz","_integrity":"sha512-867jaNFEpnvfUjtZt861Y/M6q2NwGorax8nzBHSjuADAbfrLsuYj/J/zITSD4mPM73w54OOav4C3U2oC51aTtA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230111194351-265bb92_1673466265490_0.17044587238117503","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230111194859-a35fd48":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230111194859-a35fd48","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230111194859-a35fd48","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"31ddfba85eb74744684842f566e6861793b9b7ec","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230111194859-a35fd48.tgz","fileCount":60,"integrity":"sha512-tVgPx6I7v7K3mQSG9suXF1WmdP+t6UAG0+cd2vF9Z7I3eIs++MnZUE6wxqn7KBnzmIYBAmFkAujwZcJKORPxTA==","signatures":[{"sig":"MEUCIQCfmO43HUMRAnkRBe4QMv08+ti+uniQSAcp48ogy4vT4AIgXbCAifLAKqKT0ES6tjmj8cQ6r+qFEdOpnwQbMRnxIXE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169561,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvxLPACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmqw6g//QF9yzSWeJvrKC4KaswuU1MhmfhUzYDvbTodQUOBJ1+KBQ1tY\r\nxbrHfxCOwc4ui+ljdl0sJB2CpaWDWqMssNHWbU6XS1OzuWoOyb7lY4KV+yZo\r\nNdVWWVlV/2FeDqazQRUyEgoIyHcUUrlwJUvLP6wjI6Pzz5Gn7trNKew1L3a2\r\nsvKNEjT8lnFEKzZtCuPA8IN1y63DWjbsYJknDMXAsxIsx1xJ5cPvxE5O6I5g\r\nyCeCgG3ga14aPlXvl10fhJMnO9YR1dXeXmm3JRaJiclWMflApd+i7zwuIlQo\r\nBadokGo7/UJ9I6R8Ots0pMACNTjAVjcgLlRPM+KXP50KyRSI4TC+G+HI7/BI\r\nOyzlV2om/3XvMF2Yd066KzRWsmTasREii9nBz2BMHY5Bcy6U/aahH62vwTjc\r\nmPJG2vHbjRbOMZH0Q9ftF4QRLiu4N/dB0IGRWSAHR1Qjoc2ZSRGcMwpqhzvk\r\nMISckMqh0ALNZ8QOPuLK8WG1b9jL9hgJrkow2YZlSBmxNyOKIX8g2NKCi0L/\r\nStr+dPLJXlnT3CAHMq+sF8p2iiCKmzWEBcA1qe6KgCipZzFr5W47q6g5Q1LG\r\nudcmIcToUWI5QAaK6+FFXjESq6ccJEIKM2pEqGJujxOzSPzZrYCthEDDkGSS\r\nxQaarlui5nID2e0HbAtbsFdj5IM1imq+b6w=\r\n=uGn2\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230111194859-a35fd48.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/e4848ae40ec08cda56dd3b8150bc779c/graphql-hive-client-0.22.0-alpha-20230111194859-a35fd48.tgz","_integrity":"sha512-tVgPx6I7v7K3mQSG9suXF1WmdP+t6UAG0+cd2vF9Z7I3eIs++MnZUE6wxqn7KBnzmIYBAmFkAujwZcJKORPxTA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^9.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230111194859-a35fd48_1673466575481_0.9239981379312023","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230111195459-9e0468a":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230111195459-9e0468a","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230111195459-9e0468a","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"82d09e151a7983e9887c6b10b38c697a7fa2d67b","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230111195459-9e0468a.tgz","fileCount":60,"integrity":"sha512-Z+tfA1Hy1sayXh1KIGYnjw4X7aKPKiyiTWwZk58MomC27/+NTV4qGIrnt9t6fWA3CUVkUDyiEgUtGxVA/61r7Q==","signatures":[{"sig":"MEQCID+mTvipZNpWX3rJtyfU0pcy1rYAGL5LlD6cXiE1mVpvAiAdqEc0xzD11BTHm+ZxSB77bZjHdArf+kcb19ezLFzMaA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169562,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvxQ8ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqdoA/+P3wHNdSh8YlKbKv+son9HVVUxdR8LUoqmTwbgpjFazHkBqUr\r\nkmVwI345znv+JgVYtL3fcqAE1cXyP1fedjOoYbwpnE5/Nsn0ijexuwTX5txD\r\nGPRIxZghySF3OMIkxpS1eiQ33Se6sA1N4QtROpgfcBB5urb4YlcBR7xU+2pR\r\nBgquGU3NpS5uUvbI3zC13SiS3eqJ9LTcNZYK/cXqxYhbf3fweuLZz6iKhHY0\r\nTZeHnbEEnhmT38oJmmSy19KIlAArGw5EhOcBXjLoQ+bt3QyqV3v//m5uvWxB\r\ni8sS9KxUVEbTK52LHlG3V1zWDmml6WuvbatxamHvtvSU+DzJoXJg66M9rFuj\r\nbKgu/12qdrDTN1nqWFnCySmyjaIy/kxJ2xT6CPnWB8x18RG4VbFpDjFWFL9w\r\n7CQ9MRX2Mt8n+iAhTOCPjv4tpeXcvTQy8nkDvgKE4eumpMTJlnNf50JpfgaZ\r\n+Jf3LTa2oKZMM/jXC6yVEEn6HSr7Chb9U2CoIxLqGKJrSfrfNFHeRiu9wmUO\r\nCr88PqhjjCp0qUkema9aq2HZRtaPGlbMqJjeGfuGH0TI/Fd3qrcPXXiTws90\r\nWaPkQlN9F3TTp23BIss5X9ESIK37PrDR+I5B3klHGl+fm/rXVspp6e+5AJbD\r\nOpDdB60tgFgkqWBpj0G3TZEGPCLnMSTJoeU=\r\n=4qlE\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230111195459-9e0468a.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/ebb34cd4be1dddcacb3bc070e0aeb01e/graphql-hive-client-0.22.0-alpha-20230111195459-9e0468a.tgz","_integrity":"sha512-Z+tfA1Hy1sayXh1KIGYnjw4X7aKPKiyiTWwZk58MomC27/+NTV4qGIrnt9t6fWA3CUVkUDyiEgUtGxVA/61r7Q==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230111195459-9e0468a_1673466940559_0.8624438570466577","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230111195839-2ac31d9":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230111195839-2ac31d9","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230111195839-2ac31d9","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"608c4d2d18fcccc00fa0bc753d983ba21a21800e","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230111195839-2ac31d9.tgz","fileCount":60,"integrity":"sha512-KDF+icNH1lr6Qcf4f7mvhFN7BDDfZSiyWuSjUXJFJ2m46AuFK0U2xQliIgtoRtJoBPaNKN4hF1WDL3EV1dR7RA==","signatures":[{"sig":"MEUCIQDA+JoxvH4YqkIrlDyxVll5B5NPAFfQCWtT2I/zpyairgIgUfGZJ9wh/sIRtkGov29cun1xW5J43e4/EuXTn8Gjwpc=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169562,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvxUTACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmonoQ//QvvajMJ/v0ZuvAW0smVyqB/we1NtbSr/79jBSXRanKP69MB6\r\nMXt8uOcTyesshhQRxXaw+lIqcyx4h6cv075q5ENOJNTmCXExJuuZJEZxoA27\r\nIAgwrVBXkA+diD9JALPKCbu1iene0P6E29owdmmBzO1WAvZHDylR6ctf9T20\r\nlgf8K1d9r4h2P2R/jddxpAg0P1+iljwPY7FO/6ybLWEhVlPE6XSLkrF43mAA\r\nUKyZxOW1Car4sxXjBxQT5C/yGD2MEenSdkQ98DpuiD4Y3bPbEPPwKIWD112C\r\nl519gFaINag2JkME2zEzZq+Iyf41dNUjK2jPMH9HIgG4nCPkQVGNlRGKFH+k\r\nDmwFg/CKKU8kwRn2o7MHR+WfXiVwK95mib5oP24PYDEavbVtJZ/cWuWTco5T\r\nbzXT0atzlrtNT/zPvpYZrBV+pfxbh7qS4KB9+TJr51m0FPqL4P9v+Rq/zoTH\r\nWuDN6OgG2Bo2TO9Xpw0milux19anH2nb/Gmh6WHmvchXruR4URv0G2pFFl5H\r\nGFpR2RHys3P1Qx3QaeRGqhVCM/0Vp+BHH7SEp4w+C1xEHwzgpiltgTy2FZyU\r\ndtDKnEw2KAD8rAppkM2idzbHa/jH0DgyJu+7I75JFJOTtbunOUrre2f5GeUH\r\nnCiDJ7aj3XFViiUYzAm0s/doXfncaSLCWkE=\r\n=/E+t\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230111195839-2ac31d9.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/cda843ebf4962cad046dfee4b01453ea/graphql-hive-client-0.22.0-alpha-20230111195839-2ac31d9.tgz","_integrity":"sha512-KDF+icNH1lr6Qcf4f7mvhFN7BDDfZSiyWuSjUXJFJ2m46AuFK0U2xQliIgtoRtJoBPaNKN4hF1WDL3EV1dR7RA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230111195839-2ac31d9_1673467154747_0.5178060106446452","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230111200451-7c7d2ff":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230111200451-7c7d2ff","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230111200451-7c7d2ff","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"58b21ea13379316673ce6b88c75c77afb938dfdc","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230111200451-7c7d2ff.tgz","fileCount":60,"integrity":"sha512-VzSerXSy73mtWuVPppCVDfgTreF6+wGvWS2VGZxpQ+Bl7wSrnccItc4VpCGLq31rzYCA7uEwAX4gfU86891cNQ==","signatures":[{"sig":"MEUCIQCSGMtx/+HAkoQ+QsDbcoyuwPYrgngBWcG8A9aJAbziCgIgOG41Ouu+3OALSyXaG8Iucqq8zqA9ypsDNHqBkNhGTPM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169562,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvxaOACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqytQ/9GQ85f/Ssupzv1vFWj3c9E78vAeKE6wgBNb+bHqJ7DJF9LWjR\r\nJiCvPK4tMKkSGGg2Ip+YqyIWPKc7q80yLcOZXEWTPuFdP+HRnIMGDe5Iz1U+\r\nyX0OARwLy6i3i/Om69vM1Lj5qTvkyv4x0yXKWDmvE+aMUBdNnBem5woI0Yct\r\nH0dObmBA5PvJIGU3CfGN/m9gbLuIvK9tmEcRt4ZwCgq5/f1YH5JaW4V+QFe5\r\nOvlhziQqN6OktCcD9NIPCS58+uGqxXHDPLgw+lTQ1FZtppjzjjqAuf+oBWyp\r\nTnYPsaYdZTx6+cu/NF/36jZVFUUpQR0OauzbuSuINJGXuSJZiRwdVfySg+3P\r\ngzlgV1JH7tpOhKt+q3h7LSA1YXPNFSKHdGobFek5GPm01SSWOn2dwTfxgvYK\r\n0sTIJjYe1jNI1qhg6g177SJJIoryALMb3ShTIDW2KzQNUFAHKvZ/RQOSdsOb\r\nVCxCaLHB3bGGG1oCip+XSrEh/kQT6vgKRZd/Jh8atesec304L4Hqp8rPGOGT\r\n7t1qRq9xiFeJ5/t/opSucQfzfKaSwFzCbwBwTTJ8ybkAHkKdrPZ4jrLFtZVW\r\nsNv+ockAr17WSP4ouDmJQz/3mwZiHhd7Zfz+whqOxKII3hMfpD92MvNh8e2q\r\ns9dI7JB18ssqkgkiSV4+4gTKP15Y4f0zqOg=\r\n=d7Ju\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230111200451-7c7d2ff.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/78cf3e8cfdd61235266b2efcb4e6a344/graphql-hive-client-0.22.0-alpha-20230111200451-7c7d2ff.tgz","_integrity":"sha512-VzSerXSy73mtWuVPppCVDfgTreF6+wGvWS2VGZxpQ+Bl7wSrnccItc4VpCGLq31rzYCA7uEwAX4gfU86891cNQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230111200451-7c7d2ff_1673467534442_0.34004773647328834","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230111201403-5e84376":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230111201403-5e84376","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230111201403-5e84376","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"058f75fc96ac5e341245ff10e103a09ef16ea565","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230111201403-5e84376.tgz","fileCount":60,"integrity":"sha512-NPHrFd9Gk5PN4ByDxoXAa9gUP9zQhIRNV/x5znAqH1SJtzwbv3StGFsup2irBzlSfp9yvgx46BykzZW9lXrrbg==","signatures":[{"sig":"MEYCIQDmUZ5Dwx+s68PdeHSMeIwGS9OzPmgH7/qwxvciaGM4/wIhAP2qayiRjwC8Sofa2vI1slQ7di+QcJC8yDDcWyrqGQMh","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169562,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvxi8ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqF+Q/5AD5Ty1GrJsoMArG9rPIUJswSJtbutTsq3CZ/mNv0jBabpF6V\r\nxydszQ8/AZjHB/2LeCD48dwnbI/CM8SVVvNYS0ADfCDjolomehKNVMoQTaTx\r\nqD7L7c1Gs6XAvHUR2LRqIs1Zg5aEPrZuNKP65q1n2K5y/9qXxuq2qISpAb7d\r\nbX5y6v4sbudkEpspEej9MN42VygN6YPNnfunLrq55uOsulnKvXwRo4eqDlou\r\nWa0ge28w8ljd/gN9cwTixrI1KyzjJl9FImPi9xeq9bT4lxFd0XZljn7bNrp0\r\noT+eji5GnzBqjUbMBJ0vKT3WgiAjdE+Ml5POzflw7MWecaY2gycKhO00XT8c\r\nfu1fNN0cyOTF/vReP6EvPgrVoZun35WSS/odGCg8R0R8+XvEarMHhjy1F92i\r\ncrYuvCWliDmJI7F7xI6S3woNhZq+hvk+wKKLVu40kUy4NuVCmEbYWnlzntEQ\r\nHrxpA2MpakQk0Bd6c7VIhNCC3DUR2jEufFU1ZKvvXleUmRKMT28Zof7N8o14\r\nvD7CssS8a1ZRMn39jfrMpnfemWvj0qWzMV7EtKN5g228bfUET/KDi5o+nlQ2\r\nJ8sSBEg306eU0pEDn5hysreqW/DsWyvmIKjOaglKLPmteqTbHxZTzws2OjCP\r\nqoKdbz8XOmLClXrnNjCHnp7WwH20Jx66k8U=\r\n=aS2g\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230111201403-5e84376.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/f0e4d6725e73cd5561d2d334dcaa0da6/graphql-hive-client-0.22.0-alpha-20230111201403-5e84376.tgz","_integrity":"sha512-NPHrFd9Gk5PN4ByDxoXAa9gUP9zQhIRNV/x5znAqH1SJtzwbv3StGFsup2irBzlSfp9yvgx46BykzZW9lXrrbg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230111201403-5e84376_1673468092288_0.9063672585734561","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230111205955-34cf53c":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230111205955-34cf53c","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230111205955-34cf53c","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"a4d4dfc5f500970d3adade10ce5fe7f3cee3e3e8","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230111205955-34cf53c.tgz","fileCount":60,"integrity":"sha512-InvRtxYEPWyWWWX8Jg+F29wMf+a6YTQzDZytsy2xzr5kdtONTxWmD7o2h1riJ8sPGUQlkNpwsZ69gkNw6KFgbA==","signatures":[{"sig":"MEYCIQCCWKMSCuZfCVXkHnuGk4+6oV8nkXjiKULO6Fbodx/kGQIhAKfKepy7ehME5mjcKq9fmvmeY5i/l674K/ZNlwVkHCJ/","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169562,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvyN5ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpMXA/+M9v4MeRfSdqm1O0n+7XLdP3x16ju2eUGEtCbKXjJF5iO7Q2w\r\nXgjn7XajgIPijsrJZF7/eR832VWuHGhqLGCTNhxcKhZoLNBy3E1JOwWKQ+hb\r\nZLUY/MQprxHnyWxxsRUSzyJtVMI6RGwmhulTMqKKUo1wwgB/l5CY6OmFHHaT\r\nTuUclLKQa7U/zLPpL91FYXlUowFMH9NiFfQ3E1tVgnEZrCdpghm3HIFPVU+D\r\nzdFNut/wGgrD7lr3XOnguj7cNVDyBDrXl3uYPV9Qwu10BXS/lpuVHK4OQQCC\r\nC909n31bgLdSwmBrDYUwsskQqFu97W6uwW4H+o0BxQ639qKEdvYo4bqPyTPs\r\nV60b/9CRQKvpRiP4dZwnTpXP4/dl3eLrKR6ghXM9G4nMStHmI80kSKtpBZC5\r\nqcPSvHi7qAr7gVdRDaKPOyCs31pK3CfGPVxA9vqQ6QjbG42YaaOt+ncdcG+f\r\nRzrF2tPo8tSIh1/w/2FB+2DJC/QH9BCphe6RSvG8n5NmqG61wyBWNBv/enRJ\r\nNigjUplzqcDp5NfyzPkRiqoEPn9fg6yPtW6CrDITEdSUV704ksCd7XM7XS0e\r\nsIf9tmYjaJ5A1tCY+fUqiKWbO7IFSmipy9WqInLxKlQpI3cmOJvlBlQfS3p1\r\nTeUkjVSR6V9tBT+k9cxTEanVV7Xc0vR4p6g=\r\n=PtdX\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230111205955-34cf53c.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/bf669539122cfffcee551f0b42e70af6/graphql-hive-client-0.22.0-alpha-20230111205955-34cf53c.tgz","_integrity":"sha512-InvRtxYEPWyWWWX8Jg+F29wMf+a6YTQzDZytsy2xzr5kdtONTxWmD7o2h1riJ8sPGUQlkNpwsZ69gkNw6KFgbA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230111205955-34cf53c_1673470841584_0.9289966156182623","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230111231234-b8f8548":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230111231234-b8f8548","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230111231234-b8f8548","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"c002524bf9fea5352b796dc0281ceac88bccca9d","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230111231234-b8f8548.tgz","fileCount":60,"integrity":"sha512-OeiUO68iRW7Xb3xfLCYFqTXKx7l+1D7F+4LbClu2U7uNLIjpHFiW56LCqM3A+iV2a3FISqvkCE5CfEPm39PQqQ==","signatures":[{"sig":"MEUCIHKIeit7nO/i7oZhTTZbZdLhXV+bWXkLJ0B+sq4sfX04AiEAnRkTJx5qotCYrmpxnCZESc8UXb5bYV95F/YbkQ0+L8w=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169562,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjv0KLACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrSbw/+IxRVaLgvFevJNmG/Zxx3FXkiVWZbkr6QVGTSE+LMwhVFsxd/\r\nwFh6nsqarhoE8C4LK7a/ExQ0HDFIYiCAmKdjv+2QpV7K8p/JlLm/tYIREdem\r\nmB7Hw0d/RUReqWJFli22hKEsa9j0OkXcFRlLkPuLuVrZlyvbGvDNgvbVyBkc\r\nqQ5Ca6ieJjCA5msNRzw03JQeUe1Y6UQ13mO+OHp+vHR5bC2VJ0LcsvftzPhZ\r\n2IGkZiOuqUIhhiZig3gmrDzfQ4lTYO7PchAv6o9fEggXXLRGp795Py+ElHJW\r\nToF1ko3mJAqygyFHVy5eLGnObhSagn/dBJN+x4FIzu3H+HifFEHop0Lt4zJm\r\nDf7J23ecqIvkD16rqFhJryrLW7uRm2SpHOnWpx8JkRUqD9M32wF6bdAJ/hho\r\nXC2Dk24wT3kL5+6W7/ce1UYCtXnQbk3cbMyBvyVv2cghBvbmwJ3Ks2G6KP6q\r\no4pYe5rlf8ZLeshI3fSuBugHc5CQIEjMdLBkT+24XsaBezLjU0G8qc9RGEZR\r\nInP+k7GILL4A8G/VRfH18XAWQgG0nSz11IXt7CGRZ51kdKjHEnqg21FCeHWv\r\nvkfNS5CNkkKscPkhMZWlsSWbf/cTbrzep5bWrCaH0dFgTzFSAA9NF5wSIIcX\r\nmW/1eyOiOCJmQCBhwlaGdh+NPfbHaQzwMfc=\r\n=EA0O\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230111231234-b8f8548.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/69ee196197f3c9adf618400d5e4c227f/graphql-hive-client-0.22.0-alpha-20230111231234-b8f8548.tgz","_integrity":"sha512-OeiUO68iRW7Xb3xfLCYFqTXKx7l+1D7F+4LbClu2U7uNLIjpHFiW56LCqM3A+iV2a3FISqvkCE5CfEPm39PQqQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230111231234-b8f8548_1673478795306_0.27124624653037555","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230111231831-d27ba3b":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230111231831-d27ba3b","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230111231831-d27ba3b","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"5d917d7f5e1520567b27cfe4ae1b8d46b54bb4b1","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230111231831-d27ba3b.tgz","fileCount":60,"integrity":"sha512-/HxvdG6d3YkDUFEqsJlKobrJ0QDnFTUeKYnKh6P4mXf3K9JuhpqwAcM22VcwlHARwyZuUfDwBdPsECsDE8kjAA==","signatures":[{"sig":"MEQCIEnRGBoQQe/3Bi+9Ig+exLCCosiumLZNK8zkWMaytYirAiAqCyG5beTdpBDndBZXN9cRVJc73CXNMg2rlBR43WoHTA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169562,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjv0PqACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmry3Q/+JBA1IHhKpFyoCHBdANIawHu5SYunjOWOLTazVEMqoyp7wfuG\r\ntFJoXIDyR34ezfSPsMCCO7KsXxAza5UW/JeSn9JR+TvDJRqyWSFEFByj1rhh\r\nu7+jq72fdNtfodqPH7AkcW5Uivsm/s7yPS9snCP2y1+KMC+pKig+RumfNR5g\r\nQJCDBahzMRKX8b3DMOomYe46TMN4RQG+vUVrzPw+2kzwqd6ad1nMalovxs/j\r\nUNt9mIqagzk+5nZNHmI/sg7kYR1Syhwt5sK0u71QrGcrylEVmoduE2zeWW7O\r\nDeYurU4+tZfaB/zL4ns4cgvXFY71ZtLyySMWkW52CapGk/OsVEbemU0zLIEf\r\nRuIPrVdXLi/+Z6KO/gNoVjd4SqWa2DbLtFUq43HMUmjyN5LUGejJiwqL85k3\r\ngdqRTs6IvDRMItlExpkBm4KjEVeBLPNIN4T/9jSrutPFIuHVr5xuWemPHfFs\r\n0TS1VPCZvkWWzj7yQ6TxoxnvJRQv9YhHPD4StG6Ie3Di56ZUuBT21UQlizwo\r\nls61bE2AvdyWl+ltHfbhdgDD1ddsoga67kH4T2HDen/puUNZ9nGDazfxc9hQ\r\nwOv650dMH7ZZusXTN2uRVI7QzbBLvPAX9wtLewXmx5n7Z5DybF7feQDZYPdE\r\nG+eqnkbVcN2lWGcEnr9kB7x9/s3W0YU3frc=\r\n=BmWa\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230111231831-d27ba3b.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/dcf7c932ae7790457aab09a77b2172f5/graphql-hive-client-0.22.0-alpha-20230111231831-d27ba3b.tgz","_integrity":"sha512-/HxvdG6d3YkDUFEqsJlKobrJ0QDnFTUeKYnKh6P4mXf3K9JuhpqwAcM22VcwlHARwyZuUfDwBdPsECsDE8kjAA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230111231831-d27ba3b_1673479145849_0.40572798242266916","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230111232329-60784ce":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230111232329-60784ce","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230111232329-60784ce","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"6c038c755a4717ea5da2f274b573ce80a8fbc3a4","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230111232329-60784ce.tgz","fileCount":60,"integrity":"sha512-9gppwsYCC44Y0ZqHvm7iUSBwph9JICtJWX7aKxAELpFmYltz9VzgLr74HMGEn08oCMGUzX3OXodI+N1M6uYa5g==","signatures":[{"sig":"MEUCIQDa4MAqckLAJqC298gP7ABA3WTeAfW4AtEjSFk0XZ2SIgIgaLNnbso9rzy7hkDbD6xPytZ0SzX+GRW1n5lobnRxnkE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169562,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjv0UZACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmopNA/+N0V7mj4PkuACJFpmrdUGSaPzRMgaUAkO40k/zcuhLJp9w58O\r\nQGi68AzfyDPFAtAluyVuduBt73hkeCVSORhfuWWcwdGDrUyY5Q9aYargvb+D\r\nghbotN1DK/b/sQuyNyc/omZGS6Z2niEbe9WVIvsy6wMnGnj/29Cu2d2eS/Zz\r\nHi2nUzw/U8lJft9lb4OPmCIcsGd5u2cT4pd36n3DFvPyCwa3mmA9tImoxFkb\r\ntp/w+AQY9GE3mf6C5G137ZKcEizwbgeoL0RortFA/Wrnibji1B/qYZCXgG7g\r\nN8ftbTWaNyU4Z10AcPjVZJLgmGKYpcOVHmojIlCM59Ehuh5cdwEyyMclpNt7\r\noXb9R7AJQpuKroqSbP5QtBQpBANOF8UdnlYBszpHaU4pvCh0Gc8Ld+ZsJfZy\r\nsKI2tm9ikViJ8+hTtFNpr9Tenvsos43TbYoms51yo2SP2kChkyoNtsfST93G\r\n7/lCjXiEhbxfhR9VaIOlU5CRsngpMBsWbFC+JADaHJFx/CcDqJYBJ6A9/9HO\r\nnzKvBTp7UDvpkcI7BoxXxWgjczOYjD66Q/0Tt0Nwcx4syPex2zWqml9b1h3y\r\nD5hy8Fcm/IYqEHCpTxwsH5uZ0lM7KNKdZbf/oWVKIYISP1PqCGoSGvWXZiaA\r\ncbIjb0yGkTeiErkX4Nt1TZktFBan5igPT9Y=\r\n=c3wj\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230111232329-60784ce.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/bad6b4131965722a320b04d1367a9bb8/graphql-hive-client-0.22.0-alpha-20230111232329-60784ce.tgz","_integrity":"sha512-9gppwsYCC44Y0ZqHvm7iUSBwph9JICtJWX7aKxAELpFmYltz9VzgLr74HMGEn08oCMGUzX3OXodI+N1M6uYa5g==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230111232329-60784ce_1673479449241_0.12135087490783447","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230111233317-de9786b":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230111233317-de9786b","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230111233317-de9786b","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"6cc95de85deade86c6b281c2f03ff4f787225a9c","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230111233317-de9786b.tgz","fileCount":60,"integrity":"sha512-dF62Chp9MycipXK6M8z4J1OAbw1cDmWr1gBE1VeTvvzlbBVWTBno44eix+HPZBAvDYagBQBSJUM1Kayj8Yhncg==","signatures":[{"sig":"MEUCIQD9a1FI/6fEItaNTBXX2/itYSPacqcvHtdjJRV/yoBXVwIgR05clwafaXt1Fp1z8NHJcSWVqWfsrV0cNF014ChyLjQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169562,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjv0dgACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmq3EQ/+JHldJy1hEPIYguoQh/Q0n3WkGV5xbyN5+rBOl7TDNG3IPWay\r\nGXljCgaqHWgXN3ybdQJ03bW2YmpGeZ0C8cWl/llnl7PHspX8WPgHO8FUSGD7\r\n35QCC5MJYqJBSzH496F5SmWW0+alx52nRnr10Sdd8BrvpVuiKD45XdAMOkAW\r\nqxQk/i+aaZe0mdyuH2gczGkfgCTp/Cu0Q139fr0WwQiUnaY8mipOSo81CvaH\r\nWyY3OyP0VlWCKZDUKBGmaSNUi5E53jAh7LO8VELpDPfPQLCuZk6SbC4b3s9y\r\ndYHDE/GNz7TtIif3GxxOsbeqwsUgr01e9QtfOiGWmqX7OCxnVGrczBslGovU\r\n3vYUfx+tV2YqYRC3tCIy9wCnesPNv35WvAGNS3+pPf2AoV5oTKlnH8nh/bEK\r\nGMmkYHwkx2mtuva257WFsaj+Q6bYxhTa/FkiwQmYwKUz/E5XQW4cuERcFND7\r\nzsOWSr0AvxDqRfw/unFlhGoedsGZq9aGS4c8fdfvh7JO35mnQ4T1rx0QtADU\r\nY00idBFEF7izOcu+Yr1BeFUFF3wf1W9mkXG2d0BDkltSUEBrRF5pE8LhKDfz\r\n+7Txanqqtfmp0qLy7/l/Q8PoThVo9bh5aD/Cm4ma24grZbFovztry5HXWryJ\r\n5KVtbBXwGIUdnhGh4UJ7lOEcU0/rU190MkY=\r\n=5Ipd\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230111233317-de9786b.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/2b9a1e000fda9eb480df70938cb190d6/graphql-hive-client-0.22.0-alpha-20230111233317-de9786b.tgz","_integrity":"sha512-dF62Chp9MycipXK6M8z4J1OAbw1cDmWr1gBE1VeTvvzlbBVWTBno44eix+HPZBAvDYagBQBSJUM1Kayj8Yhncg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230111233317-de9786b_1673480031947_0.4404131911414506","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230111233825-d878b36":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230111233825-d878b36","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230111233825-d878b36","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"d04df24cf0718568eecdfb79a410751844885bb6","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230111233825-d878b36.tgz","fileCount":60,"integrity":"sha512-voKvUWHzrQf91P+nZIxcT0mX4bADTC1o1/lXGLsWgevu+rf7HQ86xACq3Kw3OQd/LZngsY9QRPFpK1duPzGYsA==","signatures":[{"sig":"MEUCIQDZZvDm17up3W1PRBcCnvnAzH29xhWB66yFjmJQJM7lzQIgUscMWrgoy4DbXzdn1/PfSDzlbGgRgmbETbd7nmhcKTo=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169562,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjv0iUACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmre5g/9G1GnY8rYgfqhgzaZObGiNS02BTHia2Gb55jcGwBfSdyd5o5S\r\n4m1W355lDbyuPUDIwjE/NC3FpzLtgAoat9X5juneKY4l96gCdUOsEQateIv9\r\noROsijEt4DAdcDfh0daBwOD9EnuoDRSHQEt4/GwdPaajy8FB180JV9gSNW6/\r\nbiVXm9GZu8M/D661kyjfJY2bW/mfji0agUmUR7vwp+G6mg7qjxhyntFqXreL\r\nlkZkLkFvgJfKI1b3wOu4V0mOxqL9qEnUqMKrvFLnLQLeosdkDOYaJyQe/4Kj\r\n2Wdr6rYk6ax/WGrbHwJ/JIO1/O+FI+k8vzTMHeZtU4hlc9VdL5rmQyRon7Zi\r\nL815KJazfWvvJJUVZG9bA6EwsTtWuAV+9qIYYMzyQMT12z2Pn718oa80fLe/\r\nlztAVk5wE67I5nvulzArCR5qfpnTQ6ftMFntFnZV5mylb3QqSvOmUUEtDt91\r\nlj8x/i1BvgKSf2n8cGccxgtNhbbysEgt3m8DdsoFhrXUXtNYVCp52WZRRLAg\r\nnXRLdKJFugkJv8mEKDCoiMH5VmXUSDZgVRx3ntgZmAKT2uM5AbdkkA+J1974\r\ndlRcFpxvvDOELUuZsA53Ww7qvBLpiOz41x1pleI4IEKsCmtk9uFp2LqHiwgX\r\na1fcCUj33fupQ1UzJJuKONVrcMNqjKlqATE=\r\n=bY2z\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230111233825-d878b36.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/830d587467adc67932b2ad7b66008713/graphql-hive-client-0.22.0-alpha-20230111233825-d878b36.tgz","_integrity":"sha512-voKvUWHzrQf91P+nZIxcT0mX4bADTC1o1/lXGLsWgevu+rf7HQ86xACq3Kw3OQd/LZngsY9QRPFpK1duPzGYsA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230111233825-d878b36_1673480340066_0.1601116158406124","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230112065345-81379a0":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230112065345-81379a0","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230112065345-81379a0","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"a168b772ceec700c280dd0d8d9a11f7604458694","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230112065345-81379a0.tgz","fileCount":60,"integrity":"sha512-3pBt0abGZcMOlNtdX6wwkxaMrr1WZau1eXuJoe62M3o0awO/tV22TYvybv4tWa17CcIHM9RmqrYqb0qFdajumQ==","signatures":[{"sig":"MEUCIQC3ySIuNhFJ0zHWEN5MTL7L3CbJaDay5xcrjzt92KBMNgIgAziXVnlfOfP1PQ6HZK/0m99A5csHOXhZ+HR8sU75YEw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169562,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjv66pACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqLJA/9HofJid0TfJnLuQL4v5fJqLKE+iNP8srNXFVHCPzhzIdHjV1A\r\ngHyL1XLZAos8G0/7gcwgPkfsQJuvw1oZB3PYaCwMuFNVkLw048myn/VuCLvb\r\nAfUKWijfUWQWr0oeezoFXKbSKPESZ2t66BfUcymDywZ9OQcex2MQKBLWYbrJ\r\niVlQVruO+WvsC+HjZnDjhHG4ngz7mvvRyyuhNeZ4eSj9bWJVuFiPIcPjlV0/\r\nE1E9fd5AdGN3KDxJEHTKptWO5UZme5o71qpBN/RADVFATE3fX00HshlrsNrK\r\nKDi666XYvng15G2y4XoXRIOTolys+vbnMXyhODVqW2A2UJ93X/3lX2E/i/Dj\r\nFdE51Vog2DLIM2qiYXimCNTUM5o6rAGYFqZyw7m6a8IK2pXFHbConwG8qqgu\r\n9UH8sLEJUcKScDg/qa+V55LosPDo3xgBXvA+yDIbKkDzFgDWHAFPVgFvELF0\r\nETpROATg966cA1XNxrm3tTZYT3iytJG+RT6429QIto8J5QfRrvOumC6PEMoJ\r\npnWZBqfTaK+4bzLgZTnV70yDgPUYwec3M/G7Ll8MnG5vZet7r4sBvTkgJHcS\r\n+eTuxDxJlDQguSYTwj0N5J4vX7PhiPa4oove/B9IfAmNbMC+8eKtEkSGpws1\r\nmDpSN/0e8GQ8MjMavYGFDZSX3Zj3X+37O78=\r\n=T1K4\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230112065345-81379a0.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/c312f6644a340f31be1e2c17ec334ff7/graphql-hive-client-0.22.0-alpha-20230112065345-81379a0.tgz","_integrity":"sha512-3pBt0abGZcMOlNtdX6wwkxaMrr1WZau1eXuJoe62M3o0awO/tV22TYvybv4tWa17CcIHM9RmqrYqb0qFdajumQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230112065345-81379a0_1673506472884_0.969797721142847","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230112085410-e1c3069":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230112085410-e1c3069","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230112085410-e1c3069","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"85a1aba4f97fbfb956d039affc10a8d43b4b0bce","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230112085410-e1c3069.tgz","fileCount":60,"integrity":"sha512-4JDfOlAbCxvWRDXF/2VtU0at5hUb0coQI7y8/hgyjGfeRE3FzuSSJLKiGR5Kp0RVTPX+XhZDFrRii8CK+a7hnA==","signatures":[{"sig":"MEUCIQD8I/4F+Ir12qekRf4pLeTnhh4UtSw4NCI0eKVUKxgwHAIgd9shyrbzwdAAd5dlN26qdzjFiiOMT+OmjTaPqQLBdIM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169562,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjv8rVACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoLvhAAlGshK5YwFE9B/IaQqk6f8F5FqXKnp6hB1dPmhrRoeIx65HWg\r\nO2Qsh6CZFXkwK2RJS9VZnbsIfxQbJ058OiO+R6nVPEhBs/H8OA1p94PgmuDV\r\ngRqxXlEYrqBNXcXYPE00+I936m5Q5G2mzD4wKtiA20MT6VBaZ7l5skHCzFEC\r\nQoNggBpbGl3at9TD0xWQJaFW+GcajeEpmsU/I/TcmTZskXriwD6UbUmLk56D\r\nJzVAEXI5rkkqEiCTSKHoLpu/WDERH2CvRf5IS9R+XGGhPZwyzpgObF54C5yU\r\n4xN/lhwOhKdCCTQrf3QFTkOF5FkPbRIqvSzDIp2Cq/wPTXC6vmyV4LYmreW4\r\nMPn1xDELdjZSzBP9DLzpeRIWIRu60VkuMExfnSE55s6GvD2YqVh+sex5eimC\r\nF6+R+ScDNxEC3USttzACwmE25trlVbjdWCo9pClzLpymuwuZE4/2iMpjBTod\r\nz7sEQnK2Slf7l3kJC88aHu1GNbyGhcJ3jVSjFUXXcShaW/Py5psWSqu3Apiz\r\n9RHhylQEcp1AAftgtp3aI5gf+I20TzQoonRjR9zH1O4u7DmiYtjj9Mb3je1P\r\nlH8oiHa1SnEsP527x9q9DEkpljmTl6xIu3f46Fm3FjVZJ5drs9aZyLGbBAWk\r\nVWHuwIj2ztqicHCL+W9zKTPKxjTNnhTHaEI=\r\n=8QOS\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230112085410-e1c3069.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/577e44ba16ef12a7220e65a441c8aaba/graphql-hive-client-0.22.0-alpha-20230112085410-e1c3069.tgz","_integrity":"sha512-4JDfOlAbCxvWRDXF/2VtU0at5hUb0coQI7y8/hgyjGfeRE3FzuSSJLKiGR5Kp0RVTPX+XhZDFrRii8CK+a7hnA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230112085410-e1c3069_1673513685187_0.6342902851353402","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230112095538-4826f26":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230112095538-4826f26","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230112095538-4826f26","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"6b8a98ba0dd2ab11249f39e7437d53ad46ce18cc","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230112095538-4826f26.tgz","fileCount":60,"integrity":"sha512-gvF59n/mlWuG15eu4qllOFa9mqLGsgdBsAu7gpM0h2GcGcIeypxs4iudbl/HHqiCmw9bfBZW+AGcsTL82haaKg==","signatures":[{"sig":"MEQCID62FV2nEeV3om/8kbUzqWXDgUtRBnpXGWe9rDFs8N3kAiA0qsaFwCcZeKIPK+EjuDkdx0FGfeSzhgFjVCyNfjLo0A==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169562,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjv9k8ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqmsQ//b78NjYYZQXx+01GX42ZjbkIYXyf80QkKTYhdovJS9fR+20PH\r\nuSfxu7zOlQyD4vfMCyCKNJtQs9lnSCMFRMXOlhc4iNww/1Wtu49/RwPpEez3\r\n2ktft9OxVsqRlu5TJ07MVqt6QDyxwavkHqF4rdMYqG24dtnwVDluuVIWR9/l\r\nnKS84utxGMX0CS8dRBe/qvb7TSDK/AFLCXReUvM8jbPvjAG9zPfcj+2NjYjg\r\n7J6AOp75PNpR9Cd2Chu7a4fexf4tjyrsEOqENX/N4/qtecG38X6sLFzhSz8X\r\nrQ0SYAW3Ue764Rcy847iF+556lQqNkZjl5qSpU5rqAnbtHiSEzshHYpvF6B+\r\njG5I2AlbhtT9lJwTpS4xTM8nZ2zZ6Q/fwWKrx/7m28xraBROb8ACnvMvpP+R\r\ncG4afaRpYS/i6V5NWSnVJzYtMy2oUDXpf50/6VBxDpk9OwB4t+jNBYlNZAlx\r\nulb81GB/qg/pVy88uPSppBcQQ2fJYW5cIDFXPC1Kz3a8g58x7aKEGaBruCO5\r\n6YkXGX1I9K0D81/bMTQsZX5eVHFtmJoHTbcv1vttc1efjXSwGAtSDG9l1Xo5\r\neG4PrZYyPv3++q3KPdkY5sKVD4jkQCnhJgNR5UiEmADML3cNEHPdMdJOxGy+\r\nfmdFAAlQwcLV2t3ItImr1U0Sf3Ora3oqwP4=\r\n=EGk3\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230112095538-4826f26.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/755841c983ce774382e5173109541986/graphql-hive-client-0.22.0-alpha-20230112095538-4826f26.tgz","_integrity":"sha512-gvF59n/mlWuG15eu4qllOFa9mqLGsgdBsAu7gpM0h2GcGcIeypxs4iudbl/HHqiCmw9bfBZW+AGcsTL82haaKg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230112095538-4826f26_1673517372554_0.5076514769974201","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230112095549-7c13352":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230112095549-7c13352","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230112095549-7c13352","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"614a6e3275a58b5d65caedccd327622ff7fac29b","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230112095549-7c13352.tgz","fileCount":60,"integrity":"sha512-CsGSQ1ZNbzxyjdY9p7Q1kuRjz3ZryWj5hfAnMRLcRlXbPBE8/fIXMt4OF/a88O4SdRzWRutS25yQ2lZsCgDvPQ==","signatures":[{"sig":"MEUCIGGxks2duZHEN/5/nhNFWFMr6vfQXkvD1aP/MyMHUjF0AiEApJyia0GBB1yX4Bgk+uHFdyyarc/TVnBpCN0irPS1qJ4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169561,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjv9lYACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr9/A//TvdaPD09vGpggjK6EFot9MyXKjuT4qrSxdaQxBb7it2LIeru\r\nbwpTBE+UmPjhV30zowBaERTxvlYoKB5lEHF/jbpGUdAk3ONSwFBxzwkJc1+X\r\nqhc0eTqW/b+kBsq2vHAIHRLFAQwVc2DvHASX+P/WmmwKaFiBDo6gbtrBKkqn\r\n1WOpQFK3fKMhyawlxaviVVPcuEPZRYd/ME+Xjn1KqVKj3x/G1TN9NqJgqXFM\r\n80AIsKZ2kk5GaXWC75HLCf3J6pRMoPQg/c7UCWSJDleGJ+2sIyGS/2O61CO5\r\nWGrgbZuidNhKloYTJMlQgj6Pigq3mLtaWRXE03Sc/1eC9QLRHag2UTjeUQir\r\nFYtB2K5bwQyjBbbUc2eFMT59HKQ2Ko4ce7bz/Xuxiqq89A7XLLlsY1kt2o4T\r\nMTQELuH9k8wCvUCHD1fyqS9csPdJ5iWWTGr82Zryjd36PshkVmEooTCB0u4r\r\nQVOMeBOQp2eYLqbtaAt6j0P6nelPPxwqTjP5fzqahGoABJFXJWX0OTrSF/Xq\r\nRI/zMYvkSEFsI9cVOFVDSTRpvCYyQDsYcyVgNwVW6XSAzmnIsdkuPoWRcWzP\r\n3gRW9fJnJJyxDL8Xhbf7cPwYoT7ERBS7FA3XdUwRhcyCVqyPzCTZxPZgXzyQ\r\n0+quivAKzOuudWOwvPFJWPMhjbRJ42nZDVE=\r\n=ce7c\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230112095549-7c13352.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from 'apollo-server'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nserver.listen().then(({ url }) => {\n  console.log(`🚀 Server ready at ${url}`)\n})\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/ca615d684f80296a305b2477d6d38c2e/graphql-hive-client-0.22.0-alpha-20230112095549-7c13352.tgz","_integrity":"sha512-CsGSQ1ZNbzxyjdY9p7Q1kuRjz3ZryWj5hfAnMRLcRlXbPBE8/fIXMt4OF/a88O4SdRzWRutS25yQ2lZsCgDvPQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^9.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230112095549-7c13352_1673517400480_0.5981108025516066","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230112100108-ee73563":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230112100108-ee73563","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230112100108-ee73563","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"67951ea4294ff193dcaa20a6811216b0ae360e71","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230112100108-ee73563.tgz","fileCount":60,"integrity":"sha512-HfRhEtCNiQGGdVVs+4YGYzVl2SzuIYdpQLxp3yx5gIW9j8yzIXX4UeGlwluuh8ra74CADAHQtKeEHRdw1LIC7w==","signatures":[{"sig":"MEYCIQCNwGmD/5twNn0MkQiIOQfWFtVkd8VctYVvxQD1EgzVNgIhAJQDj8uBO3NVZPnpp8UeaZct4gQuVuif4dq36GozS62V","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjv9qLACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrYMBAAgxGzzuY9+/Xl38GpIwVCT9QiWq7wdHggyFrQk51BZYdmPg2z\r\nvJcUf0o08G+JfkSZ9sMGSts8eggO3QmuV/Jawt6hKVePM/Hwl97Sb519jxzw\r\nLxVg4thf/295ssdVQfmQc4ikl5nwmo2D1uVaXX8ZDqEQZlsgsuvCs9TVI8XL\r\n4SqtZGfmYO/ozmXRTnNsBjZr7/gRtujGe2CvmV/XToVwn0dFnQrcVKgEG94d\r\nC01XUzMz74nw+bHUJjMf0ljYx6/sRM4zlV73yROKIJN8Q+bsnBr5DujpItUd\r\ntCVYG3sgO5mMWw0RLeZLa3L8PZFyN5FNtFGW5UAvu2e1i8xdNqVaCE8eyIRl\r\n5o2+uhOnG2/LLYdRLFFnDCwkMs5nnDDtd2INgR19zo/0Y/LWRa2PwD2+i0qX\r\ntVQBMkkYf9TWQbOd+qpspzoby7t6KAguVFdWSY/OzznUbtz4V/p0m3dAVcej\r\nRazVuTOoDyYsHWs80eXy28qkhTFoIVRk68DEvu22CbT/D/+dl/VAAISnrTsq\r\nriMBVE7bpVBbwZWdRS6d6oyaTZ++zVuGNJiJjDUbTTiJYP6+ArXFPCSzZPuw\r\nqXp3VQ3IYfyRlD/679EkY3OBw2fnrReMZIbjB1ssSbAYHcShL+XEIB4PsZSK\r\n8iP2Y0OY9tTFiJBXnI8xElzCzb3/bmyVyrU=\r\n=zYtB\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230112100108-ee73563.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/d75772c6cb66516a20f7cf5f0f681bc5/graphql-hive-client-0.22.0-alpha-20230112100108-ee73563.tgz","_integrity":"sha512-HfRhEtCNiQGGdVVs+4YGYzVl2SzuIYdpQLxp3yx5gIW9j8yzIXX4UeGlwluuh8ra74CADAHQtKeEHRdw1LIC7w==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230112100108-ee73563_1673517707425_0.9132989569004484","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230112100131-e8a27d0":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230112100131-e8a27d0","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230112100131-e8a27d0","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"581ff62fce6d5b8a285645755d797ff72f44c043","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230112100131-e8a27d0.tgz","fileCount":60,"integrity":"sha512-T/KKTQ8OGVoG6FbrkO8BEy/vxwF0C4Hg+SlM3f851PB4dkuB8VTqCltQ0YgaDkJrcGyJ+SwciGo+zfGlUMCUDw==","signatures":[{"sig":"MEQCIEVjMyWAsYiTxzGBf9wFbdP7/hRXKJEtKNnRx+ITEQTZAiAM8+pU8PAGymRqZptT/B+/r+ThBTSnHNnr27MNVaQDFQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjv9qkACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmraMg/+Jq2CM/VIFR+cn/euXkCecaxOA4eJgh7tjZ4/iR9pt9f6yPwM\r\nJG68t3PuK6kuoGNVZy3Y2urU8Cx8AL+fyv3FKAJan4lSvw7RdGUQIueArow/\r\nLl2GHMbx6PJy5mxErLa6lQKk00BTksxmkfDvbrJTPymeu9AVRHgbtaq+/xV/\r\nyPsAsEidhFzwGFXk3uQCfhSoaA3P6WtDCzL20MCfwAf48JW+c+tCMjo6cnFZ\r\nDJ2ekuiLZdmIp0iu/xAaOZZ/m7szanaWfPlvcnT9O2tptqDqkuv6JfIBnWWY\r\nNF49S2L1cA8AL7PXpAmL8UnnaSoRQMIJ5mIeqL2wE8UzuRyC2DPhzBfu1opF\r\n1ff9amf6CHKPFgFw2h59Z1VrH0Iz9/UDWcI+yf2lQ6K+LV76XA0ZmXmpOqa+\r\nDFl8hyaNB2elofqylMvJ2vfPr7Bk0cdnWVCcWzV3bPcFjgN8vk87NR/eqsav\r\nje6A9C1dUiF6RDdp7IKcvLbpCa1YpnkoYPYrq7WwpuPWqAM7nW0tOEVN5+e5\r\nHoOKjOYFqw1/xWMXDjmrN9mJ8YyUWl4QW22dT0kjz07ApLHVsf4n5foxRkfo\r\nO2wo/TgXvNq4n3JrUKolkmEJAaPIFu26v4YffqRSEZWorh0mWlo51bcM3SF1\r\nBH0IVAIWJbZqpouXjMT+CrEvW9+nbb3qffc=\r\n=DQP+\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230112100131-e8a27d0.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/3ff6345350ac90d508051e3f68d5882e/graphql-hive-client-0.22.0-alpha-20230112100131-e8a27d0.tgz","_integrity":"sha512-T/KKTQ8OGVoG6FbrkO8BEy/vxwF0C4Hg+SlM3f851PB4dkuB8VTqCltQ0YgaDkJrcGyJ+SwciGo+zfGlUMCUDw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230112100131-e8a27d0_1673517732579_0.9316363634642268","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230112100146-b3a38f6":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230112100146-b3a38f6","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230112100146-b3a38f6","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"67d89ab867a7b61abe0c5fa7f6761e36b39efe2c","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230112100146-b3a38f6.tgz","fileCount":60,"integrity":"sha512-Q3sZDbvH2iN45gesCitOirAP6vblteSWiXOYF2WT4CH2140vpAJXvL72ifouVBasUy5OqAbUDXa946GFAdwkqQ==","signatures":[{"sig":"MEQCIHM9LiYyEfKj6YTy7XxSBB8d6a6T2E6RommA+k8LalPdAiBKqUXidc9/hCVjJAQb/hcpHssJzWh9SDXKRtRMMfy7HQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjv9qwACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmrutw/8DFYw4lqGSzylSvOIPy+uTT2+nDyDJCpHkHO7AwldmO9bWgv9\r\nrBJoAuu0hjJfi4wRUfbMjUCOpues0UGMx/X8Jys8h4BjK398vOiRLWFs4wtI\r\n8tmJoz6RS+EhMXf1nWcTHZeXgDERqlFxGBSu/WzPdaGsIjJ6BAGf4T2Tz1is\r\nvgi0hse3r5bDJgWmxNeg3ohwdTY4+u4PaZvF1eA4rhnUI4sXrTC1ahrkns05\r\nUpWZKUF+mFss8j8crlm55dk28tjWjYpOHXQZeV0kv6HKkQBmojAO8gsSGB5o\r\nHPQ7o47VQonK7gNgGc+Mvwd83Nn75nJzGGXNi+7Sw5kMV7tHInkl0Tw2OFnI\r\njwbyFioJn8KZudqOI9bUkw33CiC68tLzOT3AR0W6gPAOFqzI4++ZP9TsoR1j\r\nE3Jh7kDFmjLLr0NvBWvHwHq2isWXEdVB/Pc6N2ZiZEYTNFYpb9pSQpLeRxLr\r\nRbRHcBX7CCRzP35GIaLBRfBe/ebFV/qL/wjXNHbKPDP/sxjYVDbBAQQSscQG\r\njOITYgiNR81TjwsMsSZUW6bNTdv/OPbyNFhjTaGoPKqysxPECakh4NUEZ+mB\r\n4lZaOJLS1Yq5b80SKozUy6eWBi2euRCAxhoj1uRPmtIkpLa/KMEe+xKnX+qh\r\n2wVPH85Cxj3HBqJb2CyhX4RnZsh1jb7Aq/Q=\r\n=C1D9\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230112100146-b3a38f6.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/f9fd81b29155a814b04fb160217e2338/graphql-hive-client-0.22.0-alpha-20230112100146-b3a38f6.tgz","_integrity":"sha512-Q3sZDbvH2iN45gesCitOirAP6vblteSWiXOYF2WT4CH2140vpAJXvL72ifouVBasUy5OqAbUDXa946GFAdwkqQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230112100146-b3a38f6_1673517744071_0.5302842258359717","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230112100345-325d603":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230112100345-325d603","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230112100345-325d603","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"27690c55c6a90d07006227729ee0807f2cea32af","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230112100345-325d603.tgz","fileCount":60,"integrity":"sha512-2hW72ZonBihZ13sAZASv7FNdHqzC2oLw8zBpCBuCYe4Mq2C9G+l5SB6964zXAc8C8c531qMxqo2Lg1He+IrqVA==","signatures":[{"sig":"MEUCIQCAMgx2h12iS+JHfRFFufPKZOEDK2vyC5xZUEFkom8S/AIgI5w45nlVqo7rCAYGFOGjA/GUgW0sZ2376e5sUDptYTU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjv9suACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmpbug/+Pc3bCddS8C+96Q7eQHlPk9GhLlpUkkuQwyh8aReY5WTE9wMe\r\nP+9JCI57c2j4B7aPO6IO9pUISnhm+LuQ3WPand0YykUVX/sKTw8sc9lwYp0Z\r\n5WhRVqu5XtBuSM8/7PH7fEMWLKtyo4hj4BJQCffdP1wxz5qsq9uq1WaXMaU2\r\n2TSZORRPU4bnv/lLKxES/13MeuSAby4TiNpXksVwHZtJ6hXsziodS0PAyUkZ\r\ndr1A31ghd7ebMO2IXzXaYpwPX8UJdF4T1kfC5AnP6w0gIfcMumXoSeIu/cpz\r\nxhMBzgaFL75Wvn2+2RooScC33TXnoulE+ofRw37WKbl5DmxoGPadtn8JiyBr\r\nHQuS5hUQwLL1xXGzzgvtF3OGCnzha10cRhMg/pYOOa3AOqFkNfB148J8/x+k\r\nnsQswGhsMR23/cfrDxL0GlOVBzCI1QM/MZ/OQ5ObNozk1OP7zYbZXjfRpfwq\r\nv2JmWISm3E+4eUh4/LURBFsqbHbNxSq+SFFVGYdk7uRgM+y0PTs0xAg7oOoH\r\njs2elYmf1+4ys2NuE51zYONQZB1tcc9Lk64OSue9Jvi1sJDr9W8niRQyTCMG\r\nR6ujYf7i4VeNnsdk26PSQWQ3unpN9JkIqjHWO+HoJ+0zmIVAOK5bITgRbqed\r\nKpNJqFdCcq7kEiPc5gblvyP/bTULEetYhW4=\r\n=jr2I\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230112100345-325d603.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/5e461fa2e432c922722404ebe9d0cd86/graphql-hive-client-0.22.0-alpha-20230112100345-325d603.tgz","_integrity":"sha512-2hW72ZonBihZ13sAZASv7FNdHqzC2oLw8zBpCBuCYe4Mq2C9G+l5SB6964zXAc8C8c531qMxqo2Lg1He+IrqVA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230112100345-325d603_1673517870328_0.6429543015295669","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230112100653-1dc2f2f":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230112100653-1dc2f2f","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230112100653-1dc2f2f","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"5693bee0f48e0a06c7e20425fe07e2131ffd6b6c","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230112100653-1dc2f2f.tgz","fileCount":60,"integrity":"sha512-Uf2KUjTWuRbeCaD1Hc0Ze8yOoV3epLZa5z5zxQx2EH0ZpK8BK0yN7NvzVZGB4BsGU7NRp5t8mx9vYVgHGhuHWA==","signatures":[{"sig":"MEUCIA2FiHBgIqTOTNUGF/z1Ga8rSz+Sd7NH7clVW2IyCaMmAiEAl3c0do7u9lCuJm3GLbQP9E/bBFGCmNNdhYfApEyqc7M=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjv9vgACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp1yxAAl6lzPA0pOrsHmBxrw9BvnVOHtL50BoBIxXc5f2Wba5VHS26q\r\nc86bM2OX+YEHTrvN2bLKpn/yQCTBAY6iTbeQQVCZ0+CNBfcZ4sPFsNjyAYV2\r\noVdpvi1Si/kJhPTXRn5smUy6RgwWmTHWdS6b9VOfBZ0iXfHGA6v6PannTyVy\r\nXIpiB7oAmpvA04G6Ge+JFi1ITWgRxk/xGjuuONCklR0+in5xuCIUX/GGTUNl\r\noQ4zy4R7SABKAWzVLvZTwZkDas3eav3w/9uTQnM42zUppR2kxdxMd/F27neI\r\nHfnzDd95mpj/Zq0mLsjJJLLnchBTxDab5EMtUaZu619UEJplLlnAsCGaeNBI\r\nvZ+92qeuoREfUhePUC9dr1xWqhBTWeHuuB3pT8f9fFRI/wGFF7RSATI9ryDH\r\nzoOsW5QZV6V+gzB5PE88r0Br74ZEeEkC7dyuJFf1yGOSa8hp0SjKJ6txQV2w\r\nT55HlxVBBuxxcFejd6Qs5GgyjXD1J2ysJUl6sa1sKbTVsVR/F9gs558kiKBo\r\n0cT90nNwoCsGnn/ycFlv/gL2DbV+yEmaCNWNdqewwN/oYvMAeHWMtFw3/LMb\r\ngucMielTLJ6+8+Qz749Z2yEWkfgE1PcjQJz2n4M0C6+KDzZFo4CAf2SmwkeW\r\n8BxlKvFHYQxvyyJZGKN6YFwt7cboUPVjq0Y=\r\n=Vklg\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230112100653-1dc2f2f.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/20b6f77ba4d0721170b03aeb749a2f3b/graphql-hive-client-0.22.0-alpha-20230112100653-1dc2f2f.tgz","_integrity":"sha512-Uf2KUjTWuRbeCaD1Hc0Ze8yOoV3epLZa5z5zxQx2EH0ZpK8BK0yN7NvzVZGB4BsGU7NRp5t8mx9vYVgHGhuHWA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230112100653-1dc2f2f_1673518048163_0.6449366595003205","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230112101222-f671ac2":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230112101222-f671ac2","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230112101222-f671ac2","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"cd258c7735d17e7f2da3ccd2b32de698937663ab","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230112101222-f671ac2.tgz","fileCount":60,"integrity":"sha512-/VAYPFQuXiueH94jhlWjKik1JJBgetzV6HfGjWT/5LLZRD5L8BT6jvYD2sSuWoqr9PgBUEqyvGnKnfdaYPUOXQ==","signatures":[{"sig":"MEYCIQDS9gO/O/3TzjJmZfUCZK8fEwzifGDKYgZLlwy5eS1MnQIhAKVbIYBjU+gdvV3uBhPUIxSdXwngHg8+CCvbu7GOCA3k","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjv90pACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqQkw/+KWeEEE462zyspkGvbRn+VozEPOyFrvpNsZePhhczuzqe6Gza\r\n0gLtLqbIl1T8opKnkwSZ4dXgmKo0DlFjn2+pNeU0g/0Qds8VAE+hDVoEI0qn\r\nEqaFS5aFNXu2w4Pz47dXtoso2nAO7Fw8DTzkWJQRhSMBtvJqRRyi4696anWl\r\nyob+sKxkOJ3/3P/wWwhySF3jiK1m0MAfb2Y0fbVMv/bX45SqctdYDqEP3X3w\r\nexsryI0pXY3Pr2S3yj5yXoR4o2xOQTZ6o4wT11PgKtTJcp3Y8OFiJxlmw0uM\r\n6opN54MIMA5/l2VeFZPy+EUrrkBQMhd+2xP1ifAShLb0AdqjXC8rxNNn5J1I\r\nzQnyn6yNhIXm1VbCaja3YYRNqSOGLwOQcd63NWFCBOdh0ePy5Nni1WF3Oi8p\r\nFNEdmemKlUgxx1/IpRWHfmRaqRyYxEy26bwz2dFl+lVtMDysoJuYXbwIdRbZ\r\nU1X51P1S9WbZFoFZalcYFcvNfu8URIm/D+Y2Yk7UFmyzGfH0JfRh5m5SbfnA\r\natKB2l3s/FFOdX1Otuwvq+hnSwmd5DZn1bcBqD5+Jt/CBq5j8CAYadYP8VAg\r\nInGCdVYWrU9qLjwv/xxcOIg+mC5EB1Et+kcI9uLlPmvPEZDtTahMY2MXcObr\r\nTya7F0dYZ8V/yRDnCyR6ErbG2JkDkY6c1wY=\r\n=W3wj\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230112101222-f671ac2.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/445a5ffb15175fda666a29a161c6cd77/graphql-hive-client-0.22.0-alpha-20230112101222-f671ac2.tgz","_integrity":"sha512-/VAYPFQuXiueH94jhlWjKik1JJBgetzV6HfGjWT/5LLZRD5L8BT6jvYD2sSuWoqr9PgBUEqyvGnKnfdaYPUOXQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230112101222-f671ac2_1673518377577_0.5797271873254985","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230112101407-399f6a9":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230112101407-399f6a9","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230112101407-399f6a9","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"0026d0f80f894b281609b8859048a03fbc214f5b","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230112101407-399f6a9.tgz","fileCount":60,"integrity":"sha512-vUsJz5hyoaeMAnAeroRBy5iDs9qXA/cCwV/5ddA5pZy3gnkpikqFCepB7Xhf56ZCAsRuLFSUo6QWdhp93RcAnA==","signatures":[{"sig":"MEUCIB4RssAl6NClX7klSWAWNZdSqL99cOxa5LWL6gfvuyKBAiEAsNl7XxVgOV3TPBjefPRnk3FTQrzmRb7950FpNt4D6iU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjv92TACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpQww//esgZHKnvgGS3h2BmpxJvNHr4BwmE09EWblw9frADKX13Fvi1\r\n7wmXeWvyWOBDwHrVMnDnc/Tw0aPzTdM3WaarJJh60IrwNH09XnV4GTIhxWUW\r\nw3yl7XMoRM/FmPFZH1JtwNRmx98kcMx+LUrNDU4GjsHCIl0Nsx6rTI6k2c/i\r\njedXJn5hhP8gQ0El8/3M2Ma9Rg/TGoL1H/RWaB7nwtCoRNX5sudSaz1m90Yz\r\ngNp6Zn+7gTjBwA2pnioabqv05clUa8nzLrc9vbnb9m/ZiGZrgAZhNUGsLQY/\r\nN2ezPnGGXJCJBW5rwO/Kzm2SbGZCbo+/GBCyhrHAZLdeknu++LOTzxzjjyrh\r\nx/mx929qk5TodaYe/1vJk8mbveVEpy31tIih0myWIOXYxAL3X6DeHpp+jqWx\r\nSguze0eu4sQWWicpaO6Ty8rmQ2D3ewKH7vdwvKNpg/7IKz7679n6CNsP615n\r\nnSAnwJS0yZnT16W3mByPfd4gM8kl+7FEx9R/ltZRfyUl/skyWKZ3DoKaeF/t\r\n5iVBotVCfwIqRwdYqxv+HZ7/cGMInQNXBrHCL0DYJ4g1xfCke2V3m991+UIQ\r\ndHW2s51v6iXlPtG29ZImbGkbJh0vyxWvngg5zzk/NQFsk5Zdfv0qMgfJYKJa\r\nUIyecKMsUTvolQvIQPT8xqxjAIcYNO+bK4A=\r\n=1A3r\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230112101407-399f6a9.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/be0dbb22039aa81001a2f39468d0d93f/graphql-hive-client-0.22.0-alpha-20230112101407-399f6a9.tgz","_integrity":"sha512-vUsJz5hyoaeMAnAeroRBy5iDs9qXA/cCwV/5ddA5pZy3gnkpikqFCepB7Xhf56ZCAsRuLFSUo6QWdhp93RcAnA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230112101407-399f6a9_1673518482964_0.10958662296696708","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230112102405-a3abb0b":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230112102405-a3abb0b","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230112102405-a3abb0b","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"e42fe7b33ffecb692c417c56f26f63889f001b16","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230112102405-a3abb0b.tgz","fileCount":60,"integrity":"sha512-YjRp9QpLbs6CkWm9zIFkFGZvJApGw5LxXaapcgmgebEZtlpQhjsxWbJ5XNWAkHJFe4sL6X7TQCACWU672sv5HQ==","signatures":[{"sig":"MEUCIByW1f8/beBJMUkzfyzv298adW01EfJ/YiujcA0DjyyPAiEAuHO1eQtai/XnGydEUOcHMtmnw7Zd42KWdTpU+u6HMnw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjv9/nACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr7/g//d05Gq/YAwBmMgkUpfjI70YoQxOV4eTRVh5eZkktr28WOfSGQ\r\nU3ojhD7f/Hxe9IPqVK/HDClP2ocIFCugdbWVwnbW5ZK1051vh3waDXt4GtXU\r\nCt9N67+Z+Da385p9wb2dWHtkvwdR9M5baxoX8plhecCbTHeOhz6V+M968CPd\r\nolSW5uGbN9F+fCUmE1JSVLoVDr5LQzbf4I+qWM7h8Z5jRRmXHStGtKxkRNW4\r\n1D06lzz07OFQldodo2mSX3BRHKkDfRZERt1SdSeMazo6oAfsCdoC33wSJo83\r\nWCQKHNPxQSV4Jrr7bb/meqsDfaY/1NTtdE3vO7tAgEKyRzcnJgF2sbjN7hb6\r\nkP7Oa1ITf/CerbooAgxvqijRFbxWddTht+2mwIBG9W0NWrUYD372nxkxbjG0\r\n446K2k4CgNiKFwjk5msqIngmluctYcVCAmdVaoi2MleNNafXPNRSSIBQXMGJ\r\nkeB01ouvE/IVYj5l5dQWm3bIvzU7cwHYTiPFoGkMXeKhHXGvKwe3Haiz9+2c\r\nXIs1EZmvz7oxlHVn1s8i018cWdFZyWDhQILNlHw2qLuZPFctNytnBPhGhsMy\r\nBs5HuVXkoOgbmaMMLc4Zr7MSBgPbBsRsWK123eOk3D4TiIk6TdqSfTU57Xkj\r\nQqViH1wYg8wKIqU4IKKMfDvntdrnki/9itw=\r\n=j0ZH\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230112102405-a3abb0b.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/7b94c4e502efb149d5055bc4efddb4f4/graphql-hive-client-0.22.0-alpha-20230112102405-a3abb0b.tgz","_integrity":"sha512-YjRp9QpLbs6CkWm9zIFkFGZvJApGw5LxXaapcgmgebEZtlpQhjsxWbJ5XNWAkHJFe4sL6X7TQCACWU672sv5HQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230112102405-a3abb0b_1673519079457_0.242141976307233","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230112102936-a3297d8":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230112102936-a3297d8","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230112102936-a3297d8","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"dae61a23f7615cce0208e7b036cbd730fa18b37f","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230112102936-a3297d8.tgz","fileCount":60,"integrity":"sha512-15nfimbrsHfQKmKJ1nhYPPlKPKnCQT/+CnuhYy+qB9NuNCFY0Z7RS6dk4194mPtX+EXWj3PUiAyx256CBmn8Vg==","signatures":[{"sig":"MEUCICWCYbCXxq1j+XrMmS7/77aKL+tstjWiSbXjZUW647CaAiEAt/+KX66/LYG/Pv2rNmkaXkS3vriWhJkhaxt1YSHadsE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjv+EzACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpBQg/6A1o6Bc8vH1anB/Fo5xfs5j6HTqu1v09AJs0QjL98na+ekOiR\r\n0tTvtAWJk8hHUOfDM5XZvZXysj9iRKld1wktWFzAGwAWyKtxAjV775x9hahe\r\nDnRB5oZQbqBFans+kYbOel3kDwxoOEhzPRvM8X9TxlfGR31h3UPvvLCWmeor\r\nYJvfxYl2ATUbtrNRDEy1bJwGoHbjF2pCH6bFRVsHuY/9gQwOo7QXCVmYiM7a\r\nt97eWaBK8UtT9l4OOCcL/YdqIxtJKvD/rTmBuETcx+VakfkXs6wdxskAtuQP\r\nK1cmiWi/q13wEPJm6e09zKDecAv3He7XZO2PAB5JDN/rsHOvJxvX0iK/yYRT\r\nyscp7KsCMFjYRIWACj8HrV1PJ3r3r0rq6FuxviKqToBnv9v+r64EIvsnmAGA\r\nlkNVArIA2Z1b/7cbWJKsIrX95AVWQMNyC2reyaXvxIyPLE+f0mmmjYuCuQ4F\r\n1WiarDZuHbBnVWd6mL7Yz6DtrwNLYVn2K+2UMPfjVDHfII8FVWjwFisVF+iE\r\nf7sCdkm4vx6+6BW1AsjVSVKGFZkL8YcQMj0t9G6HUby0q7dhR5cK78InWB+N\r\n6qoAteEvJBO4f7zTUb8GGz/9rXUtwjIuzNpxudOHyy3AFMDKAe2x5Wx/XXd+\r\n+kM4c84/fBUGTeO20o68RQPxliqfD1FayjA=\r\n=Kv0p\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230112102936-a3297d8.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/6ac5a45de64a7ad79e2e9fed3725fac5/graphql-hive-client-0.22.0-alpha-20230112102936-a3297d8.tgz","_integrity":"sha512-15nfimbrsHfQKmKJ1nhYPPlKPKnCQT/+CnuhYy+qB9NuNCFY0Z7RS6dk4194mPtX+EXWj3PUiAyx256CBmn8Vg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230112102936-a3297d8_1673519411527_0.7067775948082418","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230112103545-2db2ade":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230112103545-2db2ade","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230112103545-2db2ade","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"6d5db3ce8b1991a2703b6cf76f50ec5e41703369","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230112103545-2db2ade.tgz","fileCount":60,"integrity":"sha512-rx1CyLPCN5zwXipioSurZ1RfoK480LedPMUaLH1PCWvSv1iDNTNN3BhLGOa69V72W+eXcUstO2oY+Ish4IBCjQ==","signatures":[{"sig":"MEQCIAcwe+ayk2yubyzhb75mj+MdAsbWwmmqgu2LA6XhwRhsAiAFqC9y6r9wV3ytDpitZhQRqBzq3bIr+CHVyZz2tw25bQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169643,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjv+KuACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmqrag//SASprsGHsv69FGFV+sEDuwrB49+K3PU5ysSagfRDSMshV5WF\r\nF9vef7+TVOiZGKrFoopC4SvwtPmS/0LG2C0bXyAVqpb5ql3iFNtaB6rB6gHb\r\nAStY0rAmpJu2sqHSP/GC0/QTNzRwyVYL8y2gIdPg84jsVCRMAp0bUiEliUav\r\nHtsC3Bicb0dlP2texp4dqa8FG6BRgKqDgnukZUT9n7dwBM07LmA5rCIK1oH+\r\nf5uaxgpBlmBaJGTeZlYPK3orAUAg7GDG83pmg6rxgiG1yV7FTXR8FV/Mbm3a\r\nwSkHPWK5bs8lptZeItDwINA0bOb0vMQIjScv4yMOFkiCwjj+yJ2Hc6v6DZ5g\r\nxmaUkZBFYg/rYVzsayGoQQptefbrvCVzaavCuYQ//spXlk9qH37hrBGJ7JIT\r\nYbCXrYM35v6ttVA3o2LVQ5pSEg97gLZoFPXT+xpW0dNXuqXO89CeeGYGT469\r\nF8UWzwi5HIxBx9ZzJLJqDeYP3ImJt2SxDNvxyazsYlhOCJ/aJjcMvFlli4Gr\r\nVJoHm+fBeng5js7OgROh7ZMrMW3wMu7YHFBQd7lITCVPo2MSzQ8ZJtvKZyWL\r\n2M36UaftRJfSuO1Ig52khlzR6j9lElpG6tR1tjh7aR9R1NOGCKI63nd17qNo\r\noEOg3u2i8LEN8WlHh144pU4jknB7+oHoc78=\r\n=RSwW\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230112103545-2db2ade.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/e6d9fc9e55e3520aa3b344d8c96a8d56/graphql-hive-client-0.22.0-alpha-20230112103545-2db2ade.tgz","_integrity":"sha512-rx1CyLPCN5zwXipioSurZ1RfoK480LedPMUaLH1PCWvSv1iDNTNN3BhLGOa69V72W+eXcUstO2oY+Ish4IBCjQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^9.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230112103545-2db2ade_1673519790251_0.907508155549547","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230112104046-23d53b1":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230112104046-23d53b1","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230112104046-23d53b1","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"4ec71a33505a2eb4f4db5a255781831fe27784db","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230112104046-23d53b1.tgz","fileCount":60,"integrity":"sha512-UZAho4rfIfpM2vrEO+V5RoflnnzsXRawwuYqN2RxpYfoDWfryyGAnR1bxw9D/1qtVE8DzIUXvlh0ZcjUVEsPqA==","signatures":[{"sig":"MEUCIQD2MDt2V3mMv2j8ONjL1Nj1REl0fSxXCCjlfY9I0rALqAIgBlJ6+g+NpA5OFU1Go3BosFi9vGdQ3Ok+PJ1S+/XJr7g=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjv+PYACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmq1hA/+LaGT/PPj+fJDfQLMouVhaoHZbX8GmIQBOkA5NIG6cedWBm9L\r\nNIn5BcYLD1hKOaJObmB/NjRWVy3Coi12HROrJMcQM/IiR5d6/IZRfcGkx+dq\r\nYcYCHssJUYOBGe/mS2RxHaiUPoAFAkgkMvXyCEBzQ2zEZU2m2QDzXKwvKjVE\r\nBSx9S61bRAfstB9cSJYsCpbv6Y95wGoSX1PvNAgRzkVPNdNBmEq+jzub/vaX\r\n9iTWbAp65slgmRFMCapFM2iLkjPCty1O7nZVSk581FZC2TmLeE5CwX41H0wE\r\nfsXY5mOFLsdEzifmLhg0h38f55wcOrYOX9D/uDRgjk+0HM2r6OTH/dPzLcbc\r\ndYM5A0Ea5UpekOJ8d7LQ/ox7njkiMiOqIxHiuOjkTffYKyuV3wxOwn3VjZaT\r\nipNgtLmKEm6sfJ9UEih0l39S34u4+/zE/x8j2O32KoA0lMY/o73s+eTGTNrz\r\n1Jg3qCsQ5EvehAMchPDBvutl3z2RAQepGhsN7vV1s1GZpfYpLoiUN4WcXLL8\r\nsRDb3oo8n6W3K3KK5DG/cLPmlgoLKrmGtYmaaXRsbh53oTIHVylT+n+HIEWk\r\nYwHQQBJrPwkdJ2fyRs7QJhFLMOTHGS2R9bXWVzxA6RGnqhAbLqwuv9AYSDP4\r\nyEuYWYZogRCtHd7YgMbsQJcyVAVVn8Iq/CA=\r\n=fOk0\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230112104046-23d53b1.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/91c85a799912c22ca31f0c0eabae81f0/graphql-hive-client-0.22.0-alpha-20230112104046-23d53b1.tgz","_integrity":"sha512-UZAho4rfIfpM2vrEO+V5RoflnnzsXRawwuYqN2RxpYfoDWfryyGAnR1bxw9D/1qtVE8DzIUXvlh0ZcjUVEsPqA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230112104046-23d53b1_1673520088077_0.4933696130548275","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230112105035-88b309d":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230112105035-88b309d","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230112105035-88b309d","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"97fb5f3f7495a1d3fc9be291d684f0c119103975","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230112105035-88b309d.tgz","fileCount":60,"integrity":"sha512-IxZLJ31/stMPSYSygfgr1OhbvZQDeJSh6rLOtbJBskNMBWpz4envHVQHieiPGdD6E7FS3VV3zouy8qUDtZjt3w==","signatures":[{"sig":"MEUCIBV1j6TvZdcg/ZuAYHuQHM9LDDzlCEG1zifc/ntsl3fVAiEA7QCCGs6UfQyJ796dkvjyHE42hzTGuixOY8MVEaCrpGE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjv+YeACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo7Gg/9HCKaC9mrX6Mkv3OJVnhNzFWLbSralqo7cEXSx7Ykb9As3BE2\r\njJqTSXhvfYErCvjP5U3kVM9f/fV5ZZ8huW0d3QMvtlN/8wKd883gGJHmCBhx\r\n14e0zUbnv0o1RtkUrZo1uv6fVG3+HdxyjRuaTohKM2QHSOsZO+SUHW0EzMDY\r\nBjLevgHUEvmvLOc920KT8MukO+SYtCpINfBXxC7CYuZ6L6BiS5YXU5V5LzSl\r\n5DQEpozFBXgaIM5RhYCfe2VnoBvhqLStDGF/nuv8JC9bPMpRrTDQQKk30xcK\r\nnVW9XBIKGrAvW2zLeLb3CMj8ESjU+ptomyP6NfiEl7Q4NsTY8Ie06RWOO9DO\r\nkIulgvvUwTCrJRfqCnCM+JpWOVMi6rSjNuInUNlhmdSc/z3ojjyq5xo7U+/h\r\nLe6PEtH6R1ztdueeQCgcEbx8dNvgvhpqZetR4U/SRWddJJ03PoYF1xVDgoRg\r\nENBeHR0nYmKgpov0phtpMQkGcumbuYTDNVk55UuIyFOS03qhGh/XLsjr4G7D\r\nvdRZayY8aBwKbd+uzrsLstYpyR2IrpKZNkEZTSe5Vi+G4PSI2evjil5vccFR\r\n/5mmsTifrjJ5wXYX2n5tiZc+sTW3bNUuE1FrTcD4Mpy3JSH6xnx/xyMzI23X\r\ncw6taQaK/9dY4OHkH8G9wA7zJiK8570l+nE=\r\n=UaJK\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230112105035-88b309d.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/a065bc69c6a0011b61ae0d7ca20765aa/graphql-hive-client-0.22.0-alpha-20230112105035-88b309d.tgz","_integrity":"sha512-IxZLJ31/stMPSYSygfgr1OhbvZQDeJSh6rLOtbJBskNMBWpz4envHVQHieiPGdD6E7FS3VV3zouy8qUDtZjt3w==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230112105035-88b309d_1673520670184_0.725510208598483","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230112105038-8cd0d4e":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230112105038-8cd0d4e","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230112105038-8cd0d4e","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"f8c58413ecd8ee3c753d51e3ad5861a7f6ceed44","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230112105038-8cd0d4e.tgz","fileCount":60,"integrity":"sha512-iPh7HeJSgUMT8VKvcE3WFDqbcVNjxAzDG7XikhFiCDcZQ0FZ6qLmt4ul4XfEayRZ0xTMgGMC55lnrF5ClxvGQw==","signatures":[{"sig":"MEYCIQDYdzpU3GztV5czyYAVR8DaqaCl5LpOmlfZQS/iToT99wIhAIf1a/EN2U78P0Q8sYtH2gRSO8TuetgWE94hMHmlFjLd","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjv+YoACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqGog//fo94E7w0wRjcg12VmKm+YWmxT7YeK2f+5xt8Rd+2VZKPSubK\r\nWG++6/2LULRBXOFRIXdiK/mcpEaO6Si2sg+cmzUPSuL7ONUJ5sxeVB57lD+C\r\nJAwLNhUWvcFqTmUrvjhMPO7w9fhYNm1Rvooj8h2o2ObBiXd90SgZMGPLz8+Z\r\n+Edx9kEj8pFuKq9V08VtNPz3Mv5igYUspO7xqpY5zKNk03MX1EbaSbhuelPg\r\nVlWm3jwPSoRumuLpBGVZddHe/ns2+aajVp1iye6/BKRks+tz81jp3OWVEfM0\r\nUycphKMVPcvCGQvWC45uNO1PD1F/BeG291xlWhHgCiCSItbnQ6xLwb3ur4rs\r\nmGTJc14lYtzGfYZWuALFujuc4R+5M5irZQrYxKaArtKyZ0vTmGMsxlsR0ytM\r\nYHtdHAc1arfAp06tq+62gGouhXaAcD/UbIK+sluvg9Vjb2iQQXTBHzYtyPuT\r\nZaobukQp07Ipe2iYyKyptzYxSaC5HwOQpVBTSpqhz8FB8xqfbwctW6rec6Si\r\nRHjZaeNuSQb9jUPt5tvioXe7jSXNUExQvQLtVxWssWWTSChEdvxc0dAb3l+Y\r\ndbuoCPrtBJK3TtCzO+dV32l5n//sv29/eLPm/d4+XtdDXWeVlfy3ftOJrm0J\r\nmXueDhIoGV0y9LGL1kOKZWNyzGexxFcf5ew=\r\n=Kz2w\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230112105038-8cd0d4e.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/e2ca05a7eaf84e624b5dba8f68c82010/graphql-hive-client-0.22.0-alpha-20230112105038-8cd0d4e.tgz","_integrity":"sha512-iPh7HeJSgUMT8VKvcE3WFDqbcVNjxAzDG7XikhFiCDcZQ0FZ6qLmt4ul4XfEayRZ0xTMgGMC55lnrF5ClxvGQw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230112105038-8cd0d4e_1673520680313_0.4918088049660809","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230112105043-2927354":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230112105043-2927354","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230112105043-2927354","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"fbe37a5305513af3ceab3b447d7db399584d5e06","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230112105043-2927354.tgz","fileCount":60,"integrity":"sha512-LGkEuIP1pbikHPth2E53dd4aanw59pdhil0u7sx7v1/2SFl74e7O6CIGsLdCcJLE+KdOgC1L5Y7qKH2RDm2Daw==","signatures":[{"sig":"MEUCIQC1CjolgJdEW7KEecjKcC/zsMP9fnpuv+EBY73derUsAgIgKvaUaLVMR1n33hpxFlCsixOwpyUfbHIzDwCbCjq6e90=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjv+YvACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrXMhAAg349mUtf2lu+e39tsTz9ozUmGvWxlaVDT6sepYom+bVnzvHp\r\nzvRfpEDos7hjS7T/f92hggIfOJUYDOj46qO/RxUDfJFkZbOOKVamMnrhiG7Y\r\ng3Kk2HIF1P+nPFf4O6jtLRFEBIYyulwwHwJ8njUkR3722juNJkoLo56dZts7\r\nnqCYq0r5aya32+jv+IQmZBUyaJFatvFtKhXKiStUg6JQO+fWEDAYmtMEZNDA\r\nykTAvyi6tduofx1/9l5AiWa8IzcPo2pmvgRAal1Pj2XztEyPhfLnB4enirPi\r\naaJ4SN6UUY663PCfM7kaHhGwwf4yT8XRuMclTRbtX/7NGYQGYzHH57WXVwKz\r\n9gIrv0cTGJWRfI/5imN3uUyX0TRyb24KsR1nF3G60FWQrOm/VWsMDCF21/fE\r\n7YO/9CPd/Mhi5weY7n2doPetVxi0ARGaCT81WSr/d0DrLu/xwRGUEO0EONkq\r\nKLyuHKzib4qurMN9+oAZ1EMd0xFCdf1vOSOhBCovD4aVdEKOQ8a4PL4bfoLb\r\nHpQxcKNqF7TKxrDSova3tbTXdDEJ/ro30vkTsyV1s7mMgVm1WD7YIL7OrGRD\r\nr81Iuf3tt8pueRGa0PTdEeyRF197fk2xxPU7km6ibiuVX+ppxQGbPmfQyvfP\r\nNVkUi5S/Eq6/3w+Bz1vEwuQEwBrsezV0dC4=\r\n=m0hi\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230112105043-2927354.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/61c41b4cf8565b3fa668a7f2d21ab1ad/graphql-hive-client-0.22.0-alpha-20230112105043-2927354.tgz","_integrity":"sha512-LGkEuIP1pbikHPth2E53dd4aanw59pdhil0u7sx7v1/2SFl74e7O6CIGsLdCcJLE+KdOgC1L5Y7qKH2RDm2Daw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230112105043-2927354_1673520687232_0.0891989084305369","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230112105547-a98adf8":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230112105547-a98adf8","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230112105547-a98adf8","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"f9d7cfc750184dd8b15c5ec193b021c612efc767","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230112105547-a98adf8.tgz","fileCount":60,"integrity":"sha512-aWXkNSQ9Se7HGOQX7PcldPwNsC4g8yUPJpjfWxHgQ35cpFSYwFBgljSNI3WixYJv6FJ3HZ/OQMRHqyWKfj4apQ==","signatures":[{"sig":"MEUCIQDQZgObqUgI1js8kICXeQEUML0eC0Tbmzjj4IvYz+V32QIgPNT10zmqOHXUEFcLXdw5FCTgT4WewxMWsWCtBwYdQ8g=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjv+dZACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqLwQ/+NvxPl0mZi7GZ7LX2pmcdSJxESCeOnnn4Y3xiCjYNPTX1JE1Y\r\npsW0XBpopk5TOc4hXuOy7mDNQTX8cSeDXd9NIk7F2P/5ZWz0CNr9RizuYFqv\r\nXWLmnStRq8TsVk19D7sSGw8HbvWnVIdRfUOsyh82ygRVooYVi1cK6t6taamq\r\n1Otd0pyMuyG4D+PgRVBJSzFqKMt2GKkMaobytbgz9JL/iw981LC4eODi3Xu9\r\n7239K4uAo4Y3Pfe1A1j7+PxAv/BwYG7YzbbeZGyfSVKMIBxf8gjQhxKpoxJw\r\nnr9SfXQ1aJgfaKkLgatgVYWNUno+MW97zUCNbErsHQSKAQp5JptDnWuxLdMO\r\n12lY4FpyusRYvPeyunaGQy5lKSNQWRDxvyehp4jU23xgQgwZ+GwqnnTv1cO3\r\n+ABZMQ6u4oqfqswCkS8/bxYeyq+1rJ/ywXWko0xq/oN3uBIkXU2kN8r/Eahp\r\n7BBwqclmWDyeG143CBYMPny+wJ9abaUB08liLWgkz7WevMvMr1NZ+hzJBgPS\r\nnxeoA12pmyxW8TSvhHtGdHendC134ghbf76GfUDenFwpMuouQIW2GuIdHA6g\r\nSKGNIyhPjp2ctRPz856AJj/HWycPr205ye1kQfnF10zlrrsZQ4AyaKjYgl3I\r\nyZ3e08AptwtVml9UoletEvoBIo+1J0Om0Qs=\r\n=auLf\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230112105547-a98adf8.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/e480a9b15f333507ee63b601bdfed5b8/graphql-hive-client-0.22.0-alpha-20230112105547-a98adf8.tgz","_integrity":"sha512-aWXkNSQ9Se7HGOQX7PcldPwNsC4g8yUPJpjfWxHgQ35cpFSYwFBgljSNI3WixYJv6FJ3HZ/OQMRHqyWKfj4apQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230112105547-a98adf8_1673520985092_0.38696939807786057","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230112110104-a31572d":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230112110104-a31572d","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230112110104-a31572d","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"337f6305479e28242f1664ec35f13207aaea1925","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230112110104-a31572d.tgz","fileCount":60,"integrity":"sha512-tefFcMy93iEjrFuIBx7lr90ahmPqQTCsgYWTpRrOQrTU6PdwG81DysUU55GA+ZNjJWVZMx7gd86hYJAHuzwwOQ==","signatures":[{"sig":"MEUCIQDTeid2/6Ht2OvSuPfwoiU006aPmgaRDoB4bsoHRCWZjwIgbMFzzNxx2Xdxx/ob+xEfgvU/73RQrt3EPHejrliKxnE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjv+iSACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqamA//aqPP7yIiHvSAKALIgRSsrcie5e+wNLchO+I+aX5YiKsvANpu\r\ngJVFglxJR2RgQsxoqLEbZ7dJw0MvNDwuNAK3X6oxip9YC0QBqRXMm6lt8SEG\r\nXYLUY20OpwbkPuDzE6y4Upt+EQn0UN4mqNVtHcc1+BxIczi4MPjQ5HZ4z1hE\r\nC82AJaWJVKiWwVdeBRQSoPj1f2V3RDIu8o6zNOOIyZx5AMEmrPDyD2u6t7yc\r\nSYZbL+UokL3gNYlJrlq8wv0Fjf3duOffKpAhrMUCbvX+NXRDTi4YAwJV0rk5\r\nQW9QLjNYRho93i2UbS8XDus6CU7l2mBuqrMaaj7aSjXFPXziyo3yBV4M2wZi\r\n5CyssI3D6FYU5vFtdaZHdJYTYALqgZPDLXRCYRgCOTQsMJrg1UAlXKxCrLiu\r\n1jBHGczoY1WgC0dfNlwgZuto5yysr2c7tZ1x5T8jn95rgI5+U/EgJ7BedPgG\r\nQ9ks6p42U8l8KhpB22mZarXFlqmTyBQEzdnAOrA5Q/rmbpOduyk4RHTI5+i4\r\nlRgcDWVbKM08RLWRk9bOLf1+yktf3lyoIo5pTxLjULcGvuZQyAaN0zUt+GMA\r\nXzGR5gUcBjkfnI2gFHygSUppJEUIV/SENiR0Z2geNe7i5eu55uwUBY1fzaWT\r\n2UKL/wXB6Ngv8FVW6rbMGRAxuFeSdomQ+GE=\r\n=D6N5\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230112110104-a31572d.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/82969636a193c38b7f5f7352ccfe9320/graphql-hive-client-0.22.0-alpha-20230112110104-a31572d.tgz","_integrity":"sha512-tefFcMy93iEjrFuIBx7lr90ahmPqQTCsgYWTpRrOQrTU6PdwG81DysUU55GA+ZNjJWVZMx7gd86hYJAHuzwwOQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230112110104-a31572d_1673521298653_0.23616732127706896","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230112110344-53f05fd":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230112110344-53f05fd","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230112110344-53f05fd","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"86d9228ba523af4b2ae0af0e3e47d6c1a99eefd3","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230112110344-53f05fd.tgz","fileCount":60,"integrity":"sha512-fglhMnyoZBAGnPnFUXIvFT9I3rexyRDP3fKYWBI6QG0g/KUqhN1h3W7Safo/w0hRVn3rycwvWOffHF4X+PRdyQ==","signatures":[{"sig":"MEQCIATIR9fX+dHHDhf/ZQLrVcXzaYf5/Dq91e3R6hY/dFUUAiBkdxoburcM9+roZwm/Qa3UoC0VjPx3eSRwu+HOpNhMZg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjv+k8ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqHiA//biGWdtvvfjnp2/cSp9gN74kP0sidZWjyTEyXE0UzHr1IdEV2\r\n1fraOtu/DzvKQYu079iMXLsHLDd5epyQ3TA4xk351JkxaHsX44zf7KDS/YMo\r\n3MnbxpdFCZ+2uBa5UP1t4QIgr5Xc6c8ZrTNqEwT1hxAQr2Y8Zejb0oEhc4Q2\r\nJ/MAleOrga/4+KleYhABfY/YKhKx6FOMe7TJvFMvNRV23UWLbkBfhNzjPNsG\r\nN9XkzpyWucNHaH1WdawABHR+MyeenbJSdCCQ6jeHjXBPNMe0/8XTzEfJDKBs\r\nyt//+/tqSq2sQuPdEKFtylDPb1fcpbGAcEw+IYOGHAaZ8kpFFNBfpxzuwYW2\r\nT1pNcVOPfjbH5PD8fd/SEOQw5EP4GPLbw6NcWrDx3I3jX8M+6cmh9e4bLSyV\r\nbX+nyxr5FpErK7YW7VCehKWdOnVIyHBC6jFk3QeuaeY58tIfPEEjn5zdSjQP\r\nhD++lOBE8SnjoJi5XO341rGM1tDwTUdpRoRM/E09ETVHUvQvPp9eKNGX41h+\r\nSjTfW0DLRZi7/MoRre2ds3FOCHGIwfYH8lD3+y9kne+aQ1BM6/Bxi/yvygV5\r\n+aoaKhOaKQt3bgZAx9MI8PcT+jsWuUvmKa+KmuYZXotOxppTDLzAERqSsTDa\r\no7Z3h40xvZ5pA2hdncynJqUbcy2GboOBgLM=\r\n=3XHh\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230112110344-53f05fd.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/65ed9b2886af2cde1de058f78ca26279/graphql-hive-client-0.22.0-alpha-20230112110344-53f05fd.tgz","_integrity":"sha512-fglhMnyoZBAGnPnFUXIvFT9I3rexyRDP3fKYWBI6QG0g/KUqhN1h3W7Safo/w0hRVn3rycwvWOffHF4X+PRdyQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230112110344-53f05fd_1673521468687_0.9095193782529929","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230112111320-d83aafa":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230112111320-d83aafa","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230112111320-d83aafa","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"4b8a42cd02d4c818c0c392c7d226fbc286a4fa51","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230112111320-d83aafa.tgz","fileCount":60,"integrity":"sha512-ySWAC/+mnT6g8P2bmBTyU4P6+lkW+CR/2DNqR3FJinCXqBh7OgzLgF+utvVYvbM8quP94Poz4vgj7AhXqCAfxw==","signatures":[{"sig":"MEQCIGGtcPBL8ek+bo9fP/P2/0n4rIHeFSBfWgZ34LS7lbyxAiA5VqETV5rbNUof2slP6VG99uJBeStszJ6V3jdUS5mXUQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjv+tzACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp63g/+PwSN52vHX6wQqg7/W7iLkS0ZZnbG/cU9GL2lt28eiezqdFKz\r\nRqX79DJpH7u/4/XE5uN1i/gCdnemZ9epSgQNzCGhuryoe2gGI3XDUtl1txhf\r\njE4zGuW3PKXcdomLAPW48KN40aG5zmQ6FEqG15rjjE8stSSAJXX/TltNO1X7\r\nsyhAEN5r7gxz81ff7ZOSD2ngpU/LwdozywA5c1NGi2lN2z+bR3zTaUovNJSl\r\nqiVEm7l3r959sEe2bTRSWu+MekNb6/9QPkbAnC4oI8mtP/CtzBQM3CDceD++\r\nLSB2b3NClXiOZyJnKKF6J0yP0hZnE0MgQUFRYlLCGgGONI89aUTrinrHMbPB\r\n1n/hMaUH6mhNkn0neAbaNb/BVRQjgb/aGSRq708wpDXOAlAwTVNw9UyLdFBE\r\nzMthag0+rvyV1NmOjGxY8gqYbrxbuPe9BTi2NGqnoylcnTYF8hb/tJxw4Th0\r\ndUkz3Al/lIsOr6EnXLyB3Y64+zkDHEr4VFgB6TH7F7kSPMmjleaChPN88b2Z\r\nNSSfZ++VpixS9bjtDw/+CeThBy132/8pVYbN1Qu0OLKkD5gvV0t9mhWsRvfH\r\nYKJBGCIXMR4yjK1zQoWlFCSkiBTxvtnacPwmm5o1/UNh/su/qzitIzWOQ7Kt\r\nGK08OU+Zv7n6Lt5OSAocJGywndqaukf2/Bk=\r\n=O+CT\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230112111320-d83aafa.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/af3b76cb8ea5dd9a2a2defdc7c4c2c17/graphql-hive-client-0.22.0-alpha-20230112111320-d83aafa.tgz","_integrity":"sha512-ySWAC/+mnT6g8P2bmBTyU4P6+lkW+CR/2DNqR3FJinCXqBh7OgzLgF+utvVYvbM8quP94Poz4vgj7AhXqCAfxw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230112111320-d83aafa_1673522034999_0.988716205786704","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230112111432-45b23a0":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230112111432-45b23a0","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230112111432-45b23a0","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"6e84ff19923d4988132d734badcf583a3dce1da4","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230112111432-45b23a0.tgz","fileCount":60,"integrity":"sha512-ox6K7MIC2SojsObw+zAFlvEMCJb2bKEP4vPurFbDIMIfWPK/P5XCbS/elwsgUkbIGZMx8piSWftwCq6P5+VHWQ==","signatures":[{"sig":"MEYCIQD+6mix4YVdJfvA1B4wxd0aNbwc9HsjGuU1AK/pFmL5ewIhAIo4W4BnA30+rlW19byXyn2PdW9DeKqeAZnk65UaTeCF","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjv+vAACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpwCQ//Rmv6KbFJkiFvdOwicEe880xcsLuObZaNof/5qR1Zka1C+CnC\r\n3+cbb70sV0j3CvkfKQmbdGIntRRZHHZo0TvIV6tj9k+whdtzMNPH2W5lZstN\r\nE1IGVcVBUmE2Ye+oxvgB+24C+lcoDLewdl5Sgne6Vcdi0psFlcOLpy7QdT2+\r\n0UWT3j3TJ9j8b4y02X1PypecxmzYBRK/707hTRRYToml4JdLoJxKNBsdCK3a\r\nmdCKHXILMAHGhS/y96UO4AdxuA+F9ygAufkAgd5zjnvv1wpe0OS0O0mISqDs\r\nHLT3e7QthSWgKbNuo4lQDQ7E1lFdK7mfbwpK/bDgCzWByOdxJF3S7pECvglu\r\nirfgdytITGOtns3Y4/mUHwhkQUUeJ+xAQLtyToqINiKG979A8tN8hX5myjsw\r\nFHVossz+tdBT6YENDUj2j1Q6TUZ77J/sCwhey2Kkr+3R7SI551pNZXCTxd2x\r\ntyg5Nh83USUY6CMEdAqegmeUO+YU6LttFsYmI/bn1iOpkxplIEm4dPp7SFCm\r\nDKWrALon8RSX9nA6AOxm2F9SubW+7mtUV9uToHjxcoqFjVzWofjJSni5jxuZ\r\nRDrg/IJUJkBB6eWk/sA/lW3OJc2/mnXFsjyjRlLKK/DyM0FNA2zavf2eDxxH\r\nOnZIMn54cyRnrxwzkkq/b9JdqecnTpTTpfA=\r\n=0Fp+\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230112111432-45b23a0.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/895af764c3c00af7c0a490bb4a48652a/graphql-hive-client-0.22.0-alpha-20230112111432-45b23a0.tgz","_integrity":"sha512-ox6K7MIC2SojsObw+zAFlvEMCJb2bKEP4vPurFbDIMIfWPK/P5XCbS/elwsgUkbIGZMx8piSWftwCq6P5+VHWQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230112111432-45b23a0_1673522111947_0.7638108024966892","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230112111916-22ce2e3":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230112111916-22ce2e3","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230112111916-22ce2e3","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"5002a63be16f18797c702a157ad02dce21440dbb","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230112111916-22ce2e3.tgz","fileCount":60,"integrity":"sha512-2DwsLPND6fRVxu2xTVRphkic+uo0ujhbG3E7U9hk295rELbFnMl5Af3/YIBen2fzXW2W5mwo5KY+5BgThcFJGA==","signatures":[{"sig":"MEQCIE9mHB7J2uqH7+oEB2t5F8zZ0yp7zbHpXia8QCBxPrd/AiBtsIWH2rAQVecpMQw0Z57G7bIkX/E4nvdTquRIPeg+Rw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjv+zWACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpQmw//Uu5FPqqbxxzPCVw7OKOeN8QHjGvXAv4DQdb2nwJPVcE+8fJ1\r\nhmbvffvss/UtTdhKEtFLsxXfvavOVmYyREjrNDMd2J1xc6hgHiVi9EVcYyG1\r\nrLsaym30eqo1Mh157VnkCyFDa3w0kkcWlQGjHSYBnhgIGTCqofUZuIPDfiwu\r\nxwUg4xqHUAizzlSd0NZdRuD5EucylNvmCvLZpgJE/O3eL7J2azLfEQa/oytz\r\nk0HUOW5ziNVgI/YcxCRQJFtalSXwrBtYZPUIJ8mRtB8nzlqU0abTevBPTmIw\r\n5pO3f/ScftqTKDnxlH0oAepvCZeww3C6rn88c0luiA13xCRL4WstNsp0XpSA\r\ndIZnY35ymoZa8oCBeQ8S5M4GGf21NTN4LAg+Mplfvo7RkYmECJeKa1ZFXS2U\r\nZzTjYOnC06PgjC/5MvK5U97DhOPjYLUOLzhcSAFQdYZaFF9XpQE5yG2/V7pd\r\n7pkQQDuscEdRfZxz72s/1UYStxMLdmaNDcRTQMZK//XAti4xJrCLMkSD0AKe\r\nVxVIaqY0pFRDm3jMMXnrnG0Mi+Gw3xG3F+LSwkbmVm2UiHGsdySEaWSJ87l0\r\n9WwdgDj0UCjKWnqpLovDXcBdydATy9nCmo3QSa/CQkL2c1C3HDSIVgMVZI/J\r\ndX01csHiXJm37ZZZzizd24zE1oNJc/BBZXI=\r\n=ljU5\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230112111916-22ce2e3.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/8e8a9e8b07afe6c1a9820b20f7f8128a/graphql-hive-client-0.22.0-alpha-20230112111916-22ce2e3.tgz","_integrity":"sha512-2DwsLPND6fRVxu2xTVRphkic+uo0ujhbG3E7U9hk295rELbFnMl5Af3/YIBen2fzXW2W5mwo5KY+5BgThcFJGA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230112111916-22ce2e3_1673522390251_0.1869871229558171","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230112112430-3be9e34":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230112112430-3be9e34","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230112112430-3be9e34","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"6ebd757091b153c0d411b320d9c9957320e17d37","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230112112430-3be9e34.tgz","fileCount":60,"integrity":"sha512-QaT1mFoSsYR7Ln7LqjEiAEhke3HJ/J+XVqdJ/+EqSlcJrDAXGwdPQQZrbKXZdlRYuYz2qb9ZQQZJx3cxm6xmeg==","signatures":[{"sig":"MEUCIQCd76SDLjcwrtniH0eeUQIZjVNGESljO5Z0bXMSja6CpgIgRPp7weR8f4CHqop9iXBWqfoxvE8C7jUNfieOCiqrHxg=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169643,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjv+4UACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrIIw//ZtoXgejrKuHheTyXeZ8OOZV2ikP+Ap6y5bGHA2S63DqWB+8V\r\n/A7QpK9EqHy61Cf0KjVUlV3cD/4rDXX9un9UiooW+VvZ4IuJ+gCc1H4RX4mv\r\n/Joc/mQRKWY1mKvf0bdmlw/aK5KIWUtIJ+4GyuHdFgUW4YL3O7qm06xBb+fJ\r\nznG2s71c9+C5NKpdrGzjqZaxxWbbQa005yhQZw7tQyTZNcuGQoIU/PO3+Lbk\r\nquONfmAieoAUjDI0925eADLoueUR5gQjQ1ka5OyrW01+91Tr/8F0LKHjE5Ll\r\nWNlrrCIFB34yvt4wHx8vBTlE61Mq6Gz0BycboSoSqtwh4/StykeuMxIA32bO\r\n0Fp3jaGrDQzgXmsmHeaptmMgNbxQWqzghQCsNHlpRMg/GKq6D6qPSLBDl3/c\r\nT4ZCgCMq4bG3Q71k4zACzuYrW7UCQfeueRPE+hbY6TbxePorxUtyeDoeJq7k\r\n1zbcPZ2HbsfylkZ9hl5gl0Yw7Y8FUNBrVww1Jh8by+wdXIkNTa3JTUXth5Ss\r\nNHK8KCAZemSiy1+0d3Yz3onvSBGqj4kpdP5s3u8UIlZ8YqHvXKfVezB+gqMs\r\no6xxM+ENtA+AoIctPdKso7XmNEYFXps0lYcOfpCi6MDQ1ImtxPIKUQDJAqmD\r\n/c0ubrLI3kJH9rhYTYD8Q6a5QXbIl6G+KZs=\r\n=FjeV\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230112112430-3be9e34.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/503b9ea25f8f9587017a741a464dd383/graphql-hive-client-0.22.0-alpha-20230112112430-3be9e34.tgz","_integrity":"sha512-QaT1mFoSsYR7Ln7LqjEiAEhke3HJ/J+XVqdJ/+EqSlcJrDAXGwdPQQZrbKXZdlRYuYz2qb9ZQQZJx3cxm6xmeg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^9.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230112112430-3be9e34_1673522708550_0.8030315317620105","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230112113021-08b3b73":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230112113021-08b3b73","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230112113021-08b3b73","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"f54db8ecea721a52c7d68b793f27d630f4a0f874","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230112113021-08b3b73.tgz","fileCount":60,"integrity":"sha512-lDHUnCB8zl+VP9IcSWypsO8toVNPAgDpG8fkwNBDBoQ64kPEn7vaulq/BT0RwTI9PmUkZ1BvHV2/qaCcZ51K6Q==","signatures":[{"sig":"MEUCICKylqD3PT4nTTtY/BwZ3Dox8pG0hCLaYu5XNcLHWRMfAiEA0m1+8zpKqgQA9VAA5IP0tCePCYv63zMZLQ8uK5VNNAs=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjv+9vACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoDSA//YMQ02KtuNqs+8d2oJG9iAXN5KErXkg7T4NWEirkPoywJkDs5\r\n64LNbN/LQE4Qh/94edrFL5lbbKHTMb7gVHAhz8Sih1C34Vxi348RVfet8avu\r\n+WN+uNiFzxTi0pY4ifUmtWXZJ/LHZ2vi0FQxKty1mO0QAsOf8w4isrDNiGwM\r\nFtINSZ56PdbBxQdnyIITLn5sfzzBWqXaWvaZy2IQjdohuWV3NLd9EpWOitMc\r\nCKuG/iyr/Ia3ERpJed/F2vcQmoSsYmt2UXat6trRvwHo+4n7c3IgvANvHLzn\r\ncGp/8FX8gxJPvyaBzhffUfra41FDiUc4Cccar82qswt07DlpU3FS7cNkRKpl\r\nNoe6nyG+ZP8rY6yAepBRx9xq+QFeFNrNvHy78nd4ld3kSb6XD2qFslllXgIs\r\nccm3q7WOCU8n7WUwDi/ApWkdFLvvUqY3WTZ3l5L3H7qqat0BH39kByFCzXMa\r\n2Mrw1Doz/kzK340cKW++VswlaYh36sS/ZuxfGbtlzVUBfUfL89CK67nRpGeS\r\nFTrjUkh5zrQ7xCbT/KlhNAIv+SPNDjEtMVW2+O3jakRdwWl2TqgPHGms3wDH\r\nlFmjsd8cmbjTovNzLU0O47lrQqECxW+fx7dOongJ624WUhs0crY/O+CO2n5M\r\nSDYiZGHiV1YWD1WENLzEApsYWnZX9rCFP+A=\r\n=DU8X\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230112113021-08b3b73.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/613d476f7a641e27b358c7855c229bb7/graphql-hive-client-0.22.0-alpha-20230112113021-08b3b73.tgz","_integrity":"sha512-lDHUnCB8zl+VP9IcSWypsO8toVNPAgDpG8fkwNBDBoQ64kPEn7vaulq/BT0RwTI9PmUkZ1BvHV2/qaCcZ51K6Q==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230112113021-08b3b73_1673523055485_0.8317479222905804","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230112113533-cb09ef6":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230112113533-cb09ef6","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230112113533-cb09ef6","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"51114cfef53eff43f3957dc3099a5aa87327de63","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230112113533-cb09ef6.tgz","fileCount":60,"integrity":"sha512-zvmXTHvWjZ0USzwyBn3XpJ1kTRDxtrhzvIat5wXAQH5Hfd8Hho2epasmafdcFg7E+aGtPioGAQLuvmlNYS0Rnw==","signatures":[{"sig":"MEQCIEKG0boymtfCw88XaSu7a61kpntHkyyU80/WPLxehzzAAiBPNsMZiX4QIzRooXEKvK0BEOiTmrrRRh31IfT5UdFGrQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjv/CoACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmotHBAAkmizP3ULmDjIopjPGi2L77txWBjNDql8jkQfxrgV7+5JsGla\r\nL3hvSrJZISDeZdSI/zpLUOsDlml+yfjikXvATHBqYPivBav3IIcItQg4chfg\r\nFsE13qRsjnGoUzl3L8a/m8OZtdxVnx0LF4me9N0DbusW7OBsyG5iWGfEbVVp\r\nqMqhkFHvobddh4Hf87sIajPd8JIQYf7CntkgBSs5fSmLatEDqelNEZPt6PZe\r\n0jQYawePPLUVr/SFgXODfBcSs64jrcsuk/1gfjOsQgW5Io9I2KOc5mDM6NJa\r\n0de9pImBNamyfIsjBy9dvsVydyoAsUVO39kH+HzkDXrpx5M4OScsz+pnW//u\r\nwhh1XaoP0AOMZE7LqMotSNYsDhrV26BnQ9dT5OsvQIFxe0p2r73oZkn3sjdB\r\nINd1+A6xPwbAL34zcIkOhj5M45R4v/GHeo/XaqUYgREwJOXsRKEIlpQX0NDd\r\nsbratys5pqDMuJ1OOQBKjEH1vP+ibdH+1jbMZ/2K5wEoF/N1meI43fsvoqTS\r\ngQoc31olm99uiNIJlxh5+yHIAWNeDroaK4kULGG/j6aGN117weKhJD6154HB\r\n/q/UrusHKG1k7IQbfBpWhGYSA2JrKhcDX8f4V1oh9idOhchJZ4UyGEPsN/EZ\r\nOBjci6rJUoU6VBsH6Qx4fBHQHS/aJ3S6Pl4=\r\n=ubG+\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230112113533-cb09ef6.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/6be9243da589e7d786bb9dabed626eb4/graphql-hive-client-0.22.0-alpha-20230112113533-cb09ef6.tgz","_integrity":"sha512-zvmXTHvWjZ0USzwyBn3XpJ1kTRDxtrhzvIat5wXAQH5Hfd8Hho2epasmafdcFg7E+aGtPioGAQLuvmlNYS0Rnw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230112113533-cb09ef6_1673523368591_0.16089552389462813","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230112114041-55072c2":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230112114041-55072c2","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230112114041-55072c2","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"0e6ebaa1fca38a64997c982f94723bc68041aa85","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230112114041-55072c2.tgz","fileCount":60,"integrity":"sha512-uOYZ0BNxexXKqv8WeH2s+WH0ehklAaS0eZ5skwcE9blJhGLZQwmwppxeVrQ2n95cswKqoXCzaVF/15SJCqEChg==","signatures":[{"sig":"MEUCIQDGgaKqqoL09Xc6LS7P0RumRGJE40iNBXBBBO/yDQqiuQIgU6x7sOZFH3B2qjKtQcisUibyozX5rNNHdfPUf4+BwQ4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjv/HcACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrKVA//QZ+jPKDex85jV9Oe7L5qlEYC9FUpFfytbo40NfDaOsd6ELoo\r\na58es7cnqL2woKj0RSjkmQ3bV+mgwYtdwLufaQ+mKzq6qMqPUJ1RpCfReWBB\r\n3Pstv7lbPEvKWRT5T5BBJ59eTfDWFaC4BOw7Cu9fo/yeyHkTjSSSOriwZWEg\r\nvw1mAO0Zu+AHU9kRahKKIggQbR8ZEMd84p3DIg1yl1SU6JrA7UTFum0lSy29\r\nkHMtsl8DvundXKOQp0kySUM5q/J/eGfiRBpa+lwo29pVBSOT8SoWAOcrJptI\r\nIZDMkXj0bytNjoeC+XCqy/xCLbBs3uCvkfzKZL4JCzKjBEZeePGVUJh3eidN\r\nuzi+bJtcs3seI0Gurtvc1QQl7ssS8f3PplEmXmNIY92qObjsyWKASJdy+2RV\r\nZPmMSI9d8LnkucCSghUuBNdC32iC4DrrFbakaL+/8mswbl3KxZgg9+OYve29\r\nzeg3Fg9UzVxXUw6R6ykeCHzL1KMVgg+oGR6QdUGwuxfyV1NS4gPzMGLM1xNA\r\nXmgWRE+gSxnvEmTigkMZMfyYGs0J4G39EAUJwc5OWHElBUKKlMkPBfSkKKDj\r\nWg3Uqph6aG9OsG0mkcw+LQ6vBBKjIiK4tsF292Z+7gZAF+3NEePsUv/FsdEl\r\neZWC1pkKv+cAfpC9dBm9tpk7re1jS+crm+M=\r\n=6BPM\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230112114041-55072c2.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/e0b5dd4085b068b735647e1a042faf53/graphql-hive-client-0.22.0-alpha-20230112114041-55072c2.tgz","_integrity":"sha512-uOYZ0BNxexXKqv8WeH2s+WH0ehklAaS0eZ5skwcE9blJhGLZQwmwppxeVrQ2n95cswKqoXCzaVF/15SJCqEChg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230112114041-55072c2_1673523676324_0.42180361627789353","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230112130551-da71598":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230112130551-da71598","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230112130551-da71598","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"6ef559f73814f72f846143630f05c65e645e493b","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230112130551-da71598.tgz","fileCount":60,"integrity":"sha512-2tWTZVSjHW1VrpyCoNUNfTBMvSFQ0W7ha2CuWDqwQ7zksTZ0FDwhd3hCM9dXPr7JhW8Op3nLRha/99rDrt0MXw==","signatures":[{"sig":"MEUCIDdJs79gbhwGUiViixFrHrGCjwgkoPJfEv9R7icewikCAiEAroYxk+HQGnqq2l3jtAA+v1sh8Cxvg5+SvR++XXWpWTg=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwAXeACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpcKw/+IkN5vJQeWWFOc+zwRjWVig+swtXqay/20YAq/7qJUP36cuUW\r\nfLP5lgv4d10TPOT/tzRzrb1mD7TbV+ioPTmA8rWxGP0OCC46hjanxOK+68aa\r\nBhKD3edlb4QpzFcF9yAYB1Oo+Y6nTLhYhyFBBUvwtTX5aLUv6E0hpp32E2Qp\r\nUW7DkEIprVQ6f25JJpF0R00ljPRtT6uktmFIx/Y6FxR3mKnzH8lwxeQEjTLh\r\nEHoxYGnR3dElP12U3YvZlupQYWNQEBRJv0ndjnUU0A5UCXwos/Q9RRLP+Vn8\r\nsDdPQez+GSs4YsKfhcNwBKzSePjgOFXBxmCHGY7jT7KTfvmtBgrqGr34XRoJ\r\nLpDs9JpiNehEeR4/TetAL5znF4eJprD8DdNCh9aLLLKg5aRMLwXMXDybIsfW\r\ncTFzMlzTxWlRdeTZnFsSajR0Cz8RB6s8C6+xWFPL07Ae9GVymSvGbW9fUtEo\r\nSIUXoq8XpSch7thmSqZPdBJP8J8lhnpChk66HrjVRyIA52B66a/2GH7ZhAva\r\noZL1Ne7Qasfk1DlAWE+dV2il66bmhY6XIuItH7W49woTlcweWcnHbQAI/B+0\r\nKf4G9FZ8p3vo/rWQOuiqhJrpTjKX5fBlBD04MBC4FcMHok2zE9Auf/kx6yu6\r\nOGbs5SLKwSeNY0KP+V4EO1MEdRwlnmzELCc=\r\n=Rqm9\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230112130551-da71598.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/d7e66ade06c37915df156526ba7ca486/graphql-hive-client-0.22.0-alpha-20230112130551-da71598.tgz","_integrity":"sha512-2tWTZVSjHW1VrpyCoNUNfTBMvSFQ0W7ha2CuWDqwQ7zksTZ0FDwhd3hCM9dXPr7JhW8Op3nLRha/99rDrt0MXw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230112130551-da71598_1673528798585_0.7537877101890105","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230112132913-e4f8565":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230112132913-e4f8565","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230112132913-e4f8565","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"f74475da2d3df2d8efb5bfc17470dba0df1e0c68","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230112132913-e4f8565.tgz","fileCount":60,"integrity":"sha512-MVCDu88oqf9hPQiaTgTEEVaW9ZHmLiZ6bLbjrPLebvLTO0yQMr04ZOdFxmwzv1j+RgEUs5gqbkyxj5OYG3vUdg==","signatures":[{"sig":"MEUCIQC5pNQi/efVakD04mlZ3hl+BI3LnSEsiWT6iKkOKA2z5wIgBkJjxHQiUrp5wtOYXpRClXUzhdk8aLyx8oDqyu7mYcc=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwAtWACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmpn6w/9FITs710+E2FIZGyNsZorT0KyvY4brz1MSxOyCMn7+f+sR72o\r\nZ7Z+oqH5/bzmMOGVyn8ElB5XHHa0TAQujNlhfw+x+7EKKZSCCu6F7tVbQ+OP\r\nVhhKAFTWDGJxpyhHUy1O7WUC8UV3HthCGnvOANqg3/FghG4HVbL7yiYRnkge\r\nuMRR26iGlcEftetIyGicYnbGLRLhZbHHFNxQSVppPBmoy21ObR62pbkTN9hv\r\n9KJNq4i1c98TfAtnC8ctJsS895t91ULbwObGkUimt09YatJuABFUQvakq1iA\r\nHRC4Fgul0Hy1Ubg65rIlYEMR6ofTNFzCaKxvr6C4MTB7s0XkND55/1cUzEW/\r\nZLbl5IAtxRREaEoSmVcjLu2dnsBoT7G2yYCT57TYKc7UTSnO8pnAIuBGoNwF\r\nlWuGmdqE86nufZnUc/bz6+zC3nMBl9bG5IOVzDrHuZO4YaQBKt4uTkBg/9+U\r\n4yr04F9pNlYxW2snDQAWcTnWJGDsmsxHhHHbc6kPLBAt32NpfMtKvJhWRi0Q\r\nvBa2iT2HahO/txgG2icbDif69SGTj1EOBrwa6x7WaWf4ozo6IOcPtdqvNj+9\r\nYFvZ2LUPQB9/2BA70xUNZSn5EM5c9ZSe7CmP8P2sB12cklF1TgQ7cSiug3/Z\r\n3EJd9jXiNjNMA3O8E5a1i6qAIarjQfVmzMs=\r\n=lyht\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230112132913-e4f8565.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/d0b61be4b1923d0ef92eead9352f7f5a/graphql-hive-client-0.22.0-alpha-20230112132913-e4f8565.tgz","_integrity":"sha512-MVCDu88oqf9hPQiaTgTEEVaW9ZHmLiZ6bLbjrPLebvLTO0yQMr04ZOdFxmwzv1j+RgEUs5gqbkyxj5OYG3vUdg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.2","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230112132913-e4f8565_1673530198385_0.13250085672651246","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230112141758-7f33ba9":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230112141758-7f33ba9","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230112141758-7f33ba9","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"bc38bbf863cf232f0dd15569a38b381b812d0fec","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230112141758-7f33ba9.tgz","fileCount":60,"integrity":"sha512-MOwq6DPuE6xqPH4ctoR5Y76W9Wu8v1f9Pp5E+i/mDUYN7lyhW/tcECKh534iZ+dLIwqQICZofuZHO8ifYRSmWA==","signatures":[{"sig":"MEYCIQDVxYkf2FsaCTy62zf1Amk2Vz8vWlO+UHlz5FWrYjI/vgIhAJch5W508FEofyjpGSodupRm+UgCEXEjie9gIXdq0bgQ","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwBa9ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqsnA//WQsQf65PvRfz0MyyMhvkU/fETiHTM2WnqB0nmQttoFujv4RW\r\nzFI8NM5+O9frE+G9utlGYlcuGpsT5Gh909pNT2SgEU2IrQKSmzJfTCeRkNdu\r\nKsHGR1jsPoJz0sf/C5cTsd7i1bgAbwte8ubYSX32yyhBv+OA/h7VY7LwATyC\r\n5RDMgdO0YI3mjrwCVsJ19UpOORdcCt1xm1cIrt7f8d4JD1HWQAM7miBiKomO\r\n5NVW07v04diyqqQgJU8e3Ljlj6EY4oKjYORYvA9XbGqrsOVSa3BAs/eGuCKk\r\nlFYgy8sWUxSyDe0wIqghyqLp//m3X8uRcBP0BRSg87uj2u3zwMBUsAHsTZId\r\nRVj6wiBZcfEe8oawf+C5OEWMwGGLY2Qp/YAepFRlmC14UagDmz6I+/mrTOJb\r\nH5Dx2MQVxKuc4uiRmEPLVWcD7zSUb0AjuasCrdJG0iIkHp8dABt1bef1cQTj\r\nyszumZltzjEZdkDd8Zzk63HzNSyT33aSBVd2bYfe2T4DDr4Tlt95xoYC79T9\r\nLotHptvSyPNK65OK9ODhIFSs0RvRJRvZ1wFlRK6RKXT5VtUyKsk2oO9KJcQ8\r\nVekG98otx1nkhRcvsCAVefsA912IsMT1fQYO/td0UhPpLenclOtfw1tE2uv6\r\nT62l7oCMzpovzN4NqL17TeJQkussJ4v+/ks=\r\n=obQ3\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230112141758-7f33ba9.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/9d01d385d79fac919946fca2af58593f/graphql-hive-client-0.22.0-alpha-20230112141758-7f33ba9.tgz","_integrity":"sha512-MOwq6DPuE6xqPH4ctoR5Y76W9Wu8v1f9Pp5E+i/mDUYN7lyhW/tcECKh534iZ+dLIwqQICZofuZHO8ifYRSmWA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230112141758-7f33ba9_1673533117131_0.05978155264750118","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230112145832-f0d8a25":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230112145832-f0d8a25","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230112145832-f0d8a25","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"64342cacbb459f55ac778f2abe1111ed763440cd","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230112145832-f0d8a25.tgz","fileCount":60,"integrity":"sha512-fNGsZFD0D025U4o+Nj9VcZ+JS+jTs0BXs+H+X9evEdd4/mtR54JGkMMLUzFC1mRAS11ta7/tibqix0m5ZxiQWA==","signatures":[{"sig":"MEUCIQCohHd1Dz/ox/FZLyc2B/GdKufBB1CW+90V6CpPfH+IWQIgbpY52leKBxr6kPly3Jock/TNKAOQHG/vh4VxXmHbpOQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwCBIACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmqx4g/+LVbo0fg20ljyvGzqIVGiRhZw+uBPHehcsfBHuS9ZJUg2QQcW\r\nO6fVJXtXd3Bz/tUfAh2Qiv2jIcSQBgZpO6JJCW/rj6wlgrY4TSMdGHpzKyKm\r\n6tHxfnuY97lk3/FHpW2W5DQRZIE5734QzrGQm0uK78sEkgtXs0bX47p9PbWt\r\neW8CdmJX5q6QejNp9hzD2c4H8lApeQzwDG9vMZW2CFiBCGgUyUkddSHcIc6i\r\n78XNGsNpEaZ+6Wua4/mVBdbe0GpVixHDSVeneuOZHl2gVjb1l1s/26Q9un4u\r\nVcWfWNdNQonyKCTOEtguezzBc/YTwLWaxbGxa1YbvlFY4+YlNP4ZQF9/fKbs\r\nmzbQqhmo3uFZ5Mlg4S53IJskPoP/lqLWxOm8lLxzVDPhNxXUuFGIRGDVjIMw\r\nbfp76ktCaXFIp4kQv2setebS+MQqoaVb+CrkijLpWGcFT+jHOM3svOzjp5yV\r\niuk6JzgD5leTx6pZsMK6DamAdViSQiEp7g7kcrw//rGXxjuFw4kSNOOeERoy\r\nLY2jz9ACecWkXboYHnNcOQki3YwAjlczhcQ1pkXCHVd90AHb+9G3PTbCXOsm\r\nWhUJehw4+vkGEPVOmvJnQXK/0SKi7RTEahE9Wh7KIlPmKVVJjlbRMDNZZm8a\r\n+7BYRJunwG19+e0fIBESSJHwIcGkqiZAxto=\r\n=M5Un\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230112145832-f0d8a25.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/45b80e9697e8c64bc9d41a30ca69fcb5/graphql-hive-client-0.22.0-alpha-20230112145832-f0d8a25.tgz","_integrity":"sha512-fNGsZFD0D025U4o+Nj9VcZ+JS+jTs0BXs+H+X9evEdd4/mtR54JGkMMLUzFC1mRAS11ta7/tibqix0m5ZxiQWA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230112145832-f0d8a25_1673535559924_0.6788960968018234","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230112150250-890530a":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230112150250-890530a","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230112150250-890530a","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"f6d529b3b3bcc6f8e7a827f2eee9c8329ba98c06","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230112150250-890530a.tgz","fileCount":60,"integrity":"sha512-AJOfCzXzMe+gWl5BzeQRqZ9kzzgftKH2y0mhfeHLHJ6M9IA03CIKZDKGRBYDkWK94N1m9qYz7aAOn+BPKmvrHA==","signatures":[{"sig":"MEQCIDOw6T40sih/tJBOjS9QjlgZLaL0Po/ZqDJM5SxcO1qGAiAXTqY3d+b0kOkUF/YWaOdDXx+r1rXudUoTr37SwMPeEw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwCE8ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmrnjw//e18CJMeMWrvy42KUKCKAMKgw+m84+e4S8H0mRgJJG974MUeq\r\n3ELiSL4zG3Qj+l3mr73rfE979/LhDHAiU4NDo97ajmas+6xXnV49GMvG0Sx9\r\n/yAhzE53rn7DZEDJULrtl9kdNy01Z53huXADYDw6oNphgvf1o++CJI5zA2C4\r\nD6U3MUD8FO8c0P9ASixtX9EjU/lrfrkQp4LwkJ5PQiyU/oYvpkQfk3Ed7J1H\r\nbYNq7T437tUzuLUo1Q9wkoWhLUt9pVIiW8WEtPxtZatbpSQx+ILeKRsApfej\r\nrShb0OGE41GGZQKjWRS/1vwj0wC0xz+R5e9HpW4rUpUN9CudS4dHb/mKOF5U\r\nMIWyBQP0A0UqDAhg+gVJqgMNgnwqUTrMtYPoGkOPTh14OrMnuK8FepSAJf3h\r\nka9im71IjhaxPjNsaCARLa4iPXPCaqOa/QAJ1gzv3+bK6K6b3ghbiZB9A4Jg\r\nrew9WlAhQfTmiP5OxXL5kgHghBxMQY8REdGm5ak1XmpVDOTrGBlC7oMjrp3g\r\nhFc6Syo1n9U97t6gKF3+A5QxG/4/Z2kqRZca3D8Ysr4jpTVW0iDY6qn/QarE\r\npoUZ0LZNl9rRXy6bZckLdJD8ttLGv1tWLcWpobirrNRsFM3jeS07Zv80vcRa\r\nFwP3LMcCApead3H4SCEc/XBOHORpsDxkCM8=\r\n=ueH8\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230112150250-890530a.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/768333d6e2374970c403247c1a5a746c/graphql-hive-client-0.22.0-alpha-20230112150250-890530a.tgz","_integrity":"sha512-AJOfCzXzMe+gWl5BzeQRqZ9kzzgftKH2y0mhfeHLHJ6M9IA03CIKZDKGRBYDkWK94N1m9qYz7aAOn+BPKmvrHA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230112150250-890530a_1673535804225_0.9454348430161723","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230112151240-67162bf":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230112151240-67162bf","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230112151240-67162bf","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"a43c7ed62befb8d0ba1b93d8c3414df1f9c30366","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230112151240-67162bf.tgz","fileCount":60,"integrity":"sha512-6T26Hb/xQxv38IqjumN+mwTngMXQ0wp2pjN6euUoHh8pxcBTSlGimPIYR8EqLt3Tq7f05vN7Gw+LW5IuqkHg+w==","signatures":[{"sig":"MEQCIHNiVLebAFJDIH3lr4txHoBnSGHiyaQigchFGZGndqAzAiBax5T5LP0eDyN6ihpLuhOYbKaDVqpRnvGTupo5D5bEUg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwCOMACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqUdRAApNMxxOq+TylKIhzvXIcdsdnOyHtvE0b3C17TD5PRGI700omn\r\nEL0oCObC07r35sgnW7wQrXqnsScy/2zSIYtPq/I8yDQL8mwoshdf5Bjq2Ur9\r\n+hx/CV4mpdDshEfEu0dtwVYcXrEf5CcXRZBla1dt9n0IheO3wpbysegxBElV\r\nW4X+LUAQbzKNdjBpAYhMlbVQk6m+z1qlQMHGtJfxwpJGGXPKTb0Ge4gqbok1\r\nFtX28Pj8MBbXMOhfTxy/6JAEUMV2GbQwhnE6r+bOHGK7PQfNg3xxy5v6WSuC\r\nTpSNeVFFr+4gGgTXrAWtBcve04KsJOxvbRAXkZsHR0KF4IaFDa6j+tZFJur5\r\nlgU38Z86lqb6zSzQobK8Km6b7KAO0tpvNF649VYdzgOB4dYbngecnRoba+Mv\r\noVGNX/VpI3Corz5UOo/Jkm5O0MICYD0X2X/nod+bc12/y9v/eihawKw3H4sn\r\nvfF1zQZxh8xk0BVbE0hYregH7ZgfW8Iq5/yFLTWrD94QDbkKuWkc1pdySUEE\r\ndPORHa0s9ivCqcvrfKq5Lh/ov1JhapLwWS7ordHpLcBRrvsY7MGgx+ev1LfH\r\n7fUkDcK1TR1Yyp8KLQ26yLvkLHSstk9774VX7/jhP3i8I+V4JPkuqZe7dMSP\r\nDFjeJa0xP6V4vXjSKq2bvSYYfio82Z6XCA4=\r\n=ujFL\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230112151240-67162bf.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/bcc5b595d80dd444d0a548b1da425185/graphql-hive-client-0.22.0-alpha-20230112151240-67162bf.tgz","_integrity":"sha512-6T26Hb/xQxv38IqjumN+mwTngMXQ0wp2pjN6euUoHh8pxcBTSlGimPIYR8EqLt3Tq7f05vN7Gw+LW5IuqkHg+w==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230112151240-67162bf_1673536396468_0.7154141488171841","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230112190932-d34b8be":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230112190932-d34b8be","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230112190932-d34b8be","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"d32d95bc6b8fc7f44fba88ad471fc0ed242a49fd","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230112190932-d34b8be.tgz","fileCount":60,"integrity":"sha512-lJnuNHGxhqEN3R/NF/fgRIWf7zAMAYKjV7t9EhyhRwgXFwoB0KvvbQlYDEQ/FZH2DbiPmj/3tBoep4KC7wFMMw==","signatures":[{"sig":"MEUCIBGloaEGmhhpaQnTCQQ0fH8yFxP2lCdPionjzMFV3ulkAiEA0O1qZ5f5g7YNDvNgKrcO0NPIQRwYkpFd4h9ZK5d5rHk=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwFsPACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr7+w//dmZkp1EQw46rR4SByDLz8mZNZzZ6P4SgdQ+KA5Km15R3JToh\r\n5pWb+ZQF+W53pDNUJMr3vVttAWJ0nNJJiOilZ8gYL7ON5wkaWTiS4iLNBHmN\r\nSK1nFtn244L4KM0j21xz/pY2WVm35uxOGTB2Qcx2bUnDA/l0PSNa/FN2uD7S\r\n07wMC1nbifa1rlB6Icd2GMm7IuO8cj3Bg0FIuoczuo/z8/EnEOMQvhxJQ6Ex\r\nxUqTISzx1+CIynTaiEmd3vP2bJu5zV+XAQubnqHQwIGa+yXSJ8QUzlewFb9T\r\n5orok2Y+oRRQc7A5LEXaC+Gro1O3XT6gYhNfvdCULA9vrUmcQ42W5IVTed9A\r\n7lHQTMgNNoHD3QwOdgcrmYbAfhZ9aCI/dSuKYS5ywMGsifWJpHp18LtlUeMh\r\nkp4XUtyiCGcDoiAYmfn6wmdcHvZXt4cTSS9iEhdCs7zxT2QUJV2jMnseyAaC\r\nRrpsKXzrtUbfyd6fjC+LhTbdnR9enq5GFVIivCqGOORL0q/eqSMFN705WvpS\r\nMwTgMsb+dX6xEEZ/7jO2DFpHJmdDdLTReuNJcyfsSLTLoXyRzGGvNl7V+NC7\r\nFjUgWjGZmIYfprwqYianJ1K+VtqlXcc9blYl9XcwdmWUrI/BREmIO1gqGusa\r\nhNNs4rOZjFPm3JVfMOSwns3V2J1QAOLdl10=\r\n=8luX\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230112190932-d34b8be.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/8f44bfdc5fad814ca5eff79e9fe2d661/graphql-hive-client-0.22.0-alpha-20230112190932-d34b8be.tgz","_integrity":"sha512-lJnuNHGxhqEN3R/NF/fgRIWf7zAMAYKjV7t9EhyhRwgXFwoB0KvvbQlYDEQ/FZH2DbiPmj/3tBoep4KC7wFMMw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230112190932-d34b8be_1673550607041_0.19573244305275073","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230112191604-d46b289":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230112191604-d46b289","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230112191604-d46b289","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"2536ec8eeabfd272671aa33455c7e647c42042b6","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230112191604-d46b289.tgz","fileCount":60,"integrity":"sha512-mjjfiQXKeIsI7143+PUoBp43q+/kK+cXGgv9w1El999I44AxhxDPcDpWzaECbKGj94IEMlDaImEXycoRBvE+xA==","signatures":[{"sig":"MEUCIQCtqF/QTwFKSQo4rwnxraWSXGwqBbjl0NvmHUJCWiolpAIgFdScLuVav+svsJgAVHFgndIsjOlD7Q/Wd3qbT0x8Zrw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwFyeACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqKVQ/7B/904GK9ooUTK+uKAxhRYCN9YoJHI1Hf6mTbhTyQ+Phaub27\r\n7xwwM0+viDEZkX7l10p9ejFEHvOY0533q5FmSsFdUpBB9mB9gHUCxCoX5FRz\r\nqomJfPJ92KmYk6q5HKeoO8+wl4r3qWorQZCzvdoVl04tF9/RAt4nm+Z7CZZD\r\nES4c2cCmnsvOyxXO/oQrBhAdqibf2+osTL285uizFMJ2/hoeD4auvt4KhctY\r\nn/iS2eWsuGoc/PHgIEezjhQH05GUHY4xKZvALaZXg+vhwU4ypbJ+nvH6QGyF\r\nZ/1/4cckoW5+PNpufkdqrm0bjzg28e8OPU8qZx5i0QFo7dixwUJi6I9NliJZ\r\ntXrdvLlu7+0xrviTptZNLQj/05Nci7Yhnti19HJ5YwqtfqFA+Hsde8y+c76K\r\nBq9iWgVjxaGgU+kj+9KNTlKeqDQ+IgpKAGheUrbFidyRvup7L5MvsCLbGhJK\r\nFjcKGX7KGeH3o2odw8vOGy+DvJBblfjQnREzMJDVs2Wh3KA/O691XF6pyPnx\r\nlRWobJzpkXYImNANJGjPqXzjN9IecQrz7vqremBHuhqh4MJ7NGAYFhBtw+2K\r\nxe2mSvHUkMHfF+LrNTWh7kBlbCkfhW1TcuXLdeVZ0gNel4meg+QKJ4JbJxUt\r\nySMkq7v8VH9LxfNS0TSA5IwqmD2RAH3bYto=\r\n=vOH5\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230112191604-d46b289.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/31e1029e2d44364680003cd3b746c6b7/graphql-hive-client-0.22.0-alpha-20230112191604-d46b289.tgz","_integrity":"sha512-mjjfiQXKeIsI7143+PUoBp43q+/kK+cXGgv9w1El999I44AxhxDPcDpWzaECbKGj94IEMlDaImEXycoRBvE+xA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230112191604-d46b289_1673551006478_0.6972285571551622","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230112194233-98f5b67":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230112194233-98f5b67","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230112194233-98f5b67","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"9d35c59afbb91bb2099eeb32cff58c3d3ccafd07","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230112194233-98f5b67.tgz","fileCount":60,"integrity":"sha512-5GGKifiJj9DUvo7118fytXyCL85aUbOr3WEnSnhxyMgbaDimxA11Jxe7y7m583ivJnh/K6o1FAHnDX47ikTqJw==","signatures":[{"sig":"MEQCIEwUMRBPGCuSbFVtkglkXoZDWg22nQL4TmEUGI5bQ0GYAiA40BaRPkmLN9gDF+Ccz9aT/snC/BunuGCig9AN+533DA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwGLSACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr6rA//UR4wQOt5/v/n+Fo+tnL1vc0Hij0aCPbWXCc27Sl8fSiS0y/5\r\nFyWAOsdEozbSpETDDNalJO+KWrTUCNpBV2NpLdDyv8zKLyPmR4eqJ4TSQYO7\r\n98Q5015vRdcaa/mudZvNbgtpkQihDnCzqKnjuGq6tYUfwbmCrxhkgkz8tj4i\r\nrM6OiIwkEDEqysZ/TgG5B8oqNi+D+fVFG8zjYfYvTZk1GOSWKjfjDJC1I8qh\r\nLpEHsZ6kyTPglkdXaF2vyDxv+NrBi2FZT4SS7+q04mqSmyHS2xacYqUiuw4e\r\nkYmPW55mfy3fwN+05fX5kajSxV/SUGumsYUIdohUG8++49r2VhYHkFcnXIt5\r\nsNVKQTx69B9g9XbOhKtuliOIWDhThY29B6xsjH9VkBy89iAXulrtz8UI2smx\r\n/Y/8egNimK7THVlDPIMQ4FNmewr9juAr9QuXjNZQUCftOzA2Jdxwu4yup3VN\r\nJvfkbA5b70T/qgoG2FgGrTFb2be5v7v+6jpiTAgLk/lfr7xki7kioZhXT9hd\r\nE7HqCebfcU6B6BnEFmBLt/Leobg3OVT5K5/2OjEVy9KMGGsoiTTd/ZTjvVLY\r\nwv57zkAChxIKJ9GaQN3Pbsai9eGqhqJtF/RycLCm5B96MiIQ0mDOFS4Burim\r\nyl2L7uMZ5ix1k73nw1AE12AgHnX9gObLC6g=\r\n=LcPw\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230112194233-98f5b67.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/aa816901b9ab14c5f67a6408ee859754/graphql-hive-client-0.22.0-alpha-20230112194233-98f5b67.tgz","_integrity":"sha512-5GGKifiJj9DUvo7118fytXyCL85aUbOr3WEnSnhxyMgbaDimxA11Jxe7y7m583ivJnh/K6o1FAHnDX47ikTqJw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230112194233-98f5b67_1673552594595_0.028698666764054748","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230112194251-b10cbbe":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230112194251-b10cbbe","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230112194251-b10cbbe","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"cab9358ec13668024d48f3c2a494f7ddfb312ee6","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230112194251-b10cbbe.tgz","fileCount":60,"integrity":"sha512-iwdbXqhX03c0lCT4wYtewhvXKeq0oCdOYEMlJlT5MyhysTtdhbUOBrW55YdYjq9zaHirqyAfQt2gqQmIRcGRWQ==","signatures":[{"sig":"MEYCIQCMOkhn9SdwwS9S7KQTUpfOFMfjcAO1wMfU8OJmhMsz1gIhANOCj8ky6KXQ6CTG0Yh78qy2Fo2li0qCkeEzXhmct0bU","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwGLeACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmowXg/+PIHSNwgS2/b8azKC8L/J2hIUrJGtAHPivyuzP+XBzlw1swpX\r\nR2Ekb2LsrcFXFXG7bii4cvUdpMhhzoqmrPlX78Wf5m6Y320rTzLCwpBM8aht\r\n/aPuO/C/o9EScvftTlcHYDrj5LgxezAhMZXt0IjO5NWpn7mCepyAztzQpqQV\r\nlU7bVjzhAVXpUBVqX0a4MF+rXC2cgPCqATFD4EG9hR46ndvl7X1w2oK2VQUF\r\nzrFax8C/m/lUpuC3IHG/JdJSrbXL4ODulsFp5Lm+hju4hjbUTqWcJfdG+B8z\r\njFLPCa2QDWhn1wcnFJNrdg6W8Vz7bhf4rqOPQDjZzrkcOKIHH2R8lYVR1n5f\r\n6/K61SrvgOqb/JN3HM/rSM9+YI3jf0cJNUb6AXJIE9NhxE66XVDv7mrDP3pZ\r\n97e2bWs07YXUy2IClElicR7OEzWgpV1ML3TasBdgwWk64lamrqs/nNqhYq2T\r\n8AtgXoyg+b8jvwb3b/CCWt81nlXRUe2WmkM0RU15MBwK6N+C8TkYXAJhyzUd\r\nP70CTj6UrnVHOI/7fpsZkijS3OdnB+VNXnmr8yZ4cgYtOxVyuS4BiVCqXJny\r\npauEPiidM43Op0ZJRBTLYzu1HTBoVk+7NdTx6OHM7PExtDaov69VoOyCV9nJ\r\nGgqojAf0TSbSWD6sL3VXrCaUs8wYWp8BQBA=\r\n=g+gq\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230112194251-b10cbbe.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/d317ea585eb03cbf43039687c039a415/graphql-hive-client-0.22.0-alpha-20230112194251-b10cbbe.tgz","_integrity":"sha512-iwdbXqhX03c0lCT4wYtewhvXKeq0oCdOYEMlJlT5MyhysTtdhbUOBrW55YdYjq9zaHirqyAfQt2gqQmIRcGRWQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230112194251-b10cbbe_1673552605919_0.21877017916096242","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230112194257-38c43e6":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230112194257-38c43e6","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230112194257-38c43e6","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"0d3047e1ba0402ffa4382fb044deed9cc19d66ce","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230112194257-38c43e6.tgz","fileCount":60,"integrity":"sha512-6ru8vqEWn0t5TwD9hK3hjZkg3lRP07Tmf4aDotjgvxt1R75man6phXSERWQy/CM8/bxbRO9wwp4HDGDPDGpgBA==","signatures":[{"sig":"MEQCIH7utKBBixUIlJOSY58W2ItgTnrfYS5zmgRDqcL/EfAnAiAr/cUeXUIXXiW/lwa25NiNOiSKFlEGMJSqrp95tSx7xA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwGLnACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo9zw//dARzcOC39gRTunEfKK4R5yRVoji79X94TWXEZ650v7GIuC/2\r\njqUC5Pv2PfkLYEoLSdrOnG2WgbHridWnGeTPvqN2JqOoZIOMBq79W3coc0ob\r\nFgH++Yq7rNlM027MmBADInmcTg9lrNAYop9ECUORuyYJiJMeFzIeTCGywMPE\r\n8xfrnUJNujs4k3Uru428korKR8F1jR1jOjFl0fTNVQG96DSBG3AwKhgkbezY\r\nS1DJVt1MMgCp7HO/ApOc3iwfsy43WEuKqGqbh6jK7iEHTvoo5g/9p0gWY95S\r\nDVVktPw69+MDme94BmIksAWtSweXFYmu5HIRDWKGRxI6O5oYYvyu0Mtu7PvN\r\nP4NHckCnHr4w90Kt3xkQ1tEoBpMyGe1W6xnIYGif32QgjXO21xWeHsbcp40K\r\nhUKGAd/dG/E9ncBIWNWsDR9yOjHg45Qf/gGDDIA4Z4l6ldT7zH6tqDTjuT+y\r\nCoMMoe+8XvdF4WJFpTBe0y4EFFLmkwIqph3zpdDPreoRm79L0vWFSl7CaVvd\r\nDRUaZU6clxHd46170EzaA5iXXObE/ZryRFsPrv3s0VLo5JEKAtj9muX99Gza\r\ncHO7VOeqytTmj7gDo5BFTobJj/HP+8RzKcaFDh+6fdpfvkiVYbneNDwDVs9T\r\nxRPUHOwZohSFP1ayX3whSjfkDgvAdomFcPY=\r\n=Uf9b\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230112194257-38c43e6.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/05395c9cdf9e2ba51fb613b46bdfcbdc/graphql-hive-client-0.22.0-alpha-20230112194257-38c43e6.tgz","_integrity":"sha512-6ru8vqEWn0t5TwD9hK3hjZkg3lRP07Tmf4aDotjgvxt1R75man6phXSERWQy/CM8/bxbRO9wwp4HDGDPDGpgBA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230112194257-38c43e6_1673552614751_0.7845652931395017","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230112194314-16aca48":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230112194314-16aca48","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230112194314-16aca48","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"f343ed3d72ac6bc796cfefcb364bb45cd5e36ced","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230112194314-16aca48.tgz","fileCount":60,"integrity":"sha512-3Z7GWt5xYg2X/R86Dk0wACm2xmT9Gi4szqKCHEh1iY8yyL4IK7ayYpTd++2qT2NrO6HxHBGi9YS7bmfBYEGbcQ==","signatures":[{"sig":"MEUCIA5wQKJHmpX3y1HAgSt8ta9GNS4ZZHLH4nd5nFs+EvhyAiEAoK/X+6ZwqxH88q8q84KQoyAuJqw4eLLC8WeKLdwUo7E=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwGL1ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqqRg//ZgK3ScsQ1T/9L3KfP3OL+wUsRCyPZ/CkZYPxEaIFmkMNBl0/\r\ncVpwfz+oIhp28pLLqYCisKySkC1qGIDnCgorFQgSh7C2ftFL5GyCRfI0a3/a\r\nXdTAyMxX874rcRkRxW8ZprGRBU1K3tXwuIxySjSlLiftmf2d4Ic5juLKWRs4\r\naRIAzfxAVZFGLDfXE+Tz6/mpkI0piD8MS4RoqogveM0Zi1Yc7Yxvzh2+1aUL\r\nC2YaiKgm479Zror3hARTKoUGBa0MYWXk+pHbEROP4P9irGkecZvuZtJ6wp9o\r\ndweZvfghftDypMVAO1YrW+qMXny+NbV4/k7yq4f92Y3ZL6bGS/rtfbye9pj5\r\n+M4MZ6yc/FqTKH21TmOoQTWhmn1X/sbo5tgRKBVMoCOJlk99yPZXu6afN8W+\r\nOZhnBi7etkrNbbeFgBNSyX5RM+DXwPl5cWdDL3iP8s+fCkZMpTff/cxk6jsV\r\n1sQBUZyLlHGjXqiaNChvkQXHVRMS0CCOAC8p+EFOC1lBH2XEyR/MunxCdOzh\r\n7aNdZw2PmNuQN+UHikrJ4YD+SQdAAmGUPrt+lLnBz2uiSYteu94NX3FlBtU7\r\nQC5u5/Erb0I3YlmMSNV6rodUpGFEfEwIjoQkGPmQN9vi+p/PmqAjWoXXV05V\r\nnJWR/Lm9f+yk+QaFBJiP1AODEV7xjKDvi9k=\r\n=nm6H\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230112194314-16aca48.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/f4b9c7546e45d7c441fa68afd54716f5/graphql-hive-client-0.22.0-alpha-20230112194314-16aca48.tgz","_integrity":"sha512-3Z7GWt5xYg2X/R86Dk0wACm2xmT9Gi4szqKCHEh1iY8yyL4IK7ayYpTd++2qT2NrO6HxHBGi9YS7bmfBYEGbcQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230112194314-16aca48_1673552629596_0.44490038430115364","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230112194802-8d5a430":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230112194802-8d5a430","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230112194802-8d5a430","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"ed4721e1c05f4e8229a96be18a4963ff5de4c66a","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230112194802-8d5a430.tgz","fileCount":60,"integrity":"sha512-cgoskQVtX6WdZbBBY6t/3JRJQJUJgwS+6SQefe0Be67vAWMI5MENqgMt2ubfcSy9I9KmhbYYaIpofv1lRsVU0A==","signatures":[{"sig":"MEUCID2bywDmp7sksFiqQMBl21g3MazcxNjvZjvzTP/kq3GgAiEA/Ggt0/WE0bXGZghMQvJ+b108yVy9atEKb1KCzXjyQnw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwGQWACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmohJQ/9E1ovmurSMOmAjti0/3/lhR1NrMh432ZG6wPsDO7Jy18QmA/0\r\n0KUem4BEKBDEJmdzXiRf1f5vQKz7zhfN0MCtlVPHJRkIXwgK92aw7lLesgXO\r\nMRNY0/CvGdPOzYZ6MFc6AKHAGXJMWsa8yG1N2odEZghYGvZGg2QVnv7QwwAb\r\n6yn6M6QL0RzVvIpUqwOtzslGnm6MEzzr7RUwPLSbA1TxjTDdHW+YZO0LGJ/K\r\nvaLLBO23GkOiW+U0gR7FT9F738OAmrX6mAxDEKGW9WmNrrxtEvvzx0h3v6zN\r\n/cIikTRRoXfxfqRuj7gO/8FgQtudH4vtyhkYRWSSaP77gEPOZ8DlzgZ+O0Ln\r\nfHx1IZVytTITKADao2NcgDXR59+Fa83jsS9XO8o3NqS+5ubkE7RE9wctxEBx\r\nkH00dSAmLAkiKUD0d4uTx2Ocmzpqp4lyaxEYYkpVEjsLypDWgV0/WcJIOXzf\r\n/r7oUy3gK2P9rsjNrT4PIl11xw0iR6wj6Nyb1wEsS3sad4I/z5WNGbPSB5W+\r\ns0CXmFydrPjx9JoNvRalzj6bdFTT4tyXbEaMsrv7/MEkbWPqmM1e8U4oxeBW\r\n3HaLWVfkbnV3HZZd6qrGEggY84Lw9bzq0ilkL3YJkdY3yGuHbfjfA7XoIwXz\r\nnaYoPQtA64qmXrga4aEPIhA0eoVpWFTppzE=\r\n=+PT9\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230112194802-8d5a430.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/d36ae0ac9e2c88e20120dcea5767f0cd/graphql-hive-client-0.22.0-alpha-20230112194802-8d5a430.tgz","_integrity":"sha512-cgoskQVtX6WdZbBBY6t/3JRJQJUJgwS+6SQefe0Be67vAWMI5MENqgMt2ubfcSy9I9KmhbYYaIpofv1lRsVU0A==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230112194802-8d5a430_1673552918392_0.01756530368178688","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230112195314-2fe095e":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230112195314-2fe095e","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230112195314-2fe095e","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"aaa35fd13b708efdf2f4a1df14a7ccecaabe7099","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230112195314-2fe095e.tgz","fileCount":60,"integrity":"sha512-lZE6w8I1ES9LQaVOrGvww2H6+u0OkguFmMZy0Rn6MiKBTFMTxfh7RwlIhz+9aexEnywh8zWXwtXqWh3AxWoTGA==","signatures":[{"sig":"MEUCIHhtlDYPmJnRlYV3BHFUdW7db20en1ZOf3NLg1ESI6L8AiEA275gFFOlyR8A3o8HweB5t3ENUD1PboMnzOlFq3BZOuA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwGVQACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoWTQ//dbpAwQoJP+MYAVPMDyLDYqEs6mZRCnF1ZsYJKJfQ4hweTIvZ\r\n8w0XikyOy1HOHWiFET8j75lspauhmD1sjqZTsoHx75A9WWeui4zb7lrEy7oK\r\nKSdfUUCzWrjcSeBrzI8Ln/HTng6qspPGcKD4q7FmAXAXsdW6X7B5AXWz9u0I\r\nJ1uxMCzlpfxCdPGZkjeLsLP6zKrylhWNx8WJouao7ByLkO2Jgp/1oXzD1usJ\r\nAdFle4Vh1iqaXAso4gFQrRUIpRQkKfi6jbfeZ7HFHJoaBGt1FSNjgjj9xYWm\r\n7vcMZiqwj1Vlz1LZYKdhXokvp3aaxOV6kBwiLzjboLdUtmaGgLnGhoP/xFrs\r\nnYxxMNLHkopENcoBEj1JNXRVAJUo/f44U99fOieDVBQ9dOfl8ERbAWaYJXlb\r\nBE3ykbpeeQ1wW0418+13DCgn0d7m+31atcLIg+ec5QHPZXdGvyTRGhp68003\r\nxVWiMxQGRlZ9bKULve4zR94TNZryXpccraG49Bdbh7GGNdSzSm+CixFEKeUJ\r\nRwRhnJUVmoAJkT/RqQkaEbNmO0w5PBBqxgcTZ7YXSos9eGfp4bKdmITzNGIK\r\nlKYHuw7X9r+GmextWp6UpWdqbZvOpQtIgRsPhx/0e6Z7t0DERiuSOrG/qBTH\r\noNvj7x5GIX8HAq6bXVg6dA7YQQUNTZUxIYI=\r\n=IELy\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230112195314-2fe095e.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/1db39454579bf5ab672daaad639bcb07/graphql-hive-client-0.22.0-alpha-20230112195314-2fe095e.tgz","_integrity":"sha512-lZE6w8I1ES9LQaVOrGvww2H6+u0OkguFmMZy0Rn6MiKBTFMTxfh7RwlIhz+9aexEnywh8zWXwtXqWh3AxWoTGA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230112195314-2fe095e_1673553232592_0.6943657508987262","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230112195525-3aeb4f7":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230112195525-3aeb4f7","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230112195525-3aeb4f7","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"26dc83f4c1fb203829e57c590b122ac41d7aa1fa","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230112195525-3aeb4f7.tgz","fileCount":60,"integrity":"sha512-tBuuVcBIXNfVmcPxpX9ZZ/aXafLALPZc+GcY9d/E48du3CtEUPvbK9N84L0IwhkKSEQDbwS1kJn40PDSXrPX5w==","signatures":[{"sig":"MEQCIFssJRiPlrAqgJeifx19ewe1MqJN5df47lEDOEfLg9KFAiBavEuOFEF0EFZUzQlKKUPK33+UE8dMDV8eG5Z4lkkJrQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwGXQACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqH+A/9GNWEAlAxufMX0R9yrQmhXQatSluZkS73bCuTG41D9qosFB1W\r\nRFd32F96wFBZFWGRAkxq3APh218vxU9T7fyhG/dOJ7yuzXlIAVp/w0t265Lw\r\naMYH1eystC4Dk7Sr/t9vkZr9Rc50Hzlwspn9MS0bF3jL+72rZrdYwfYtHT6Y\r\n0FnOaKXgg+To+qY6Huez4ljc3f590oVB+uZMYIRs3ASSDVS2IjBzDqpO02bR\r\nj6ACR3GjC86gdRLhw5Ec7NCXSayVWpr9sCOEyb9GGnSdqlsCrYbvPzfldyTp\r\nW3/uCJB7GtB2YoX4Nm7Ni5xIqijMhb5eK+54QayJf2b88oDbaR7rJ0+9gEdc\r\n0ZiiXLGQsROku/kK/oLM1odvX1A/hj9P9oVvHHmHrAdEFcCiAIJlESi/hI/k\r\nogBPtaYjc/FSrW/VcIHkh7aym+/ttGj2G6dL0dc+NiN4CgKZ7hl0R1FuUzal\r\n9flftPDTA5d+geiukauNu+b7Ts4ic3Vp4RBf0HVIu0f3StgZZcr7j7EfQ+KX\r\nl+JRgKar/CjprKB3O97VMKSUquLEKbJ8FMVmVA2ArZ6md7S38HM231XjHQlq\r\n9TpvLgT2Kh6OIU27wZIv3/iJnua695s2di+m+G46jz5Uymq1ZAvI1UzjFYut\r\nE+GGeEY53a0An2ZW7M0/daKsk8HGKOIaKgc=\r\n=8vfG\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230112195525-3aeb4f7.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/ea7e800244b85944bd6d4d1b5103fc73/graphql-hive-client-0.22.0-alpha-20230112195525-3aeb4f7.tgz","_integrity":"sha512-tBuuVcBIXNfVmcPxpX9ZZ/aXafLALPZc+GcY9d/E48du3CtEUPvbK9N84L0IwhkKSEQDbwS1kJn40PDSXrPX5w==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230112195525-3aeb4f7_1673553359858_0.21475930954814015","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230112212328-8dfc2e0":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230112212328-8dfc2e0","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230112212328-8dfc2e0","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"d806f64436cc77a36d62c50515fb31c6b7b33e0c","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230112212328-8dfc2e0.tgz","fileCount":60,"integrity":"sha512-i+QobzC2kL/Cu0HB8gjjT9ySUgDVpGPjKiB+CAmiG2wMwpIb72SK618rico2ueQxrgCLl9818Q3TYqiJEAWGGw==","signatures":[{"sig":"MEYCIQDeDpN/SNzx3iXWqpd6XWXVR+1Onx/8A15AAEu35oJeYwIhAOob2M2KpSpueYcCRdqDhtB/ugw9cH1LWId2kqDUuYUb","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwHp3ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrCqQ//Vp+qlZphe4Tkj3GtNDCmtSd8EaIoIm4SjslpgP+B9gkFwi4P\r\nEHbAvmbgLdZPOKkrL4YoDysJCWHh0uQw4j1P+5fw+ZMdcYJUNifyVfrm9jqj\r\n25oo9OnKFMsD3RVc/riKPSH59LR1nIB63xIm4LRYHFb1sfnSiQorb2A3n0wt\r\nDDwHR9/DYRMd6Th0xVnypFybLaYGfocZkjJ1iSrxbSf1+K/gO8qdk2p4U4oV\r\no7tcMlk4+O+Q7MkaYzR25IguFzRy/ptrirZ9ajIQ6fcT/VlrVjmshHr5o7s4\r\nS2lXZUdeoLMxx+Q4/n4ErzozqRX//P4bGhlxU3nZjX4Cg0bN8US6SIL2f5gZ\r\nMsuVf2mOg/JU/f9qgRQVoTRIs3ux3zNfjT7uPae2uk/y0p4NhlVFjAVS7w8O\r\nYTyTOFXI+iDGAkzeac5BIAalia3mXJh29E5rcCs3h/LeWJJcnHs8uNQW2hrg\r\nUXQi8PDN1Yx3jvrbKxBUkV+pDjUdYzfYF+b0/iyKpxuHKpGztRhDmfdqpUT/\r\noZsuRuD5b7b2EKdLAF806Pe4vYgcjKASYz8QOE+01WYyPBQzrz3uUOVfqly7\r\nMPFW8PSAYANtdjbY1K0s7ZJFm8FU7t05xSpw8oBkx9tGedoUOtz2vzjLBJCK\r\nuhlXZHDz18S4WDRfj45j3y0fID8NNVtUaNw=\r\n=hJgF\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230112212328-8dfc2e0.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/92448195638f4b4ea5f6ae03c378216f/graphql-hive-client-0.22.0-alpha-20230112212328-8dfc2e0.tgz","_integrity":"sha512-i+QobzC2kL/Cu0HB8gjjT9ySUgDVpGPjKiB+CAmiG2wMwpIb72SK618rico2ueQxrgCLl9818Q3TYqiJEAWGGw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230112212328-8dfc2e0_1673558647191_0.9098080167800124","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230112212852-16016b6":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230112212852-16016b6","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230112212852-16016b6","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"5012e8c0749b7a7fb06e6bdfc39adb682acc9730","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230112212852-16016b6.tgz","fileCount":60,"integrity":"sha512-ulWPTIFcrTlUaQBDtZCOvR7QYbaj/WJTTcbDfGPVPZXKDQhnT8Feas1sGh8FNyGpVtiRRx8IsfJ+nkEQRmTphQ==","signatures":[{"sig":"MEQCIGT0BT6FJ3pmEPbEiTksHcXsWTMwHyDa/QvWte3Gicr3AiAcwNYuI++LtNYymhFQ9QuQ3ls/9+Q0mwLZaJwD3e+Xaw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwHu4ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpQfQ/7BekwMaUDPYGSY4rg95qp+xIbqtWh/DRs23W74y15xHZISswm\r\nXZY5639ASHp2IUwtMTE+1SYz/VkDMjWIlAL5e8bi5690PTm8rC2VX7EZYBCV\r\nbW6cIMfgbdHnqKs8N95zo1+z3aGbbZpYSkTmPS8UvUlJD80nsK7s3FuTM5yP\r\nVQzr5PCNEZCjf4tOV7+pLhw1+kIUew2lwT98zBlBtTg3h8V0L1L+AxUKqXsR\r\n/68iUjBaSQn/wOaLsS2/Eu7+pdQMIFbIsjgNJhH39PwPBldaI0kmDsegDysS\r\nZ97nuw4ehHx5okZnI2+nCBDT9Y0uULYD3IyTeFUyxTsCMt4t2mqDnpSa3JjD\r\ntLgRMYpYJikDDAh7AGYfy2vFGGiWIvgk6pQdC91mYrlG3cHsnCWpWe1PmCaX\r\nbt82UXtIkYCx065gQmp6Dql45N8URRu6bJ0oGnMaAU30pQfcTqGdkLiDGtmw\r\n/2Avv/oUrCmp29uW+QlpS7FkZm0styW8vqvdsSj25kJwcM+P5ZChmDVVfCK1\r\nVUJZTiZsHp9Am8/NLfbUGr5gfiqToFTborxIEY6qVbenXsSLicVuOC8vT4GN\r\n7zaHfbZqZ7MZxmnDq1wisxRbRa7A0f1GwRRgk4leirjg/VD9aRy82DvN+zzr\r\nX+vQxJAVMPSMT3XDiC4JkTwReqnnnzIsLDo=\r\n=vaV5\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230112212852-16016b6.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/0cfbfe8ef57845e35073994f0dd4171b/graphql-hive-client-0.22.0-alpha-20230112212852-16016b6.tgz","_integrity":"sha512-ulWPTIFcrTlUaQBDtZCOvR7QYbaj/WJTTcbDfGPVPZXKDQhnT8Feas1sGh8FNyGpVtiRRx8IsfJ+nkEQRmTphQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230112212852-16016b6_1673558968302_0.9941269574670089","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230112212907-ac4dce2":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230112212907-ac4dce2","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230112212907-ac4dce2","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"f36ffb2ce8d8c08d45d4c23f2df26be6a591c868","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230112212907-ac4dce2.tgz","fileCount":60,"integrity":"sha512-YDJgNRpY4siw0UU72elUX7GNbq9U2TkbRFtNjlsC62my8/3PrkhdN4fIB0GHTBGJ1kjehcJ4BiD3SrwkY+H08A==","signatures":[{"sig":"MEYCIQCJ4ODE34z4P9sj/F/uIpkBtjsIhmWCx7gfky6ENXkVAgIhAPKtOziykHKMWir5nz//rDIC6d03HSxfxL8lCGf8S5eh","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwHvFACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmovihAAn+cCLFCMMoafkXJBfG3Y8yURtcKbe/BcVVn4LieivP/eussD\r\nkItBxY3o3QK1uQgecrb9Ln66ecOTp2NAVt+0ukaQA/6/eAayNzU4PJOSFTJv\r\noI1TMwLF8MIq4tcwa7fvRpSGFmmQ7dZxEUb7BlZhjQtNrUa1ouiX+ykrfzB/\r\n/ZOxLapv5C939nVEBGr15aQLWf/cCJQJowM+LKohAF/FOJ7mFRqjtpeD7HxE\r\n7fMMaq+BG13s1m/TRkRpnghdfgGlFcfSjQDXCjKgHBSIWqCgYclsW0oa1gxe\r\nLelrUbQVYCwIdu91RKQEQVTm5uBkXD2h13Z+VUpDbZPbNnfXUfVdHFsC/+0x\r\nILP4MLH8reIY1pQmHm4bqW3vVpMdFsFvfkImv8R783kRqceTDYfqZGjHQi/0\r\ny3lTIpqAuZ+bOeDW/VdV9C08koVzEyVaoRUvE2X4ATEY3N7jAYjugoUCWDn6\r\nB0flhLpDN0+4MMBlIU2fqVf7mleCMENa6Vm3YvOkrhWnAkNFyeXuAODCkOIo\r\n5uEXEMDnnqG4j45dp7QCF8/VnJPfU9P9eESu0lHIbWpEWooBn6f9CNmE/Z1I\r\nhsYDFDDWpcun67MTXtDn6H4J31wkVBmCUVFcwnyjCaoZpLz2CGP8MKPdtO3d\r\niw66Lpq4xrG4uSg0fzVs9kUFNGEqixjOpBY=\r\n=L+UF\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230112212907-ac4dce2.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/a556fc78e6ffbd23c90aa6af69c7df46/graphql-hive-client-0.22.0-alpha-20230112212907-ac4dce2.tgz","_integrity":"sha512-YDJgNRpY4siw0UU72elUX7GNbq9U2TkbRFtNjlsC62my8/3PrkhdN4fIB0GHTBGJ1kjehcJ4BiD3SrwkY+H08A==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230112212907-ac4dce2_1673558980767_0.18474475143025848","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230112212909-1e526b6":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230112212909-1e526b6","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230112212909-1e526b6","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"750c6d3f4e9dc588f7e62cfc56e8c39f107f6c76","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230112212909-1e526b6.tgz","fileCount":60,"integrity":"sha512-MH51ueI2nLaU9yvb7fmmbign0mk/UqSqIcn3hnrYdhooHETOqTqpBtCNrZfR9pP78YvbzvknUfKw/9NP2CVLDw==","signatures":[{"sig":"MEQCIDw9fG/bP/qp1qr2u4HOjCLPtVOHvhgouIFrE7d+IT1nAiBDgTXgwM+m1751arsA74H9Rp55MT8KTYmRGz7jFftRlQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwHvSACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoqnxAAhkvqiKG0fDhuWtmkPZhVpjDUtpFX2ycKUE06JF+EVyYU9vCP\r\npYgq9xl2nPR3KFDgYGC637/CRt/qZlsLU+UguuSgwL7b4KDrFTbE31xpDT1F\r\nqbBcNox4u35sbmyjcqqKjXFbue/qzA11AfVoMSSwAocbzpz3OQZ1wQwvLLND\r\nnNUA3gc2H6oYtaVQZfbv4hS54Pj4UGzPEpiDsE3eDRJinX0xlsYV58E+T3cu\r\nL9tDq1xEa7C9aiyfFFBA54zfBnt42qyeo8YN0tTEC5ry6M7jDwKWLfsCHBhl\r\nJ7BLGMvHAi7JD0YzHb8VI94JLoWOyoTKg9B9SrL7lTHoZVoxaTpdJ5+YaE4A\r\nwlYI5TL+mcoGljTFnMGQj6ZIaiL590EuFoekh+8beuYbpNzmBOAerkgg+d1x\r\n28yr0R/FiaoPq5bVscegfa43Xn1CTfrfFyEUIpCtxvEICOgOpH0hedgWn4ZK\r\nkW89OEVhNlWY9YRjwxSBlZ/9pgrJVQVQgizwWG+6vaColV++wudl9bQoI/0b\r\nnY9uUG7gGLXN/1rE+osCzHECHOz5A++S8QOP5vJ33YSJl+CNUMxEH6p9mlvG\r\nL3OajdF3CvMIhAGPTc/eHQ2eqJwvKSzC0Edb3j1r4lrzOz0Toghm2MKPViNs\r\nkyrExIR4so74kH9IBJ+GBhWtn9zOqQ6kZrc=\r\n=CDyx\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230112212909-1e526b6.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/7380365e768772a5941581001292e4c6/graphql-hive-client-0.22.0-alpha-20230112212909-1e526b6.tgz","_integrity":"sha512-MH51ueI2nLaU9yvb7fmmbign0mk/UqSqIcn3hnrYdhooHETOqTqpBtCNrZfR9pP78YvbzvknUfKw/9NP2CVLDw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230112212909-1e526b6_1673558994133_0.9192322578746808","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230112213411-7b6e2ea":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230112213411-7b6e2ea","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230112213411-7b6e2ea","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"21732eafc203aa561c1c13ad93785f78767b004c","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230112213411-7b6e2ea.tgz","fileCount":60,"integrity":"sha512-uZg9ZWzUdKTQU3hAxTAYLGu41OdkvBr/HWVAIJt6gMUwcx7ZkSRvp7WCWMWS7GC8ZoMuVjqBgzNl5ZnvNgU9jQ==","signatures":[{"sig":"MEQCIHbuT+Tuln5mMzwe3IDaK/c/ERqgdbcViddbnFLXY5mgAiACzBB4bCPqo4vl0gwq+gBj/YH+zBCvn9LDz+YahOTXZw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwHz1ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmrc0Q/+MnbHe9+wPpR5moI39xD/xMCripPXNFog/qCzeMKQU0xpXcv/\r\n0DMAl4zzr3tp4x2eGI0OUft3GEdWOBF58zVHybbYlk/BpGBZVBXTZrfsGmrU\r\ns4AYVxQC0dI+84wqs3x6YC6eAuhgrI9GhqLoPTUj4/ZoKs6ucRNI++mM+No9\r\nwpjIGv2nIurc/UIz2UjUHEFRUnBlb1vppGOlkk0QYYAsmdxAnlk9Q/hrtaVk\r\nNdbEpLREHMp0Rp5As6CvR4YHWIxVIy6RW0efBp3gXFZkXBLx3qZTpxPDHyRY\r\n8mz5fXD30FFck/dpnQUwIOduC8lCw1M9I5RP8m3Lj7IGFyHJEtPLgWBKp1Oe\r\nZhkvRrdt4PyN17ktBWwZi8HHsiM0szfmwtX1NkCANbHq5KI0UiISvf7CgCx8\r\nrPBr8j59O/QS2yKzQbns4aqiZxxdyHpCwDe/+eRaTcgzhT+g+yjyzoEEsr+X\r\nUlFzPX/dxoJf8M9zZ7CJKCWtKVZCWBv8hKRk940HiRCg+8GjWMTzj2y5ICng\r\nyLjE//XbxtSiliaBTVNHzumBXpDAl7mMhX4bfgdxLpIEnisEmwBEYbO2kdWK\r\niCK88tjnJfyfoLUcXurPZGCJMPv4wluFWGOOU2viUYabVGZGgOQKsxyPmCXP\r\nf7qgTASBadG+pwf4Wrj2xFjOp1DV2utTDA0=\r\n=ibP9\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230112213411-7b6e2ea.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/62014ab689a476af5be9335fc9b3a0bc/graphql-hive-client-0.22.0-alpha-20230112213411-7b6e2ea.tgz","_integrity":"sha512-uZg9ZWzUdKTQU3hAxTAYLGu41OdkvBr/HWVAIJt6gMUwcx7ZkSRvp7WCWMWS7GC8ZoMuVjqBgzNl5ZnvNgU9jQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230112213411-7b6e2ea_1673559285553_0.11960795326776008","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230112213851-ef0b7a0":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230112213851-ef0b7a0","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230112213851-ef0b7a0","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"85793b81af4f277066cc90477030bfa1135ff763","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230112213851-ef0b7a0.tgz","fileCount":60,"integrity":"sha512-AE0/+oUkc3QpNtn+F3Mh965dHy58TXaQQBWxLwS0TS8KIsuIaX3vt91ch5joUcjjfVyll5NLWGbUofXJoBnPdA==","signatures":[{"sig":"MEYCIQDOPbVFQNrxJJZsqdFC4H+IHAuQXKHfvfWSj02Gcs1Q/wIhALYJ4Pk7J1aLEWjVbRdfZyQGmuGlL2yWOKb7NvwIzD/u","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwH4QACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo2vA/8DhLgSB6rDiA6QFUwNJsseKPJ6L0C4Y8Dd4Rfe0KV0vDMA88J\r\nFUyYuIiDnytQmSEwO8HS9QDiUIB85ClYZBka//8+kOV6fzoyzhmobEWpKLGP\r\nTyeMmol/QjRUg9aNNotVPefS5HJ4kgVDB5+/IMVsoRBQ8Wzn773f+/luy/1c\r\n2MEql4tZrNDbPgaKcnTmdrBvjiou5j5RvVuSczu6seMZsQ1Bl7MsmV0YRf3q\r\nJbXxudqkSO5bYkPkphMsbP7gSXs47tiD2RCtdufrXHt7hGAiN93yx7g7YZfN\r\nf2lb3Gts6yzJDTbbds2jfTQPp0OYsXU5OI+hxujC6LlTjFEqXPWUabOFSLt7\r\nQAmRPmDfOrZv7LZRTouv9tkFtFqdRmodd7hoEb0tlAb6yN+9bRObMq1hc+xk\r\ndgJJO/rvM12v/trTpOyitblGN+v7zOTzVXyPdnajq5AEgByuT5TSLgpNFUMR\r\n+XanlcXur5WWszOo3mdFWyph8B0XF6kYvVfJwyLwXcA7xBt70XQnjCcFhwgA\r\nxpVPTGMxnZTy8OQE5Uytb5aA+fawc9N0n6udW3BdftxkhXtq+FwLQXNL4JE/\r\niP9S1jazTFhh8szEd1BjhQGtqGxeAnCwwzWv0Jb8B7U7Yj7i1XD5oOcorcgF\r\neXo/o7GgdG+K2X3conzzCd3VWwQg7Oa7WUI=\r\n=l4pW\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230112213851-ef0b7a0.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/590a7ed29933672065997aab9981cf56/graphql-hive-client-0.22.0-alpha-20230112213851-ef0b7a0.tgz","_integrity":"sha512-AE0/+oUkc3QpNtn+F3Mh965dHy58TXaQQBWxLwS0TS8KIsuIaX3vt91ch5joUcjjfVyll5NLWGbUofXJoBnPdA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230112213851-ef0b7a0_1673559568361_0.0920835522280945","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230112214101-789c5fc":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230112214101-789c5fc","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230112214101-789c5fc","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"bf9141a7c662fafe981cd6a4b2f7dfcf4988015a","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230112214101-789c5fc.tgz","fileCount":60,"integrity":"sha512-syvWce5F8EgUJOW0nhPbTcC3srI2r7cV0PCMINCF0FtRcIiM5MUg3j3y2xx+bBMzRylHkwLiSuuPoaO6YdVBxQ==","signatures":[{"sig":"MEUCIDcBVaE+sPjyQJKEX5c/Pn8P5g0zQqDreO4bVSs653UnAiEA0EDf48dYrrOPtFFCPMk8Px4BHiZY/scAnI8mazbDuDs=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwH6RACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoP1A//TtUlE9Vrc5vjZzWfSIW85cUx4mKcg5xZNZUdYkEkBYPdZOgG\r\npy2t26lVio+SE/GN+lPPtwmxDCsS7YYYCkUaDPEAs1rTIw26w75mCZQF1hLb\r\nuVgrNAAh5MMARJ2YYyMyIUU+7yCv0mrY2amT93bjgP85r8zK3dfbPW/o9y1w\r\nYErAuin2TD3erXWGgWG/qzGvFznU7bvUHZYQ/LFk9B7XrYiZvT2EXuohUQQp\r\nDwdgG+KF8nqvA/GL9zHD9IKv/9wViL8SL6jR+Mj/tsQoQOPaNPIgc2qcIbWX\r\nTNMXSOZBdzDLJo3GyOP3vAI8QoBBImelV3+BwlQNGk4Pz5y1ZiLRP5HtoUAm\r\n988qhVSnIvUsM3FyXTIGdlGefk1VRwnL3t+9gvqBT4mgdGLRDgNIauCAeMNq\r\nOCqkWPpsfBJ0J0gFP1EKYjti2BYmR5bueXHr7nREQOvruscVnpU72xH1n9Cx\r\n1T2yERzTbsNYU3He96XhGKioWxqnd1n94nTCdQmb/l78+4FrZme8vRvce73N\r\npRU4stzLI4iqDs2HumGBDIar1cnMUgf9Qw4QRoGtMPmdKbdAzB+DE8aEe4nC\r\n+ayGH5okMbF7yR2vndxVvkWuPv6rsgo0HD082sjYR8EvLVIUPzhivb4id0zI\r\n564B3cK7T2GBryITSANiLej3n1Gn0OzqaNg=\r\n=Z0R1\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230112214101-789c5fc.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/a292448dc0b450d7d3609e79a920abaf/graphql-hive-client-0.22.0-alpha-20230112214101-789c5fc.tgz","_integrity":"sha512-syvWce5F8EgUJOW0nhPbTcC3srI2r7cV0PCMINCF0FtRcIiM5MUg3j3y2xx+bBMzRylHkwLiSuuPoaO6YdVBxQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230112214101-789c5fc_1673559697238_0.9607648588837856","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230112215153-930a486":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230112215153-930a486","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230112215153-930a486","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"58b707d969ca0c1328d8e46d200c60129410119b","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230112215153-930a486.tgz","fileCount":60,"integrity":"sha512-fpf240SaYGmGEaYVDBbUOVguJcQAjf39etIDhflO/SLW+sTwTB16rjzzUVixzMr1VagUG5Se891cFwQCiVQ+tw==","signatures":[{"sig":"MEQCIAcXvst368yjgPNzh44pRNRaZYxKyqbFiIfFh3oq+V1LAiA5z/fxagnmD+W84JhPvrJpOVExssX6WMt4i+I0SYoZEA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwIEdACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp9kA/+J0V5RebL3kjXYkbTdwyLG9A5+dBvSOtVS8uQRoY8FDPEFAvh\r\ns+HtELqVcYSHlfZ/J5/tJd0KgnfyoOFg19irhDU1zXWMod4B4dgk/aIS4SKu\r\nP6QeEu/y4DI0RyjRV8THW+SbrDeIz1CmZRuiQaY5AjqYS1JdS55AGF/xtSd7\r\ngA6Zjemfy2Yd9TFAuZPoj9+YLWWM0IWP0h0e8rtlZ4/Xx+6VTWIBSToMnFI+\r\nf7hBku5jfxVmmv/R8O/tWm+5yL3D9QumsPQhcVM0Msre1hW15c3WdEAb+QaQ\r\nrScKJi2Q8dIBphYOI3ENbG8lFokvDuLLbZzJ74HGtOQzbLUQsaen+HYSLObf\r\nYfHt9ynWuLnkUaCoQJ8WmH/hubNvi4/UVSKglSGipEkQYT6N6ySemZAMPAVV\r\npF0jrRLKN8BWWnIzkohgQ0YvimeVFfm9bFTi4bmaXNu/oty2xcyTDFgZILks\r\nhlCTHdchcwtsvdxEEQb5NEl8TGflbWtT/ertWJkO0dYeJSbT7ejsfgTo0RC/\r\nyVUDc00AKZwGxNuIxhiFG1ZhyYNNSTcO9JmDWpVIrBnCerOFWm1FcESIjQHM\r\nZA/l+WNaf1IfcxXTogggcLhKooLb5twurKArHJIL6q9Rqa0lo8GNiSaB/ppY\r\nUmTm3retvQsBe+EtPxuCjXX75SdBTcdYsH4=\r\n=inOF\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230112215153-930a486.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/21be1378bb64ef3a413d015272f9253c/graphql-hive-client-0.22.0-alpha-20230112215153-930a486.tgz","_integrity":"sha512-fpf240SaYGmGEaYVDBbUOVguJcQAjf39etIDhflO/SLW+sTwTB16rjzzUVixzMr1VagUG5Se891cFwQCiVQ+tw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230112215153-930a486_1673560349597_0.8576299372889784","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230112215224-f48aa51":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230112215224-f48aa51","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230112215224-f48aa51","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"5afa8fa448092dfa5ef5c371d3352941e07bb277","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230112215224-f48aa51.tgz","fileCount":60,"integrity":"sha512-9GhULkEKvfDQG98wmJFIKHCXqMe4SYRSybXQkb7VgNWkLb0K+P9ZDGqhYuXYYiTWJSoukAKvR/4KXGe26JH6gg==","signatures":[{"sig":"MEUCIQClbn2h8V2bSbhPwkcmeRYRAt0AM5unMVK8cLx4H6I+tAIgAKNOyNUm/IrPKhyn62YUR6ktQR2iVzSRTaUDBdMviLU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwIFBACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqwhQ//bVs7i72jxkgtAKDVhzKGHoMy00/BNNL+JbE3EIrx+zBwjkUG\r\nJUGqX0T0zoQF8nCp6haKLb/KqnsuhldcQZPL4EndhIIxRzaL8AOIH/imXzjm\r\nAw5fXLlY/f4YM75eUg5UposkG3/f6PdhvXcwbViWeEuzHvEqd6MGz4nMQ5fb\r\nqVeuX6FosdJz0GHYEe1iAFebAr52kSW1Z5Rm/qtPfLlEjBdfr7KQT502x/iw\r\njc/wxuCqzGhODg5phV+YtqoWNNkx6v6wWpm6C97oCBHNLNFaSbQ+h/U565hD\r\nNr+LhVbB5BAFGQyriqz4J9i/03EtUpkd07pdWw3fY3q2ASevBOnJfc3FMAjs\r\nis4XSYhRCpZ0JB8QObY8Rh81Jy2FKncYvwUBPg9kwRhGpiS8LuEJow1ROS8D\r\nEv8TAhkutygi1z1EPNjWCMqEQowyRpTA80+DrkPkPEYV064iH0gv0yIVUC8D\r\nEIc15asQFLA553HtBEaIfYOO3Y8+wAgBfi/zHk0cAVPWiuJdAY4wpKHUU2tN\r\nDgc9VIoX38Vy7Fuz7bqdTgKsMQ8/fNLvZMgKOZb8blHbu1i2CJ0Ksp0mpvQF\r\n7kJOXqZY80jYlY0n11lqaplp6/hmdAo/c8CzNrkTHb7ITQOXorwk9fQUF6b2\r\neYfTFrZk5reykVDmypl82wlUPvrE7aLuDlk=\r\n=9cFA\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230112215224-f48aa51.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/6710716a8cec23a88ecaa8eca6c4ff68/graphql-hive-client-0.22.0-alpha-20230112215224-f48aa51.tgz","_integrity":"sha512-9GhULkEKvfDQG98wmJFIKHCXqMe4SYRSybXQkb7VgNWkLb0K+P9ZDGqhYuXYYiTWJSoukAKvR/4KXGe26JH6gg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230112215224-f48aa51_1673560385059_0.4462657255415814","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230112215739-8c7cca4":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230112215739-8c7cca4","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230112215739-8c7cca4","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"7080efe4fc772fe24601298d5d7db88512c51832","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230112215739-8c7cca4.tgz","fileCount":60,"integrity":"sha512-GDjpmtRHUzUls9r9lvCdaWsORgZ8fthX4MNm/tZSSkjB7euxAWSc02AW3fsX4LA0+lZPDdoi9FO+OuNTPqNjng==","signatures":[{"sig":"MEUCIGtBb53Y1fbXkkZ9kajUVCtC0NOc+Y1sJCKXNV9/lhW2AiEA3cRF6IBsMmgh/47nOPR7gTzifJQzUz4W/gaBROS+9+Y=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwIJ4ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo1zA/+KQ2few4Y+qDE2FijtRCakbZuJcOqRTMIAa70KfSrvb35q+Si\r\nErNBVLS6tZsnF8+xii4O4dFtqvtpqNZAhIamdU1sV66AQDPjqocN4YslYzKV\r\n6k7NQKa4as51MtJQN7Iq6jj4XavXW4+O1izL0JJWE+1n5xv100+S7+qokSG2\r\niB9uGtWLEn/XPJu2BznYmj4U0iXCC7YqFoJHUI4qS64hcF6CnYBsTNKIe1Hw\r\nUrr7cGrBnCNBKjM3+nGAlt4L6FmN/6z4Q8areWY2S+X4FpAbgV/I6EmZ4/Ow\r\nQlJq+y1TGEEnNoRAZZWfBavHM3wjOxYEvq7NgQPaIdVLiVog0GMsjuh8rYoQ\r\nqG+pl9z7ziBdNZ8jiMpx4WZumI9l6P1UfA9zI+Z42W1KHRCnDqcLDv0drjx3\r\nnGD3bzTKVh9IqEQ3GYL4dfnDsJyUY14t03P5DvO4n6flAPUFZ35jeQx8WcfX\r\ngBD36mKICwVX4k8BUzSGL08mXuKvrpyVT9LAgtU3oBlgL+RyxT3B+c8j30dY\r\ngG+0gKgpaI/ZsKyLk63+TEXHp39RDvWUEhP/kSXxtxHTnEE4voWgaShUyENQ\r\nAKHTN582IBM0OTBwzOVo7cSjiHauok8FPjgzIcrOXIPZfYnRN4yQQw0t3x/R\r\nwtKlX4XxGObt8EPiopKFwiYBF7m5IgO1jJs=\r\n=4z/K\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230112215739-8c7cca4.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/58fbd1beee9301781cced89f70631cdc/graphql-hive-client-0.22.0-alpha-20230112215739-8c7cca4.tgz","_integrity":"sha512-GDjpmtRHUzUls9r9lvCdaWsORgZ8fthX4MNm/tZSSkjB7euxAWSc02AW3fsX4LA0+lZPDdoi9FO+OuNTPqNjng==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230112215739-8c7cca4_1673560695738_0.2088109929219062","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230112220242-350827c":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230112220242-350827c","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230112220242-350827c","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"448d3b56cc10d7b7d6ae2a5f0a1d0afffd085d6d","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230112220242-350827c.tgz","fileCount":60,"integrity":"sha512-5Vj/JUnTtLhISk+ZeBQafvxo0aPUUjV41ewP/wH9GMt33JeJEJTc5YR+r8MR3WXkBjF/rnOnAz5YMH5JHmg6CQ==","signatures":[{"sig":"MEQCIANj8qHuLQOByg/vIPcfbljH+VbfcBlmsIC8XchbQJa8AiB6xOg51UzGUDs+iVMI9NnpV3tFWDuM+a3+uv2EtiG1mw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169643,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwIOlACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqWsg//ZFOGTYghNVWEFFH5ThRSDum4GVML5PGWtVQvGeLYp6MAQF8t\r\nZ69XyMWpoQAjhjLPoHH4BcBRVkj2ZLgjQ0nET8nzKDu3cjDMS1IarilCmcLi\r\nYzWlnfes+7VWeP0LBSNNBlSptZSeoLpaBxc6839CY8KFj5btmRUq2O5JBt5M\r\nzO4nh2ABXFNU0Tcteve8Tn+aYQm7DIC9nlzOLyspg0rcDErrrWSSK7bXy41Y\r\n1eLr4o0ILyAATlDJK8NNNIe6XgURzFv+b6IN8ZfzDGjODrCy0tEDNGYBCjEa\r\n2tXQvLnuA26NVcwq3VxFJzbsqH1G4A2WvsAnoYzFvEUX2jwdn+cdxIJd/XVM\r\n4zU9mlAxVcRloKhA2GM2KKmGS2hJsyq3WLAfVcnG4edfh2qwI32SB09yHlUh\r\nb6wqyjwTeEhULTH9LE2gIcBAhLz1l/06+eF3KIXDD8fkes0hjw1ZUevsIu4n\r\nOO2P7juD7IBJJVN5pN1SVklLoLBsLvtZS/RzSmaibn+UothEpSUrRjKjVqRs\r\niZRULIhnw4z09zZf1ksnLHVGbrdb8wvpu3Ml0veUQnvwcSA8jbrqUdyHu5bu\r\nc+4457GCChleKyNmrbRDckwKGkUmco/U9JyvNef7R6rK++eiVT7LbXhz/fkr\r\ngxtNSOSFnXdB3xtJPtBH0p8SLYsN9Hz3ZYg=\r\n=Wj+g\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230112220242-350827c.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/0fcaa41cb8eb9df64ffb16691c44a758/graphql-hive-client-0.22.0-alpha-20230112220242-350827c.tgz","_integrity":"sha512-5Vj/JUnTtLhISk+ZeBQafvxo0aPUUjV41ewP/wH9GMt33JeJEJTc5YR+r8MR3WXkBjF/rnOnAz5YMH5JHmg6CQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^9.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230112220242-350827c_1673560997169_0.8598847782126602","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230112220805-84cf3b6":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230112220805-84cf3b6","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230112220805-84cf3b6","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"7b75d1fa19775477aba73527944f620bc0331016","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230112220805-84cf3b6.tgz","fileCount":60,"integrity":"sha512-irLtL+3kOKoumy2PazKaDhsCuamw2TsqT5CnURbOIQJqydvtxtfkoObQS6pTAxnaJNMNOaKEt8/MrpX4ToQfoQ==","signatures":[{"sig":"MEQCID46bbipLON15S3z40NlKbMvIsQfOsNpJjxDATMV3J6pAiBmbKmb4bFIerCAebZ6qniE1Wr9LqlG35Pqk7S4CaxQoA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwITvACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqJ+A//WJd3YbQ45PunHjvBNoqHZdPH+T8oK5e1pnvA7/Clx3JbJ8+y\r\nQELpBjLsn6SIV2ZMjkcErLfTl+zdWyC3U4x9war4d/s2Mgnyx2isHZp/nhkO\r\nN+rnlLfly6pDwQWuBWrkyibVGwDJbX6kbWwNEsnVtANWDT5dAXfxm7ikuQpL\r\nhVNZfWeyF2mH4vxJbIy4RxP16faIqxFa7fsDg9W1ewbbMh+WXUZfIG56pqPd\r\nZP/NIDdq0IH+lqBlXxoREftPe+ieQ5mrszH60KKYLWo/ktgjj3E53ZmHEezP\r\nB9D7LNfFClqWJwVqrKzqb7BXxR8LxiuwOO6JXW+MVVpaSrB/1O7NbNhzSIgv\r\ndT4SerXnsxx/iN5UzshUZG25/vjweWNE62VWKeAvYDjOg7L6S+bjpJIM9Wlx\r\n5NwzRoUBKC7dooGdf/QvQymH5WqiND0PCCrIsdLL0h4eGakwewRwwcPQtszH\r\ndR0kqCYPDv0DVebRT8Kodb5EaYnn2zJ0pJ1SN38LwIjxAtQU8qwOQObfVrix\r\nsCVXyQ6Rf9zqAEHqePSeeBZvyqDcxdj6ehh70IoqZVYaD8i+Sq0TzSzOjZT4\r\n7kKaL0iKUzm4zqzgOTsqopDMFXKeWztd18ihwVqdBXPWi12RN0mwQU6mjBBb\r\naxn7pB9tYUNYIW2ww9eY+VgqkxAt09AxR2M=\r\n=dSii\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230112220805-84cf3b6.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/5260acd6d50bd17474583ea6c2d7371c/graphql-hive-client-0.22.0-alpha-20230112220805-84cf3b6.tgz","_integrity":"sha512-irLtL+3kOKoumy2PazKaDhsCuamw2TsqT5CnURbOIQJqydvtxtfkoObQS6pTAxnaJNMNOaKEt8/MrpX4ToQfoQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230112220805-84cf3b6_1673561326775_0.22838130055464445","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230113012721-470e2c6":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230113012721-470e2c6","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230113012721-470e2c6","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"dd9d88e9afdbe55dd7094f30da54eab32d1de925","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230113012721-470e2c6.tgz","fileCount":60,"integrity":"sha512-xw0ol+HlfFo0CHHZO4nV3VFOXDF1r79TUkvyEYH6TtzxX6L5C+uumiZ+hKgn++2FuqMb6QMgECPRm+mLazQohQ==","signatures":[{"sig":"MEUCIQDQoUWFsRhxOwm+6HqZ3p1dUn8P2eqp7nb/+rWNh6WJRQIgU3VPPcJnfV/JZXwaZRvJo/2ESehR8sMp76dhMA9KHgo=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwLOkACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoOkBAAnh84/O1vs1f4/2BIwTf9X6hIILN29w4VeFpfkPT9MSzVntP+\r\nfnHn2T/r7X0FoxqaBv24hRGQejANs0uNVZ5/nrcYa7q4fa+UcE+qLLphr0mX\r\nuD2UWbjLaNYjLA1HR5/0SY6D+yjveyaBmhMlkvn/VPCi5U51mmpLq8ZGRCOV\r\nLwB80zTRx+0n1+sEVhhQr6IPjTkmxU8hvDBjpD/t8szzBnogfxCNneR/qgrC\r\nCQMNNlz0BWh6JfBO7ajKRRScpROiV/QPzHQlIMhi4+NbUMSADsd0SwVU7oxW\r\n0/Di2m5kNqM2g1JZsgScnD5b2aM2rmWrB4FpXS/ois2OeMN0a9VpVj4K2gBs\r\ntaZmmJ0gnIlghd+IkmSf/bRzH8NrcFhYrcLUwnmtiCCgItusyLRrt6xbrict\r\nyMn1Rh0sm37Ac2WC9sFQah9Ues7Zz2zEzAwwlr4BY3SKW6kq9YHTDo70IrQz\r\nlvRw7atYR5aq+7X0YFgxm9IkknF0RgPp7R6tEer7GjkGb3y10Yts172OPzIQ\r\nObCxAiiJUiiWRJhW2mVYLVCcRif8U0ddtC5B8jzhAthBhZA3tUU7Y12ZcX1a\r\nHtWtfkvQxVX0qoY+Pl6aEvd+Kmb1DOfw0B7/9eHRM5cr712sms3LO7AWTQ4k\r\nABuZ/UqLvWDiq0L5qA/L5ydR0CPaQZAsjkw=\r\n=PyUD\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230113012721-470e2c6.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/205c6e56f1500c14abde7be59e7b9699/graphql-hive-client-0.22.0-alpha-20230113012721-470e2c6.tgz","_integrity":"sha512-xw0ol+HlfFo0CHHZO4nV3VFOXDF1r79TUkvyEYH6TtzxX6L5C+uumiZ+hKgn++2FuqMb6QMgECPRm+mLazQohQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230113012721-470e2c6_1673573284647_0.29537307917938094","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230113013301-bc96c4c":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230113013301-bc96c4c","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230113013301-bc96c4c","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"efd7703bd50d434662f7f7dd5404a2e61126e1f9","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230113013301-bc96c4c.tgz","fileCount":60,"integrity":"sha512-sS3LRzjy7Rkbju87Uvqed/6tEDJ4CrKhjnvvbBCWA06tWqg1Mh/jKoy77ARmPGBMA4nvzI1qFQgFEK6q7fbZTA==","signatures":[{"sig":"MEQCIEZHGZsznU4S5/c3a1+xKdZYXXBIdbNfLGj1MC8gsOw0AiA81YbHpceWYld1qM7rxM+0LLUlIt5gMmu1+dRPaIL74g==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwLTxACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmot8w/+MixsznnvbHGgMiNCHR7pMfK1VgQ8Ec57l69HJPZczqR8SuGR\r\nVVe5A9L9ws1xbiELRp6ROU6zZYpVuNoROEKe60+HYMNbaXpD3b+tVVa6J6mo\r\nXi720mGBvVBN+k17CWfdu2QwXKcf0YKfKGZWzxYD1HoEXxZ3HRzFKWLT8uuZ\r\nPkSqE2eEyt/rBlzjg0e6/JJXU30PdIGCJH67oFFPmEzD+E9OrMxTFGDwOR5F\r\nL672rIA4aMNxY+OmW7TeERrpphAKKkoEhBb0cS4hne+gN63AxAcdUUJQPMX8\r\nbvK36eiI5e8qQpNchWCuTxZb9Cib76VYZ/lc4qnEZfjffUQzXLFozQdIFDhr\r\nGi9wd9JLNq8KnvjFg9+PNQJqRtSeFV8WVd6gi7FmHR75Wnvv60GhtnpgSf/k\r\ndIlTzwBfWvKGDGZmkc6qOzknygj6xi39jQb+mEWMyFxi7QmBcftVjzd1kQbp\r\nF2B1mnnBfsC8+/nwlOiHJsxvrp9ifNPFR66szWGKsBQPVAcg/BY1KKyS+lJl\r\nLEBVxG1rFJVXk4ocXk1eWqVvxoVdsl5Z/NzS04liEDDIOxhBx0N+70NvQt/w\r\nheMlfXVF9trThrXT+Fhdyf7dC+1P0AwqmpAabULguH+rjx8moOi5rq8kZHTC\r\naZRslZM/C7BBmhc+VcGGGaFzQOpAOrVwZoo=\r\n=k9Yv\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230113013301-bc96c4c.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/5abdd95105929edad57e04214522c9fd/graphql-hive-client-0.22.0-alpha-20230113013301-bc96c4c.tgz","_integrity":"sha512-sS3LRzjy7Rkbju87Uvqed/6tEDJ4CrKhjnvvbBCWA06tWqg1Mh/jKoy77ARmPGBMA4nvzI1qFQgFEK6q7fbZTA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230113013301-bc96c4c_1673573617164_0.29552756754131426","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230113013855-ad7eecb":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230113013855-ad7eecb","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230113013855-ad7eecb","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"8471b1c0cd5e1afd2253f3677bff6ab3fc94d243","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230113013855-ad7eecb.tgz","fileCount":60,"integrity":"sha512-gCX0BbS/i7jt4Cru4irSuMPtlqwMGEjIfr4hOD4yLwSWRG9tIJW1xubVaWpLJQv4ETXFH4uPEZWlC6hyx8KmPw==","signatures":[{"sig":"MEYCIQDimOKWg6vAVpEVb4w9u7iO1AxRwB5UnBjKcpt7ZhHVGgIhAIqnnnn6KH/UsoC+UCY+iyltfqzrQBep+kQsGiGGmcf8","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwLZSACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqJDw//YPdNLfQ28eGD3a0hUL+EzMo74VkS/zd/HVIBwbZ/g0/2TLVw\r\nVwJg/ks3cRlPVYNFNF1k4WJPGlKsBJX6694PDUnkgl+jjNsOEYVo0032pP3F\r\ntqsYbogPHspmtDQ9EhkSdnvLJSjvLOsSQpJB1NtG7fAkn8NrLApyQAGyJuGl\r\n0TmCOCr9tsm+zCrsQPOGe0s4P39sHTkprMh36eq7/wohuTdhtL2aVpK/IPt5\r\ntr6VebQWO3F3eGmG9Y6di6ZZ6mtkTOCjN15ia1kynCh32LlAi++/ILKSdFm3\r\n47NOxv0dBBpd930bCeD+GFSSi24uHqkf0rWIcsPrV5Y/5QmyTw5r7Ou1Ygj3\r\n5zM1IskKUErnY5fY1ejKUFXWcrUk43Dp//9R8zz4QgSj9V66SwpTtxy9TKKm\r\nl3aKMe52V74iRsLrlNlmE8FBrpZhhYfHJ4liBvxTxzSL7vOGfX/kkw1KO2bU\r\nuXaCy9gJW4CF6zrH63H322dS61VRW7FwB/KAzQEq534OpIuj+bezfblVUK9r\r\nTrcm5GoODD3/OkUnVxaKH/EEhjRGO9rOXX4JRPhoZxW27ayjx9sTC02MBASF\r\nYDZLsxP/jSpG+bNgkRaelzpBv6zbvrVxDHQf+MlxpflTXKMHvIOfounWvMF/\r\n5RHJfFLKtLnL4uPgEhGyjXC2cDmzp44niq4=\r\n=ODnC\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230113013855-ad7eecb.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/82aa7b15af193389050f5f8a91579136/graphql-hive-client-0.22.0-alpha-20230113013855-ad7eecb.tgz","_integrity":"sha512-gCX0BbS/i7jt4Cru4irSuMPtlqwMGEjIfr4hOD4yLwSWRG9tIJW1xubVaWpLJQv4ETXFH4uPEZWlC6hyx8KmPw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230113013855-ad7eecb_1673573970335_0.6035473955711992","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230113014454-fe0075c":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230113014454-fe0075c","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230113014454-fe0075c","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"2bc4454b3b56bdf0ceb3aac466c4508032dbb8f1","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230113014454-fe0075c.tgz","fileCount":60,"integrity":"sha512-KLeccWAXcg94DTJHVP8AG09rybina6lB0MNfO1oN+R8hdlngTjZaAwu3wpRb31sPHolIhgWC4LxDCQcKxj+Ttg==","signatures":[{"sig":"MEYCIQCrhm2LCwYKsL7tC2uETMR/kOJGMVyB23Ha4lTViJSsmQIhAIhvy7XwGh4HeiwIAffsS+SvPKGUJvUIzt/01l/g5Lgl","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwLe/ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmrs0Q//Wdfim8Iihgwp+nr+MvQXfg69IUR9tRfEb8BrTXlcY7E+qTpV\r\nCjsHGiPcDUPcbDaiN/cJa/WXKGfHSfOm0QdrqdQM8NmsUasJ17/Bw+br+eWQ\r\nTQgvSy3eUFPzBdX7oxMokc4NLpwWsn39dR0GnYtujsDP6OcaGjNQT7PLv9hS\r\n9RtJMzdn8DZ1yjgG1OiQjtSdISlVHyZ5DKOYWf5980LN39WStSzfgUgR0++Z\r\naaJ5ScKywmYbNa5dzepmXWm5oGRmi0BpZ6KQTN5gClTfwBKwf4lQUfs5Vszq\r\n+JNRd7qqNlf/rnzdQn8tc5vbSS4jTsz2PbMn3TzlTPSkoYVlEpC4U28a4Agx\r\nD7xFOo0+lgpoMfJrfPL8XAhCMZAEyeoP8DcLFf8MOslohfunSAuu45diF4jL\r\nvdCYu/8nG9IQ7RcUpw3hC8xRlyHgCkpaFyXn4vtQUABTMCA9tWuNnbpxXLMc\r\n40EFEkaSRjn6Y9gNWw+8/OaJBvyRYzCkJ9aO6YJQMfcKJT50B0efU6hpuAzJ\r\nT3hkTWjOkFN36n925VkQGS/fx4UCMLaefc95vS2Lu1ZoVqJXHieaDSkYBYHm\r\nSzatwQZXQ+SciP99Zqo5F0qHTMHjDqbU0yulP1b7hJ9qpydDtrLDGgqVbj8M\r\ngp0dFPJhHKgi7Vsrb8dKcOoYLiccGNw3L+o=\r\n=H61B\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230113014454-fe0075c.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/d50926bf770b10099cd4967a0c4244b6/graphql-hive-client-0.22.0-alpha-20230113014454-fe0075c.tgz","_integrity":"sha512-KLeccWAXcg94DTJHVP8AG09rybina6lB0MNfO1oN+R8hdlngTjZaAwu3wpRb31sPHolIhgWC4LxDCQcKxj+Ttg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230113014454-fe0075c_1673574335233_0.8999529336940748","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230113015659-06b70ef":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230113015659-06b70ef","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230113015659-06b70ef","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"767abe21cee3c8f58c78c8453d71e66d4afe348f","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230113015659-06b70ef.tgz","fileCount":60,"integrity":"sha512-3eRqfenEuwxQOZm3o10VJnPaQIJNGTXN+uVBiJH15QyJAxcjIwqe/sYZ+ReNCrNAYOjoymvayXG6nsWbssbZpg==","signatures":[{"sig":"MEQCICNoicvD18CfAf4Um+bRpQG9OTZ9igqaamFBXrxWfCeSAiAk0/Pxgpk/MafVYMgnX+vAKaNhcG63oFp0tO2lAuRDzA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwLqbACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrooBAAiMFuzEPQb74IybaQjXu/RolcaeM+txkDb3SaztR6wRVQjNGj\r\nF+gaS4DS4qvBybN+l4tfnMABngr1nam2v9y/ZvZNdvt1URfhul0gFIgvAV2L\r\nEGUslk7pr7cWCnbjEXqzRuRWIne64jsveSh1oHwogSfT2uyx42A15qkI9oPi\r\nBJXWKisnJj4uRqyLBj9NHBbLBgVyjWivNc5apyEg5rosgT968RSjr06/gbOe\r\nYcQRJrp3sbuNNTKgtD70wKgu+jAEvl5/1ykYF0ag+LcIqQJ7b8krkYnSIyQK\r\nZQyNzexpq/laXUIEqDPgIoKuCQaWXnls0uWcO6Q21qUNlSQdMWyDMozyqTKD\r\n9smJy7puySqFpHa30fduY+qasjhDoLNQYMCvZdnGPOldd02Be52tNhGyvOZK\r\nhSymPGvdLWH2m16g/+mOWMD9sgNy82/0C5pW+iCz01uinZAAKbFs1+7Uc0ma\r\nX/VCjpiCfG7++hVz1Xla8YEg2GCG4k+UbATRCbHiuqjx+sSN6keTE5B2TuaN\r\n75qC/V+zVhpJlqL16HYeP1Kmok/7Az9HwfCmyRswgwr8yodCB32hrwgZKC7w\r\nPvw3ZZrEZXYpqLsa2wD3c7RdxvLdE+BC9cDV0xiGpWuDGgz3Xq/TqKbdlSYU\r\nZaLb83YJCWMydan1pxx6zAkkXB078fR2MOU=\r\n=5g8/\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230113015659-06b70ef.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/a8029196e0bc54443fc7ceb03af04b11/graphql-hive-client-0.22.0-alpha-20230113015659-06b70ef.tgz","_integrity":"sha512-3eRqfenEuwxQOZm3o10VJnPaQIJNGTXN+uVBiJH15QyJAxcjIwqe/sYZ+ReNCrNAYOjoymvayXG6nsWbssbZpg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230113015659-06b70ef_1673575066948_0.31704802204744187","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230113020147-1dd8e28":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230113020147-1dd8e28","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230113020147-1dd8e28","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"339e0039f305369b715fc3a57be9a6e3c6a5dd26","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230113020147-1dd8e28.tgz","fileCount":60,"integrity":"sha512-awIEDiW++SRtqvI/MsAriZWMYzCklL/hkcS1RQX9TCH/dZ1KkzWYTkIxPK+VFw/Iua0Es/DBwLRJfxuSsvx5uw==","signatures":[{"sig":"MEQCIHbf+3MkPqtAmshwa92AbawynQ5ys9z1zC6d/EMwhv+VAiBhgMe8zl1TbWyPrY7UkZm5qpzE8l1kVc7WSX7ib/++DA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwLuwACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp3pw//QkA8057ZZON3yBTBFknQ5Z+irQpTsbp1xXNxMYrX8K7BXHgS\r\nd9DpOEemiD8ssqnQ2Ot6GKkTw4zc/QUAjg/7byw1fJjZgIqqfOK0HD3TPPsZ\r\nBrpZw17MIVC96uxzw6j4Xw1ZFXebuVwei8B+0M/hipeeVSKLYH0HbZxYnWYP\r\nd5Q+1jnTgJbLJJggN8PMzj9Y7wLZp+1+hsn5ixvu8asXxTu748Lfq+hWEGnF\r\nOq1cslX6fJc2VpuWxp3i1YhOqK+soBtn4Mkyic1HctZFir4fn4eI9+RqkiUP\r\nn6xsGKx/CT65VZ6Ew5020AjJF9UIl82MQWSazVXC5l8mjKBBv7NVowdElIvB\r\nsw5bvjta9Yu9YPhJ6BcIQeMK25SHgULD7EcRUXzqcQPYNCclQDzc763eA8lH\r\nTOu0XgQ7SbaQhhbDpbvROev/UONMuJ+2G3nt5MM+V3pVcgQWxy1KCop73QzN\r\nTzT5j8XhFMaiSLzhhNBHvyA1RnEHQTnYbN9xh70hi0SzcebvGDnhJsxzX8GR\r\nl8NS0b1eTjWn7zMiDEAPfsgLBZKqGe+m7bUSyI/RoPqSwpNBZTO8+XEjFQBV\r\nJ7QGE6OShvfm451a2+AZk9SRVV8LO9mPSbNpcWFX8/w4mHVQhNeV8v06Dag0\r\nXcSZ87ic7xLy1RBImDQtGAjYECCRc5y2Yyo=\r\n=63xY\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230113020147-1dd8e28.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/6e5a66ec15d1ffa0172f50ffc71f5154/graphql-hive-client-0.22.0-alpha-20230113020147-1dd8e28.tgz","_integrity":"sha512-awIEDiW++SRtqvI/MsAriZWMYzCklL/hkcS1RQX9TCH/dZ1KkzWYTkIxPK+VFw/Iua0Es/DBwLRJfxuSsvx5uw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230113020147-1dd8e28_1673575344090_0.6184006395276314","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230113075630-96e80ab":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230113075630-96e80ab","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230113075630-96e80ab","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"5eb766cefe226f83e157ad2205db2b9a5a4f122d","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230113075630-96e80ab.tgz","fileCount":60,"integrity":"sha512-U0EhOMLPCrBodeziX10diHTAzptnK+HpjtX5XHZAhEqmedF2tZ0mKtp4qxhPZ2RfNgbYM3oYHBsK++ksjET/DQ==","signatures":[{"sig":"MEQCIHaUMf8VgDT9h85SbGKsw6KwavwYyCKj9CNfmcQX+tYZAiBCEHzbK2VX4l6UhVcJqC4oSmFaUOgE8lELVA+T+I5gDg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwQ7RACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpTyQ//Vttjn3V+Hk56DbB90FGbEASwmKxSXOi+skB8SxYRisk3RI77\r\n/vO0Pz6s5dQ6pcBK9zRS5XxT9qvG6HDyfBj76g8a4gKAt8n6UIJAhfo7Znz7\r\npx/SyRs8uQzqUg+VW6q4EhyJjlkMQY6MN3toz+pvZisx5ntlURE+1DAtDm57\r\npY0PH3n5CghgOJ9/WKy29hSrE0VCWjuNDj4TFTd6vtoob3lmyugHCro9Ss3O\r\nL+hgKUbuEvfYe9RaHvgTuHiiOKObZYCUiACqf3DVk7Y7PWL/l+/iZLLvhLO1\r\nzTObEqbm3BdAds6AxxXJcvRn1zP07VJfrW0vCpvtlaNRaf2JDKWjL06GCe6U\r\npe6loi3PEo75MfxdrB57PNYMIvYU5zisvyBzHRz28bB6xwhTR7+82u324eWV\r\n72WcSZLqy39q5XGfEr7oHkA+k9bpjgy5ETwaO+qfJUwTXbR6YvxbGo5xT7S/\r\nGpdOHNaoYXh/kQUoHdqu2/8TLXF/bQibzATJf/e3slEy2JvQbWXGXYeNIcP/\r\na2NKojWKkN04+Ds931nz2hGrobyvDLE4RfNOfpgUC6sQS09olqEpS2UK8iTt\r\nBirF5+klBRWQsJGq5thF26sYzaf5h2B7PLgC3gjrNTWV3OaGpk3N4m6jM2kr\r\nJ4Ki7T02yxKQRt3P3eAcht+PFzy7GGaibKQ=\r\n=Du80\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230113075630-96e80ab.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/8f4a26732b4c32ed50ed3f4bb0f51304/graphql-hive-client-0.22.0-alpha-20230113075630-96e80ab.tgz","_integrity":"sha512-U0EhOMLPCrBodeziX10diHTAzptnK+HpjtX5XHZAhEqmedF2tZ0mKtp4qxhPZ2RfNgbYM3oYHBsK++ksjET/DQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230113075630-96e80ab_1673596625491_0.25907055484229025","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230113080143-9aab134":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230113080143-9aab134","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230113080143-9aab134","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"381445b370718e13a6ed654cbbfb9618f73264e8","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230113080143-9aab134.tgz","fileCount":60,"integrity":"sha512-Mym/u77gAOy4m1HhEuDhC0LnYT8YP6cOhnsId3ZRCIaPu/TeO/FsbBhYAy0a5LkXDK5ibrVHzWG1DxE1HL7OzA==","signatures":[{"sig":"MEUCIHA4vYqVmr6DkXqYgaFElF1XtdGYCxm/9ASnZdfBYTv6AiEArXFYuhF8jPqVDXrArkaRygFEYU6KbyE28Q1zXMPsS4A=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwRANACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqoGA/+J9Ey3zsN8LjuAB8QfLjlPcIxrdblCSGLXfJBIDUcoSLcWvQ3\r\nWBsKyajbvTcWE3EAgDqbPfHlQKBmCKRxb0f8sNWXYTvDgKKqSvG/4I+6ksCL\r\neNAQyujtvYNd0//gVH+mmRYKRobETZdL4XV0ra2DNXaej3gK0g2cAmBzKkST\r\nX66HX5RpIefgmOUMPYkFUlcox6dIc1IqZOpipBxnIALrs05nRyGL9YS+ln/4\r\nCnq1an5WGhC3pE5jy6qpnhkhfvwoRv6nLS0zTPDI0r4knZxjltOmDY61uP3e\r\n6sRqxIBQZOUJVSly5pYFAkAnUugzN3yvXf51K9ngE7pnC56uAiGld7izNb36\r\nONRY9jbN/2c/kaGdGI0SPZsZDwmZEuWbeZfAB3N4/+joDtx0LS0M8akDVrTm\r\nRXmOVdHK0NMMBTm5j3pLMnbwp4PjecVAwXdRcLRdqDFaFiQNs0O1RqYkHUoB\r\nV/cqEjB7jVVQ/uMhRwGXu+7PHzYq9EwS2rl/9jx3jaTTags/bGxZdRynTYyK\r\nAIAM//Kl/aCUXty418ITabGy2Gp8O1Lkxwta49W648zmyUeOqa6oTTHzqABS\r\n4NFWMTDuMOmoHFvAiGeOAl54+nAHxQ6+glkyoQIlmpiE9u0Pr9Q8SMi3t15u\r\ny6rR6YA+Mhu0iKvg6AGExsmO2JL1p0amrQQ=\r\n=9Rxc\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230113080143-9aab134.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/5c946b9b47ca9d7732703f021b7a17f5/graphql-hive-client-0.22.0-alpha-20230113080143-9aab134.tgz","_integrity":"sha512-Mym/u77gAOy4m1HhEuDhC0LnYT8YP6cOhnsId3ZRCIaPu/TeO/FsbBhYAy0a5LkXDK5ibrVHzWG1DxE1HL7OzA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230113080143-9aab134_1673596941278_0.03199582450532579","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230113080703-db1ff19":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230113080703-db1ff19","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230113080703-db1ff19","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"9cf2fa60c133e2bd44c467f95d1d43000212d356","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230113080703-db1ff19.tgz","fileCount":60,"integrity":"sha512-4GvQ50GLsT655lgsWVlwzzyrZwozuENdcjQMkDvfLa0i5I3sEvAsDcZRTg7qDnoSF7onyBhJ9RjwrI/HA2ZIpw==","signatures":[{"sig":"MEQCIHnggSB9iES4RQf8okTi9SFqX2wLhTP0rwsoOPc6Ow1OAiA3FSbGxqFXURmnVI/LFBMnT1uPyXww9oZLaCgZqCI4vg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwRFLACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqexRAAkYznwekY6yii4f9x2gpio60JMAJP3nmTmvwRKo3mi6Wv25Ej\r\nvL+iu/IMxwBoyaIsw4JZa8axPRGSlm2BBoWd7Bw8ZFGpaJ87cc/QIa3C3pZd\r\nBgREl54vKk4Z9lBO2tuF+DHY+ZyH9wkSYmIcybYoyhnbinSaRF3SIYCE8PgP\r\n8Crv4zF9N0HWR/T/aEbmSpbBefqAm8wjrAZvMH3FwernvUoWDroarFwpPpgV\r\nbLdEcFEUiSjkOKhp4hkIQNZDT++MU4u5SdyOgzXFo1vMJfL5D6U1Gy88i58v\r\nrAKlq3SYpPL4rzL8ewofJF4KM9VMoughxXF82QeHnoVVnNyxymMg3lZDfSQQ\r\nWyatekoY/sthU0wd4Op+m60al3ParWsk/4oKlayAsQSMe4t2wPev6EXreCu4\r\np6/TQFGRH9we+4t6MjGUFY374OJ2SOARt6vESmVT2LtZmzde6qL1ClE1MNhw\r\njktH9fWMD1D5zDDLMhZm3qEb2kGc9McRdRajeIxzN/wcXuh2eY7n4qiUCfj5\r\npM9uX3CUg6JFkorKI5KHX4xmqIHGtMNjoBNrbcPqCfM9K0p1ytXpo3vJeph3\r\ntSXYpXJZlGIK/Z8p04tAkQRZZtfp9yJxT+EW8rwXRVUCDLpu3vZ6h4ErfTKl\r\ncWJ03024H/F1qJcu7T2HL9mpPsnCuCeRnco=\r\n=EIFi\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230113080703-db1ff19.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/cb27f867cc91addbfcb78a1555178feb/graphql-hive-client-0.22.0-alpha-20230113080703-db1ff19.tgz","_integrity":"sha512-4GvQ50GLsT655lgsWVlwzzyrZwozuENdcjQMkDvfLa0i5I3sEvAsDcZRTg7qDnoSF7onyBhJ9RjwrI/HA2ZIpw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230113080703-db1ff19_1673597258918_0.604368382419783","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230113080905-5784913":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230113080905-5784913","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230113080905-5784913","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"56cb105186a4a7376aa798d91e89d4c5caae6d0c","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230113080905-5784913.tgz","fileCount":60,"integrity":"sha512-tqVgqmr42wC4OqU/1AFx8EkdmhwgKTfusOP7W/REazdw0lUR96QEimah00IT9RXLNc1QTcYDOPc3mdQL25a0BA==","signatures":[{"sig":"MEUCIQCOm7xRfIVh8jTOnOSOTyLSi57mwCJm+0zWmeHGUzAmbwIgA9J+FP0VZZ8mUaQbOz2ht0FbKDL72nJ83ArnL6q7ll0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwRHEACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpfhQ//cTrT1TNvJi/m8GPbictkjPJu6lsM3+yX9TZu59T1yYZ34icx\r\nmTM5XMd/3ItYlLnpk+yT8H+aeZfcXTEu09cWOdPm8NMh/eNfiRalXp3Zj1S/\r\n698pto5fdI4XETFhQC2GtWYtT3Z5JPd98KnpV9MRL+ahCsf4/BklUlAX+73x\r\nohKzJR88u/+80mMCFQRqIJUUoGtQm2fdFh5OXTuhB8hZ5cQKAt+hS1OqKB2T\r\nMQg0W+ZsRJmldkl3yzalWy9Bwk+17wlRfBHtx0vYmfqS6o6G7gxuC/6QtWDw\r\n53IAqlUt+u3KZkAaaQEhCZnDUQXsFs9TGkWVJ7pll8bTMYSqz4m0oPqEpLBl\r\nPQgbKQO8CBI0O2MPVQ+EizUSRKRaypxn3HVtKKw2FGW+ftwUUb3FF402/gye\r\nNkdAAmyYL+prZKgcMKT+pwKcxq2/jV3ag86Bie/Gk4oNHmPsLI17FhZlMDxn\r\notd/WmlDxYLF8LtHvrXq81HPcHA6o+KXvQnZm9rpbUX3zExzcbKHsjJxmXaM\r\ndM/6UmmoBRJBcounK99rdfirhw7gJodL13os2VZHdwTj6Xh2yLf0Vy/iA7IK\r\nFnpjtXiK27UFn7ZPOq86fOmD0xIqCoq1dEOQnKBRrxqjqoSZJ77B9twGnaGC\r\ne2eqx7nmX7MF6eaDqd3gQSaGyvbTn7skSq8=\r\n=ZlTc\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230113080905-5784913.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/18e17021d5e1fb68a1f361a5c954c85a/graphql-hive-client-0.22.0-alpha-20230113080905-5784913.tgz","_integrity":"sha512-tqVgqmr42wC4OqU/1AFx8EkdmhwgKTfusOP7W/REazdw0lUR96QEimah00IT9RXLNc1QTcYDOPc3mdQL25a0BA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230113080905-5784913_1673597380464_0.5796396673274864","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230113081927-f4bb8e3":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230113081927-f4bb8e3","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230113081927-f4bb8e3","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"23a170cee3d473ca3cec9b49c9825ffb360ecf62","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230113081927-f4bb8e3.tgz","fileCount":60,"integrity":"sha512-9lhoUmopeHh/yzPtD4HRn+7EoFL2woHBTtgPSZDMhHo3ZQbJSSE6JfbsudSNeMvzO71z/3VbGP2M8e2a57hsjQ==","signatures":[{"sig":"MEYCIQCBRKQzMSAxb5gLz79hOMx2tcu/LrtgPctgjSA2oIHqzQIhAMJwIWD1bhlgF4Y0bl1kvV07ronlMIRuV089HELqd4SD","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwRQxACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoJRg/+OSD9rhBGLLbZvf9QVzddWa1tDK6p6jX4Q3im927AycZyEdc1\r\ne4LRdXq3OxKd+lOGgYiyR5rGeukRgc1GfwTdrciMPaBQw8bUFul3tiNJG2BH\r\nCmw9HFY4bnDY0HVuLCuUsWerJ6AEbnwM4ZkCxBh+2Z5tdC5LNjHlz7N2VuFP\r\nIViiN12Oh6J+jVGAWOzkdZxuaAmLZgKJ6qXYDqOyAdynxOE5RwLYgMcr3wnV\r\nVYNXfr99dtm4X/mg7ANCjE1qH5AXcq6S5qEeOgNlEyerf3mksWHQU+mtlYFs\r\nX75yucMgwPzwsdzg852AhvBzf4H4HyCzDMkdggdY9C5FyVw7+T543ID3Y0WW\r\nsOh0VG0tf/ADtA+QKM0DLKrxhZDdK0Ik4FHK2tZUUuqWfy5jDcthvJtM8yCs\r\nNlksL/FTbl6Njw7pjxoVe2HP4/sBE6xiQdQz/x54Pf/3nK+i6f2ns6V/4DmY\r\nXUlWbHwooOvgEqozP2X8fKSVsXxiLesfa4CoT8UrghnT2wouK0Ex59TplxUG\r\nz6oqvcBhgFsbpvN0WRv7zWCxL2CL/SZ0rJBMFJGQxn9WT0N2rc8nd8yb9Uoq\r\nQCsORKLCRoD781Pjc8YFqFk8QqZB/CNpDSAQqB3uWrpoJIP2u62JZ7i/INvw\r\niJgwF2pX8LL/3Ux1gs4bLy2IfJyB2EKaikY=\r\n=8EWD\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230113081927-f4bb8e3.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/f8f5dedd2e1a664667f2e786c3584da8/graphql-hive-client-0.22.0-alpha-20230113081927-f4bb8e3.tgz","_integrity":"sha512-9lhoUmopeHh/yzPtD4HRn+7EoFL2woHBTtgPSZDMhHo3ZQbJSSE6JfbsudSNeMvzO71z/3VbGP2M8e2a57hsjQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230113081927-f4bb8e3_1673598000903_0.9571035888535466","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230113081959-ef03170":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230113081959-ef03170","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230113081959-ef03170","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"dc424a8d860ec318a699494a44ecc55c6602227a","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230113081959-ef03170.tgz","fileCount":60,"integrity":"sha512-ozjB5sd+8SgHqpd/GoFilPFLjWD5u8bqCmLEciSHVFK2ycOYhY8MCYClOXKshEtkV81BhwIvqWtRlxj96D2/nQ==","signatures":[{"sig":"MEUCIAyMMDM/wWDUoKTvpshLX+JtWFIKyjEKt/6iRZrp1gC+AiEAwihkUKR3gtUrMMgUOUSa2KG8oPijwosN5QHs63zcthA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwRRYACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqYCw/+MUnnOXcfVbH2vjwFFiIcfiwW0rUAzcVcYoOOplt7f5up3bvy\r\nx+o0U1Ot9pVHvuJloYBJMfZHHmGL4wBrjkGfu5bAIU8RChKN4O6/H3yRf2eG\r\nlwEm/EI/LkLB8Rl7/GLwcNSsMwbXmx+XB858PUapEL9TH5ns3JTG38Xx1unA\r\nGsC9rc5w0j811ORIQeWnC8Np1IPkNUZjeeCZzhM0KR9JGpjRc1MgQrxsauK9\r\n2g19ghnfodAplxa7I61ZukrfT5J6/Rpv1Zm8aP1m+ntKWbDycba925RPjZwn\r\n2swvHmojUadAQtwkh0LZ54TbP0YeJL78bTUHDIOhWly5cgwxrFLBCG5iqSP6\r\n6WjnjjM9/dsxXscQNMHWv7X8kLTsRRCHbKFY6krZvPUrI/wMIuGMAMHIwI7a\r\nFl4T30cXP2s8zRB0RZI2gB9TokEA9cXx/jNoBVEUy8qMlr8A2StVYGLGL2r3\r\nbJsx3OEEYnS4797HgdWSbvBjiJuALVYYPXRi0Dw5IDL20EFxoFhivyZhFeaw\r\nlf3Amife1+F3dYZyzU19AUTaHhAF/2R/+UM797z0mAdZygs2gmTT3KV0ggzt\r\n8nOqLARLi/oybXS5t7QJOnqqn7B8tP06vsolZ+V94Se9EUx7cV0LX+8NnbvZ\r\nAAMJBoXtQ+JvrGvsnQdMmspxcb0tBnYvMpg=\r\n=3aN2\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230113081959-ef03170.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/6fa4c4d1e404da236638440286ef936d/graphql-hive-client-0.22.0-alpha-20230113081959-ef03170.tgz","_integrity":"sha512-ozjB5sd+8SgHqpd/GoFilPFLjWD5u8bqCmLEciSHVFK2ycOYhY8MCYClOXKshEtkV81BhwIvqWtRlxj96D2/nQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230113081959-ef03170_1673598040297_0.9834449425657494","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230113082552-e830052":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230113082552-e830052","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230113082552-e830052","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"2cdc15f0d322d83286e9c0392cc662571141c362","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230113082552-e830052.tgz","fileCount":60,"integrity":"sha512-W020/YZTDhNlB6SXcyn+nMoFojDOUoRjGskhsO/k3jE2rZPkzUzKl8QREJsLrvGglPAzV6gZwn+kMipccPSm+Q==","signatures":[{"sig":"MEUCIQD8JP/lytSDMK5ofm6BAcgERU/J5hgfWrpViIjuxNaLtgIgXl9xEDYNStrxJO5ERnvsKrADGBz7B/PBM1z5Jo6xXP8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwRW2ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqoZg//el6SnFqT3Pp2pD2Q5EbJGF59RZlOsKQA4wkyZnsdT1c9Q+IS\r\nNH1+5gQR3/hj1Xcpo9Bvpq+tU0vtV2noBp+zHlhOuiUdkdYzzjJQizxHhs2n\r\n1q9gxUJQ2+f/4Sc1rJAxNFeraTqqLNJwYuRDjLgKKrq/V7rPv7tzpXOuBBmm\r\nooepI7ZuzPlR2x7rh/QrFTqqWNrdppDC75ojYbDRfF2Bt51nasfzkktZF+CJ\r\ny0FT+9IC7STwjkkhCHwOG4tUI/47k9CCA66q7I4HIjrVfUZ7tCHHvnH74UJX\r\nG0/s1GGEisXiyEHGBt4//1VqLo0IjLFufak4GpIXbuo5RVCkODFlJ5Aq+wbO\r\nIinNyaq5LcY3qybeZ8BnpC6RibHUmunuPQ1qvF+K7PDXSJb490Wx68ycg7Le\r\nKH4Qhu2LgsLlXywswReGH5lUDz6bgEnZt2/7slAPcAL4VkeuSKz1ACySkrkQ\r\np9za93imUuQfz7DHwTB5yGDAA9qOY6nkQEPu6id/K0IRU1iLA7RudTo+0nMO\r\ns+p0PTCqRh3baaYZiRs5bEDCZ8PxjIBjQv1EWUuvpp8I1kFKj0QLaYvzmd43\r\nl/FJmg2eVkUQyTgIJJGqx1pV0J7kZRmMKJHTP/QfhNbhF3tmdWI/Le4hfGL6\r\nqyECeZiXN56r23QsxWYwTPm3bJEntudS5Ns=\r\n=oRyU\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230113082552-e830052.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/cabf1c313da03d1e2196efa04aa3a43f/graphql-hive-client-0.22.0-alpha-20230113082552-e830052.tgz","_integrity":"sha512-W020/YZTDhNlB6SXcyn+nMoFojDOUoRjGskhsO/k3jE2rZPkzUzKl8QREJsLrvGglPAzV6gZwn+kMipccPSm+Q==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230113082552-e830052_1673598389807_0.3584912888253582","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230113084629-d56396b":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230113084629-d56396b","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230113084629-d56396b","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"201f48ee4134081ddf15c6a6ec3c93333e773d12","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230113084629-d56396b.tgz","fileCount":60,"integrity":"sha512-aV+QgZC+qOQvrBZhql8Ipf8ePXGsW9eUbyN16TZoJ0v2eWpE/p9u2BKS6zLdgu0vz3DYtdDezPAohevP9gDHLQ==","signatures":[{"sig":"MEUCIQCCKHr+X4ivXzA3HIiWfYHqfWB62OyTgmbAA+ieyZNMjQIgNCV11DlWionCVvForKwPZtG/R17ouu+2P6XGlrQm1vs=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwRqGACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmowLxAAl1mIA4HzO/o/i8NkT71ZC+JlurCvKOSLSE3GnXRZnwDzQaL5\r\ni+t6YDNI86ayZRfcDfpieZJXGJ7HAHHm4/dfmsbZ3zlzldMArp2gE2jkboeC\r\ncaqzxLfhoNyHbF4R7oAKCx2uhIlh9UDybkh686tClt/MUMVgKNSxDXEXQwZB\r\nMmdnLr6ThX3vKuYI8j5GDoJgKzOiPZy7UXbs4+ncP9FLVqDWo1jIhi+QF0hX\r\nU5w7QiV9EKfuIiYbgAL3uyCFZd4P4JM0Re2vqoyalkEg0HDPZymRb8E5fJPq\r\nrX5XMlqKTtDrRsg/c2fD0NdX3zNy2RZ2vJDamABHXOZqHSOe0l2m6pJYTH0F\r\nfIei1cGSyLFKPJqtAqcszyYDYe0dOsQ0SUtdBjQn30OT/f1tG4lbkEhgLkuO\r\nl+eODggs8NO6T3Z3U8QyT/RwFe1hn2oE+s6uiFy5E/ww7mmO4q9JeVhmsUcF\r\njHEo/yO2iW+AH7Sz3BOM0Y3mrg0meyA1ouG0k6UrY26Qx3WoVLR02RJR/6sC\r\nhi+pYBrVN5Zq5Q90BEk+eqaKaWa5kx+y7GFqJ+/p+zisfjkEcnhAk7KninK3\r\n8+/FIUjRzZSnqHdm9oKdyXYcB151/DUe28UfQCgEGmrZn1QcBveO1AmJ5wHe\r\nOSvJ1AvGbv7o3P+xB9P2xZzrVLaFNvxOPJI=\r\n=bFIb\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230113084629-d56396b.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/c21935d16d2b20036c55363a65f216f8/graphql-hive-client-0.22.0-alpha-20230113084629-d56396b.tgz","_integrity":"sha512-aV+QgZC+qOQvrBZhql8Ipf8ePXGsW9eUbyN16TZoJ0v2eWpE/p9u2BKS6zLdgu0vz3DYtdDezPAohevP9gDHLQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230113084629-d56396b_1673599622367_0.47749328197583507","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230113085227-1a3c8d0":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230113085227-1a3c8d0","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230113085227-1a3c8d0","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"21e193ba470b7807bb5f2edc34613df5e8e66c89","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230113085227-1a3c8d0.tgz","fileCount":60,"integrity":"sha512-RA+09/1AQHyGhkj08F4j6bxgA1jz1Fq4YWb/B0baojBNw2zv1jvmi7gsJbz2KC5h1f7cnSTtlLkzAAbYOr+7jw==","signatures":[{"sig":"MEYCIQDim3bLrWHqk4hHgGQP3ZIgzDCxyfqd6tiwBLI4ywHurQIhANFQD8MG+6RlCoRW8GivFE2LCUkRKyx+u4FpMXCqcPGw","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwRv2ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrDbA/+Lu0eu4O/24YWyCPmP3Vr1M+xdBpvFoehipGB2NuMGymPMsAW\r\nYPWyFxk6SEzo9iS425FIGue5RrBoUtLEa1jjm3oX2mSJorhO8wH9UpORtwcW\r\nQAAIlpce0/Ccr+wHtFF3CDy9Bv61z3EdzPqloVXtGpsbzqvCzPRKEyoUkYnZ\r\neP8HzMZomyQ0gCzAjYj05a7AHIaTgcywZdy8p6OcUDJblQriCDmNm7A76K53\r\nQ1gp15jdMmgW6D8TCiNmdHINmefVsg1zEVgEjx5tFwDuRDM3FKOpE6AyqMWj\r\nG80sKUjfoWt3KF2y+meHLNPmnPM00NMoKxwVgC2Wmb9GjKBulIChn8l2QzJk\r\nzusrJyTTTEDF9yrGlIXoTNrCbLyjz7vII0RXgLE2ZXam6vGaNSBqBYfAIRHo\r\nkaVru6kKD3pUYEO8W/BIsPpyEjTpS5X1YqeX3Fi/pbNKsUG0TRTB2eazi+fz\r\ngO26zxnVfGZupnbjiU+XXlR6w3kBtssdRbNFZLriLqO3FgaGV0SLA5E+vz6q\r\neEithQZc5vdUmUt7y3VtD9LjECncMsnnKuapxISpOhe3F5xX5qmpS2R0yYjp\r\nl8T8l6ThTT5mOwqMvemI9i7wUmacu7Ue9/bbTPYAZEfazvdYDsUzZ8VqEmfp\r\n8swai+IGmIExcPsssFRv7Da6AzoLxTOrPjg=\r\n=rCSX\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230113085227-1a3c8d0.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/b6c02672089a9f89997f46c4f8304014/graphql-hive-client-0.22.0-alpha-20230113085227-1a3c8d0.tgz","_integrity":"sha512-RA+09/1AQHyGhkj08F4j6bxgA1jz1Fq4YWb/B0baojBNw2zv1jvmi7gsJbz2KC5h1f7cnSTtlLkzAAbYOr+7jw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230113085227-1a3c8d0_1673599990278_0.5975246930336515","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230113093306-6cdc20d":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230113093306-6cdc20d","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230113093306-6cdc20d","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"fa5e319765f0d1c839efdb0cdd0f89d26b4094ae","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230113093306-6cdc20d.tgz","fileCount":60,"integrity":"sha512-2HzCObnQ8jjDRxCd1LTWlQbQvrdiuiPuBDexX1u3arjeDXoHji2TZ46Vt6ifDjIyNdWMiCUAdZ1sOD6/omTouw==","signatures":[{"sig":"MEUCIQDRpFcia8pNdvWiU8MRxWhCREbfBip95J0JjhTtGQvmWQIgasx5BPlYgiIQFrEucfuaEW+WMuZxC4PvQvqet4QRADA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwSV2ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqiAxAAhPrUpSnkgeiO/gQjMnkpO8/5d5PjvzKaivxSzHhb8la1Bvg0\r\nUaAiyrTE1eDUZzJA6P9BbJ8FJLCC6eQhFCEJ5USnP9tcdXpyxFVIEIUAyRD+\r\n2zXJtKwESmwt7qHde/qi3M2WBw9UJiWwidcsN8CPayvY4O22AUZuibkfD9YZ\r\n2twL1Dp7F6WLVT/e2Or9jwDK6IXN2gfR9tazPVKx6LoC0+xbjgGDlloDGGhb\r\nCXxY6Ew8t1+8bkuno5ba1H/TV4qXk4ynjKmCRifAsl6dYzpv3WHNf3q0mCMD\r\nQE+h8Jb2PiXTZHhmDYayapJtkESE9s3yjY24B6tSNT8rZO9qVzYmDundsL7I\r\nieYoDjwBGDo5HCjNziQ38IHvtDyTStf4p9dKB9KCuUvKdMwD5oC7wHw3mBtf\r\nfb4HOH/dUrea2Dp0Cf4T+T0YLDNWBsENaragFX2/JoMU6zMpC4vpwfIavCFi\r\nfaWjczM2BmP9pI+T4/cy/5iVvuI2yT7lWvx/8/NEnGInwSgp5SxVrGdT6pN2\r\nU3xR0OnQrIIl0huOsgy4CDAn95R5+C6hWPRMO2fb4TOlJWjLxWygvLhvGfZ2\r\nV6YUulV0wMfFQ+GYrO92zpVKONuj3DLt7DNJ6Xexp/K7D3qTg4IslzqfV3Oc\r\ns3Y4LsrEsuJvr9HdR/JaWPxr5+04B3qbut8=\r\n=nYLl\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230113093306-6cdc20d.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/3bdfbed197df0ee44e425eb56038c2a9/graphql-hive-client-0.22.0-alpha-20230113093306-6cdc20d.tgz","_integrity":"sha512-2HzCObnQ8jjDRxCd1LTWlQbQvrdiuiPuBDexX1u3arjeDXoHji2TZ46Vt6ifDjIyNdWMiCUAdZ1sOD6/omTouw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230113093306-6cdc20d_1673602422637_0.9870712868837466","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230113093357-d939a44":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230113093357-d939a44","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230113093357-d939a44","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"042df6159db01ad62567afe927b79f40d9421866","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230113093357-d939a44.tgz","fileCount":60,"integrity":"sha512-HvzvR+MnhDypLuggw3oetezkFa+mJCXEWqx3qi9dNviC14JVaMDMB0oBLqpd62ozllEFCJldvqCUDM2GbjOBPw==","signatures":[{"sig":"MEYCIQD7UG93+boNWVibPoqHr1cdfJjLM2wspGO6mdwQmxEeaQIhANvuc6b1dJ3lzFLiii2QQZplqYIuIjYvB1AEIu6eLWWM","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwSWvACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqWxA//VkSkYJ3Lqh3m1mujfnnUpESycenwuceyx9aQ5rQkMXAlf+2G\r\nznY0sPzCFC9k8QPlHRqvoyRSMqpXIgWAmX2ssf0kGpm49B/aWqLy6FsYKNZn\r\ntOFcEsuFVduHxwjsk7s0vkqmbmxSsngLdTyp5X6fU3LYzb05Eka3Oar4Kcx4\r\nvD89OMWsBHgr51I7NrwFcUGFpG32zJYh2tfnyq/TYhcSq3RsfP1ycn6eyf28\r\n761sq2ELEx7z0QQx203QbORE7my5Fn53OhJCIeIvcEWlunGaJ9VqAxJ9dkBC\r\nXQcGYmEns7ondZHLytJdsXQgIvhHcljPzU50DutghLWPNLKPh67YPHSn2gE2\r\n0HMVIsX9oaOxDAzS6875ReUn1YAZp76XfQG/S/mxUlEd+zKmtHrgRawkEzz8\r\nj5pFncJ06UxHpdnE1FoldS+IExFIwM3ibGVyBXaGlJfRm3zNln1tezItORpb\r\n9K+wy05k3tndJ40A0xKIKmrTpnvI2sl6nFnKwEbm1ecze7unigNlG95BsOYs\r\n2U86DZwgz3+ZVfxvecESZSRJEhi6QZDqUMOM9Z4AWtY8CrdYa4n1PWhmqdT7\r\nbqPTQcJ/I0y2xcDsqothPpwfr5HTypH9WIHiB01r/MApeCH6cazDb79l3jOJ\r\ngeGFUNQ/uC0QrZiPO7Xf0NP5BjP5w9KuCFg=\r\n=A+xU\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230113093357-d939a44.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/b4fe7817a6bc1ed8635ca781c7865bc3/graphql-hive-client-0.22.0-alpha-20230113093357-d939a44.tgz","_integrity":"sha512-HvzvR+MnhDypLuggw3oetezkFa+mJCXEWqx3qi9dNviC14JVaMDMB0oBLqpd62ozllEFCJldvqCUDM2GbjOBPw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230113093357-d939a44_1673602479278_0.7483656265077421","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230113101226-281a951":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230113101226-281a951","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230113101226-281a951","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"1d6750dd574d764eaafd11e75e056d320fdc11b4","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230113101226-281a951.tgz","fileCount":60,"integrity":"sha512-+chofcqFOIX1kWHRGFA223cpe/LXRdLS2G/WckYAP3Ned+Bw9ZUqUlVIhf4rUVAZ6lVIxBY2b7s7W3gx9acjkg==","signatures":[{"sig":"MEQCIBFePCGAnm98PIQ8nHVM6IZWB+Cmjxc09QBXssIvGKdjAiApU/xZKUAZpTUUVnAViKP0ZXzZpXaXjK1fvrEY0Kcmnw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwS6vACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpMIRAAlNVPpy+nPXgnQ9JpcXRsh9rUJwFnkvPJmmE4uo61sOjNcc6Z\r\nugUUlPlSSGz97Baa23XnI+Vcxt7QuuGXvZ23/foAnSKhgb/rWGWOvbeAnwM7\r\nu+J8blxqcoeVt5EnTjgFb1J4xXGNPHPKW2Ihh1K/P4gFdpsi3IYDSJ3r9Xvu\r\n4YvXSlUi41fkwOqeEPYgX5Hmr6vP7Sbx568ZToWzUM1XEq2uGTUID7EJzlWK\r\nKF8DWukGDlbTkAMYEmkNKKCKHCPvsSsdHJ8N3Lqg1H+aqcWXjfVaW+9V1n58\r\ncLhavkEeMcQfAYi9LlzJ6u9HS+DygzCVnhK/e12tk2le8+VKrce8EK4HVEKX\r\nTHelZzCHr8o8Nct9HMynomEU2pw87q80Acujnx6M704SmNuXSqkXU7DrWc3k\r\nmGRtm7dd+t7m93gjgW43HkxWc1fx/LOHbXde1tkBXoEa2tX4vS19yju7Bmxd\r\n9KKJCd6ci0HL79xGEjsdsnp/ArVpk+i3+DGypWGQZE6Lz14Gnz+gl6dtqtiI\r\nIwQSwZtU9+9zH/zPQDeKjYK8/QzUIrAXDnyWfwK3d6s2MWYUvWCEUnm+8WX1\r\njGE7nEOiKE5Hbg/hJLW1jIevoukzHL4wuYhym1ysu0qWizVnZAj7KmLlaToe\r\n/a7qmP9fVvOHCu18Km4rrQa+mJyTpRgYKGQ=\r\n=OZHM\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230113101226-281a951.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/5e2f5e256e369141850735aa8cf59eaa/graphql-hive-client-0.22.0-alpha-20230113101226-281a951.tgz","_integrity":"sha512-+chofcqFOIX1kWHRGFA223cpe/LXRdLS2G/WckYAP3Ned+Bw9ZUqUlVIhf4rUVAZ6lVIxBY2b7s7W3gx9acjkg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230113101226-281a951_1673604782905_0.37306803876863226","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230113122439-ddc9c11":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230113122439-ddc9c11","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230113122439-ddc9c11","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"a51fb5183781d772d1efe53832c165009dc30b17","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230113122439-ddc9c11.tgz","fileCount":60,"integrity":"sha512-oL55cDS4ajxL2BXWvtVSwrdD8LtRLqMp4dg/52ZrX4SMD6TnnLtT1nUw+7g2g2VDen4vureg3WU0WELDW/bm6w==","signatures":[{"sig":"MEUCIQDUkUMR25lmp4nZVOhGEYOtj1XiFz9tYGzN1I+G9q2OUQIge5LMLJpNaFZVrn82whgMNqjey313Ls1n9Klpq8KRaDQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwU2qACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrHhRAAk/Yeo2WGLZ44ESC8DIM7niW8muDXjQepdgzc21IYjM5GdBsn\r\nc1adGxIBrjJ3S+pd85pLY1RCFWmJrAPwACXj7nJQ+N3jepZviGzdNIlVWN++\r\nd+jRBhlT0lAOaUOhRbvwcyh4epNkgBVW1zAIf5t1LO89U/KIwfvCW4uY65HB\r\naMJfrQ2TrQluYXTX9MZaTI/H1KI8Jo1Hp8uNXSwQd0+fpMZi38CgKpy5QxY5\r\nV+MH/1iEVk7tqknrQiHOAOoNJKc4Fa+dYZqfvHFZsRXzt/bBIngQ0T6hr9kj\r\nwf5tv9T4Eoaz28m/9rOyzT8g13X/I4z7RG3ck7nVIHxqVEbixa+CnOgJtrnY\r\nY/m4XARPAJ3sGH2LXoGVnRowetFm1NpmXCl94ErV2IDrIlpw9Xe5h02+zjmx\r\njp5q3A2CbU1T8WB1YupRZwpjHBfu5nHstQiNN7qgdPReJhLgbSvLEvoFvAPd\r\n1XTZB4Usf9JhfXFJGagZ1ZxEYDwyPPtbGc9uCP820b1XAKEx0WYQ4r8p47Dk\r\nr1Saro2tCvMGPOinur+tL367aoRwsCznbwo4O3VzRqGbBZVZYJfbg5ctHP4h\r\nsAuOFJu0PZxWotdl8GGrG8GPAbZfn7zsjJ5JanHrtQmEZMoEx5ii0+FD7GMH\r\nfaDJQh7UPlAXbgCY134XBU7uW00C5XdT7f4=\r\n=ev83\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230113122439-ddc9c11.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/0cabcf40e37a9531b021af11aba9f5ac/graphql-hive-client-0.22.0-alpha-20230113122439-ddc9c11.tgz","_integrity":"sha512-oL55cDS4ajxL2BXWvtVSwrdD8LtRLqMp4dg/52ZrX4SMD6TnnLtT1nUw+7g2g2VDen4vureg3WU0WELDW/bm6w==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230113122439-ddc9c11_1673612713862_0.3507379569411633","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230113122957-3220724":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230113122957-3220724","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230113122957-3220724","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"1828fd9e0916ce98863f12e3fdf33b2b5bdc5327","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230113122957-3220724.tgz","fileCount":60,"integrity":"sha512-woBKlrCMZehvbp2Y1QCCb7pLeh38VB+zm1gvrbsHCMagi0yb77rJGqBgN77hT86z02+7eDoWlE3jktgVNbxo9w==","signatures":[{"sig":"MEUCIQDQ1V/dejorzmvme695h8JLpH8Qs44lsv5ib4PfTgbIoAIgKtE/Dl++G1axynhj7yoNPzFK161t4nHfsa5wzC/ZaTs=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwU7zACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoSoQ//cDdn+qpXVNnNfNc3FPPTmrn8dEQ7OpAg/ZRlQc1aSJR1CP6H\r\nkO8vGXM8IDv6QTjV//nmEIUYJNX+kJNNCGbAQpYV/hqr2oLZKFjQg7ppF1uu\r\nGvh+HHjY8MPUwjk+US1vlz2nJIKF9LBU0EZWKJ+9f0ru8azw0Yw0m05h9H5b\r\n3LeO9Uv4oGK7v2xBNSJYGrSMiUlJt47ZZ9annEXSnqtF476g0oFqBNa5eB4V\r\nCvhdEtkBQai7Cz17WEWsUNDwsi+jTc8ewDKKSzvCK6u2ObWpGB38wr590adm\r\nlMvsaKbDhNIdwT1T31hDahFu15ETyR0/Bj/ktD/3oh6TXyMFFseZQ73MRNNt\r\n/3dPWCt9meSZWlxG8FfQfPL+Tnaq4/RFkO6ED8EqXajnDOqOFSp0Yd5H4mUw\r\nZACpAPjq1lI3wcszDEeeHHqttZFMR3Eq4JOdcJYpC19TE+Nu7H0NEqKdPIF7\r\n3n8zYS66dpwh7LiOWEespiEiKlP+wr2aPmzSv0AMrbEhbscfHXztrH3l91b5\r\nWq2N50Jx1twWneligOu5M7MWvab0Fixg8g5HRL2wjZoGWNBbjp0BO91Rn2al\r\nModDXgonbWz3nz8hBby3ueinzRemHH9jiKQ0bWGQk9XXkW/g2Uqypc2SWpUz\r\ntxRjoNfwERw94ReDFfAf63aohUDI60Fnqks=\r\n=Gqe9\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230113122957-3220724.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/654a6783601b86de10d53dc27cebd563/graphql-hive-client-0.22.0-alpha-20230113122957-3220724.tgz","_integrity":"sha512-woBKlrCMZehvbp2Y1QCCb7pLeh38VB+zm1gvrbsHCMagi0yb77rJGqBgN77hT86z02+7eDoWlE3jktgVNbxo9w==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230113122957-3220724_1673613043105_0.37526123440342785","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230113123604-cb2713f":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230113123604-cb2713f","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230113123604-cb2713f","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"101b46e1b85ce6cea36b43eeadc49e7e9d6d95d4","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230113123604-cb2713f.tgz","fileCount":60,"integrity":"sha512-hoRttQEevwANkgd85n3rUgoJUhepa28/8YxlNFuY7yfYeZidlnsM2Z1EE94yP55RT1aWELU+Xa3cT/v6bwlP/A==","signatures":[{"sig":"MEUCICjIz4Y7p57MYZTZDtSFoPl1Y3rLcCKoLHjd4V6GgssrAiEAysiAYX6ujJZZPBSsG7zK76Q3kkb/EwHE7Uy62kI5LTU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwVBXACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp6+Q/+M+opKyxal7pMDYnJWoqtXcteK9RhoOMQs6OzeQGUECWMG3N4\r\nB/ynBStBRbL1BWLo8FnRf0tsvF7Fio1NrjbhkQVfc+3/ZD58kZLrAW9hGyGS\r\nCdV6vvGgLSCK1618aQ+zWk0D1xj/WzBEttXuT4ksWByPTenhtLH9n+uJK6yk\r\nYrCOPK1JkKuuQbPJXxCHzVWqTiH3+XzK50MXscMf+uGptP5MapgNPYxj114g\r\nUWnpm41CuUEgzf39BvjemfuE66ixWajnwg0dmpBRI53XGpt1KraM2JdU7dtn\r\n1RQ2OUFjF6zww6BmyZG5/cOYEA1ApmCfMz+Gz6jZxak1S2a/N7qfdnsLOPYf\r\n0F+HZsMoqV2GACjMPjL/CknFB7fpdcuNZR6Wzjd5a9y6gZET5w/pWFAGuFvk\r\noIEGw9OhhnHowgOmF9g/GdBuagZ2KilR6PSiif7D2imTQrLNVGS716zoh0hb\r\njezLXhi0g5ep6v1nsql8PCzRroSmdBSqeRV8TIxpvKGB4s/zCZCkkhXCDPOk\r\n4LdC/xNkCvvVJEf4pHrnWf6G3/y3Ybozh+KyE/5399ifakeeQd5kYYdRz6nK\r\nmx2ryoiZGbIHl8sNeHy8VdbdQgxzHz/TjBZd2AUNPhZOP2hnruzA/uwqJGFp\r\nUThdKwYbWZGhOWZeQEscDSFopDDnsCYYK5k=\r\n=dDOq\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230113123604-cb2713f.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/2099ff69528981f52856d20d99811ddc/graphql-hive-client-0.22.0-alpha-20230113123604-cb2713f.tgz","_integrity":"sha512-hoRttQEevwANkgd85n3rUgoJUhepa28/8YxlNFuY7yfYeZidlnsM2Z1EE94yP55RT1aWELU+Xa3cT/v6bwlP/A==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230113123604-cb2713f_1673613399065_0.131229885499329","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230113123830-cfefc19":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230113123830-cfefc19","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230113123830-cfefc19","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"611f79885247b9eb03fc6e73d6efc22b99b4572f","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230113123830-cfefc19.tgz","fileCount":60,"integrity":"sha512-jgWZvs3RNpY5u511gYDPxpV1FpIZAPNsjik1Vd8pxpbRZQ1DhARZAv1hhieDeIlnv6iaPZ1XI//PU7RfrjZZRA==","signatures":[{"sig":"MEUCIGpxwR99CCSwzjjfSVbgQmi5TC/3clsX39spBdWeXC8RAiEAnychhsyKQ4t7VEts+C9FmnSADMpqT3aAmNXvAwk3I+g=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwVDtACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmqosw/+LRZJL1pAN4tmKaY6q74QpEqaFJA2/1UlEJQ8M0YUt0pBtChl\r\n37BcddJFmCpSSrHw/GMGkJhVntDJbxBBxZaoVYyOgzUdGHCs6kaq4YwgGmDr\r\nbkQeUUtzr+zUI6ZCxWUUcZ8vJWWuXw2lpfnZFpcdsT0/PHoMOalAySm7oSps\r\nqPQWenSDJa1pGg8h+eqhAGZlVOcdarmshLaP4Sy23al59qitRwGS0kQk/0Ju\r\nB5AfP3bXovP7lMVcr58J82mTVBozWHIy5a57VjycY/iEig5PwqfqWcxWbf56\r\nhMfej7MZyG7XENj1PkBBcvAGiYabiYKp4M3Rl4AT6/GrhV5Ki0kghoagE+b/\r\nnlIHBftnJi546Kxn377FYinHICwaUl0V80L5vQln09AEe1Jujp7lvSTnsEMq\r\npg1HurAECApB3iQAu0rDnt0dc8Xstia1cGCJE8BYv/5uHz3MbrMwnO7YKp/T\r\nvnk/+9iHG6eVh4JeIAehRtLHlKFzMr2lqBUjqHL53dJ9+NcXPFkSK25MwPN4\r\nsFN9BO0hVNIrn2WkCMsmc2YAHuGq2zhXqrOST3UMeHWgvkv2OLbIxT/ejGeT\r\nafaJpjabmlkQkIQthRuBAxmxMl4QF2EpuNDcbZLhsf625KJbu8MTQMaI5SPB\r\noISyEfUU/ENsChGHIv/8IGJDyeL8bD2qA1w=\r\n=ihIi\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230113123830-cfefc19.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/775b112e9423345796976cee464e62b8/graphql-hive-client-0.22.0-alpha-20230113123830-cfefc19.tgz","_integrity":"sha512-jgWZvs3RNpY5u511gYDPxpV1FpIZAPNsjik1Vd8pxpbRZQ1DhARZAv1hhieDeIlnv6iaPZ1XI//PU7RfrjZZRA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230113123830-cfefc19_1673613549515_0.34197857277637556","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230113124128-4a6aef1":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230113124128-4a6aef1","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230113124128-4a6aef1","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"b810e041a46c751dae6b690bd03236a9c1610b51","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230113124128-4a6aef1.tgz","fileCount":60,"integrity":"sha512-Q+gEnNl78D8rhvVmd7bWNPooI0JMwr0LumZZ7WP+dSx0CtxybOTm4TOCSaMyga9fFmZqmuBp0s93+Yk7h8YQWw==","signatures":[{"sig":"MEQCIDUD+U51jQSE2QTjTQfGwplbI6ydvfrE2AUEIP0aAjNQAiArQktHv06ZB51rsKAeq20BzNMIDA5/8dPhHaoEbzilgQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwVGgACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmqjvw/+Pa79p1oyQzC1xp7/2WffLU9ihLiK77tgYHFxuBWHKnf7bMEf\r\nHvKFG0/YpBEILZqmAwO9CvWaxxkHv1T7EaigJ48DyvhPuqkDReb3fKpspTjL\r\nSklz6IkaC8qOF5LCtdK13b5lbQF5NV99jFL4DWAB47u3jaOdQDgY6TIHVrv0\r\nNePyOlq4ft5p/3D9XfsfE8SDL8r0VQWYnxBR68V1Y5VILHivwh5HmblSWOqm\r\nENapqMdFgZT6FeJ/iSH0s3YHGgmsekU7ulVfJb0bjj+hmvbUXZIXkGGljt/w\r\nHBjcHffEaRYQrgB7O/fZfU2U4SYHWlzn9k5PpUAlhjS6yZsDA3BxzEaEOdft\r\neeiAriK8jWAur2QzdL/3ZPB+ek44832pbWQRsqbRefgqs1lDW+NDxHar+ubF\r\najoq/iqg9766o5A66FLq/qoXcbOd05xGW8gplFjO2lP8Fenf5PmmHDBNeJJc\r\niKXY2fxdcqHuqfdjpDvryKgnrLE3j2ufjwhfAwZBM5JipgePfyUcnPHTnhdj\r\nFXIZTldUFbhhtEc6VI2qTqphQzTsTnLW7nNr+WgvRBwmLiNNypTedz41r7U2\r\nAz1DxdJp/NIc9sTzyZE1+Au7KJgKsa4Q3MBZ62dQoizwRF4Hi8Q9D5nXszVq\r\n2JTd/8axLrYH6FTl81SWHoCSclnDKR/1GlE=\r\n=VVWD\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230113124128-4a6aef1.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/8d669e09c66e2334b3983d5a4c75e22b/graphql-hive-client-0.22.0-alpha-20230113124128-4a6aef1.tgz","_integrity":"sha512-Q+gEnNl78D8rhvVmd7bWNPooI0JMwr0LumZZ7WP+dSx0CtxybOTm4TOCSaMyga9fFmZqmuBp0s93+Yk7h8YQWw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230113124128-4a6aef1_1673613728316_0.6059982303405347","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230113124459-9049f4f":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230113124459-9049f4f","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230113124459-9049f4f","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"c230768d131e5925a023486f2c663100baa738fc","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230113124459-9049f4f.tgz","fileCount":60,"integrity":"sha512-H8JGKrCGgSifjFaFGQFww+SJllfs6Y8W9wXqdwaKL2UKBor4SfQTKSK3KGjTMezFuQLGPDRjtWcKZ+2ye6PH+w==","signatures":[{"sig":"MEQCICYOhkAzid8+vgI3KNeHUFGb+ybDjBgEyNHmuaqseeeHAiAkeMj6p0wpjUxFpewCdm40FZuwrq6bmO5rv5FozONUEA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwVJ5ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrCZA//XZ/uJ/ycuTYQzYJT0crNItjXFCiwBS5GLeoqFolJBTotVsKi\r\nc6OGY0tMiYeAoVdW5FqjEBmpVTlD3ucNmXx4C0Kqg4A3oMHMM3myEoHaRK8P\r\n8T1HgsjBmKU1sa5WWTu396eqb6vNhizZzXwhRCzCaKaYEQMfjXlCYaa195wk\r\n9P95PqSKNrNxwQYnLgjwF0my9V/TFqWrwoZrcffa+PMmcFZkcxO9naB6t1Y6\r\nd6CbWCvzQMmxcpT31MeUkDFAfUyvy4j9e19wQtJg0vJg1NZ0NZskHnk3jngs\r\nzXWKa8l0oH6iWZdQLRXOIJti40p9dcJ+KDSG3lFKqyejGzRMmVF2m1tVCsvw\r\nD5z2+CEIjDkIP5sa0A8LSD34gwg6iB66nHjka3lcBULRhqYdhbolcWBL1GyL\r\n7+IR8OGQH8YSkrRYAoqOuZfPpMa5Sl1ZUVMxz3xxw63GB6o7NgL6TmIocVMH\r\n3YQXLqcXzw84ezV9yrq2GFfAg3qNdV/j0Z4PKZZ1sgfDVn8XnEe/fBFTjXPN\r\nsxBbdwrhyk4LaChUdCj24TIxWeWdAFu1u6ghiHQIyhM/bRR8g2G1CcgSMYf+\r\nHiyxsfIjZOc/tt6hGKtEkdrpfA2P7g4cNfv1F6t+wdAOuS4W8FHDPeI+qEmg\r\nrW8oViSvLQhbrdARoi5nFY1vcw7yZTHH2YA=\r\n=nJAw\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230113124459-9049f4f.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/29cedbb6bea1787a9908230b72c99345/graphql-hive-client-0.22.0-alpha-20230113124459-9049f4f.tgz","_integrity":"sha512-H8JGKrCGgSifjFaFGQFww+SJllfs6Y8W9wXqdwaKL2UKBor4SfQTKSK3KGjTMezFuQLGPDRjtWcKZ+2ye6PH+w==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230113124459-9049f4f_1673613944857_0.46437236646478963","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230113124844-6f9cc14":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230113124844-6f9cc14","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230113124844-6f9cc14","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"c67520c4df3f7cea461d98aeff00a1903f57e85f","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230113124844-6f9cc14.tgz","fileCount":60,"integrity":"sha512-7tCbjStSifBEdFmYUBuI3DkVuRRhK4cQGLwxSGJAoepi/O8CA135yhr8zQ2v9kYa97vYMqE8Vvk5qGHBzDcxCg==","signatures":[{"sig":"MEQCIBaBtbGleAd8JPRcEWJwtHCYjZpM7mlWfd+tohUrbnO+AiBbQtG/XdrzrbR3EqcYF2OeMhtrIEWehumwgRl4lBwULQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwVNPACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoxeBAAhUksCbIEZQB5ZVxcPzFfLxByFW8p+fAYreTbTGE9od02I1OE\r\nhSSS3m72ynloX7DQ78APHb4/uaKdad2kpqU/bfKB5DEJy6bOc83WbZ6sjZc8\r\ngxebJEM02QkehZKegzESJAEowsc3/3yJnVKQr4aepAn9stddY+5HokXQEJMo\r\nSADpKJHWlh1v/89ar4ggsYKUU8UYmEtH1M74GnhGLsw0PrnbaIF8/r+WPaXu\r\n+8Ur2lfP4xQqey+NxMOxBIjnZpafg4EcR6BJpfpMlPPDpOMwneIJrs2I/o/P\r\n2B3J+WdgawDX0+sUzm/ZplwbcAHKzK3hQZ1uiQEJbVkuZCr2UqQ4enD4rNBV\r\n/8cnMW9uDlPlEgWnYlUomqhSXJKU+H6Xg2yFLIJH4+k3vPpzkkNtcLyS3Ppd\r\nLdCSGY+yXixCP3f/73ztXSEwgq8Gqx2tSuFrJDnWR8ksw3DDJLq3mlbOT9x5\r\n5Tia581zMa7Bb5VTndxHlosKvXeP7JMZmD8ENWCV4cKL7t0x+Sj4oWpVzhDq\r\nv6ZhDcUDi4TUorpQ8Ii6nJFKWn3QAIEhCa8A5RtT3fd8fZHN4P68LELIAFjJ\r\nmY9iM7QsbDFFLLq6R0adTQprXHTV5F6/TWiaGWKwfpqaPKjP4O8n8ZLDEb24\r\nSvtfBZX4ywg1p1LZNJgsEdg/IXhKKSnaCqM=\r\n=gc4q\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230113124844-6f9cc14.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/7f7e720fcb0bcf16e523a55208064e0b/graphql-hive-client-0.22.0-alpha-20230113124844-6f9cc14.tgz","_integrity":"sha512-7tCbjStSifBEdFmYUBuI3DkVuRRhK4cQGLwxSGJAoepi/O8CA135yhr8zQ2v9kYa97vYMqE8Vvk5qGHBzDcxCg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230113124844-6f9cc14_1673614159473_0.7505969713106662","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230113124857-e3bdecd":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230113124857-e3bdecd","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230113124857-e3bdecd","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"dce0593710985add909a060a81c8debfd67c8733","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230113124857-e3bdecd.tgz","fileCount":60,"integrity":"sha512-pUKef4GyyIij8R0ZIpvtj414TmPfqRvt1RgiJng5vjf9vVIqonTDWxhtb88JAzwX4ychyA1kfhSVc4UgrI9Gfg==","signatures":[{"sig":"MEUCIALp9Vij7+1gLgEa0KV+tEhef4QRSR6/XOnMUMi/yTXhAiEA7XA76rmj/NvZtxXTEbIA6igs64hCjcpjG37vJsCIqmM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwVNdACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqX6w//aKl2H8lYTOIjx6f7cO3McRquiOgc9r7eAmedOEN3FdFYdeZW\r\nfAhp+Ixl04Pjj8KTmQJNwXXZqKIBn+7zSjQSIYsI/mx5xII6AnkTdjo8xCvc\r\na/gqF/eI8942d5BcV6WXAUlD+vhXvZPEDP/3RnAdQq/i8bs7Mx3fu8vL4Tt9\r\nLdYUXtZBCPNf9VtWd7heOmKzpD2ejjoawKPWzmsgKtnC1RA9Z27FTwGIO2Xo\r\nV8zWgPq0aY/B/Eqd5LLaNVP70d2pXjxsQGtWVZ5i4jYdPA5T8N71pDuZEq+e\r\n3nQ+UZrvS3sPbP+LYo6BxpWjtLIeY33dcj0mA4yaF2L1GpJbZ8qWXGZ8Dmri\r\nHnBO9c55nwLKUflwN3b6bauq7elVGEN7SHlWQKmCNdeHRcJ/GmQjgb9XGm9T\r\nB6qnAU6abLJJ0C3/udWVr269ccGD8WJXjIJfSt93HT2mkN+m2IwApA7DRBII\r\nYRV5lLz9yowPPANFj64KoniATFqRD2qoJsgDMizvch+tC6RKbQBMu8Q7ScfG\r\nnGSoh/cc6yigVsDS1LRSr7wjSTc5twheOTiKoBm11iceZtVEuoSKA1bYibJU\r\njljcPeZqs/8Fzir9L4mN+JOE6Vzm4Lq4JkpwCa7FcEMYYjolkcY9uoYccZFP\r\nmhj5XVFshTsNfQAy/LiRUt3fxqToQXB53Cs=\r\n=Cqjy\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230113124857-e3bdecd.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/9f6bf23c7bf515022fde55c2f1141abb/graphql-hive-client-0.22.0-alpha-20230113124857-e3bdecd.tgz","_integrity":"sha512-pUKef4GyyIij8R0ZIpvtj414TmPfqRvt1RgiJng5vjf9vVIqonTDWxhtb88JAzwX4ychyA1kfhSVc4UgrI9Gfg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230113124857-e3bdecd_1673614172945_0.2378419810396437","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230113125443-66f855e":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230113125443-66f855e","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230113125443-66f855e","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"d358690fab26dff176d89f44e04b841f5a028e40","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230113125443-66f855e.tgz","fileCount":60,"integrity":"sha512-s8Ye29Y1zYvyXEycOLoeRibO5VsMwCvIGvYTfWWdGpV8FcmDH/4W7UtmHyh4xooxRp4CHS8+yalQiLNpVHYSXw==","signatures":[{"sig":"MEYCIQDI4YQXJY/anis4NZ6is0QHOwfWgFSBE+9Q3OeEG2R5LQIhAIglM1ncMyZ5hAZI1rNPS0Wm7cwhd5xrU3cDuyN7py8e","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwVS5ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqbSA/+KMQGTeGnLEY7W1I0rszXEnmATHx8kdQyOVtL8GwIE8UrN6jX\r\n0LWyg2+zrbNTcsn9KiRQWwEGzDhlwqpynbqOeEO3qVnONR7rnN/JiHnedJau\r\nxWlNbRHTJImnO6yoGJ+iafN2sqo6xmg2PoJLaj07HmmjxbpJD/8VaBiLHG2Q\r\nAcI4oDp6pDDEeSAbQDw/IGPbLMruQWZ+FNe86tnT1R97h/QIJEKWRPJzXwSN\r\nISShWQ5uJ9xrZUFz1NM3/gUKDYLd31I2ltPauzd9svsaPO75BSFZEi8YoZks\r\nm9fxVln5IzlniJvOwZ2RATHtIFOgDEGEyuynwji5vY14JW0Ye/JWuHuxTFj0\r\nqkGaGFeW8XFW5Ny6CG7IufUHb2fro//sU5iQzvE3KuuxRQY5j6XMhBK0Nq6j\r\nsjtH7qAdsPPSA4+EhbuhxbNO73kcUiZB1t/mnDCRd4IVzXQZbTSk1lbnvLFK\r\n/Oe25ZoUEj2quje7YUeb6p3ujrV0iOYXEn+MJoZruRkdBIw6MxYq7FwaUFJj\r\nFm1HWKYo/fVh4NTm7nDNmIIplV/Hyrx3XtWrAFEHB5s8Jchs6uXxsYnPq2p9\r\nWg7lgCp7fqZ0e5dayhgEbhoZKIU2ECjWux0EaU9Ac9NBnkWODn9+pChkT9L4\r\nKwd5GHZoo4fmC1P4zx7R6rZhnE6atl9aPs4=\r\n=6hgO\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230113125443-66f855e.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/84445e5bb03eb0d6d1cc13fdb5f29c13/graphql-hive-client-0.22.0-alpha-20230113125443-66f855e.tgz","_integrity":"sha512-s8Ye29Y1zYvyXEycOLoeRibO5VsMwCvIGvYTfWWdGpV8FcmDH/4W7UtmHyh4xooxRp4CHS8+yalQiLNpVHYSXw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230113125443-66f855e_1673614521168_0.21328166472118482","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230113130109-9373edc":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230113130109-9373edc","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230113130109-9373edc","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"f8b185eb65cf91d3fef9dec6bd951d69d3de21d4","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230113130109-9373edc.tgz","fileCount":60,"integrity":"sha512-7qffOP6oY5LDuQokI49CS2Dwo7tE9nL6xdMXMF9LwzbHpB/ow8edNniUPccXdKNhOA3uDAP0KRz+HO346sTaww==","signatures":[{"sig":"MEUCIQDQk/tqfLjCBaqkEoO9EU9rSg8Sqspc7TAVxNbGsWr4MwIgU/FPkPCrb1BpEHwncSJpn8EEmFVpXYENnTkupxEp4lk=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169643,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwVY5ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoT6g/+IbnJQgrfICX1PdSch3YVzpOu5lYg3opy+oHty9z6H0S0S9OR\r\nCOM//1i18dzsqg4Axe/fd4tLL7VsUMDLEKMcA5W2GF8I3ENKeqiNi8y61OM/\r\nNaSF048WKI9+1dVcucAMtUEU7mWcOIvs2C2b0gmaWrg7oYv7RIVFd4yrPPhm\r\ngQknecvLPoMP3I3yCnhBeVVDMHuuyKMY68GAW+rpUvIwN0b1J+Pd6nSXWeM0\r\ndK/q2DPUQQOuww7pFL65R7aesJs02VmeXUlbZazPHmYwBpVWCwhL+SYYsH7e\r\no6dF/mVPJ5t+Hl+3YXJlhVgn3WuZRKUWSMekWBe/RRsttV8hrXghP49ebkee\r\nmDKXzWoSFwpCpO2nqIZtMkVWHKHhtoKgos0CIEOe1TeX/DkZ20ORGJyYiSn+\r\n/3p6ueubz6RyUKG2uKnHpdVXA/dngZXOOmbQWK6fxBl9B9mCH3ebCV8slEMq\r\npn4P3ML5Wzb89ImQYwgR5iD9nWabzXKMyQ9+bcmTncs9PYH3bWp8+3HshD87\r\n+tAPv6zCjf3OkQz/mXPEFT88u8zYniejvgWVOm117B2PLQ8HxfYqISUbGaRr\r\ngxrtY6Y3I2A3nIS6hL8VxsV5AyEAxFVCR8VvSTmUbmoiEvdIz7ElTxx3/9E9\r\nCZBxUhk4Qs4tpHDTdKUWc5K6KRosN2JNGzA=\r\n=9AES\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230113130109-9373edc.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/6edc6a34c53e21060f2410b303845edb/graphql-hive-client-0.22.0-alpha-20230113130109-9373edc.tgz","_integrity":"sha512-7qffOP6oY5LDuQokI49CS2Dwo7tE9nL6xdMXMF9LwzbHpB/ow8edNniUPccXdKNhOA3uDAP0KRz+HO346sTaww==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^9.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230113130109-9373edc_1673614904868_0.4791260999077309","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230113130623-eae9376":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230113130623-eae9376","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230113130623-eae9376","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"1344f4a36cce2e571b2bf0270f7e29949751ca7d","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230113130623-eae9376.tgz","fileCount":60,"integrity":"sha512-65RtpDsShrxyLB2wGCWfXsQ7MSSpaCv1TWYrel9rqBXtoKyP/KQfsW6reaPW8vl85zU8KGIbaAiRdC55VhnYhA==","signatures":[{"sig":"MEUCIQCVxa6n0+jRq26yrRPDaWPMNmnvzZ4nOGDp3eldAVo8QAIgWqaUQYg0RPLNQ6zqPezFyGMM0HH/DWEeZX2EjiCyUWY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwVd3ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpfbQ/+MZrMbIBkAbIGawcfB1ZM5dMA8qt1F0K6RHZfB+f+jabrTS1L\r\nkzRjTBIj7BblJAm7RCabWGCDnV6QrUm0k5zZCt3GxpUM7sROmfoCt8TCFIPO\r\nkL8LVKM93XlecW4BuZ+Gw0WgQ1MOZl2YFNByK8iEgULTdTBea4HzLWLUC6+R\r\nH6xX/+56+ad5MDOL6WlitS0578UqZ2Z+dBFZMbZwM+LBUTi0MCCnwyKUlL2n\r\nDFO4Fts2P0SNQC7bFNRzON5u8MiHcSWj+4zHme+xqszwBFAfAuBHtJlXVqaC\r\nTIJrFW0Pdr8mrVAAif4Cqn951nI9A+wJ8EpzLbe/STIEPvAhIsybk2oz+iBn\r\n5C7Gq3Mhk9WHG6MrhVxApJpJdGLxqf+GQ1A0dpk3li39q1rs81rfgTABHnZJ\r\nffrK3uyUyR0nrpj5CIONtezViRf7RamhLLDuBMowxzoEI6bWT0EoYX41sG/X\r\n7sdJar0QHrGd/2fUYlprfFuNu6sWOtH6C427kQH6BjyeOo/MJ4D1ieGlkSsU\r\n02ev3C3KEc2WrS/XpnrH8J+fPMTl5UjD++0ey+mXHFufDAipHewoVdrM7stM\r\n7urFUEC6UXzhwcp7EE1cQCc8xum4FLakI/JgUsKdE0q1ZCx9FrAm3DDAA2Dc\r\ncoUZ904my4CTGK94413YP1yR/Y41FSYdEHQ=\r\n=/K9L\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230113130623-eae9376.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/d4c3c390fbb20cd76a0fb60eba1abd60/graphql-hive-client-0.22.0-alpha-20230113130623-eae9376.tgz","_integrity":"sha512-65RtpDsShrxyLB2wGCWfXsQ7MSSpaCv1TWYrel9rqBXtoKyP/KQfsW6reaPW8vl85zU8KGIbaAiRdC55VhnYhA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230113130623-eae9376_1673615223321_0.4512159748311386","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230113132905-a1586a7":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230113132905-a1586a7","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230113132905-a1586a7","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"9113cf2f8b7d143e67758d041b39223197e34e21","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230113132905-a1586a7.tgz","fileCount":60,"integrity":"sha512-uXq/8kOTyhMChQtTUSYKSkmZwMnNL1EDj7iGJZdq1IgZOIpclbMdaRX2AymESTgrFC/AED08j8LCJYeeS6YsFQ==","signatures":[{"sig":"MEYCIQD77xLq0p7YwfXipF8oMp+vqiRIe4OykyjfmDYG4poHUQIhAL+5Jf8y3AJE5OLym7n8bIJAI1KdSYLUY2dMOhED9w3V","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwVzEACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp73xAAg9u9oexwXYe/kVqagKMce3jlMT3l6vraab/bpiM7/gkRnrS6\r\nPYy7/NL2dFWr1IjjAEPC6z2WuqMkMowGKeaOLkgbaNHkCImpSFLA16Bj41VV\r\nuYvC1/JdslTkrp7i4sTyPG9O0ne5s22qSp5WiGAKDHvQz/Z1myU97HIjWGDh\r\nvyp0S4LYo3ridp/V+vRFVXgdGVFEBLGQk38yBgTe1uMJLNUSU+1C+MvRcLIh\r\nGSBPIU2ggWVnB2SOVyvPlTd0GofXlDrsyEGuUhEnb3AxP04pXQ0XZaqGslep\r\n5pK8f75yP5wrIEwKWxO8CdO+/ps4zv8Vxw0SFvejHEhof+MplU7PRachrrMd\r\ncKDlfco1dmbjUsLxImi+CAyNru3xoCejVpA5kGkwaQkZxVqfjo7Y2djg9THr\r\nA7mSzFMPX5zd/2M4X8av++BAWbGvJFdPvo1S0HaRjTyWoJ+2emKM+UacwH/m\r\n0zQp3chaiFsNWp5aHUQRHetD39upudA4z+PRz+W5Fl2zV5RBomqLWHpo5k1w\r\nIDyUdey5kSTMj3TGmAtxV3ncwJkuptUheQu1STP+BPbxAnWz/lZSlFlLEvZc\r\nbTzv6C2yDAkBhOoi+/CqvSWF986Y0HjX0qllax4b40qRFLB+/Rm9UxPJ+8EE\r\n+HTUU51wDpOB2VF4xMC5D3eU99NQ69BLXu4=\r\n=9UyQ\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230113132905-a1586a7.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/e351af118b6d427f31f03244a8ded071/graphql-hive-client-0.22.0-alpha-20230113132905-a1586a7.tgz","_integrity":"sha512-uXq/8kOTyhMChQtTUSYKSkmZwMnNL1EDj7iGJZdq1IgZOIpclbMdaRX2AymESTgrFC/AED08j8LCJYeeS6YsFQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230113132905-a1586a7_1673616580495_0.400072156092224","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230113154643-404eca0":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230113154643-404eca0","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230113154643-404eca0","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"db08ec8e04c27e8a763b8f197766d88247d7bc1f","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230113154643-404eca0.tgz","fileCount":60,"integrity":"sha512-fjmHKluH7QVawWv/6Cj1hYBPvUjuSxEOGsPWu0eVxRNMYGcRdHQ+KwL3pjqb7s5LbRRzkqW5If2a24O9JZJJJA==","signatures":[{"sig":"MEQCIAFZUQ333kNPNCr/10MrrrqIDx8SOcBFCRXl3f7KKCFcAiAI0LgbJZCDq/eYxF0OJV948QohgNjpb8bDW17cE+wZ6g==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwX0GACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqMOA/+PnVxMQGAeygAYAS49baYILKEc4Sg0Mix5MMWrCVpPVFZgdWP\r\nrREAobf4sANqkacW37q8CJ279fdxBI0WYeByVV2mkDqrpLp+QTOOkPJ+kbjO\r\nHNweHyHUIkVRFs61keeFtkrbBvyLjdfF9QwhtJq8/3tzpJZYaI11twp/YWNb\r\nVGKG+nfG4NT8OAY2APl2dFvQk0q6BqxodSsU+XbZJWNIqH+5mc6M7tOEFE8K\r\nDCAfbOcvWDlx4hPQxKIdHLgn/U0LRTp2XRx31wYYAhBee8p0L75YPtMXukpU\r\n96Ps0RU4EP3+d0eZU+AJcySwVN8U1om1J6/azxMdlTX3By1D7v1n5Cp8Ld5a\r\n5WXz2jDrTETE+zNs426xy1UTaaPcmnpMyKIRwFZ4Y7dGNwwpiLmfrVlCjXV4\r\nZgaRsdCU+5mBqWdbD5JsHiJxpzKzgaTN6/0xKaDYl/d+ZupVDXE72HgYHBTq\r\n1g115ioskxFUY/FYSw9EtED+lVlPYrgZfibZwuBs+6ar2Or61vCDZxXnVIEb\r\nSVFs/gY880DP3VvcbazI5jQ+05GNybDRuBCurUy5lkyaugvDD1ruZwFnLYCF\r\nYe1Ofdf4oS3Sl4M72t5hEAjS6e6P3vASSZyJuolCBJ4oK3egd0cQEJMFqRBP\r\nBmOGdXskYKHxxLiVGnVFhR256fthFF8CtJw=\r\n=DzGu\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230113154643-404eca0.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/98f6eacb3ebb300d76eef312e4e35baa/graphql-hive-client-0.22.0-alpha-20230113154643-404eca0.tgz","_integrity":"sha512-fjmHKluH7QVawWv/6Cj1hYBPvUjuSxEOGsPWu0eVxRNMYGcRdHQ+KwL3pjqb7s5LbRRzkqW5If2a24O9JZJJJA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230113154643-404eca0_1673624838764_0.5337024028565103","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230113155946-1631c2d":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230113155946-1631c2d","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230113155946-1631c2d","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"aec0bc0ac76fb944f426f8f82da7cc59b22e57f7","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230113155946-1631c2d.tgz","fileCount":60,"integrity":"sha512-UJ6N0+clzpQgRMs9HI1OzJynDHZkw+KVTY0VVdX/79+Yn1mv9VecJAMP6xZ3I4mAkx4nI1MFgZ5Pv7/dYZ+/AA==","signatures":[{"sig":"MEYCIQCa2QtdSDqSRKK5/eiVzPub+bRG2S0kkiW2GLUFXoSpFQIhAMBsS7NrsG5fn3lXpHORxlLV216bg198rvkByvfS2wlM","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwYAWACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqN9w/9ESAFur53TPfJi0JpZO+za6lmkvnk+MQIM6VBH2jIc3YGXccU\r\nTzRafH0j13psDtqkK607xUH3htnpFPsRKloaRLE+VX2jK4Mdfx1yebjYFyRG\r\nAhTr0Y8pIZ3QzBphGycLEJrna9ePM7huV7ov1Ek80ymzmc6OeCkeWHJTtntj\r\nV+GNNbh0aEhwq3JtUoPwnTg7Y/jcjUbfIFQmrqK9KCM188SJRrlJP6RNtRgB\r\n4OTO+5qzSPVFbbWAOqGWfQcr+fARlYIoQWn9dHZcO+N5ydqEH8UvTMo5Nplq\r\n7CMedHsR6SCYi3fOSBRy2UPEDhdYD8j5+mOrEmaH0QIdqdzDelty0srhZQQz\r\nRc+OTEhzctgLlRR4bYsKy0QloklwaPnMIGGZC3tDEMGubqT6T6wNKoDmVOwt\r\nsi2sG9tPRsQ1fxeIkNrD8GEjUESlOo0oy3vOGHF1HzisbqL9Oj90kMwRBpPo\r\nj/IMkxvgmcAx0TGGl2owd/7SUgJJ0+LX0UlnfswoOssuLY3LCZi6BpK+JGcc\r\nEqRCgYDvEisUNi5h/QcPNGIWPwpVk2dv9xaF6NN1KdTA1D/eDoStu4khXkDy\r\n/Iv/ysSOoK6YQ2BYEPLuGRWHUV/F0xHnPT7fhjXCMdeQwDYTlktoKD+4JQ5u\r\n6KgBoiUi6x8BU0Sfjkrnoo3uawjpesnbDhM=\r\n=O4ff\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230113155946-1631c2d.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/c9e808c2af4915a4f2593d0fb1e18ba8/graphql-hive-client-0.22.0-alpha-20230113155946-1631c2d.tgz","_integrity":"sha512-UJ6N0+clzpQgRMs9HI1OzJynDHZkw+KVTY0VVdX/79+Yn1mv9VecJAMP6xZ3I4mAkx4nI1MFgZ5Pv7/dYZ+/AA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230113155946-1631c2d_1673625622096_0.5965199706591864","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230113162208-5e59624":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230113162208-5e59624","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230113162208-5e59624","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"687bd0907e4ef4dcad1833cd56650d7482838d0f","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230113162208-5e59624.tgz","fileCount":60,"integrity":"sha512-/hzK5hD8itKJCiKsZR+i9H62gc8CwoWad4oohoyQk92Ec69imLyt5NfFb+G4NY0HWDnP8IIQvEv08zKouPX3zw==","signatures":[{"sig":"MEQCIFiuRNatxrtJU6OOhA5+bGwmU15FCmmJ4CIfhtImgFZoAiAbWflfppoyR2iDveKK99O+fiYErfnl2urmqrAcqQwIXA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwYVTACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmooEw/9H/mekxx8EkX2rivb4cKHE7rDWDMvKzRbECQ/JWWTh527e7Ei\r\n5vGh9tvghTY48Nyiest4vKbwYsOv9E9vK460L/gh39YiWgV6XUe3TFOLYKI/\r\n4XQd5g/L1d+/VjtziA3nTe9QiArhvKsQaOLzSRwNkKgMxnX1B+zTnB6o14ov\r\nSW75+JLHg69CJaEFwhk33QPetttwbCPvPkEi0zUKlJB9xz6uWaAFJ9q/B4n/\r\nsVqDU45rJHGe4eNjxP14wBu2AUpMe9V5QwqML8mMVNva3jkS5eA0oldAv816\r\nS0cYcZ8W7lbL2c00IrLYb/WVceclNNjv9pdZPGGGc8DMwnMNrkSHLYrQU1TQ\r\nZt/zaBieZyywj4/PlzyAQyDv93hPKjF/QYXUNg0KJJbL1oPYQM8/YjLP2jZ8\r\nJMvN//V/BWhFnlgm5ZlufynCnPZwGjvjSGximzWMqeXis3SELrlHe7twtSBM\r\nXyOBT4GyYsqA9La+oWqjW0nu2V4LFATpoE55qXlpBxQwPMg9nQe0MOZ3bR8e\r\nd7U82AH4wZTXO3DVzmECZfpyTlIyaO51233X7UW7MFx1GF9+vXKaAnW30hMX\r\n2glhB8buzkS0XY5mE9+2HGldGF/3bW8FXDAGwuItdbBdQeBvGLohoEAr8bS6\r\niooKEEjXGKxRPRjDrP10SkgxEaL01UBbJZI=\r\n=p+GX\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230113162208-5e59624.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/08a0006a95876b879d7e5c79bd2aeb16/graphql-hive-client-0.22.0-alpha-20230113162208-5e59624.tgz","_integrity":"sha512-/hzK5hD8itKJCiKsZR+i9H62gc8CwoWad4oohoyQk92Ec69imLyt5NfFb+G4NY0HWDnP8IIQvEv08zKouPX3zw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230113162208-5e59624_1673626963072_0.6452556204938051","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230113162359-6cc2225":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230113162359-6cc2225","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230113162359-6cc2225","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"446d24c1cf57da1c7d286675f4d9991266a6fb93","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230113162359-6cc2225.tgz","fileCount":60,"integrity":"sha512-2MK7PvvI96sGYRNE0EaBqC2G84QBnPOL7BeF9gYvE8AALd3+q9SUoLWjALA/SXX9NikTS9pjrzEOLZ5PvZK/ew==","signatures":[{"sig":"MEYCIQC5gBDVSz4HsCPfdg/Ja2sDZYovsv/HScuC57nIfUdvzAIhALwgbfdq1rTS3iKLzRXp8BnMhMGLEaYH9hdmo9aAVL37","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwYXJACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrzPA//UPUuMsM6KQtaxgeGATO5x+rUeaEagsuH/P2VkNAOn4FSH2l6\r\nXd8sDSq/iZI5wnkDOQQJWVzFS2flDyrPfUxhQhlloy7CqoqjpHJUbUxTP0EA\r\nNg1/LmD9yMhHQSYrejqistjcKKCa9PSx/pOxjPEjMI7yUk90VAJzzPomjFlQ\r\n4hKyxQJ6Nc8TRLFONiqBOi9PBWNGmE0tgkY/4Fu/K50aAw/KcUTOcKMkkg61\r\nuBTpv5FJ/lTk5DZKvhYrw7eHuzRaCTrvzau5jn8dwbj3jhMr7kIPIcLEvCfD\r\nHlFFM716KDip175CFNcduI2kwTU3wrgwiGpjcQ2YJH9PGF07tCQ5Y/afRXwq\r\npB0UVAPwdIVkTA/0fGPENnn+7PBqGLyKemjVEYLfuxLRJSXputtrfvXMWody\r\nve3fmsE99Z7VzjI+9Szar6yzNucyAH2OXyFT1h+wlPMa5R1VBkWpKAdTK/yl\r\nI5iqEce3l3vzDBQBL75J4FcmeX9Ok2nPaChmmAgRS7yL/Rqqkb4Vu9ib2b4G\r\n3+Yvn0xXZcLMqcK6snTsYi5TaakwO30Nyl3UnlzPctgTO6vlXIi6Sn9w7jz2\r\nDIo/B6cwjruCyzRlee7Ya4KiFaqJ5MhsEuOpeOSyVMo6vFUF+WYvcvlaeZT5\r\nlfiYaBh3GoxC2MzwfG4ZQXvMdVWsonrjG9k=\r\n=kRsO\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230113162359-6cc2225.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/cc319e038d03687f0250c243cda6650e/graphql-hive-client-0.22.0-alpha-20230113162359-6cc2225.tgz","_integrity":"sha512-2MK7PvvI96sGYRNE0EaBqC2G84QBnPOL7BeF9gYvE8AALd3+q9SUoLWjALA/SXX9NikTS9pjrzEOLZ5PvZK/ew==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230113162359-6cc2225_1673627081124_0.19735377967689893","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230113162538-bd8eaf8":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230113162538-bd8eaf8","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230113162538-bd8eaf8","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"460ec9ee7df683d9d3445e83ceaeb67e81666672","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230113162538-bd8eaf8.tgz","fileCount":60,"integrity":"sha512-8aHE6Wz91VnM9Z0LhkM46Cg00BTWWXXtWfXmplq/v2M56Zywjp+3n7JN/r1/vliBOVq6zi+lfHtBBYaGTJtdRg==","signatures":[{"sig":"MEUCICLQAhKdIyJfGAY4xlShSo7Twb3SDX7op0NxAEfDCf8JAiEAylSDM1y4mKg8+gAhRXueswkTNZjoPxBiFd2huR7CMe0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwYYnACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrEJA//QgIlZuok42spvjbE+mTpwrKux1k1ndkcYAN5wRbUYuPZ1OP8\r\nc+cl+BfzJIInQuchvTh4eA92TkgAVIVRauiT/sEUf2FZWYUgqPHcm8zuwW1P\r\nDqv+XuzHdqcTvDSU3XaAAxfH8II1OUbsfuIrv1VvHBPsJ1y9tGlETvB0bIzv\r\nY36uLLw1sfUgdKHL4HX+uJzSXyBREsu7frk/Zqyx1HlAhsa0+y6HPV9Kqvi9\r\n/kFr2fKZUTpeHuCRrQeGJR7V6cs36BmxwlJmM9pG4Ryy9g9V/GP6KP7IF86G\r\ngK7T9l0/1J0Bf9vq2PEx7T0IEZJMOAutupQ56QRGFfMdWx5wUECIBwKCuNMJ\r\nTSVMVsfWa8Cq1wNvqlq4olQ+zq7q8/fgTlAcMt6qs541cbB/IFiozHiadb5A\r\nweqDJU10HB8dSwfvC2iSDCYR0rzet/M3lsPQBZpuVeXVxsQPSaJK0dgq/ugO\r\n6+8Ot0CUc0oIUBmD4VlvyJ58Y7qX/781OenlG78cVfJt0cW/PcPI5tl5biym\r\nLOxfULbzuleO0FS9Ee2utmOubvpcLEIHJ+OdDzc1amt/PeFQ2vlCVntuYnxl\r\ntKXY0aUmwuuuEqDNJZRKodjQZGpXyzrgZbj7GUTls1NGmbkXj9j1s/0YHKgK\r\nalNPMCfAnbqrXcGlKXMks3WGd5gTtuxKN8E=\r\n=cX6f\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230113162538-bd8eaf8.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/9716243b2f0fb1b29fc5144b59473917/graphql-hive-client-0.22.0-alpha-20230113162538-bd8eaf8.tgz","_integrity":"sha512-8aHE6Wz91VnM9Z0LhkM46Cg00BTWWXXtWfXmplq/v2M56Zywjp+3n7JN/r1/vliBOVq6zi+lfHtBBYaGTJtdRg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230113162538-bd8eaf8_1673627174988_0.48823258305430617","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230113163003-2fbc4d9":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230113163003-2fbc4d9","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230113163003-2fbc4d9","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"305b788d755c8f086dc7300fb0deaf28fc9eb31f","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230113163003-2fbc4d9.tgz","fileCount":60,"integrity":"sha512-V3j0NjzcbuV8Z3lfIttBXxihXZnRh4cppSLwB5AoEx9Ewh0Fw749q/0xg50ffWWZdq/Sm7/62yDnaKZW/EcFiw==","signatures":[{"sig":"MEUCIEuf3X/chqaxfSN9TshObiUkWjbS4AXNnAd4zxTzEnBRAiEAnx6GecDxNiz6tUvswPiXlDFZajEihn7vJomiE/oowo4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwYcuACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmoe5A//XXrZyqSCzx8z4R6EDGVtKfNx1n4Vyary9KhRcMfMt4mw/XiW\r\nag4l9iR6JN8w3PfDD4MAaCyPbp7zG0oleKxdSvxZ1iOuYXVLIR95RUzWfuLu\r\nnAL0Fz9TdTy5f97rH6VDV/Jb7uw5tJhS3GgewB8FmFl1CVxT3ngTF9Fime+B\r\nF2XvxLtQJjgMdkHu6XCF5cGPRiYewBuiZffBwJ0oE5ZOLQNOUVNI3uvS7z/p\r\nVD3H/cXs00OObSHzU5fRSU/GHFFo4fDiuopCKM6YgdgBKT2Oq6UAOyiL8bIy\r\nn6wuu0zlX8EH4QBX4Wl8vG20Dl98OHcAhzOAvkitOQ9rODn4jeDAW64qkKEb\r\n3BQ14L7jRKQF1q+J3f7qk6lpULzdRsuiwAt4R6A0F2IRSb3iM1SK0IlNRBT5\r\n3YS1UurP1WIDDUX9E+pB24jCVYeH/SJ7Y1k0p7QzVf/+TrO3FVvcYPIyEKd3\r\n+o4BDrQ4qNAWscJoVAa2PIkmH4S09VvfwNivbMo1VXusS80TliqVMvwHwrZm\r\n5fVITqUyGP+R5dqcy9f+xFowi/4wCvHgJxjOW7oaX4D+IWpkXxgqY6feu2Nz\r\naX60EJ5Ywaf/dGzPN91gNGgcz7B0UD++HsoS9tppNiLH6D2sNE9Qs8pO648o\r\n1M+/7ywFrmDFjPls42P5lOez+aMdQkACkjo=\r\n=zHJL\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230113163003-2fbc4d9.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/1b0a7697c67f810171321f432d95245e/graphql-hive-client-0.22.0-alpha-20230113163003-2fbc4d9.tgz","_integrity":"sha512-V3j0NjzcbuV8Z3lfIttBXxihXZnRh4cppSLwB5AoEx9Ewh0Fw749q/0xg50ffWWZdq/Sm7/62yDnaKZW/EcFiw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230113163003-2fbc4d9_1673627438439_0.33946584526890167","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230113163404-38ecb6b":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230113163404-38ecb6b","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230113163404-38ecb6b","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"c9675dde64f6cccf1696098007ba5419032d3356","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230113163404-38ecb6b.tgz","fileCount":60,"integrity":"sha512-C/hHPWfDSnJxzCfqaZ45oLj9dZSau/GigfzSwHGReI9/n8QJqevg9xJtDJEHcmbOEDGk45gPDqewjVYHq+w/LQ==","signatures":[{"sig":"MEUCIBruHmiXBt8SCQWu8rpxv1Gp7h1rZlO8bdZbkPqtprRbAiEA0YQSkY5frOaWXud7BfX8pKgoUahmOV/AgL5oP1dknUg=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwYgfACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmogrw/6AgMUoTMcv5oc1QwphU+5JnI4TUl4lmJ6SRk+w9a8na3keU71\r\n/+t5XrOorcQEYsFx3tazYMQ8EzW7EMISd8d29ZEXHWMHqlkFQZtHrP/Oh2TA\r\nbUlvaUEixBu885pQry0AYcD4ebC+SfX6CzD34hQXkaCRIXfWtCCryfbpqddj\r\nJQP+gVntDhtyw7vj4mtddF7OxmTmxEK1vRfB7ZIH5K2VjHuyRCA+YmU3DUmP\r\nMPVCFdEtAunhtyZ9aeyD/VmTmvWVSz0oMn77LGaIqrFEDDYwYswgWUjEz+1v\r\nLASlEqmrru/xIWVoq09/RXn9V15G+quT7SkLPZG3Y+mu0Y7uL86k3lkf13nR\r\nVL4SJKwN7pZg8JnkMzekuLaDFjWxAA/X6/xcw1j/MHwqdcLQZcA1HvHvgQVa\r\ngySZv+60r7v7Xaqq5zMHffGIOfqiu2kmmPFx2qVvlSUQyIzOFS+jCn6J0ch3\r\nnCTh56HDbGHVm3SNk4LISr8Th9egLqwzNlP24bWKevnB2xW7lcvXo49nJNNU\r\nYNIlCKLhBURgjRNtKENvWo3/+7WKGa5gP//FgnWpfTrRTuePLVFvD7m5PPPJ\r\nvD4uDonYvLymFLkjIxTItw3x48WjPC5m83C2orO1zUIE5CjXJTxfV0yKs5ea\r\njoPkiLVuqKv2PNTv4PjbCJkxUR1wOE6+Uz4=\r\n=VTMV\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230113163404-38ecb6b.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/aa3fbd9ec3d477180d72b2518c99d5e9/graphql-hive-client-0.22.0-alpha-20230113163404-38ecb6b.tgz","_integrity":"sha512-C/hHPWfDSnJxzCfqaZ45oLj9dZSau/GigfzSwHGReI9/n8QJqevg9xJtDJEHcmbOEDGk45gPDqewjVYHq+w/LQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230113163404-38ecb6b_1673627678964_0.5025049061314673","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230113164020-16105ec":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230113164020-16105ec","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230113164020-16105ec","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"dd16fbf001150f5cb4519d2b9f6f9876dde5bb4c","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230113164020-16105ec.tgz","fileCount":60,"integrity":"sha512-MeAFf5ZtOuAUpLgMc8vljg/PK4Mr2lpZ+MjGaq0UpL0eX7Niy4JSvrdVsrmP+5z9eroiMPRHWYt2JMbaDGy+rQ==","signatures":[{"sig":"MEUCIHWOxyudgzfQG0647tLncmXXtwzs3fTyYk/ebDlAlAdWAiEAyW4Z3B2R+q7Nv69TRmYxo9eTMCQ5RHhs7Gw0yiN4GyY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwYmaACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqBfw//R2/cIIaSHuPohuoQRko6cFdB7CsWWVnRTCDj42/Wbc4dct8a\r\nwgPVgf0wjBkt2vUEs1w93Q71ZxVLCck6CW2Mhmtcp0y/sb6dk0WuZ31ZF3rJ\r\nYg2J9eT7wfTqUYckHA2W7vcq/FVjyjRQ1UUBtzOs6RP3ZTNBzi4aOd0PCeOJ\r\neCJ58+H1pmVAIljKveMUtcuZnRCpECGnIYOPtV+CVYYi7ruqn7ooVFMSR1UK\r\n6gUM+8wFa9DkQQaikjcbOQbrLi/8/eA6ywXctWJYCovVTzgnCSR2V6L8YgAK\r\nWycfIUdnTGyM1Is+pG0UrHGTKKUjGD8MBF1L4Hk7JvkwzNr1JGbW8t1t1aD2\r\nN9Fo5Zy/4kOEGP9abb1zRl+RNh9CJOsdShromAL5oN6482lbd5EtN9szv07c\r\n5RiBZNNyXek44s5yHWAlthr+g5s9gjQBkaXNlI/6TtvFhU7gvKl7rO3p+E/B\r\nmfGhdXwosqfqUT6kWrohMIdTCVEFPt15FvufbZECTXtIvwfkIkH4FArf2ujl\r\nXkPFOhRv0YWaa08yTiP2tbEwDd+gANm9eRUfDbxhhT89ff7x6UZglLyyqkLz\r\nVPNBEoTeymwCuPPZv2UcPQMTFIMeIydZixHw/sGBRoWuyOFX9t7S4xujNUGM\r\nXg/kLoWqua1KaMFy+xCaD35LMLncjN1AVdo=\r\n=yfkO\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230113164020-16105ec.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/de20e3dabec6cbd44a9b28870845ff78/graphql-hive-client-0.22.0-alpha-20230113164020-16105ec.tgz","_integrity":"sha512-MeAFf5ZtOuAUpLgMc8vljg/PK4Mr2lpZ+MjGaq0UpL0eX7Niy4JSvrdVsrmP+5z9eroiMPRHWYt2JMbaDGy+rQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230113164020-16105ec_1673628057945_0.615787954887125","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230113164115-ec4804a":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230113164115-ec4804a","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230113164115-ec4804a","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"582a59560629632e9ea12c8cf0c19d94a98a712c","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230113164115-ec4804a.tgz","fileCount":60,"integrity":"sha512-iMte/YXVt3xIKXZDz0VY5+9NczNCnEIk1u55lJv1d5VplyOAQ7MWUDhfOn1jTSnobt5LvjAHiEw+NMUdql+dnw==","signatures":[{"sig":"MEUCIE07Nr3395luBZ+3912fjnLOGL0EYkwctWOkem7+rzkVAiEAzJBSkRHGQ1xts/RHHYe3s++BTwDgz0DOC5RjRbrSqFQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwYnTACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmqsnw/+IkvQMfe/oRZVQ/XY4ryuDPOmSvkazZZGl5sZtmm9nkkP47rA\r\nrKWpS0QJA74K94rRRmvX1rzRS4SC4n0WuL/1XC3fcRiPjCajmNcntNLa49Ne\r\n8bRY00cdSHTcj6ublrtX+/TGMPfyczHoY2wll3VJNrpxTio1aNfTxM5anm1W\r\njWwpGW8tROW+MhCMJDvkElJMBuBJpbfCr2G34RwOnP8Vn5NDr3iKQpt5X+rQ\r\ngbmPHUf5pjAGzzWER8CEyI2aEfGi3mYgrsHzk5cWYC5NpN5HjP93EuX8BEQ+\r\nxYg0icBkzhCSB3vwDV+ctoSf5QoeZ2WZBEJPF/nrRM6lcCIhuGKwRl7uWs0S\r\nmDCXiyzQoMzz1M2t3F2GVI7ZgO7S6jSQRK91hEz9+usa4F/pn2KyKETrFHiw\r\nqWwXkXis9HLj+DdMrTAeFGuwXKaBx7QglmKQcXSjoK89uGKb6Znj5mFM+fOR\r\nwJ8rovqKminz7pm0k61jsr1w1wZngx09kCZ/YmjFVpE8sYOMPnHfAMu5hVot\r\nw8hdE0plY2hi3wXPwaVDelSNuey/wfKmVMxbDKXWQWBhfpceO4GGBSkccpY+\r\nOLmvhDPyEhKBFQXmajz5DPYFrJvQESzcnVvd6Lo6+NHHW+710P5rIEyAbwzy\r\nYyOlB54gkgXTfuQ4pxXOXp2yEXSNCccgJhI=\r\n=pBoo\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230113164115-ec4804a.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/c491b28b99c560ba64ddee830da6873a/graphql-hive-client-0.22.0-alpha-20230113164115-ec4804a.tgz","_integrity":"sha512-iMte/YXVt3xIKXZDz0VY5+9NczNCnEIk1u55lJv1d5VplyOAQ7MWUDhfOn1jTSnobt5LvjAHiEw+NMUdql+dnw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230113164115-ec4804a_1673628114858_0.623920178066206","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230113164429-9314a74":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230113164429-9314a74","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230113164429-9314a74","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"f874855f80ae506deb6c65e595984881a5de8978","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230113164429-9314a74.tgz","fileCount":60,"integrity":"sha512-FgRB8WBZRWSMD8ezNb8TEFjHyrhIrmYHGYA3MUUqsP/P4xH4br1DfwIghjHD/7irvwQi52r4TrK4P5HQCr0OTA==","signatures":[{"sig":"MEUCIQDnAZ+WnBW9f+PoYokZqbmY04h7W2XoQPq72omB9MDTeAIgSWg+URfO0SjZOgXslB6nZ7n8lvkXu0SWQpQr4sZxbD4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwYqTACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmom6BAAkAsy/3hCRRtxVzhCSE+nDawhdNdWK6UUqJtggxlfTFGXH26F\r\nO69Luo+BOiRbta/1Cx7oIUR/VNJVZE1IRZOz2Cm+xW87Fsv9a2QvLhGAHxYS\r\nsCfTKWn4IaoCo9iY/wO1sSkleswfZ+H7CQ7ChFGF8enbI1dnnnhIygbNomwd\r\nNBEwAExiKo4B3Q3L7FPF4XvzAC0v1LS8fJiHI/5Ng2VLzVn96INAd18NzO2d\r\nG6UDn9C9ceeBE6uUrZPzxunjwt/ga1vLyZVBUjS+aTPPVYb20uli/ti9yj0n\r\nahCKoS8s+SFtTX342uCa+FMymfVClzx/ByT9O+GXx89CDcQRSXQRzdXDtX9V\r\nZ5MPnwxz888XGvE2NzBMVszvR8WbM4DHRwLE0nfL8dcFlka+PI9V/q5aN23T\r\nUAsrCtBzSxOzLDx8jtdDy5zEmlastmvzPtnlGt0L0K3OQyLcvs2EdhuzD54Y\r\nmkDCXMqhcEIA7US3iq1yD3y7iYpQCkiyD1ah9iyhYPZ29VZldCbhUjYDbjuS\r\neyjJgKK2ZevQmchbS8mFZwJDyf4jaIo3cOsB2fFfT8rICrXaDyeI5YygMxWa\r\n4rsqQT4iRIHcbUnCcic23f4GAc7NGLCVx78v6sTm+x+eBkdsu05GWBz9kxQ5\r\n1ZmGkdiEoCEWINXDC5VVDwMARhgM2rEAvFs=\r\n=vRaF\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230113164429-9314a74.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/d450d3e36a132f24d39ad3509a62a59a/graphql-hive-client-0.22.0-alpha-20230113164429-9314a74.tgz","_integrity":"sha512-FgRB8WBZRWSMD8ezNb8TEFjHyrhIrmYHGYA3MUUqsP/P4xH4br1DfwIghjHD/7irvwQi52r4TrK4P5HQCr0OTA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230113164429-9314a74_1673628307252_0.7498234205675536","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230113170924-5477d21":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230113170924-5477d21","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230113170924-5477d21","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"4c28384ca7f0734a986b03fbdc2626968c968c8a","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230113170924-5477d21.tgz","fileCount":60,"integrity":"sha512-qkUb/SSCrp4mYH490MMxzHOGHg+mCMkbx4cIwHa1oGLixNkGzQp2nhsdo2oo1ipvln4+4CjU1Tjt3msRKXsErA==","signatures":[{"sig":"MEUCIQCJOiIhR8QvEL8gnSUJUN3V8t1fPjKR65ezuu6hYHrfKAIgcNzUVPe1J3+aj1VrFVlvneLcDOY3JAWWhJEFg77YWLU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwZBmACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmrt5g//VgiR2yEMcYTP8Kr5ajqJUJSjHqiobwN25ZvMcNAIZ2QfyyvA\r\nThc+FphzjJL05i9o3Pf0Dutg5ceDJqtP47ZC4L/mu4i0bSdY143JMSaHmPsJ\r\nzSuGHuVyLbfh6XCHUAeZo3y8nGx3zqY7Q6FhJcVONVXZrUCdSc/mdjAZNhvk\r\nV8U6uzc3gWuOq9v3S+u8+Nr8RgRsabuzlE4PxcS7JoCN/wapt1P0zj1u7JWD\r\n1C+jF9JVujDRUy5Bfe+HSBTcY14hAA7IqbMyUrDMfUilUK3Kac4At+Tr6fZi\r\nBU9SgoTe5WOWT3qmh8y5L5p2iflJeicBPqzbstv7Vja9LaLLijrMLbpdprfB\r\np0I0MW8usaUBpMTlcufeunpoNZr3XWcPDnstLy6K8inSVZ5t4Jy335fin8WE\r\n7wcYVeV1AP3xoUlEo6LF+HUggAo0ezFQDk0Xsb40JHxPFajUk3Jl7+v9pVHh\r\n2Sf6KlVoEwN9+KqzKprSPpeP1Cyg2MU7oP+OHndU7uiLdxaWnx28Vt3kN9um\r\nj5lOvpIYTd5AiaO1ZpUYhwBdJejCnBGW0o7s5hQ4L9NKQUX0K+ltmXH3LmK1\r\nihPBSra2zuUrazPH2zDM4/h4tUi5WnnAT2gWaToRSauPuBO7vzvGFAYycMqa\r\nQx3GsIkBG6+YkxlSXouhp0nwmhUfEmrTySs=\r\n=y/zi\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230113170924-5477d21.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/85ad924b9fc8f29ed2315d8b1fb640ce/graphql-hive-client-0.22.0-alpha-20230113170924-5477d21.tgz","_integrity":"sha512-qkUb/SSCrp4mYH490MMxzHOGHg+mCMkbx4cIwHa1oGLixNkGzQp2nhsdo2oo1ipvln4+4CjU1Tjt3msRKXsErA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230113170924-5477d21_1673629798351_0.28732692870235055","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230113204407-8e6b1bb":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230113204407-8e6b1bb","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230113204407-8e6b1bb","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"63bc78c80e8ebfb3022b98d3faa40d374f8e168b","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230113204407-8e6b1bb.tgz","fileCount":60,"integrity":"sha512-rWJ/ZBMFI0BRQu5Y9tFG2cLElxLM6mHbXyu77Pc025Nl3lo60nCcDpNrzmpmZK9TajRIBMqE5bK4/RY/mIWUvA==","signatures":[{"sig":"MEYCIQCjXdo768+r9LJKFa7Fvo4Ms6VxI8iz2Ns9ANpXYyPGCgIhAKoQ+ieaMWn3rSUqt6annOGlVw8F8pw6hCuqQyscqBkp","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwcLCACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmq6bQ/+M5ucNA1R//Jqadij6b2aTnnfDNE9P83p9VLsIgpBh7JTNNBc\r\nuhvgRhEM7GwvQTYn8LOjQOw6zVpNZRXZCkifqYN75GnHQ23NwFr+7mEjSLs5\r\nf/Q/NoieA7H05+vmX7R/AiKVIAHpPHUwt4jZB32Q1CSfT05YF0tOu9i9bnMS\r\nujvg1XYuehIibOROuQ7fStqIedooomDBi0dhU40H5vYsWVdoEDS/XTK/Kg6B\r\n4AQCDbwI91ge9K0/snP65LQwr4Eh6TjU2tXwGOMh+/9TpadnLlgOG9i117lr\r\nbV1ZH0soaVFhQJd5GKLNU102c/f+NAc2ZvVzO9lJFXbZPTGw6qVih2WhhhRp\r\nxfaKYok8qjBnPhEcjAWvPXCNfr2A49oDzeXEU4fZUDY8+kwBMzF3QQJDvoJE\r\nMWUPwwxtBer4jicjd45p2EgmehyQ0DzyRMRIcxZmeqwYR1jPMOkaXMbxajHu\r\nasWu0omLp3fBm+7Tm7nfn3++MC+584h3dBfzl0bi8Yb4VXlTUipFpraUnBEh\r\n62WpCtHXOxkTcVE3sCL6oayHBlrezQP2Va7Y/KJuJ+49aTIe/BfvxRQT9LrW\r\nUTNBMOw70k8jx/frRKKh/YMyPFqpvTRjHWwivbezCyZBigA0VTfJi70NSv6a\r\ntRQB/aIKUoKvgkKS0DoaKqNXnL/VtLnRaoo=\r\n=rddY\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230113204407-8e6b1bb.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/aae8654a38400d2f619971b67f34c624/graphql-hive-client-0.22.0-alpha-20230113204407-8e6b1bb.tgz","_integrity":"sha512-rWJ/ZBMFI0BRQu5Y9tFG2cLElxLM6mHbXyu77Pc025Nl3lo60nCcDpNrzmpmZK9TajRIBMqE5bK4/RY/mIWUvA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230113204407-8e6b1bb_1673642689909_0.37592432421389144","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230114001700-039ffd4":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230114001700-039ffd4","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230114001700-039ffd4","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"5b554be59fe3906891098d29a0a22be1cccc5634","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230114001700-039ffd4.tgz","fileCount":60,"integrity":"sha512-mCmJ9dklj8ENnnMVZ0O3wQyNgaK3vO8MZ0lD/dXgaZ0tPlCBZBZsQAKciP6uKQgPze1CR851PRaeI6N/Z8lcRA==","signatures":[{"sig":"MEQCIEHQpp4xCyA8nxa3wY3+da3aLnDxdbhKjPufO8gOzKMGAiAOlT/REVijy6O9aBpubDcE9bmLq/A2EJT7mKDZq9YLug==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwfSiACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoHrg/6AqhioGUrwwTk+vLp/kR/MIpH3e71dGUebCxGKASAyX8PsHVg\r\nJufU8VrR8t0puFtgrMBHTXxi0505/Csu0G3qvkFh15EF9aTlaVtxT19vLiQZ\r\nnIaxdP8b3DEEAl8x7K0/CeNZvOBcVasJv6T/egZSRXd7eTj/s08Q/xdCiBRb\r\nWHsyRRWHyRTkETUlxeiRiaBbWDoxFvl+jfq0xaVLXjs6DLXcqjPdJ3t2GDib\r\ncebxwXZvc8F/UkvSwlw0OX6wI8lf0x0H6ivKxkp0BtZQsK6O6l1oYRraRqaf\r\nZiF0KF8+VloNBSr7FCktTlrq+UDCIipW3HeFxwYM35DRstYtJB0vjVUS5z8e\r\nGcnUwl8M138G0ev/FnwK2aELBsKblfxT0t7MKLa1OuOhKeAKs9g1dami8gVh\r\n5QYr8rXPvYuh6joH9TZ5GTUFhPOXEePr4ZKvuGnNqF6/UX8/ShdF6KQRVDAf\r\nNpDc+1sVFobEt3/zz6lJ5VaujOAmNGZ/Qa7Capy5hlHAOSMGiEziS3Ooa7Lq\r\nvZw3OO8DGd3/TvB5AX/v0IbudrAQ13hCj0tZf+056iW4mGCUVppLSljCA9Si\r\n40mwmM5tJZTGRGGfOwsu5rP5Fg+57s3EdqX0RVDxPe75IVu4SvvwLyoLDevb\r\nQOel6QnX44oHSUtuswtLsCS1zd1x0SP7THs=\r\n=ZF6p\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230114001700-039ffd4.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/5b1c39c41fb8e015dd4e3845b0953dc7/graphql-hive-client-0.22.0-alpha-20230114001700-039ffd4.tgz","_integrity":"sha512-mCmJ9dklj8ENnnMVZ0O3wQyNgaK3vO8MZ0lD/dXgaZ0tPlCBZBZsQAKciP6uKQgPze1CR851PRaeI6N/Z8lcRA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230114001700-039ffd4_1673655458546_0.27830104775186504","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230114104025-60ac133":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230114104025-60ac133","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230114104025-60ac133","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"fe942943d2263928a9b4061ffe7ad8f83c9a7bc7","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230114104025-60ac133.tgz","fileCount":60,"integrity":"sha512-72tQzBLUMkpBRqcvaDh3/Kyv1RNuJK8MqpECgsYVJLaYa47QlBx5IUPqI9+4kxYa1bRy2j1zEquApG6dFuK+mg==","signatures":[{"sig":"MEQCIDDIVUZrhp+bHslcQXDS+U+WiR+4kBvq82cBtjmgZryhAiB8YfBYL+Ajc6jXvJ6J52Ay6yab/F+eMaiyUrcajLUEJA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwoa8ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpngA/+IwNE715VduhNnjYKqQqamAVQdmuCBPuvq/aaTH5WU6o/czxS\r\nLDQJeXx7Deiz4yabYclf2ZQownddbqilKfLOVirab85CjNdH2BNmzOmrcGmW\r\nhcKdecIryu5MSF/dJQeNQzvB9mmV4uuGi8B1AouAOtZDC48I0cUww3Dyy3MI\r\nHyNotRCfa+4qt5LzEkeXzv8/nsCuRNmJIHhDqGqNNnnbr/t0UldFYozOyWb8\r\njERG1waJA3itfqMudEaWCxx614+O/T6RU8+ECsLvfS7I7d/8iDU/363n3fXb\r\nwK1A7s1u5Y1al7HXTVvaVqi7q7uq1M2LOPcrN4rCpLZVCQ9cyVp3tpDQ4Wja\r\n2U+rvzjL4QF3XejyRzg1AemJTYHAWrPgmsfTNb4w4OGIc+ZIlaG1tobLimh1\r\nOVsqT5VYOG79I9Twr0O1YJ18xmEYalqmJLnLWtISKg3a+H9OR9kEuNmTajP4\r\nBKtwbtYg31iiAnuTm3KdlRUGPAqjGFqSW0PK2gcwKbO9oYgiiFOVo1duyf0o\r\n5vtbICdHjlbe2SHt4ltZIMsPky80tWot88khTVqbaUcG/ewdoGB4gcHpnfE9\r\nj4PpZQ4RPg+ZVKWN6Pnf8oNrHXteXZPnEhlvwkxW1tzznno+nFDzsvHqvQbH\r\nvgq/OJ/eeHGhtzEiFNAlR9SvlHzBN+36RoI=\r\n=kxD/\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230114104025-60ac133.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/3789af68689e1ef3abba4df48a5dad22/graphql-hive-client-0.22.0-alpha-20230114104025-60ac133.tgz","_integrity":"sha512-72tQzBLUMkpBRqcvaDh3/Kyv1RNuJK8MqpECgsYVJLaYa47QlBx5IUPqI9+4kxYa1bRy2j1zEquApG6dFuK+mg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230114104025-60ac133_1673692859909_0.6042834096469383","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230114104728-c48514c":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230114104728-c48514c","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230114104728-c48514c","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"644cacf5c3981263a20af27df9b4fe90afcf2fdf","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230114104728-c48514c.tgz","fileCount":60,"integrity":"sha512-A0EwpueuiDAenWOzIy3AoIK572I22WqPWv7kiZXGLHRnWCKq+RKZBd2u+uf7nwJLL5nOiKzIMZMr5P+XKtdbUA==","signatures":[{"sig":"MEUCIDOai3Ls+YUNwwyGIdZBukT6hOAUIXpYTxMLC23vJ3MtAiEA2p0X5gcWUufW9C5NGE5lyyW6IiHqUO+QkAMog/Kg3fQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwohiACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmpvhw//RIzLF4MPXNtxlrm5VciC46ZEzRsklcbCg+jJ+3prnW1btsli\r\nGGT7OFM0iEVcdnDszxDkjc/nt3gnvzGiCs4LQOIqzz/fcv+4e3wjvRvddIEI\r\nWe4ZhnItwhtiyBcMTvoVoPCq7Zg/4++l4Q+rOY8fAgBpy/E+o6SHE7+mrg27\r\nd3k7KIMX+JrFJ2ZBEZF0Zin0SS0TqqueIv4jDICJ8WmlV5DiduG/v7DZqMlR\r\nkfAd4BShsVyaHtdXSKIMRa4HoZpCsNPw/apB0rr+ePllqeNnjtSbuH5uZ29s\r\nRqYPacGQ9aYUiSGPNhJD65PYFOdHnFbkCA1usWGMEUde1pPk3gf6Rr16ZbJA\r\nNvQxv1HbBQhrGrSCNdL2EWW60ZkYwLosG/17zJDoP/TKl7BIGlkhOiiXS3j6\r\nCx4W62eI+O9fFxW+FzsgzHyNVTc/OhqTemQ4ypJ+/0/hDx9m8eckt5jhqdpC\r\nA66BDb6mnN3wywtxRMnfye3iEPGHPOszGU7s9AUtIoz/2mgSpVD/1VQNhLg+\r\nOE4zJhQhFm1MtJoPq5Sg1lQTbBXKNJ5rT+3WbG41id9beo7Zl5qx+I35OYxq\r\ntkwzwaP2+oDYWeT4q7aI5AIDYYFacqIdDswf/0F3ypOBd8sqmGDMO73i3Mvf\r\nEVdpBJFL+JiIUkLsjjUKQiDJs2KOGucHTGc=\r\n=SK3y\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230114104728-c48514c.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/a718aa122ae7ce3dc174d256c05c92fe/graphql-hive-client-0.22.0-alpha-20230114104728-c48514c.tgz","_integrity":"sha512-A0EwpueuiDAenWOzIy3AoIK572I22WqPWv7kiZXGLHRnWCKq+RKZBd2u+uf7nwJLL5nOiKzIMZMr5P+XKtdbUA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230114104728-c48514c_1673693282199_0.5638205159933809","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230114104741-9859dd3":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230114104741-9859dd3","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230114104741-9859dd3","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"39e065e0a48aee0d1a85c7e01842e61a799aded3","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230114104741-9859dd3.tgz","fileCount":60,"integrity":"sha512-/M0L5oO0PuBAGj8PiqZkc0Q4zW5gJTBB/GziPtr429bkZTYrxqCXqzsT/ByZNWajeLcq31wBuzLsnnCRBzuQWA==","signatures":[{"sig":"MEUCIECWgvKz5MeIDCVPBci84qtD4OX3KGtPKNQtVXlHrGfSAiEAqcWAYDvVabhgciUrjgn3UeMCFaGQyGEcbsDamTgXLfA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwohwACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqaTA/9FKAhbC0clNWePDIybIAelOgA1cWUpfky1VEiao6MXTX9Hokm\r\nkClTRPn1BtVb7yvkEvn/t1XAVo4/h2l1JuhpQtSxnN4/zTBivITdANtHRkQK\r\nHa1lv6nN5eNNYHUqx3DETeuxh9gDvxKDGmL8XyZ6kwuLFsrTlLZZlemu8kS4\r\nHzYJSDBoFwiEwf+LgbbowMsk9wOkFPLvyzYKaRjG8GxX2rv0kYfu/rtXLC20\r\n3Le8ZcRBvOxRJVLgzF3G8ko+sxij0NcCxYZJ7AHhVofreTppU57/e3sCA4P/\r\n+kXDvetNWJQjcInz+tktwoeTshP/9c2qA9+SE0dVneZv0jw91coRVkzVTUJk\r\nBVKDW77JzDsfC5Y0xTAByhkxSz7V8wf5HfLgwyBnq2BzEXpKHsWLtvAo7TzJ\r\niDZ+zbUKp6RHmYC6K5gP0XaQIKClGX/5tKqO2d2Etn5wJoaNs0DXMH6SYTwG\r\nCrzgR5NfaZcF8nPAgBOgOA5fACg+v2y6Exl48S5zKRvV3L8I4So2ZUYtuGXw\r\nWQamTYuA2a2p6Gpch+DteZwP1RTAxj2y96m6LyXiA2PsyTelYQGu5ePxEEEG\r\nFfJd7lKAJ6uGP4JRPoa0NETfLTpemCAL1MxbG6zEx7v7iWnzw5WJuBBs2ikN\r\n9IZseE/nJ6llmn3JTG1AcyEw1cP11DlY7ds=\r\n=i0F/\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230114104741-9859dd3.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/b392d1fea911ee562f7751b5a2097d5a/graphql-hive-client-0.22.0-alpha-20230114104741-9859dd3.tgz","_integrity":"sha512-/M0L5oO0PuBAGj8PiqZkc0Q4zW5gJTBB/GziPtr429bkZTYrxqCXqzsT/ByZNWajeLcq31wBuzLsnnCRBzuQWA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230114104741-9859dd3_1673693296050_0.13273053854576244","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230114105713-82489e2":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230114105713-82489e2","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230114105713-82489e2","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"022fa7aa79df3b5ca6cfa4299ba8f2dc1163d7c4","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230114105713-82489e2.tgz","fileCount":60,"integrity":"sha512-IS66koXLIPsHCjxI6BwtAOQAJoPfxZ4Ku4eiwlXEw1guGn3G6ACe/XQ8wlNXO1oaa6RmmdsFJMMl67OjtApWtg==","signatures":[{"sig":"MEUCIAs4ngaQGsLFZWN9migFhGYyOn3Uf837G+FczD7i8gVyAiEAh5MXvGxXUWzg9/FE07dwsbcm40mgSgKgpRDL+5yrHSA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwoquACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoyLA/+L+k2p4OU01Yrnhs7wAxIDMe2RupXryrOXhT4C6jDJXgIz+Fp\r\nd7MKwvAv1fKTvQQrZVBNLixOp3bi2eDGeb4vO+tQnz4jWYoj9Dn8CXa3LWDE\r\nio2yc1cpKWpuhy1GBv/8Q9uS6cNK48txLB+mDMiZIeeMbfGjamqW8UsWd+bN\r\n+mOSzYBwsDf7BuSw++GZCiBiIf3yyXryWlsD2KeTS0mHuKZ8p3r3r2I8kob5\r\nMPQk1pUoZhIhQe2Hsl31x+r0INdYjKu/+0kddGvY1kVOLgM6cgsbb9VkNfM2\r\n/jlx2IF/3I/1N8S6qz//EVsDx3vQTUKfafaG0jrlCArrHwvvry8r6h10xGuj\r\nx73Ls4f/setM+5gTPcsPWAFzCV1K0DxooWSLb6C8cFOciKto3syP5fyJXpqM\r\n7gHYCCKBhMN2PdZPSzjMlsjNLmYjvy0o3pWlX/lGIy8eAZlIPw92jKb8/Kiv\r\nLugksKcvEV60MKDIU+f6OwgxTptVr0CV53iOxzryf7gQ4h3rW9IDWv5VBOu8\r\nlmKBJEr0tdl7M70+m0aRxSpy4VgwaslVxMuixGReQ5ymkxDO/qevo1kwSDA1\r\nss1Dk+9SzfBFC1u2syGBA6HmWYslkuJt0NN04ZUP5mfqTDQ1ELU9BixbgJTF\r\nuZMiZcwjPb9sJJ5zi78sqcQynISf3u7YzLo=\r\n=xhv5\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230114105713-82489e2.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/914d7a4869877332737b9bf1b5dfb610/graphql-hive-client-0.22.0-alpha-20230114105713-82489e2.tgz","_integrity":"sha512-IS66koXLIPsHCjxI6BwtAOQAJoPfxZ4Ku4eiwlXEw1guGn3G6ACe/XQ8wlNXO1oaa6RmmdsFJMMl67OjtApWtg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230114105713-82489e2_1673693870502_0.3202675369700507","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230114110839-1e4d351":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230114110839-1e4d351","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230114110839-1e4d351","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"df9675b33224be6a85be53a714bffe816b538112","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230114110839-1e4d351.tgz","fileCount":60,"integrity":"sha512-0l+36+Z+viMC95iZAa+0rV3N5KNzORF868Hs/CI2suaFmGJkKWH1iNYJ11q0kzwvsgG/xJBSnKZ5nsmNgZZBrQ==","signatures":[{"sig":"MEQCIFdYt7RPWqVG7izh5pdwMXnuydLup5me4F2uSGaq7j92AiBlnnbPMfC19vCBh9TCdNw/3mG376BPGeOudXX6Xux6rg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwo1eACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmouOQ//VqOiRR1mWuaYi9cOvyTUzUzvGmy66im3UlDSPHuaMlO6cCYd\r\n0brgsZzlUGNBXcD/D8sox8fmzGQfzJEFSCI+1rJusbmzwFyRsOEAT1YLi8FQ\r\np09DnDk8SaZrkuatUVBERhtnbLFmNlFP/ivcXVbOCIdvUZHK/gFTNDLmjRJc\r\nR2V6LME7NDP5nFd4XfKP06g2/5crFOcBrMawRA/VAwIT9o+hC9y718oWagp3\r\noXfdLV1LuNhoZ0ll0/6IuMj5L91V2S2mg0RqLk53bh4ogRJ31Oz0L1HqFZ2R\r\n+rGuoAYW6Vu+eclEVv52hpimUUok7u8JvjMhardgphD4BX1RJj6+ggWkJKPp\r\nX6yYbrKZYC37rLkpL1TK+BhsF5eiMW2/gVkuCdJZ7uiHdeTmUZGwexWeWs6j\r\ncB0d4nTkgtVptqguXn9IaO+2/4pmXTU9mA35+/l9LZ55kYs17WEcapukNP3o\r\nh4gFgiPhy1oEU3E5d+4zSrwGX6UoOva1sKqxkjcXIggY9yI1jfihbcriBZ0i\r\nX1zPEK1CMHy97bFjfz+wXzeIm8PFLBojbFhSOohamu2cWLRgEaTLtj3gnnIp\r\nFdVkgOhzfePZdrqZNQDlp/Nn9FizBgg0WaJC9B5Ore9rJEAfuF/N+eQcznoJ\r\nkzY4kT0HuGxgG88dJv1L4IxoNf76HexW2Es=\r\n=lPaa\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230114110839-1e4d351.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/3cdc9e77c540071424834e1c0aa979fc/graphql-hive-client-0.22.0-alpha-20230114110839-1e4d351.tgz","_integrity":"sha512-0l+36+Z+viMC95iZAa+0rV3N5KNzORF868Hs/CI2suaFmGJkKWH1iNYJ11q0kzwvsgG/xJBSnKZ5nsmNgZZBrQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230114110839-1e4d351_1673694557944_0.2946103025908471","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230114111815-e9b6552":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230114111815-e9b6552","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230114111815-e9b6552","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"e12fe107e084fa345e3ab60cde4e7ca1a45853b1","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230114111815-e9b6552.tgz","fileCount":60,"integrity":"sha512-1zBYB8K6htJdWyMdM9ZCYHQC1Ik9swIOyOFiOCVle+xHSBkGrTdb0E8h/MFYBZNFXizlNkn/3TTz8M+Mw+LuRA==","signatures":[{"sig":"MEUCIDmCBnpsGpDc9Tq6W9Qz9fWDG7lRoY6SwJXwuFXB23d3AiEA4/N5m4hQC+kO4g9ArYSQFHpU2GN05CEVCAYPmlSBgyk=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwo+aACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp9dRAAjZTbfBp8mJ2pkYHJkZ4l24BcT1noNv/ZE6iiWjMHR/DcQEI6\r\n73qnzPINxpAatNJUGNKixJg4VA33p8/hhZD3Vw+6nLHF3JZxEUYLEucvVMGW\r\nRajE/5c1m9Ftjg1J60yzf/z/hFvADa06xKjaXHzfI/SOh+6eEE67kXGlFQFW\r\n7dOdEfJR5CZTvaqdfr6ZOyttxsAhPYqNQ9oYUe5BFO9lS7RDOozT/HFBqu99\r\nanVYKjW1o2Z7ZRMUpCZXN/tqGA4i0PFC9pYyL56aPcMWxe4y5ehTFDPkvjUH\r\nZIu2CVmwkaPv6jrrB+5rrv7Grb/SfcAV8jwVc/oqoHcQQfCNDjnZIZCL3g7W\r\n/kkKHhSiH8fXXJB4aMsfJbyzc3+zmxo8Ct779XW13H05YfJUvO2Guq8CpYnK\r\n9ftFt7gBS0cMwjLDDrFhNkt5PPGa61Syids28lD6iExoMlJxsB2PT+TcJu92\r\nfVAow0Gm/BJEJIqEllng5ickudvPtxqyJihO/acxNv78mMq/ZCSLnqJXWwbO\r\nVeg2oSJRatkC0frNvLhyHTIPB9D2ZLIyAXkaBQkz7/AhzOm49CQG3bEflyqZ\r\nVLSukZHKk1eb30dim2XczBoJY/MRiJO5fpZdp865IHGlxzBKWuCEkr1+/2dD\r\nupN6tPaxusbpiRcI+qbaIiqu4mBlYTTNHOo=\r\n=RlNF\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230114111815-e9b6552.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/2700b2a0fcb865862917086ac57941b1/graphql-hive-client-0.22.0-alpha-20230114111815-e9b6552.tgz","_integrity":"sha512-1zBYB8K6htJdWyMdM9ZCYHQC1Ik9swIOyOFiOCVle+xHSBkGrTdb0E8h/MFYBZNFXizlNkn/3TTz8M+Mw+LuRA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230114111815-e9b6552_1673695129946_0.38622588919385925","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230114111832-9150da3":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230114111832-9150da3","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230114111832-9150da3","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"6294eddb20dd4eec6167e0e8d13f94bac4e4efda","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230114111832-9150da3.tgz","fileCount":60,"integrity":"sha512-MCv+NPZ37lnGMIN1M+m5+mT3Sf63dzWTIn8PycCKYO2E6cUqSTMgFoH/m6k1I4L22VDX/5mnWZfmgBFK6wa24Q==","signatures":[{"sig":"MEQCIHsaVFfHnCuMr1PYz/jkIOgt0noMdwY/L26EgywGS+hoAiBAnNFYo2sfP6ydMSfoLXVLXGNBuEWviZWZ9GiMRpsf6A==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwo+vACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpbdA//Ybgvq/Jq/FXCo1do25uRnW4wg7z1T0O/pZt76HqQgx3cW2qZ\r\nJpj2kah42kllGZd/PlaRF3cecS1kmbQpetFcHUM8eEf/PZE175pvk+rs3E1Z\r\n4arzWv8mUpuHBQ7rleKplAnqxxtJ9nRE5lZCMW0haE5+TFxYKIZNtmcMSkhe\r\nVX4Ua2RqiXwBa7fR+/mIfv5sgg6/v1Ae+ZexrY0BQEptqhxPM9v89bAULUqp\r\nM0aS+y3o/BrBrt6Nq+e8u/gdPC8g/Ump8QZ5tEtb9xk+8Jkc0dDW5SoIxzvu\r\nu8Ir7TxGr1ivBNqqmtisX2QhadiOO51pRSEz1Ijzr5x4icLy7LCN2sY2ReGa\r\nL7ml9siAtDYcgW8dik+Db/dEzGdERyeky0S+f1nnKyc+CrtCg1h3hoXP3Fxr\r\nqHhdO+4KScWyfHP9CHSiv/aXZ+CRYs1VrFlxt4BGb8WjYRqE9YwktjLWSXIw\r\naUdDiBD5EQmyMBqYwOdrwygay7fkmAVjkbpc8JoRSL1MhQzCnGhjK/1hw7Bf\r\nFubT4OHCDFY0xaYkiZ77fSVOgpswClOflnidaxxF2XQ/29r1a1YtyoBUtjzB\r\ntlqUL7oSj1D1Ybycg95xu/92LWEEigcUCnD1Y2NPUHyu99SqnN/HRlxLU/wh\r\nruzhbTPsNhltmnElFWd8Clfdg2OHRWyPTq4=\r\n=8NrX\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230114111832-9150da3.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/cfa1ef00626a28bfa2849575a73f0008/graphql-hive-client-0.22.0-alpha-20230114111832-9150da3.tgz","_integrity":"sha512-MCv+NPZ37lnGMIN1M+m5+mT3Sf63dzWTIn8PycCKYO2E6cUqSTMgFoH/m6k1I4L22VDX/5mnWZfmgBFK6wa24Q==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230114111832-9150da3_1673695151021_0.7278926031242414","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230114112922-332711d":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230114112922-332711d","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230114112922-332711d","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"311160af6a28c253e48853877ea670c9d0dd946d","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230114112922-332711d.tgz","fileCount":60,"integrity":"sha512-JQxTfbfHIMeLpcUXcmpZxGII4DfC+7xXTytIS9BVbtUOhnh5vt6QLTI0wS3s1WEZ1hF/XEENKksNvkJNq9wwRA==","signatures":[{"sig":"MEQCIBqYoN81sAGLod2CoUC40FgA9gWqyMnNazb/jtF0nHnyAiBH9NBASd1WxZCclbx3SPtEATftl6giWU2bszNO/uJE9w==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169643,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwpI9ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqpFw/+IB5Pmv1NUvSEJ4BirXr4sT6HeKriAtg2bd6FKVvHlqXP3Nvl\r\nk2x+O1MNLc5e0iP/TXhacDxEXeflp5AsXiQ57A9G5Sr1N6g0i+OxqkZoTFPI\r\nFbJ5arPijFycVmC1maxkzO0RFiLbsPHKKUY4NRaBDtEt16SChz3ONSXYv23G\r\n1lI4rXHkQFAMPDqUsG4I4yxSvkKdv39XPdnMuSHS2iMgbpEA6yvb6C4FPU57\r\nDChrjVeLoFQ1IqEEOUb+AYAZ2g1fr8LxgNZ51/vvSIQGY0+8Fyr9M2b6e6RT\r\n9TEe23chgn9PTNk8jJo7f6Ch5Q+gnp5LLJytskX6Yv8zHMAU+kizanrdMgw/\r\nAW4MRL2sX+aJ+t04UzDmRWEj7mB7nJDlF+EbDK8/9ghxUOwo+8+hYrMq4pqC\r\n51h9hc5ltupFO27AmGhI+CYPHQv9MCQto7CtDrFNUFSBE0yRyJDOcozaKaxk\r\n2d7esQfBobCQyi6TnB5/7cjH5jI7cdoNUHubcZNyzoK6qD2X9Q2QTP0WLfoo\r\nGEoz3W7AsR8Nf2RP1r8tTAm8TWsPQpl4HAVO/6CPrT8m7Q4KqfXybwf45LeX\r\nJD4aDvmtJprm1jhdNI2HdaZ0xAp2Le3DElbsy8A3DI2tF0aiSI5THcCq0J/a\r\nCITv5hxGfy0nyaQynMaZSzNdoiEUa/iVt8g=\r\n=Kdg0\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230114112922-332711d.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/dd062ea9b21a554d6e2e4a1af02b7d7e/graphql-hive-client-0.22.0-alpha-20230114112922-332711d.tgz","_integrity":"sha512-JQxTfbfHIMeLpcUXcmpZxGII4DfC+7xXTytIS9BVbtUOhnh5vt6QLTI0wS3s1WEZ1hF/XEENKksNvkJNq9wwRA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^9.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230114112922-332711d_1673695805301_0.927016068282805","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230114113036-e41c2ef":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230114113036-e41c2ef","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230114113036-e41c2ef","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"b884edad101ab70eae958c2e0d8d87b384550c79","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230114113036-e41c2ef.tgz","fileCount":60,"integrity":"sha512-ULUnHhdbVKx/+QcwbdizPmA8xtugKrBJiIt5XzMELA6gt9VH5gR1jvovsGFD7efU0kWt1g/XEoP+T8f+bN8c5w==","signatures":[{"sig":"MEUCIQDpvx1qHXGLJlzZ/+NB+bP6jijreUdgvsmAw8Pj2wkW2QIgVZ63a2JPO0M/a20zORnLlqljMc/8uLnC33wJqzCRUcU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwpKLACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoBkg//WVHGhyG5qBg4vdrtipJXsBB79wMMP4TuJaL3ZHL/z5TTeYpT\r\nrqtQzceXU267LaQ5Q/PtSws4xjXBFwmnmg3uYnTDBzpnx/quD9mQOQVCiMxR\r\ncG6bEqkpgRtNHX2H8twpsXNr/uYV62iSdNownRnBkPwDXaNXNW1rFTlCkOFM\r\nzf3r+izHnUfslN71eYY1r/D6bT5KA2McOWZeJPIaMV3zEDEaHSH2LiyXluzf\r\nBHuyoScVkn9QCl11aQTPdJfqt1HFJhNUJng2XDOD/BxYA9EQw0jArPJNWWg5\r\nlGt3DF9R/btF5QWTPDGBMDLGk721jcNEjfkViuwCQiw45jX8F8qW1PQpPPga\r\nlt6oD3MZH15ovDBwn1Ugr/JsBiz7Ju/RZGYv30lmM2N2AxR+W9hxDGdN4/DU\r\np8moeOmPFxZJ3e2EVmlnADiT1kOdwRlUM6tamdJw1/apxLS26GnIhoqRtRzt\r\nTZxb6KiJNcpICQ0rsh5kU2LggtZsFW+A6wpkv33H6jCPg/RDQLgAq8TlGsx0\r\nu9xsKIYph6BlF0wWz83HM1k19uF58r5+gcv9La6KYvY/tB8nVuzQrCzOsk6v\r\nYQF59LGor17bFBAjAt9BD5xTX21qNaM4soLFTjD9nW+zj6ycGBAKV6a+1Q97\r\nRU2niU1yVRPu6VcGNBTI4H+0SLmii0ZvT6Q=\r\n=1rZ4\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230114113036-e41c2ef.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/73dd31d46eed73b5ef05870c9dc68618/graphql-hive-client-0.22.0-alpha-20230114113036-e41c2ef.tgz","_integrity":"sha512-ULUnHhdbVKx/+QcwbdizPmA8xtugKrBJiIt5XzMELA6gt9VH5gR1jvovsGFD7efU0kWt1g/XEoP+T8f+bN8c5w==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230114113036-e41c2ef_1673695882837_0.6878762142172741","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230114113646-7168c29":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230114113646-7168c29","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230114113646-7168c29","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"e37056cbbf29bc88fede9393c805df22c834caa7","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230114113646-7168c29.tgz","fileCount":60,"integrity":"sha512-/R8+IoHvCKdn76Jb7horV9xqZ14Ew5sKMu49I9RqhqXxYK685wAPfaHJFkYzhTEvkkMvQzBZvuWt78qeS3laKA==","signatures":[{"sig":"MEQCIGiZlCGluJ8vrhgPKmQ3VXz8t3utNABbOckMkNSs9PXyAiAQxgpbnTYOniWQMZ4Zc7U9xT/phxFPlqcvDHE9PpTSRA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwpPwACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpR9g//UdPCCRix9LAfxrmAwsK6ETfcrxLld52ZtkcWzmB36GnUIPDP\r\nuXuHomhdiruL3KoskkZSVXWHG6gWq3zyV98clqcaUiqFrY4zk1Ep2vuxdQ7w\r\nZ0fqIwrSGD8nko9ZNFFrZIK5YfSpKrqkptDf3RvODAt8Ojn61mcPzuHvrILR\r\nCN45jegD8y5k86JKd46rZEV9pQw9vapBNfgxGQ64T9TGV92U/jHv7r+8thLB\r\ndGS0It6N5WGuH39bjyutddA7zhNEHyKLvV/gF6+ctvmvfDCzd0U42TqHjl2N\r\nc02fKlXI71BDA9dweKVG/KKHmSXxT995VysAyFP3CyP185uuLqeZCsiG5UGQ\r\nsIwNYY8IJkVcbsPa6sfsqgRqhHyxzsvp2eofkVI8N0nH2o3RjClty+fMn9bw\r\nw8jIQ7ZKz9JBVrJmhH5oA7Qx98PzZVgjWvzJld22/q7hoq2F+HTPiSej+7PQ\r\n18GDUJC1Bh/Uz5I4Pi5IFdNfbEnmYndQjjqI5bentETi2hG12i5zNaX3A0mw\r\nyOWm81R79U6+LUQOle4ut/lDY7GPeNNmTkFndvlwUsFoYNRacmHmqlRcZ1Tv\r\njs7cdvi8D3hPORIwwoGEKXxXCmCwsQbp/H7J9STkPQqGW+4Ygc/qUfJ4WGss\r\ntOJBLOdMJVFGzl/98vyZIQo0OeqnBg9P/aU=\r\n=q4YT\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230114113646-7168c29.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/050986418a49639d0397309c0d13a0ea/graphql-hive-client-0.22.0-alpha-20230114113646-7168c29.tgz","_integrity":"sha512-/R8+IoHvCKdn76Jb7horV9xqZ14Ew5sKMu49I9RqhqXxYK685wAPfaHJFkYzhTEvkkMvQzBZvuWt78qeS3laKA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230114113646-7168c29_1673696240461_0.5480452392409725","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230114113823-d657a58":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230114113823-d657a58","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230114113823-d657a58","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"408b53f2a4f7b9b375ba400f2c0560596ca84de5","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230114113823-d657a58.tgz","fileCount":60,"integrity":"sha512-aSS8UnKpPBRNPALhDYm8DDfGuFVb/GBdqIrgSFNZbuDKRQFLuttXv8cCCjB7zBNrMo7cWCxz/1/MwLNKjMVuqQ==","signatures":[{"sig":"MEUCIQDR1Nvwrf2s72vR3xfZFyPZIxHNzUYtprep3gyO24DnsgIgYf2908l84J774GWy+olPKekqSH69521dKWY8CEPFaMY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwpRRACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmqtjw//aDtJ0wyrQq/1MVEMZWhPUuP8LtQuAyK5QZatbTa2d3HqHuov\r\nI750vH8DtMoGcwnDCsUaZtCkHReBV5uy538dRTDprubywhluJ/Q4ujrWs+1w\r\ndeZyszsERvcsrl0Slx/d8HoBngCxB57yftcP9teE4trkMhw02NLRF0/BAK15\r\n20/UQVAgJPxVJavXW7vzeLSxgi+M/F7MjLCflNaPfwOtY7HFsqx+vlfcPZb7\r\nma40BvoMxF3MQmQIlMY6w2zfm0UoH5cpRMX3OnaiVK2ekf4cph6zMQnnRghk\r\nUNYm8ZR6fTbxLMuUJ9YfzRQXK9jr3Q3YFkbZS3Lt1nKYf9TvlWvjzaZAnwNY\r\nRk3wcHc//86s0LtVooWj0z5/srP4AHCmkdeuAp36JUhY6B1BTdL0dRbi8946\r\n0nextA1IqhPezQ7UdS5hj+Wg5rDhcImDD0+DpBPpU5U3isVsn4YS2WjarecP\r\nmiNXEQWM7DlLpDHn82Bhz9plNIwFTl4e6nszMcfATBBKBJnpyQt2HND+uFgw\r\nHWI7aN2TAqc5ren7uTV44Tm52ctwbAcIXn2Ko0uha33hPsiUtdNG8gI+Y1D/\r\nErKwofV8tcH3mkFdN7KoNvvWxNW9AQaJZvNvHFZd6a6K92sJXwxOXeMCCI/Y\r\n/YHOTVPCQ/mbA9e3m/fmS9weYH9O61eQg2g=\r\n=mN4I\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230114113823-d657a58.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/242035fcff645f368241daed0f229e41/graphql-hive-client-0.22.0-alpha-20230114113823-d657a58.tgz","_integrity":"sha512-aSS8UnKpPBRNPALhDYm8DDfGuFVb/GBdqIrgSFNZbuDKRQFLuttXv8cCCjB7zBNrMo7cWCxz/1/MwLNKjMVuqQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230114113823-d657a58_1673696337761_0.33539985755996193","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230114114046-f30f5b7":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230114114046-f30f5b7","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230114114046-f30f5b7","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"1f7b4d350fe1f07006ba73457ddeef62f3c284b4","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230114114046-f30f5b7.tgz","fileCount":60,"integrity":"sha512-xHDwE/wnPilFcethDB+SPpx+PRGf6PyTuP7Lr/oXUbmoTrtlv68uABe5bZ6jC8ZrFQIFsujAgLA99yn80y5CXA==","signatures":[{"sig":"MEQCIFOd/RahCVcXMaDVDBi/Cl/ui1RchVlzmvrsV17Tquo0AiBnOPLaK2jNjot2MeO5LV8dQbyAN2lNBk/8HObmVsFAqg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwpTgACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoQdQ//bjDEg443TZZI0A4FKcWSVoFCrA8VwzXfcbM4j2IbmgQ8Rpel\r\nWXARn+JhSQgJk9Q+pfnBDUbZ5r2vYEZS9cCjrWG5PLuOlsFDCaAOQG8bfh1O\r\nJ/v/BQij6K/nziGUqceyHjxoejMPTewjxFhjhVYw1CmLNJ9XIGqVEFxRgQMe\r\nl3LXjihoEk7V0j4MC5otmx+lGVBLFhIje4FGAkE9/ZQSY/bM/UQkafMAH162\r\nBXHco5n2hJ1ITYW/tU83OB+Gh8g0zr5bPXaX5fjmg5y76ygbO53AxD3f4mj0\r\nOWhcGMRoJ0u34x4tQAV/fZ9HcUwh7p0f/0y2jMo5AFAjz1XRTxNPSelK7TMe\r\nSBvC8MSC9dPpTNytvT7bQREXblkH0oSdx/68gQghi01pYKro0PPA8/O57Tmx\r\nueA2wGd0W/i9xYYpwlXSRJ7+BThy2J0z0vBAbjpKhR1FyR9OIowj6fbub4JM\r\n7IxEHm0RO16TJrIIBp2FC58L4Mfd81gpVSXx+4LWivcnSpXsp1jn29pj9oty\r\nb9jUb1iDmSnrKNGMyBEkfXAehi47HwPpS9qRAX/WDO4Qtpqiobh9z0vxsXun\r\nmRKz8DY1CWEbF+SwLwtv6wp3pLDvgg1KIR1Y3/Gsq6nJuqsDOgdzRIiphnJc\r\nFIZCW997tXPHe+U6p4CPrUMHwb8edVwWzTg=\r\n=F9Am\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230114114046-f30f5b7.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/1aca858eb417b3a9c43576c391e311cc/graphql-hive-client-0.22.0-alpha-20230114114046-f30f5b7.tgz","_integrity":"sha512-xHDwE/wnPilFcethDB+SPpx+PRGf6PyTuP7Lr/oXUbmoTrtlv68uABe5bZ6jC8ZrFQIFsujAgLA99yn80y5CXA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230114114046-f30f5b7_1673696480340_0.8176601944563238","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230114114057-2b50107":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230114114057-2b50107","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230114114057-2b50107","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"053d705727f8c298a08a6e9cb61b5ad0080dc300","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230114114057-2b50107.tgz","fileCount":60,"integrity":"sha512-55QYXTrGUjpPoSc9wCO8nzoerKenqUWKrCa0VdjgakZ1m1Fdr5Xy8pbhHlSSckji9HKFvq1p6L6ZYoyH//MWtw==","signatures":[{"sig":"MEUCIQD4nBUUvz0yL082hzwUJ0VZkGnqasbJrCtnPBk8STIvMAIgFuhYxBIuwNZ1Laq3QHOYNg1MBGyivCze10XbV9WLRkc=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwpTuACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqI5Q//Sx0gXXn/379PyZdZ9iNMvmx+CZhA3P3708CTiLc2Mf3JHyl+\r\nAguY5wwGWjvh4nYD2cvDYZQcW2ICS1D2QqV93tpdkeaQ+7MNRL0NnDDUYqQs\r\nF4okGSDdUV4m3d6D/6+Xh2rpUaQxhQugPR7ExwMamiTHisnslYE3aUCFIa9f\r\n+zJSIm4XuEwanr8IN2g/A6mmNJOuLjoKupJ95wsSHrPK7Br6eYktmJZh0dWC\r\n8DPBNECo3DlbcU+Hxt6TcpAyA2D09rv3CXdgBUz1mVBsrEJLwRdmvuQGWfmy\r\nl+Utxc+C8t4VlMuLjwEJw1ezMZ+qJ+SxR+Zl6P10o0cHT+uE+Bw+sVKb0Dy/\r\nV0m032nNgyJw3gJnif9AVHV6Rv+r25HLHRco57mD2VlxBzyOYiXFac/KBw2l\r\nS551SWD8Cw2jBJc4iG4A0jV2xKOxjDsLe5zee2cUq9mKNbowLBR37UZaMbjB\r\n0fwqeXO2P6sPYdesi6CGatbpbolp07Rv2JSWMvuX6k9VDcfb/w5SkiqsqM8d\r\niUoOXE7qYoxKCgrnqquM/Ch1k5nQMwomPkmS7SnhnfGsh3agBuIsLr1eoFQc\r\nK3DqvRBMbDc1fXmZHqwnIFRw2hmF/BfBeM+wNmvjehYnB2x7Rbt8z7nbndVg\r\nDwiRTzsh+DnzSNtt6HV2UdxhtkoxbuqmFU4=\r\n=AkFD\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230114114057-2b50107.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/a55b2d6ef6c7ca432b0cdc836432282a/graphql-hive-client-0.22.0-alpha-20230114114057-2b50107.tgz","_integrity":"sha512-55QYXTrGUjpPoSc9wCO8nzoerKenqUWKrCa0VdjgakZ1m1Fdr5Xy8pbhHlSSckji9HKFvq1p6L6ZYoyH//MWtw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230114114057-2b50107_1673696494043_0.5360183724273191","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230114114247-750d54e":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230114114247-750d54e","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230114114247-750d54e","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"a66d97ef43e995f64a3b711d35085633d6ff69ec","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230114114247-750d54e.tgz","fileCount":60,"integrity":"sha512-jn9maV97zoxo/3a0oSOb9HSqoU7cOXLT5DrKp869DhdEIhnRRBs/Vx3thy5p3tCtVxyO5W7lCYLZOBsRc4dKWA==","signatures":[{"sig":"MEQCICvUQXTEeTd6Siqm9xh5zATvLdSFav2ChFNM5du3y0mMAiAG6SZb83NRJUjHZnWi0WcYaLPnf290djWNF1tCPIln9w==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169643,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwpVZACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmphOA//eMRIgaz3Eg3GmVwEk1k5tsOTuO8OFmxAmNFw06iPcrdRwUEg\r\nyCqwMf0KXuA5Ewb84L86czrh5TlVyFgDkJSlMZC6ysM1WzujTtMPV2vJNZ9D\r\nA6JBReskd3RuZcIhMARADTUAoeIyLhafu73S/0QLYKdU4UEzAj5dA2mFzNPS\r\nyslsrII4yn7ZOgbpAkSpunSy+/oaeOg/e8DJysruQ61kEc0GIlT7tJtKMRFb\r\njDiXFkY5f85+f09pjTqOKSc0QdRvEwpnFGSNSsmNRxLSc6BHfwa+rQETg+Df\r\neMDN/xH0H9657ZprJbhqAatGhNPlpvTt1IN00X66OktcbqWDKN3w+md/yCU1\r\ngFeQ7Cj/WeFpHRPlR3LMpDgbJnt/lctEEJeQ3oOvlCSpw28OvEZakiI7gBc2\r\ndjR6M/wb5SunAgeBmko4KeCQ6D33FYTrXSJWdktPwxox49imYXtUgmXctRjm\r\naHvwj5DYVSmCxlAUCUGUDL6M+ZTGUxhilZchWnS2r5TWjxrmJyMoz1EbkeKX\r\nzWs1/M3FRq+JO2CzoLpt6WKr+DqTTKmdp1edaUBWTnmU5+XXtdiVyq64ZuOw\r\nZy6+Vbts91RJO6F5rpsB9/4fdK4WdRAayrDWjCAdhZRZRL7GmgvJa/p7jDF/\r\nlmIXTi9TofpYEm21f1cyyS6nmhGhA/3Qmnc=\r\n=hfmL\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230114114247-750d54e.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/cd7c8d3f415592e89f154ed2f8e7a7d1/graphql-hive-client-0.22.0-alpha-20230114114247-750d54e.tgz","_integrity":"sha512-jn9maV97zoxo/3a0oSOb9HSqoU7cOXLT5DrKp869DhdEIhnRRBs/Vx3thy5p3tCtVxyO5W7lCYLZOBsRc4dKWA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^9.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230114114247-750d54e_1673696601208_0.910951267508834","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230114114653-f3b64bc":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230114114653-f3b64bc","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230114114653-f3b64bc","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"4debc726cfc72ad4deb0b412164a0bce669fb68d","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230114114653-f3b64bc.tgz","fileCount":60,"integrity":"sha512-OC6wNH3OU8QuPWbCEuFrHd5Ze3VXGRX5V2WkhnkJKC2g3yY3SvOu9MaM2QmPIAThQVQt/cG2dcCL4JWQVhlc/g==","signatures":[{"sig":"MEUCIFY67oWnzHrziTzd0cDodyotsqLpUe2n89FebEV/lde5AiEA7pzIdfCHiTZ6mwsv1/KMlzoX3Smsl7BNjfPUB1NNFdI=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwpZPACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmotLQ/+MmCmU6PEfqODHQRI+aY37s0R+U5L1YGFVlL8dB8yCVUKIfjn\r\nesiZZoxgCp+LrzI5yYhS5CURux3DHMlDk9V9cJzkdFnxV9WIEKA+K1weHGp9\r\n5c1NcTbB3ZbAdy6sgINC/qrTzEHssdzref43DqzUK/AiR9MyAjN+lPuhvS2Z\r\njq5/7F5VR2rWIF+jH9DeazplLjaOfDRi0JD8O3dbb9QsvaVoidsavNCd2ukM\r\n0vKaR+5nAVUIxUXYW5fVc3yauQ5/KFK3nyygbd0xo8bDdUTXhDZxjC1qo0LP\r\n2R2yQhP9s42scCc5VCKQMVtxbNvTKFPY3R9X9GlWc4YB3Hq/TCDDhCLOEbrn\r\nPkq9xDsfmTwyWXK/2/LFMb+sYiGcp8o6jOEV5ZE1XUV1yDpb8ONiClleP16k\r\n1nx24u/3XyliwA/0it0t1EEBJ5mHv1HUOVrwqVphzoliKxBcENIQYFj95PhV\r\n8Fyaue95z4JhXcWDuizA3FL+Ie2s9Pn2H5yLnt3fc/cRGNO7tEiaDUMH+1bn\r\n+58yWjaMcdsOjmIDKm34LZLQSKEYMZqArg87L0Sh9ljwOF2h03OdqmsThrxF\r\ntp/+HylWU0eJ2CyuucndUvN/vkJMAtGDFY7AerohphgyBpopd/83M7mUyU7T\r\nsHbQ5Ym0hZ84LPLZJvqksW0WbCZaJmfeQMM=\r\n=fK73\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230114114653-f3b64bc.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/db3812b3765cc3c5baa74ed0a6447f7b/graphql-hive-client-0.22.0-alpha-20230114114653-f3b64bc.tgz","_integrity":"sha512-OC6wNH3OU8QuPWbCEuFrHd5Ze3VXGRX5V2WkhnkJKC2g3yY3SvOu9MaM2QmPIAThQVQt/cG2dcCL4JWQVhlc/g==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230114114653-f3b64bc_1673696846870_0.7641155954860464","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230114115054-05afbd9":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230114115054-05afbd9","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230114115054-05afbd9","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"de6e20a1e2de37c0d8436953a6afdbcbe090aa8a","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230114115054-05afbd9.tgz","fileCount":60,"integrity":"sha512-TjdtFSTEMkpX+9pY2EtZOdrgzBvkKhQMV/zyt6RabMe87ffq/2PO2p395SivAF8Y4NzbLWNNtc8Y7W6TarRPig==","signatures":[{"sig":"MEYCIQC62oMp4NFlGLOP/7q614wvpK2inQDk+pX+QSR9DRr8UAIhANkuQRVywvgYZIHucSQXUnXn+r1PA3XsUuPMv6/oDTrI","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwpdEACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpYXg/8Cu2XIioWrr3AGs4KGviyLGOEqU/YkjVlIixQleIdmPtqjNh5\r\nLsPS5W4tAxGNPoHc9pcUYRTA+l2dcVPzXwV0XRQwle1p5hYuE+TG5oG+1sCe\r\nZT7mtH8RmB3M6nntgXGQTZ0sKxSrmFsySjPKf2h5HpIHVYCcDPfopGSXro3G\r\nI9M7kcZ5gaUR27xkKHahTWRHrVcu2mqWCrdrapz4ad8Kn5cScPQKupgBVO5+\r\n37na/Lztk1zPAtMdwjWUoS3qvbDvu1AzLljT7I5HefgTVIGsbkaqxyYj0cOC\r\n5SSSWdAgSTljvTAnL1+/q3l/jfyV2mTh5KwwuXry24UkiZ/klhvXlwf+F60n\r\nmgJNPlewBGtpObst9enn+sEUGpHBUughjRm93d4bwut4rPtal8vphXvTUDTm\r\nNBDd1lo0eAaty7udy4IOieWgmYrGYd6e9MmiMNW5E/rumW+pvdzZvY8CmXK+\r\nbm0EOMKMBOF4LWSENiKJd3nsLdtZx2XNhioHmjxlwGw3gSmlBtFfWoGNxsff\r\nHsNKqn1n92bgWk/GoE8yRjNRja75c0iYQlJ/Od0mDTF61b6a0Tvwimo5m7L4\r\nmU2UNRdWllcTSOo/ba3q4xTidYZAdc4LAbqIDG3Lqp0F4KEkuP4pAZA4YI3F\r\nC3vZbAr6Pfv80ubl7dDrveoaxLJxTX5qLu0=\r\n=CqJg\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230114115054-05afbd9.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/9e819bfac89e5f0658da07a3daacebad/graphql-hive-client-0.22.0-alpha-20230114115054-05afbd9.tgz","_integrity":"sha512-TjdtFSTEMkpX+9pY2EtZOdrgzBvkKhQMV/zyt6RabMe87ffq/2PO2p395SivAF8Y4NzbLWNNtc8Y7W6TarRPig==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230114115054-05afbd9_1673697092471_0.7901118771577056","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230114115320-d97bc34":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230114115320-d97bc34","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230114115320-d97bc34","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"ee772393fe2ecb234a3d12e77356faf387ade0be","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230114115320-d97bc34.tgz","fileCount":60,"integrity":"sha512-03fTd9DKsi3YtHIS4vFGcUxa1oGNCejFHk7N6l5YH3JZw5uW+P29ojqr4wHV/xvDO+vj6Fy8zW3YVpUQa2jv/g==","signatures":[{"sig":"MEUCIAiPs8/g5VPq10UR807MtXivZ1vXFLNTFEFSqtujwapuAiEAs91+0p/HWz0vDtOAPhD7DoD9XBC6DHbwlfFYoAomxdA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwpfVACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmpq+w//RG/Q6L9KIN8ZPlplynWjxRuBjMg5W3RL8kP29SFLZHmcKAvM\r\nUVP4pRlpQ9Zs1H6lQt9ZO3XM9GZ/8pqodd+vNy/2mQWPNP94WXEVUQAubu0i\r\n/MOih+Eb87zIgPaU3w9MDEyCnGl8dASaiBmhH45TOoMrvtps3yVIWY8UjS6O\r\nr8r5Pp4Sktra03Bc3dFmsE4RXoiKOkSOA80sZXjHJSsQDo1NZFLSYXcJ/0hG\r\nIs1pti9xATY9euLecKG1P6NLyexP7wIJ2UK0NMj2MBH9PFZmmDZ/5xIJMXHd\r\nZ26VeWpaWnZRnCNPA28GqDyy+BvlCqrwu/eRhz/hYvgBzDJTdM3W74uw4Oo2\r\nYdhw5B4umKvjffJKWhZiZ6I2IGpKEfkreQFcB22RIk8WF0VMJHyAWL/v5zCp\r\ncCbUa0fHJ17//y9T4u/s4AJ+OoS13ZXGdGt3d7idmYD9fcuYXylDzUHjHB4z\r\nwDeoQHaE0HTb5YjpofG1saRid1lpyvZHSYP3UB/Z8CXWF/ER/xH07pMY1uBF\r\nFDSGzCNJq7fUSRo333rCUKGynMfl4iDXLwCAKx9IYlAfrdnAvzs0pyn4Un8w\r\nTcn4qmODxOMIqMKgaBuIqSpNBoKSFgsrpbMC+6wdAZXHPPNLSvegGjWGTjcK\r\npZgES2qSbWR2p7xEyBbz9TKyPGXNkmV8E40=\r\n=Lrkg\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230114115320-d97bc34.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/00aab4e00fb944af645327add807ea4c/graphql-hive-client-0.22.0-alpha-20230114115320-d97bc34.tgz","_integrity":"sha512-03fTd9DKsi3YtHIS4vFGcUxa1oGNCejFHk7N6l5YH3JZw5uW+P29ojqr4wHV/xvDO+vj6Fy8zW3YVpUQa2jv/g==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230114115320-d97bc34_1673697236825_0.1568128642647646","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230114115628-80390da":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230114115628-80390da","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230114115628-80390da","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"369e41765d152e5fb0d0d088b3e0116ff885d9f8","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230114115628-80390da.tgz","fileCount":60,"integrity":"sha512-1KGpiDNclg/bHSHobSBkUMzIlFu8YUyJ8RYSqwYetla39OWrfxdNAg4H27BNLdOP7zPyA8MyWRxrwS06v0wKhA==","signatures":[{"sig":"MEUCIGLyh4hD0H4LER934mkXKbalubApC6imLjPd89QGzarfAiEA2t6xNiCBgRP8HSFPZMDX4whnfrijLmPBv+9ttvQkUZM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwpiPACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrsYw//bBlFoWcgoZ1zG+BxGS3cG1erWS9YJW8NDMgE9XMYZZzC6bVc\r\ntZDa1LHEJQPE8GyH//yScFOziJEC01ZZ4Lvu4hhwDp2QAbcZPgkRApk+CrFF\r\nqXRqpc81Dcf+RAo0BSH32MtaUkAc/ihMMpO+DGf68eOe3CFv2rcj5ltp0R3V\r\nntihsMAKv9cUaQ6271C6ETC/8678J3r+rWffCyprmFGVP8geCiY8gaDdAE/x\r\nkhZklfMmE5DAIpDYRHET/2o1Jf92eH1qQpbiHJ7uYptBWbVjsZ/R7egSKSyo\r\nUGEsVnu9wxF7TJYhir/TRE4hkfQ/5Vis9RtO2F+ljLoi/kS4p+Tm355msRcA\r\n5UnzNat9z5UWRCgEG0x2O3yF8P1Zx2KVxrM3OLTwuy0Jt1e2GJ0QSjWhu+Qk\r\nKBzkI2y6BInI/hOsvFK2HvfCFO4BsVknxcHfmHV5nTn/eEIylOOYOYfSRi+y\r\n8QuD9bGW2NM+JZeyjHI4q3GXwOo91KYS/xv+HhlYNG0cFvn2bQPYGwHaO9IR\r\n4b8BDxrrOQ1eLEKbuAr5PrIJMUdxwEab7SLwCEv62anB6MptEAhVKHybJbsp\r\nz2Lq/FKJVZjluafBfLgFIUaO7XlHZxjMIHI1+Uhpbu4yJXkspXgHqPeEHFa7\r\n0XrP04KHsjLP+7Gxcybao2B1sv5WTvP/CyM=\r\n=UU9b\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230114115628-80390da.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/a142da41c29dfe18f9b86389c22bc652/graphql-hive-client-0.22.0-alpha-20230114115628-80390da.tgz","_integrity":"sha512-1KGpiDNclg/bHSHobSBkUMzIlFu8YUyJ8RYSqwYetla39OWrfxdNAg4H27BNLdOP7zPyA8MyWRxrwS06v0wKhA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230114115628-80390da_1673697423749_0.5649970281816579","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230114120326-b5bb8b7":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230114120326-b5bb8b7","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230114120326-b5bb8b7","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"64d1d9797d0ca9580fee2179d7061da701206620","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230114120326-b5bb8b7.tgz","fileCount":60,"integrity":"sha512-Yj1/KPG+z+O4qNoNiEaf4klO3Eimpt7Hh53UQI98TBRoq0qfcHAAcGxMNHI2a50tZpOjMz4/EyUlkJqMBKgDhw==","signatures":[{"sig":"MEUCIA+wmRQ2SpJM1igpUHf+ofX1TH6e0+6da+8O8D6jLOWmAiEAvIlHh7bWfoQnKlQZ5EzVkuqRjpeo+/ByMNoTTzFXZbE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwpoyACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmq3Dw//f79xnHhg7UDNNiSY9/+La4rJC8FlcjOJHcjzGaZdFFlR/reD\r\nCnwf+v7L0fOBeQaTN3kvL7RZutlWtZ9BmjlYdITHh2cltNiBYHhKV5fdXS3E\r\notH2X7DngIPz5X0Xa1imx6NkHSwwh0FF5ap1BCRmEUrJzFo3P3p107U8f+IN\r\nCDb5XYbn5kWVWjEeoDWGAxJ3s4KyMw6AXCW6fDWlSTBzP+ww+lpiWO0h+enC\r\nywkEyMo51PIDMHwUypGf3yMrJBPi7nAujb6AS6o0BhWVsk3xzV8mBI0FJiya\r\n8/nOp4svPYVvUiW1URadouFLLebgkOBWwmvAcmESIjHmGnbx/Sse+RG+9hq+\r\nqN43evAvn4ccX4loQ5QEkyN/i86dh9ebh94nLjJqrENoYqC8jzyyUurrQ+C9\r\nsteSW6x5HBnjICSS1A0NklrLkaI5BqN8lYrXb/iW5Qur4KQmOygVFblzl8Pg\r\nLKCcYK7bR/+MXqHO1t006E8j1lhwDOnpMlEsVyRLF8hrycR1SZPVrSJ7Gv6b\r\nW99foRmaxpsYoLPxRzExLs9sQQM4GTUgwQKCs09/jbk98UXlCR0H85jTWaNi\r\nS4jUZAfd3RP1Cvnzygy65gbbyoh1GW64m9JgVdy0z/kDJ+d4488vJ89SM1Ov\r\nzSE60yDrQswk0ipHuAAcOIy3lYEaQCJekRI=\r\n=JPSf\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230114120326-b5bb8b7.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/acbe16ee63a09a5d77e10a3a6766d6a0/graphql-hive-client-0.22.0-alpha-20230114120326-b5bb8b7.tgz","_integrity":"sha512-Yj1/KPG+z+O4qNoNiEaf4klO3Eimpt7Hh53UQI98TBRoq0qfcHAAcGxMNHI2a50tZpOjMz4/EyUlkJqMBKgDhw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230114120326-b5bb8b7_1673697842643_0.2951723461108553","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230114202607-7bf2a1d":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230114202607-7bf2a1d","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230114202607-7bf2a1d","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"fe591c095488b9ee8ccc54803433e3e0284902a4","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230114202607-7bf2a1d.tgz","fileCount":60,"integrity":"sha512-xQdM8fESfRSExbBgCIm6mjdA1hSRmNcUjBaH1QKQUuHhWe7AqqjcWg1dpeIKffF7rvStMiX4H0JxyLpqdwvwWg==","signatures":[{"sig":"MEQCIDNYQvlz7NDbfnUWFHUYp9m28XN2wvfvJTw4mLUBlTO5AiAr8Wrp2y4AtKpQAjZmiM6liyBLZHaL6ts45voOSbMRng==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwxACACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoEdA/+Iig8dpATj0zVM08xJM+P9icoSUhHe/OaILPBMEpePe34i6jD\r\nMchWO30yghQTE2QwuxnSQEeAMgBLxk4jCHmJzUBDBRyS0O1j78QxUeEI7LIE\r\n60hHdy6PufRL/63jDp0zBbNUVy3e8SmjhTDxhZFZx/wm83pxmLDeyrkt9Y3R\r\nvvfO38bmRoP1Q4XGs2Zfq5Z5DzZzpwAnkZGfxZsao2oB7MkU+HN23MFEHFRN\r\nr48LEAPbP0W4yMatllEDgeFZi+onA0loxbkk4gnAPPjoSxOc53M72h8P5HtW\r\nUe40HkGwpWp/oGsJ2O56YWWKJXKatl40GqRbLhetL+D5tUT64Cssm0cXOC0n\r\nqXQ775VlKWlqyLdJj6lER4lFnqeoWTv7vdf5lBFGoWCUrcpeW501u35KDVbn\r\nrcUiOmLveAzx0gD5g7TjtS0zqtX6KXBymh6MaYBkASA0KAQ1XwXMoArYlM1s\r\njtvhO24Jxp/ECLzAoy2Z9Ywda6xQjialAbeCu4uGUwiqykilDpBkHSEY7LaC\r\nhWedE6GS1wsryuSYTU+Py4ykl189O8PxE33lPIlul7GWcN3VzbPW1blsnol7\r\nRjs99p4b/LeWQ7oCrWYjUUPSUNCIYQTW+SR3/ebNaW62yYjrYMLduFE9xhRH\r\n3DOatjxcZYEwBg4PlNFlL/KAvPHAZePFjEU=\r\n=4KHf\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230114202607-7bf2a1d.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/d71d21ac73befbc3c5bc73c179c0a0bc/graphql-hive-client-0.22.0-alpha-20230114202607-7bf2a1d.tgz","_integrity":"sha512-xQdM8fESfRSExbBgCIm6mjdA1hSRmNcUjBaH1QKQUuHhWe7AqqjcWg1dpeIKffF7rvStMiX4H0JxyLpqdwvwWg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230114202607-7bf2a1d_1673728001932_0.39191369385253294","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230114203130-1e29ccd":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230114203130-1e29ccd","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230114203130-1e29ccd","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"9d39c08034c6e1963cb5121f1d514117ccd272f5","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230114203130-1e29ccd.tgz","fileCount":60,"integrity":"sha512-DdCsPwosoG2cms2xG4Pb/6Q3zZ/frqqw1Jmn3TgTqyyk/YyUd96yX3R2AvRIkC3QD2xyVI+SCryp78JBNqvaPg==","signatures":[{"sig":"MEUCIQCsYekFlqOJNPty8lBME+1PcLnOeEcBn7ibbOAK+KDDuAIgGUSlUecOlksc9qt4DYI7JSOhPuzdrGXqP+rNAwEtCRw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwxFEACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoBHw/+Nak5CcZ4VMOxAaI2b8tpxJdBplYhdA7ci3iy8AcZJAeoYZzM\r\nLhRZ0GSZ5ETPa/U13TlH/s3SepkKed3BnKHyszfqqlVzLfAbSdfAJEUwyLsY\r\nObbtoCi7tL7IF1NyNoBBWoZsJ87DIpA2NpgTyWswgpEpYKZrlJNnL8wV8XTr\r\n5IzRDSaJCk+Bhv3pCPajtKGJFI4hUHBBMnMLi6qUPY42WlZeNRFo8KsOl36k\r\nr9FDKx+DMbpos5XQEMN5dwUnKyCanRUVvuCGKJh4ALKIwVYAetYBDCG0AQ7t\r\n4FjTSVJRbl6ft4kwVy5vD/QiTWntq/7Ajv9t0OzcDb7AvYe7z/343AVKCCWr\r\nhK+0fSXt1LnWLlF8YrODj/y5PLy/Vwr8txYex2efxCClZr1qw7RJQFd6V5BV\r\nWxxNA8m6NPISaXOD9e1U5Xe+tZwcWbeI77lA1/aH4tGxrmeUUUtqbGZRVulJ\r\niEAZExPi/kDE+H+kJWmM0a6P+p0lolNv2IZvVRSXFOZhI6UWLFnUsUocqmJO\r\nLPHYPLnXwjQ+NmtTOMpZQjUfEwDAl6wbFobZJ0BImcAtpzPcKnPFFQdpQdfu\r\nHq5IHaY2HHdnNPtcXOxbxYOiI6LSIRu7jEX7VYQcY1B27wU06m+c28Y7xRLc\r\nISy1hBzngkamZFAyIEIGRLGCEbScowlpkss=\r\n=zHJG\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230114203130-1e29ccd.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/7ca4a7c8d8ecf71f31ed443a4d2e9024/graphql-hive-client-0.22.0-alpha-20230114203130-1e29ccd.tgz","_integrity":"sha512-DdCsPwosoG2cms2xG4Pb/6Q3zZ/frqqw1Jmn3TgTqyyk/YyUd96yX3R2AvRIkC3QD2xyVI+SCryp78JBNqvaPg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230114203130-1e29ccd_1673728323809_0.06176721522501771","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230114232848-185da45":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230114232848-185da45","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230114232848-185da45","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"c285a7eeb480cb0bc1e3d63cda2fde25272cbb63","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230114232848-185da45.tgz","fileCount":60,"integrity":"sha512-/A2oJpOV+wacPp43VNpR6pMr3Ksqt2OfyDbkjI/0zgA+jkLm+sbxtVaAeA9aoDNHnz6NxPL9M53OkeUONPwqkw==","signatures":[{"sig":"MEUCIQDGdm5KzbzWxHbdEBSUgZlDqEips23LqfOm8bpTF0xh7QIgXzFCfq3hVbiYrbqQEAS+RaZkU8kG6FOCby3E/0ICvVU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwzrSACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqAcg/+MhdTCZJ2rjHKfoaQahGKqRwbVZ50vLKzJCQv3sRtuYbwAxzD\r\nA+ufQEmps+Yd4sxisBZ4FUSHR/7852oAiR7T+Snu84wt/RRVdHHDxgzjXkka\r\nDS6CZnmtPePkxB3FAk9BiVPqRNumS4yBt87SVggptU05/FkJcGhYaS/aJ5K6\r\nhXXpYWOgfspzq67KvRj/H+ddJ/SdYCDlnAmM8IakEL8zlfBvSGOWRk4Zv0Xy\r\nSlQLZwhD8KvDxxQBx6AD94pCQeB8HlcVJ54V2mM2Wyozw20jVE1fxpRjuZWg\r\nVSsCkQ4GtdCP3e1uAP1zR04s0nkfB81oExAvRRB64bsidJ2vngGPvO3IYeKg\r\nSh1GTO0mwBNRyxqwQgla413j3GDDynfSc52OgJW1r5joTtkwug/QMdJ7G77a\r\nuNelrz0Qc4cm7XWYnVhmwZHh1lqXl+WPucYcRHgU2S8f5YSUt4CHa4M3Fugm\r\n71a2qZuZK0cdMbAYRGYrDcK8hxDu+rjxTzo1guUd5xLfu8P8jqLIXIHpaGSS\r\ne7ewS+5JLuCP2bE76/XzNqyEboXZkU5VQWSVa1xHnsBaGYpwhsBw3rm3M8Gk\r\n/V7+C02o0Xm4Q+Ru+651qTlp+5B+rxNjByyWa15sx44wsffi3uQt9rG2L23y\r\n4iB+RdpTtDFK3yCtrQS0pVp7gCtktBSP8l8=\r\n=d0gW\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230114232848-185da45.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/0b0a2476b879ec00d8c155b7ea565c03/graphql-hive-client-0.22.0-alpha-20230114232848-185da45.tgz","_integrity":"sha512-/A2oJpOV+wacPp43VNpR6pMr3Ksqt2OfyDbkjI/0zgA+jkLm+sbxtVaAeA9aoDNHnz6NxPL9M53OkeUONPwqkw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230114232848-185da45_1673738961910_0.21142532078934773","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230114233451-200ffa1":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230114233451-200ffa1","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230114233451-200ffa1","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"759ced90f63a7bc6122ba5a48b3542b76b7762ed","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230114233451-200ffa1.tgz","fileCount":60,"integrity":"sha512-JlP3M1kPtZT+aawWY8KG4Vb2KUxERbKCJNUzlCZhbRBdMyCL1oqLDsEvmgsM8WtvjYx/z/oIB0YsABbBc9bUWQ==","signatures":[{"sig":"MEUCIEMiZWxg3F96HYTBJ6LnODbsxcxqUBGp8vJk6Gg4C6ITAiEA3YSNMJEwN0g/R8Ezm7eEPWSjQM0oicLmBnjrm5NBxzg=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwzxLACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrK6w/8Cp6GUYMrpIeXh1i4XVmPt68BGOd+uaeLue0MRXzxLIRsIgvm\r\n3Wh+EzSu3uoLgQN7hr0DIbFk3QXqi+4OqQoxaVrqW3O2xXShuz2fseKvpglD\r\nHgVQjFAJrD37v/+AZlEJKb6CLmsrOAbpZOCxHs5ZtMLUzxquYaMHGOJI3vgF\r\nkNi6+kIQTpX+S2CeJOi/Jqr/eCGPvnFdEG/qkxa0uJ8NE5viFQ1l0Xd6FlNo\r\nocG2bgHnGHDVmIi6iuDreSJNxcdcx4SDVFXYTCCo10z4rCwDHVnzYRZmlsmq\r\nGZJmhh/KD5mB3Nh+e28JBWHWqZ/geoY+Ide0cG2P3ujkAVqmLNYiPJn7L3+8\r\nOAZQ2j2Rf5HVpubWg4NnL+1yu1hnxvLo0eEfvYm9fqqMWtjhKyhwl9h8NywO\r\nLZ/SufI3kKxFvc+37YXFM+Rp1Zv0P7AEKufbvetZFQy1p6hcFLviOeQ2joYL\r\n4oBlWW9W8ZYsHoF41KoEeo+UX9j7PEkSh58HdLx4HUVpkrc/UKHvOHcyOPEK\r\n/H9W5ugzE4sQczTObm8WOqexE9sjbS83wxpME8muJxTeQwTk5rmTMFsDDiXP\r\niQtgLupUjKzf2zaQzEdkWKvxjxUg3DLEedNTCjaqmYqbO23u1IDo8/EMLZyN\r\n+qbmynCmCajIRJUvZVR9TxvxCErtItI3h64=\r\n=potC\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230114233451-200ffa1.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/834ad0748f824c66942fbab189041a11/graphql-hive-client-0.22.0-alpha-20230114233451-200ffa1.tgz","_integrity":"sha512-JlP3M1kPtZT+aawWY8KG4Vb2KUxERbKCJNUzlCZhbRBdMyCL1oqLDsEvmgsM8WtvjYx/z/oIB0YsABbBc9bUWQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230114233451-200ffa1_1673739339758_0.06584389548381875","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230115021341-6198df2":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230115021341-6198df2","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230115021341-6198df2","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"cbd9f8718744c57b1c64cedb4b7a2f32e1bd080c","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230115021341-6198df2.tgz","fileCount":60,"integrity":"sha512-HQbEVuxC2SiFJB4xjQ+l4sbMdEzK+CzUDLUttsIEGJPy5a1Ols5msIFK31q0Di1mJNu3atY3Vrqar1vyoddmFg==","signatures":[{"sig":"MEQCIG2QTuMZWaXhXxQyNDdjZ4xqgPWHP2mUvNkgv+d8sse7AiBcvjaB/aybPp5v9BVdbH2VUvrZ5zMswcYrcNYsEWhGEA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjw2F3ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrsDQ/+LFRB+7Ho78EPF5a9IBPzIxSS9k14XihRfSohtj4Xxo30nS5i\r\nl7sv0mTesQ1zn+reoqcu5DzGuvVFSwgWoUE6UsAQcJJxmWX1vmvjFLWQaZbo\r\n/ZKSqkOLZxq932RqfTLgmuysq8rLFZyQBzTJCr+aHEszHwfoHG5tEMH1fGm2\r\nClR/qZjRgXZyuErtfI9DiBlHVWFM63Yoo60D9uE2iVVHqAUzV27ZlkA/ocmA\r\nikqjTdUOcp3fpdHwMdfbcTm72rfQR6PdW6cm3ekJ5qvmv7sp9Bzz/rhs1iJQ\r\n/hg8xY1YizQfOwaUOb+YVlgVArOyOeB1X/tJ6Kmj41drO1HLzFhli7NL4Uif\r\n01lpzRpZ5MtDh+SjtEoAaT/HtLnv5938N0jfsD+eLWaVQQaJG1yVpaAAguLs\r\ne7HGe4T94XdOTlEXLYhQVfhK+3ZCKSUjo2TbzkHocDmCNSn4tKe9r7A4i0c2\r\nq5t/uOC8wmNkZJJF6ODH4Ufdxwb60fPPUOczhm9zDfuWqKgR4E0WZzriiz1U\r\nqmaKQJVoKgXM+5nrFL034rrQhhNDjcFhpHi70UNn15F306Ez2MOT/KXZJv9N\r\newWD2hUvMjQ22XD1zbaxTP5qx19z+2hqWAAaTKveSUUqL7TMPxTbTE9Q64bv\r\nN6GCx7dfUd60Lx74LZ6heA7t5GgEGWpi3Sw=\r\n=WWM9\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230115021341-6198df2.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/2eeb792b9bc2c4fbae1bae116431810e/graphql-hive-client-0.22.0-alpha-20230115021341-6198df2.tgz","_integrity":"sha512-HQbEVuxC2SiFJB4xjQ+l4sbMdEzK+CzUDLUttsIEGJPy5a1Ols5msIFK31q0Di1mJNu3atY3Vrqar1vyoddmFg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230115021341-6198df2_1673748855671_0.6195956033308974","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230115021943-657bf34":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230115021943-657bf34","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230115021943-657bf34","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"6a9ea9b2b94e5f319fc7548e220806774fdd0839","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230115021943-657bf34.tgz","fileCount":60,"integrity":"sha512-5q6qUjs8XYBPLcfl6tn8te3bxJTUErMNvsIhDltxXOd+LnS/LUclm5B7e0hJum6d4YhzQoLHgM9LJYHs/nPqMA==","signatures":[{"sig":"MEUCIE547k+v4SxL3cy9neg5zV+P9fSRS1DXw35hmntG/3ixAiEAx+4n4zaIpya11cPHNoLYa9Rpe1+IDlyqV5QvUWBVuyM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjw2LlACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrbLRAAlrfxIMLa9IQfF+2rsLHE4ydke7F2wUxInpN9jWa4c44feuqH\r\n3rKuoxeOOeW3jaecfnuqMJAPXIGMD4/OqgUnjywRneJPyFME3A9SzAGdJtbj\r\nt0ZFQKDU+yljEU88B3rGpr9roBEQqdP2GkHQFB1j7F3unT6neKDWWhibS8tE\r\nlVzDNHvTsoTrE5NA4148PUHJaJ82aLAKJuzRb3yWbFITiCn8sfNqhQPGvsKh\r\nmej1uaV4NNgCgNt0d/901DY3JHyxJecl3Bubrdo6PjuZhRj2p71/pC2PnlH1\r\nEvHeogfuu6J8CpA5596fN4fXBhJFt4rI5itQl2tjB+uL7641AEeMQzwMGOf3\r\nOFTqmDlOTgyJQu+9oh7O9aUCCqq5iZblbxK9GMrxtVdeFT9cfbZzxarTZVmp\r\nkXXnszEZwj/XDKwPivm7C3jn5vp/VhOGUxsYICZNN+ctv7PaxqxbqLtPBzVA\r\nezzucZeZin5WXRn6jiLStyL4powSdCA2v/USQsga1LRg6fn/FJR0g9pVZBkK\r\nixx74zX4lNml1lkmjmK8Hm6nwfKQ7l3xzwuhYZk2jNZvrtSeaKZDTo/6RZyy\r\ncarKPJkY8IWChF9NXdOgf+DOUKFPzY+ld8eS1FdCpSCzNg59pvqwZaSg5URY\r\nA7RytJLm8w+kFunbK+CscYE7u9pZSuZeFAs=\r\n=/Laq\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230115021943-657bf34.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/0adf2cb241658a5845044f98a9692ab9/graphql-hive-client-0.22.0-alpha-20230115021943-657bf34.tgz","_integrity":"sha512-5q6qUjs8XYBPLcfl6tn8te3bxJTUErMNvsIhDltxXOd+LnS/LUclm5B7e0hJum6d4YhzQoLHgM9LJYHs/nPqMA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230115021943-657bf34_1673749220842_0.25851681741084787","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230115022439-09813f1":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230115022439-09813f1","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230115022439-09813f1","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"5f84ecae5ca9056ec232f40d0bb2ff8a93f586c6","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230115022439-09813f1.tgz","fileCount":60,"integrity":"sha512-6gbWI/vUgIE1AI/ifL1Q1oND9IlvwRoYDUaA7BZK6MXSrIA1TSB2yGkln915bsK7o76QngdX4X7GWfe6qCVpVA==","signatures":[{"sig":"MEQCIEO+fSCBwK02N2VhsgYvkbq4iKdMsM+PT9+f4zdmZ/rPAiAWxBR+KBl2AZv5ufYhWj+esCUYFeeOQz5E/oLVEoGGpA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjw2QIACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo1xQ/9FnJm8A1V7WlHQHOH5fNOLlC0hPQsl6FNcN3ykcLFotIfDyHx\r\nwwUYxMcO03KmfVQwaKuTU9WAqUV4SxuyqQ6RGOr62cpvLDWAD1BIe+0GLSZm\r\nmvpn9Wu3QrLD49bu2LkGNBvJibSVePP3y3Zdega4Z79gJYbIiC5C3jMcyJ0E\r\nnG+S5h+g6gqb9d7tGtLSOFOJJweLUvOmqvGNdgpofSr/fTPII2a1P0qD5N7T\r\nAN6yTWeI5ol8s6xsexAjrP3JLZMd/3ZxAW3S7FHXnPJUL5eGI5kJ09zdYlL0\r\npVMaf4q+KvAyeZSf69uljsJPt+O1A7Q7vu9iXRcm3aQScNmQNqZM66+SMcf4\r\n61WqNVBWNK86zleJUOP8RwHi7bnK9Ezfl3IQXx7Ux14tBLl+ahEFqyfrqNWp\r\nkJlj3r8KF0U4C1aZRSCs2eBmDwGkOUAyQVaNr4zxlBNbibT89k/FDK+iifis\r\n/G0O3ci1T3AR94+0aZS8wtfc1GJNSuJd9cW+Mz6T6xILsUX/x3SOkHtPxQya\r\nY/1OPp0FFD9kbeOuOX5mlPlQ3EnT2nufvJemedEeBUjNvko1v4vEi+MFU1SC\r\n5vL9pMD+JJ/Pngv170L+GxIKLUc4yYvKVPavTFz9qFwPuJHP/zZD5RB1AY8i\r\nHzQefrX3vMc641NnHbos1x/ZJ5EGTolQ1h0=\r\n=+vJP\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230115022439-09813f1.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/37c453992c2ca0bfb082d7570b0527ef/graphql-hive-client-0.22.0-alpha-20230115022439-09813f1.tgz","_integrity":"sha512-6gbWI/vUgIE1AI/ifL1Q1oND9IlvwRoYDUaA7BZK6MXSrIA1TSB2yGkln915bsK7o76QngdX4X7GWfe6qCVpVA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230115022439-09813f1_1673749512507_0.29489519091202054","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230115082117-9240257":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230115082117-9240257","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230115082117-9240257","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"5474c7d9209419e7252885c4fe46617720f145c6","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230115082117-9240257.tgz","fileCount":60,"integrity":"sha512-FftnpO8xAi7Q7BJ+P+4fiYakOerXSnhrwo2EqI/Ma0SJxNeD7ttq4GIGVgzQdWkInTLMFiKetGd8lHK3VtlY3g==","signatures":[{"sig":"MEYCIQCMwe3BeWmGVjyL2wIwPFBdJVC61cKAPwV7a2zAg5FsIwIhAIWyGVBTj8AR5ccaKO42g3oE1sQZNw/gve0Rwb92XZyD","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjw7egACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpYtQ//XyoCKuLT5Zwhe1uhGLoiGWRmn6zOg57K2wQPLNVM9DuPM/JT\r\nAFsc393m0UNslqPa0sdLQ/ZDbhOzESJvzMQ3+Q5nFmQzOiR3akg9F4PLw15H\r\nCRvuOVcKP0YrP4sMmIW8x6WXLm20h573qwkGtj7Bfy+MP0sFeZQ+LlWcNUcg\r\nRqJvLhRVhSch2veOODniMkpYEWiucGwOHJUrip2/D5ckW+N1yJqqmuo0yIq1\r\n4eavY9I7WbyNrCdGKpuJ7Or3FUrVeeImhS7ubGonjODsCxSQUuvINW4hLAwx\r\nv00kBXcJMGOF0gpE2JjdtVGY+/zL/GvCPZMessq8CmCxLi1bIkQUXaxFoayv\r\nYUiae4DBUUFU7okPO82/j1v2QRKa5jrg1nQANUGVmYtj7prxJ0yshmyVFiR7\r\n9pHVaMIea1ylxp7/040dttAfXhtkOjfdntBw9QicXZnPfJJVi+lH95dqnkb4\r\nzhMlheBRyIqH/sorkYPvRm/blySyvDhqP09bAVY0i6cAH8hh95vAkkTavXmg\r\nGdzEck/iKpLOVeokLOP6s0id6GZAICwY6A86EORhdBKEUYEx3eREJ9OTTGVm\r\nTmuhYbURDTUaYGOnGjO117pcTRahDPLP3iV0Uugq4wpbbjxsHe+4uc290+wz\r\nZeaCC0VVlevD+ScAt0U/znTxb+XzWTpkQYQ=\r\n=+j1v\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230115082117-9240257.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/7ab6a2cdee2508f433488d746cdb4ec0/graphql-hive-client-0.22.0-alpha-20230115082117-9240257.tgz","_integrity":"sha512-FftnpO8xAi7Q7BJ+P+4fiYakOerXSnhrwo2EqI/Ma0SJxNeD7ttq4GIGVgzQdWkInTLMFiKetGd8lHK3VtlY3g==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230115082117-9240257_1673770911786_0.11345804804152104","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230115082718-128c7fa":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230115082718-128c7fa","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230115082718-128c7fa","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"54f69b0907c716811a735a4ddfe8b7fc285094e1","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230115082718-128c7fa.tgz","fileCount":60,"integrity":"sha512-NpXdK6Q8rElRm7pZ26VBeamNr2I4hBRaMt3CfhcB0M1d4tHLmME6mxQLdOoQwyyS1X6KeFqpejStdXom3mDg3w==","signatures":[{"sig":"MEQCICIYI8OpGQzKlZEIFnGVZ//jTF1BmNBgpjvOV79YLTTHAiBOhGyNMBopoiw2zqIpOh7EUYNUHFjoQslzNpLuqKBS2w==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjw7kRACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr75g//Xao/DDl+n8+I2zR3R7qur8j9wLQSK4vqf0eWF5QqHKvBRbaH\r\nvk76IvpvisUBr8a+pupNks3LZRQy7+atuQYOOIML1hkE7UzJM3qwWsIIt4w3\r\nxHoNEMxk4FUGpwAYNR2O76DldYsAQGDS1x+yf8DYwYGSFfETpccUUCX/8l+R\r\nEX0daX840GEJbGZBsSbavGtAXbla0HOKUGTEEIrcmIhpTIh5Q0oLBvvBPaDy\r\nfabnF47i5nyFSH/U6VchtrKdfZkSLSaDnMYqvpsAhDZeGQcy+zv9XR9fVZnr\r\nIOC3FKTw1wbgl2RfIqNHjZY4b6AJ/Gx4nJYoAJh3WOy0lNrU+On6STOeAbrD\r\n3CcqzGfQWkRi47ygFAQA3OF1jthNRCN9EcUMFFJDEoJdbmnGGSA3gbj9O+kZ\r\n/wdRUJmLJuLGq+UalzieGUG2q2ZvtsoVr3D8tvlcXUacz0GLCroC2Ip/ljJ0\r\nOC/JrCQKvHxBWNjbe+efbO2JdwbOxGmtRXRlufn0en4yPVx5c7GHKsZmeGO1\r\nAtKJA+mJURQdET4dLan2QB3MiIFMYZ5Fe2Db3RVG/cOA0YmH0j3muVFHZEX6\r\nZzQvoBBwud9Ip5kOYD1gX9SjVaLCK2vqWejs/c+74I7H6VmBOPHSSEjrOaej\r\nMPi4EQyiZ5REH2Y/747F80fWWRP+Gdy28oY=\r\n=1643\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230115082718-128c7fa.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/a1c46ec3030a5c22167095e1c9068d42/graphql-hive-client-0.22.0-alpha-20230115082718-128c7fa.tgz","_integrity":"sha512-NpXdK6Q8rElRm7pZ26VBeamNr2I4hBRaMt3CfhcB0M1d4tHLmME6mxQLdOoQwyyS1X6KeFqpejStdXom3mDg3w==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230115082718-128c7fa_1673771281595_0.971763117098525","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230115083931-6014b1c":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230115083931-6014b1c","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230115083931-6014b1c","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"a779a423e9d1b054bc1ff26685a7578e3c839a87","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230115083931-6014b1c.tgz","fileCount":60,"integrity":"sha512-TFI2cpilKbkD/ES/9BAoyX9QO+K2Y/sn7WTGrcMRFBMBADDJJVkdVQYkj9zzRVhUa7v8Juwo0YDn0l9f1LXBnQ==","signatures":[{"sig":"MEUCIQDr8MJ0NVFT38d9ZO0onFbOuI5oKjWbV/ooyGeXiEt3RwIgfU+Cr3U74SilZBALwHPUHM0tcckzw18Yspndn7CodiU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjw7vnACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpYxw/+LyJwNa7+RRPSJb/5FcV87DAUIlw75nDB+69Xfr4K+fm832+9\r\nX2gWWzGttj0aHCo7BVTvKrh96/VVqtqJgrGnGbeNW1jdSKIU0McxMzpdzq0M\r\n+dptEj+5tMbVGoJXWe6kZyNQs9lDfNFrg7RlArGdF6XFRejex0nwawZQlokb\r\ns4Ao4Dx/V5TSnVLmj6Vf4VOjZsCUulvQ2/2d8hZGhIMmKwqs1sj3W/3HkVyO\r\nPxGNhVyjJhlD0M/rFoh3iooPnUvz4ajmahp9VXDrzxSkQ6MThbbipgb02+Jl\r\noLGVd5FDSIhtDMCHt23V4s9vLkWDa9TqvVfNdK1NLKMV/McrmpDgiNZJcR4J\r\nqPI7ugo5uaTaN6gG9+a7Pr5p230y4kyasNjUWJKjrjACATeSiE3scL2LOhnM\r\nV5bCB5W1JAOh38LY3x3rmzAPvQQcRBsYYMlOWDD7/JT/xvpQdfl4b/dCkPb7\r\nboCGCoOI76a0TtYc2PhPSeir2af9WDXdbF2ncT7eXM1XNL3R+3PuNnCTdt0s\r\nVsOPeXZp8tI3XNd9Zzanar/uYqodu0g1vSPe7Favbtq7+a3Dw2GsrZNKXIx8\r\nUnlIeayIAO6QRL5zl/t8cq0hA21PODxO0CEdPA3S50WTD6PMsakIqp7qRYmt\r\nRzv3UsNBV0E3UZUxXt4Hls6DS91Iatr+8Ig=\r\n=lNak\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230115083931-6014b1c.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/8376ac8b2fc0acb7394e89b02859b4b6/graphql-hive-client-0.22.0-alpha-20230115083931-6014b1c.tgz","_integrity":"sha512-TFI2cpilKbkD/ES/9BAoyX9QO+K2Y/sn7WTGrcMRFBMBADDJJVkdVQYkj9zzRVhUa7v8Juwo0YDn0l9f1LXBnQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230115083931-6014b1c_1673772007705_0.7646429484911392","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230115084415-dd4fdd8":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230115084415-dd4fdd8","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230115084415-dd4fdd8","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"5fbf98d1bc68fb01bd3fd0ea1c458fa4a4738e83","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230115084415-dd4fdd8.tgz","fileCount":60,"integrity":"sha512-ityzoI8YYZN97xxBL4u4l42SLgHlTUaQq3PKCUPe0C4FLFHpLs6yzg/Ofk3RUZs1ZfdFbGn9qn1nkqBSc7BSGQ==","signatures":[{"sig":"MEYCIQCumyhohQiVecTYBAFdULxA+rN0JPP1zcRk/sD1OCzvfgIhAO+bguiVJWKWwgBgL9GZ4uVYY+1dUVYPbEXuBySzhOt9","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjw70CACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo0Wg//S98JG0Bc4xRDi4PlQ/SGOjXo5iV9hrMMXYpdwDA1YnfT/k/y\r\nDGEiwViGUeGKDgm78aYw7ElSdb5sfnCH30t/CAdfeLfJnrl7W7AqSTmiKNje\r\nvjclqVEF+BMEejCxojCGNuREFiSu3cdTjL1+LSsJghj0gQ3qHC113Gx6hD6f\r\nwhwIn0RXPPQMKG1tamQH2YyvOJVNZNgOYLOqjf9xOUCAm3VVzryAVZu7CDuu\r\nSFuFRyx2LhILucMetqfdNRjuVl5u3Ix1Uje9un277TddHYtgB2vLTGykk/Dm\r\npqNHNXIQGTo4IEi280I+xss7OE133eYsP7csS0gPwniMc3yogmF2895/Te6X\r\nYqAho9Ds7Atln3ZNGfwJ7JRhCfsomPmAntnVPOZjcmIp+K7qxjPxaMlnNPyd\r\n2ySMP3Eps7g+jrMg3cQVqPNIFd6fJN3mMlXf9TqYG0Tg5i7pNqnvcxd9yGBh\r\neIqCt6UTKuwwBvsSzV2Chc/u/EZiq/2QBO1YhCZBT30K9axwbpQWkt3qYEmK\r\nOcVe4cyT83AlOf0LySwhRZldmuqtqv9p3w8rd6AbVXBQSJ63B2TG7HczDMuV\r\nBpj0PofZHeOFfIvRiw+4VzsX1UqjQzx93xDuQ+qxSn3GNXW9Iz6IH+1wm5i0\r\nGxfM0pnlSWRHYotZVbjo9ipAg2DLLxEuoJc=\r\n=/qHc\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230115084415-dd4fdd8.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/f4e635899d28956cdf6b56bab46d3c45/graphql-hive-client-0.22.0-alpha-20230115084415-dd4fdd8.tgz","_integrity":"sha512-ityzoI8YYZN97xxBL4u4l42SLgHlTUaQq3PKCUPe0C4FLFHpLs6yzg/Ofk3RUZs1ZfdFbGn9qn1nkqBSc7BSGQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230115084415-dd4fdd8_1673772290407_0.05704916513221692","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230115085001-f28d6de":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230115085001-f28d6de","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230115085001-f28d6de","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"0ac73ba00e41e6dd146de07376b36be795cfadd6","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230115085001-f28d6de.tgz","fileCount":60,"integrity":"sha512-UWg3pVo5ojc0m5oeZtKHUKAgf+xmAuX44PE7boCjyaws2BunM3rTATx9DOFxHQaaIHhTDyRm1Ct9C8Sdn6XSzQ==","signatures":[{"sig":"MEUCIHIHJL+E1wvAOk4iXek+A+O3e24Hy17QWvJQq0nJvLINAiEAiG+IYAgd8+Xx/3q0jSdPAJvU+w8Qix3Tw63rROsUEns=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169643,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjw75cACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo3FQ//Qv4rXIotp9HNFQgsREUR4jHbg2QvnIRavMKCW+cqHRQolf5y\r\nnvIl8NScCLWKX8MOhco+UDVTNuikc10MpOFqAp0SHqBAWuQiKlqU3jLpAelA\r\nhbcEUs5nF41CTYe5rJhCX7GIyAxEl5V814qmUjqnbWHReAf9ZIg9Qu1Yv6nX\r\nEQzxMJLsqYFBh9qaSAFPb6vZ1LLjmEUOpgzLE0hpPy0o97yfS6ss2fhizbpQ\r\n9GVkTINeRt9pTFyp+L9EeHAHMTFgNdbn9WtpxkVwd1dk2kuOo+x7Jupskdp8\r\n0kbTFxw85fpuQgUho+9V4m6nxdoU3dg1R+3Fr5uc18i1PoObD+rWWxq3AfTU\r\niULHZklZUp9onnrHVDu01O+4cZLYSdAAUjBt8WRgQe4LP5t4kvqCEVRvVF24\r\nhWVNnPnAd8d5Tw3jFnhcCvwvsJp2CtGPS3NaJflvQVcg0bvJtJcum3FlFaKt\r\n90xaRMEeggMI39jL3Pl3KEp5/eK/Gx7KEmYq6dbPdJ0zczF4XXTtuY0dc6vf\r\naz4LmHfAC0VV/3U+3A42Z8piVRgDp2TTIurkIqrvloOA79QktRpwsMGYKnJh\r\nZDhUT+kAN9ZV/31w0G8LTOjsm+NrRXmzUgSnFmTfFmq74PNMGyp5fo84aSy3\r\nTkUSQMj3ne5s+/GkX+vHyHd8y4L70skHkjg=\r\n=ovJ5\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230115085001-f28d6de.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/8d12a8da30272bc485c2f105bb8ea476/graphql-hive-client-0.22.0-alpha-20230115085001-f28d6de.tgz","_integrity":"sha512-UWg3pVo5ojc0m5oeZtKHUKAgf+xmAuX44PE7boCjyaws2BunM3rTATx9DOFxHQaaIHhTDyRm1Ct9C8Sdn6XSzQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^9.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230115085001-f28d6de_1673772636359_0.7096193977972023","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230115090224-6c34adb":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230115090224-6c34adb","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230115090224-6c34adb","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"387c8a24cee123f0e89a157db07a610069f25a08","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230115090224-6c34adb.tgz","fileCount":60,"integrity":"sha512-1mZZX4L7smWJUhLmwIdmQDuu4x2kD4tS5mWj87SuRIFTbTjHWRkI7iBCqPIxegrGrTpmgH7ljyXk/ZgusGIMzQ==","signatures":[{"sig":"MEUCIFMpR/Nt8X7IkJlhbKEDQP6AibksNvBAtZQsc69V7KDAAiEA8Pp/Pb+S5Dk+M6bv09w67+k7SmIwYmdrRE8ea28DxKk=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjw8FEACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrFeg/+KVFoxk65x7JYdVfLZdszAzY/pS1+JQsNAP9c8OEK8Ti7etHS\r\nnxIm1/TfNh6Iu+ELKIKljoAClBB2HnhIV1dV9/CYEGuM1Hg+UStN2jE3tHbz\r\nBhnty5t6ltffy0NGM/IjHo2VNMrzRsYNO8zjgFOxqh60QNX7xsSd6Rkq+ZBo\r\nf+HlxU9VaWo2ij3yApfzFiXnub5XR5GxZl+MJ1+FwX+9xdOKvVRqis6v0cuE\r\nUcmtvvv/lq/j1Pufbi1gxBpLLZTx+Ok+p/cwnXRZO1XK38/HlHIlRVlYT0Lg\r\neuTVEqUCqD2hd0FDkL+h4rSa0+VTAGis2tHglr2qt0X+MVhYalK0HvxgmDH2\r\n1BEoD3tTm2RWrvqqteVp5AyAk1YsWvoezliQwgOMDlvox4vSirtOziIyjFMy\r\nnDpTvdrKceu2ECfBNsBle5fEbp693VEo+e5bzTNRjBQ4kXYA6lYAp/J7f0Bq\r\n9U95Q27iZ8/y1NjMx/3aX4rD78vQzNkEPJNv7xJQOToMkJywuNg+fvPNeGp5\r\nOIDRMQoeGhrcpxT/fkn/Lz6FNB3Ox4zN1yxnm9CVVEaQG272kQfHvy6zMdj6\r\nHlNKwKycZ48wz0P4bBng9w+YcXuZgug8gIGWmnAOf6hVe9J0/msrggKKyz9v\r\n7CPgXdIITr1Ib0mpa9irSy4Abjug5GEA5mE=\r\n=guR5\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230115090224-6c34adb.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/aae506f0e991633003fe6bc3d9b158c1/graphql-hive-client-0.22.0-alpha-20230115090224-6c34adb.tgz","_integrity":"sha512-1mZZX4L7smWJUhLmwIdmQDuu4x2kD4tS5mWj87SuRIFTbTjHWRkI7iBCqPIxegrGrTpmgH7ljyXk/ZgusGIMzQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230115090224-6c34adb_1673773380281_0.7364986742169861","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230115090644-a709664":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230115090644-a709664","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230115090644-a709664","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"8f1e7f1a647c0602d53f8e1daf4c774bef5293ff","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230115090644-a709664.tgz","fileCount":60,"integrity":"sha512-g9oHUTdbkjcAY0o8+G9Z1Y8Fvvxv+CV7F3cjdKu9uFWSF/axLPXwlCBu/a+KTJi635orWvCqi/+bG+vx9xOz4w==","signatures":[{"sig":"MEYCIQDXLelJL7Owc25CG6cvDY8xTxCY7qLG3ER38edRyMUOdgIhAKb5jWkB/ArmWEnjePKJt+fnvfNgnPq7CJ+2ctjn3idI","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjw8JHACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo7xhAAmflCZUNhZ+M8OBA+wz9eEBRtLRedV5pO0j28EPLfGE9NSlyQ\r\n9m8PF1+N2eFGZ/TxKr1CCTupZBHmXHyUV9a9w4mRrHnl9Zr7bf968iva0k7O\r\nZkll/yWOo3DG4c1x9K7IVhjM/LDVxcG22h7Fdd6FXmd2ajdnmXNRnQY0v18P\r\nnqNHBcoadXwMPh/iHXHvZZGlQ52wrejeSlPkfPNrR4ZDNIokDP/7OTmP7vP/\r\nrWUScG3vFR/Ew8s8B+SAqF1USCNrd/dn79xYl+8Iy1bVqS7rh5LJCa15oS0u\r\ng4kYPsY+K0uVo2JGKrO2GJu6uV/XleSD/G9hSyI6t18ouHWAoNpJ9S+l+NIB\r\ngCqM3eX54QZ9UbKu9Bhv/1QfpknkG9hhZGlLNMU1Ruj5Nww/ycsC4fYZIXtE\r\nZHLue/K21GUgefk9+4DZC4oUaSe+T2GAhsvM+hPfbRV5dR9hzB0fscMDH65l\r\n2h+nooHfINMqV+v1xrcXmHWNMvBlCMyvOMFydMLNmDrT1TARbd85/x0lA0La\r\nEStVvQIxdEyvAI6V1JdT9TC+z5HlRReDFxbrJH2FASEp6HQAJ8dwr9jb0shf\r\nqfTunlzdioKU6bjNG5KlbbTfxaKyQorUTc5H5Et8SBuTIU61o6E+fJSm6Dsj\r\nBMp7uQpOq+Xs9y0oaE+HPtBCLOOYfZBOI4M=\r\n=yGpu\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230115090644-a709664.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/2c2d0412366e2fd092cb3f60b11dbc65/graphql-hive-client-0.22.0-alpha-20230115090644-a709664.tgz","_integrity":"sha512-g9oHUTdbkjcAY0o8+G9Z1Y8Fvvxv+CV7F3cjdKu9uFWSF/axLPXwlCBu/a+KTJi635orWvCqi/+bG+vx9xOz4w==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230115090644-a709664_1673773639556_0.9856314186821933","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230115090921-85f2cc3":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230115090921-85f2cc3","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230115090921-85f2cc3","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"26f84d1b68b421064df297233d5da16523a8e117","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230115090921-85f2cc3.tgz","fileCount":60,"integrity":"sha512-VSD9wpODJwpgsuVlGWkukM5330YmkuSkI4ncbYjFaGIv8Kn1QWKsFrnFkRjFiZJKecbD4ol0YSpCJsEOI8Uu9A==","signatures":[{"sig":"MEUCIQD8xRUBRYwoR1GsFD4g2bulHFCO2mAASx6lohVBEoE/zQIgMefm+pOG91bdx9D9pZQ5lKgNxjL4uNmBkWkqvYZFo5A=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjw8LjACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmpm8Q/+K7vEGqJZvn0Nuk5HrisSsO0yxivmnQoytMFbFhKkPatQg5yC\r\n1/oQRPGaHTaCZ2Sj1aNJ8RK1UW7Ewp2Fw9CpbLtWyeQ0tlJAjtC/CZ63b/fT\r\nEUzrj0Y+dOpsJp8riS9kc9CE4W/s5q+dT572HWepzN4Y68ANSNP3VU3r5GuN\r\nB/ttiFaP/kYuuBFHWrezsfmlc3VjuZhEh4ShlCbyXAGPn2GYh94QYWjkbWDb\r\ngmAm/CDXuTXLXwKNKZiGSylfyZmAV9FReXVmyCvQsDCrTRcVuVvul2rHdF3r\r\n6JJtoGIoyAr+kD5Nxn8jLSAnyr5IpLcMLtI1zcnohf9KmOML050PhyC1HFVA\r\nsU/1LrkNjzxQ1gWk9ANnPOMyxQfr2djW0z03x2qgvi1D3Gln3ltJ/jNsGaZG\r\nU43w0f8jm7O+XOGAhsFldSM2HY80WIU8cYE4x4VlzpLacfq8RXNDZACNqMTh\r\n/eR1WBcZpT7lpbYvgnwxAWt9nTcSeaMo/LXvTaGccu+IUdxba38ecTAqEIt7\r\nYo9RJWoigNxJzzj5MV9muWaW9njrbsPNNBj9D662MGFRJMEZT+MAzdqC3JHe\r\n9z7qcDaq4ycjRLN4cOeq2DKMO9AMwxTWiigwcA+XaTnoBoeY/HDSv1I/uSco\r\nw8YpkcLJ0lLDkiJQfjFEJv4KaSr6j8zkIXM=\r\n=smOw\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230115090921-85f2cc3.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/1807e931a6dd467fd1625573ba125eca/graphql-hive-client-0.22.0-alpha-20230115090921-85f2cc3.tgz","_integrity":"sha512-VSD9wpODJwpgsuVlGWkukM5330YmkuSkI4ncbYjFaGIv8Kn1QWKsFrnFkRjFiZJKecbD4ol0YSpCJsEOI8Uu9A==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230115090921-85f2cc3_1673773795178_0.24764058330949656","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230115091408-b632690":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230115091408-b632690","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230115091408-b632690","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"f54ae9215ac6668c30a66d47207e21e0f2b1433f","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230115091408-b632690.tgz","fileCount":60,"integrity":"sha512-9Miz1HLXE/2XX4VQjIJIETl4f+bT7RLzcjVShKIAtub+rWUDI6/Twd4tC9AIerRNdup5DE99hITWi0v7JTVT+g==","signatures":[{"sig":"MEQCIE9lFc7Wt7DbmxoRIapZgQeTDd3FNdlVWWzdZz/r50KPAiAi4+4xZSqUTBOfmDnM3MwEceeEX2T6CIFO5xceKiNjcQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169643,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjw8QPACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoGGg//R1NgKbkZMtpCxULP5w7ztBa8vMIlKHmXb+ajfgUQ/uP/1zMK\r\nLFRo8sJdrvBy3L/UFzuRaz01+OAQ3PbIMhxVSDvFd8Q5jusXZsP50qDCTP43\r\n1RRHDXEGiwUPeX8rQ9XOGem1vlASbd7dn/OPYu1YH/UbVU3QhXPbNJyMmhJT\r\nw3l35a0hjphQ4RdO0iwPSI6zOYjwNNU93rUGc3qGHO7pzrDWdZKX+jwLmo9d\r\nGzX1yfl3a4hsC3JhORzZRvZNBXuL/E0DOlWw+Hqz+NxONfUuGQsbob5GhpK9\r\nYo+o8VQsXUM21VtpcdjjxepUu+XTRYqIIDIgG12jGZTgbz1DVE2eBLjXdnM8\r\ng2gz7Q2IfmiMuUqU7ouCy3zBB6ZKfIFYNpXz8YbFrNgTp1SXgQ2yzl1CV9Ks\r\nDU8MwDwWEV3S8w31IfRdqh5CExJKjaq80aJ2Jod9oMVj0kNdO6tnmYbT/ApG\r\nnDVS0EpFLlypenbVkUqOF+t5UyoFM2/Q7fP7sLMhK4r7yonDsbT5362uU/Zn\r\nyad+OxQvoNPrQhBuSV8CtaV1bJgypqkJ5jsLG/o4ecL4pPl4/XCI8QigxHxO\r\njIyXTOnPo43yxAY1M1DMKaA5YJdT8Wc7m/DaRHQEAz+jrdbxBCoJaZQeJ3lu\r\n3ABExvJBD9Ar1IV/m5MWCI+HE2QHRCOCfd4=\r\n=e2z3\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230115091408-b632690.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/18dc00ed27cbb965c8d26e90e6b17c28/graphql-hive-client-0.22.0-alpha-20230115091408-b632690.tgz","_integrity":"sha512-9Miz1HLXE/2XX4VQjIJIETl4f+bT7RLzcjVShKIAtub+rWUDI6/Twd4tC9AIerRNdup5DE99hITWi0v7JTVT+g==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^9.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230115091408-b632690_1673774095158_0.35571764735497524","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230115091512-e5fd42a":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230115091512-e5fd42a","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230115091512-e5fd42a","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"5aff38fd853fb8d867216a112e8a7c78fd08f9ed","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230115091512-e5fd42a.tgz","fileCount":60,"integrity":"sha512-R0ZSs35qf7ZwzML9MePknke26f5Kn9d64ZKgMmNhvPb4cXyaOgNvuv66K3ClDxUraZVP4mQRRNtZ3uD37SaMnw==","signatures":[{"sig":"MEYCIQCdkDPkbKSSF2zsdwOdFXTerjCkDEpijz647wlqpeG+VgIhALhtcA5hAhZQWGg3qZvyk0v0CbyU4JAkXToMfslHqcP7","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjw8RDACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr3hg/9FwsfuuQ3lASf35Da5MeqiUf8ihyRa+dQqIch/e1bLBiT416N\r\nMwPZW33ah+WLrQbsXErGb9YzLK+xORnWGfvEr0nEx+xyPCxM/Yxp8bMJXXDH\r\nUdzhoBHMXzg38Nw2JdCc8l9E5uFo9jBcx8eTUWtPsah91cehg9x8xpcLj7K5\r\n+fB99AaxZA3J5WzsTuBecsjgu6tZPGBEi9FKoCixUwU6gdKBcNDyFRJNuDnW\r\nRQCXzs0pDfRDaX8IzuIUFmSpxOCMvNV9n4ZBRkffAUDycxsJBaflNT+OO1Jk\r\n7xG9Dm80bwUuxXlmrJ71z0kLbi5SoOM9Qbmv9tGB1KgYiw+Kh+t+U2Gz8zM2\r\nVWej4faKcTVMvvhxsInil7o5BvMG4ZTjWjwu4QsYU/b8q89JWtbYta8TOjkn\r\n7hK1wjwOA89O4uDnNusgsHCq8ycCxmK2O3PvbNDh0GyQvsJhZyO+K7hDAIal\r\nbU8vi3Fx0cvNypTsKT2cBE4dyx4LRIUMRRoil7DD+igNdZG9NXxwuwOMH59C\r\nPEtiin3kmcRMzjmq/ILl/I1jVuQVFzYZZ+Tzt9V1ld7nvCYRJnLTho9UyP8S\r\nVHwl8+r7djm7+W2VsyXBiqscz74Dka0KpjTOX68EAcEcewOHaLifl2aUPcO8\r\nq3PQk2LmapdO6T06U9zMrPefuSQ/v4s9GdA=\r\n=BZ7E\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230115091512-e5fd42a.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/bf621af7c0c2c51bb7d2079df89fcbf8/graphql-hive-client-0.22.0-alpha-20230115091512-e5fd42a.tgz","_integrity":"sha512-R0ZSs35qf7ZwzML9MePknke26f5Kn9d64ZKgMmNhvPb4cXyaOgNvuv66K3ClDxUraZVP4mQRRNtZ3uD37SaMnw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230115091512-e5fd42a_1673774147708_0.6305042465862516","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230115091822-16b5ee7":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230115091822-16b5ee7","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230115091822-16b5ee7","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"d1603b6c8af413bb36bf373c391752927a37c335","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230115091822-16b5ee7.tgz","fileCount":60,"integrity":"sha512-GsEVT4v+182VxzIu9kHZunTdYjdoqfZ/la79RtQ3Un2sFcO1c9h40PSeFVnzdrDB8pTWRscKsBAOiYPgS3Oktw==","signatures":[{"sig":"MEYCIQCpDP1wF993b5WK2NnZA7JzN624/RLCPd08/8HHfv7gswIhAMBpYsCUco3a/V71EFJ5Ho+IVugvcxM9sNpMGtn7VmAr","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjw8UAACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmprDQ/7BbuPIOgKBHtKuq4RxshAHWuj58BgXl2pKKv8OO9eI0PF4I38\r\nykffCia8A19ld6nEHZJh8jhzg5u0QY2PzyHChn+DvbBtz7kJDjg6Pydq3F4n\r\njgbxNIn+vOgl2xKKDNv7dFerpUZPhju2ZE+sfuuxPQtplP5CZrR2jwjQq3U1\r\nPEHq6TVjkDUZhr67pKq5Bu3pRn5K5tNbZQPwWL9mZmmc2UJIWbn1TPcTyIIB\r\n5mBUXpx68shfAbNZPKBKpsSewSPawERqZxCIzYZKN2gVSLkBa8jgvcS6e7jQ\r\n2dfFM80pSdY+hdNq0PmAITDkbsvb8Z/IOwYFINk0MiIJbB/WPn3E5ZrHes3N\r\nDD4kqMKAltWwfI9Qtp/8xBPHLnaPfP5PrO0btUMzcelT658mvDmii+MYCV1T\r\nM7Rs0YROSXcndwLNIfV8tLmtLSoE8G618dvwOl9v4+Ka0nPtG81iXObTQFAt\r\nQAoQcHwsoVn5McbocSptvyWDz3TfA2BKkb2tEx1a3N2CyRkFb8cKmwLBnsSW\r\nvcbcwAF6vTBmpzgQSfERIqE5lfveXX/XfHbh980WcCFng3gcaVUlo0x6s/A6\r\nIdvhFQwlnMAcxrHxK1ROsnD1YOGRS9eoO/+3jWUKGn297Dk7AjAfvbi92PIT\r\n9hZeEPylFiPlLdhKTEQ1Sf5g2eqhLBXF7EM=\r\n=FPWz\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230115091822-16b5ee7.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/cc4ba47cf1e5b7dc198320328856f28d/graphql-hive-client-0.22.0-alpha-20230115091822-16b5ee7.tgz","_integrity":"sha512-GsEVT4v+182VxzIu9kHZunTdYjdoqfZ/la79RtQ3Un2sFcO1c9h40PSeFVnzdrDB8pTWRscKsBAOiYPgS3Oktw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230115091822-16b5ee7_1673774336352_0.9208783658581476","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230115092115-409bb1a":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230115092115-409bb1a","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230115092115-409bb1a","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"39ce57ee08577fd5ee3fa95beba5278bc9327aa6","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230115092115-409bb1a.tgz","fileCount":60,"integrity":"sha512-UMJah/iyM8n9KVB8MdgEVKmxKf3QW54TpEbxTePBX+yZcNBI1aS1YxQjJTXR50l5em0/deHEAj07QfN2uKqQRw==","signatures":[{"sig":"MEUCIQDzvxx/xMxDKhKCKyUn0xFQd3uBL3NKwcpYwC8bKbkL1wIgMnetmz+wuvhGtCalI56a2e6TLiKFVsPfeq3ibP7yfU8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjw8WvACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrFTQ/+JERAeAys6kN+ldI/tszy7gwRJfA4PZq0jhIi0uAa+5Qonhjt\r\nQR8EZIaX0ff0DOgh9Da0JS69YduVq0YrGoa+gqnb7IkJiQoVunM/TU8jduMM\r\n80Xw3iK3cArtprJ+LMzKvFgfyHapUmT0vFY+2B3pRoA4HslZhLBvjKuH7oFC\r\nxKdeZ0pekjfnsLHncIFkmJVZDzE88borZlXg09pCGXLese2vnx2YvRr8sQF+\r\nwnV4RWjpH0QC/NkpsfH5U4A/+947kRZNPTL8JRIDneHbMOarn5R/OdzR6pp/\r\nZ53a/BpJdkdv3ZsAaBRbpop/bbNHGd7IU/oANn6fAcXvArGNb3FDuBfnspx5\r\nyg75YnqetKW14NpqXWLy8chYltduJLjD/q+yslvGqy0XvfdzNDW1T94lBMNQ\r\nYOTajusX+V9aztgzEouIBrNoQdGFQYCnuDspMFfOLY5km+Vr4RDxgPXF8Fu5\r\nWy2d0pb65q3wLxajsbJU6jnkK0/zs8SjTLBe8pb0pn3NERu0OqgIC/TvYGAG\r\neFCdbBATjQVqn2X61FCZFOPvIJq3Cu+yvjZBJCu4V4OLKQv9irOMGcFOFgOO\r\nAtZFL+lIymMMNyyOSQxKtZVlVR+G1kqR9n6nLiZUABnVm+r8sbK5Y5sdD9OQ\r\nSkt0advrVeoB1twMM4KP1TjBluX+0Vw4MDk=\r\n=EwlS\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230115092115-409bb1a.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/2bce76841a1ec6a5e7daf597e7a309c5/graphql-hive-client-0.22.0-alpha-20230115092115-409bb1a.tgz","_integrity":"sha512-UMJah/iyM8n9KVB8MdgEVKmxKf3QW54TpEbxTePBX+yZcNBI1aS1YxQjJTXR50l5em0/deHEAj07QfN2uKqQRw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230115092115-409bb1a_1673774511255_0.32667000078351505","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230115092807-ec19b51":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230115092807-ec19b51","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230115092807-ec19b51","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"a19000b7083966ba6eb66077b8e2605d15f88d2f","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230115092807-ec19b51.tgz","fileCount":60,"integrity":"sha512-FGK1kmrjlS/4TTZ9W3Zi62axcwcbujpL7cNaTAVMF7tzVBGW1kYZC6y44nJTRVWnM0o3Eq0GaNId+VROz6KT8Q==","signatures":[{"sig":"MEUCIQCxh+DEz3iaYBvgwjM4qNSftKpbLqvi9U2GQ+q0rQJRAgIgX00BRt6ng45i9do+1ZtQeF8pHwdyw6//P6foXWyihXc=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjw8dJACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmpbtw//dehQ+DpQuCm87o4ZcSyiOU6iQERpdzrNTFrINPKG8bb7k+Or\r\nSIqKFrzBo4X/c5G7e7G4hTr2Y9w9tjfFl5nZA8A4UXsp1ULaRZmKYX51hM4X\r\nUTd1XkU9Hk/3V4qIZXxYXiGb14EFpECgt0YE3JU3qrpCkgA29vDl3W/u7zQk\r\nObXk28j/sSf4reEeKDMryYXnlEkpZxwD8YF5K1RwY7pm51BHftAb/x7m5/XI\r\ngIJyJNRXekh6HuSrMKDWpK92+8OX4FXy2W1vwPqvB4R0P3OS+iCGV+K0ruNX\r\nVynV9tV8kZWD0KMtI6d3KetzqVPGECCYF57OpRApEBLIYMDhYYy0PanHQmM0\r\nqW2XQlSbkpoxXc5xgzAfxqbbZupCE4//TzLH7pAURqvccJRFgmciLF7SWQfh\r\npE90i0HAsr9ItNRNmksZDwWeCFklbzWnItHjMJi+xPViM3Go+bImeYV27olw\r\ndbrwttfvBbPqVrVRDE5zV7o5Ph7ZOr5Trh7kxXCFnqwgVDIl+Gh59My70//o\r\ndqbqFE55MFHg5ZdZpFfVBwZfSQF/i2EJuj79d6qLLm/VcF5OAXya4zmXgLbY\r\nobP5bg1StVoA9KFN9AEi9YMQeHCWghQlevK/WCHtxnCvxF0HUChlbCUyS1Po\r\n/MBvBLTJAtL1rr6ZZnGy7vb5s1vUv4KiLXc=\r\n=dELu\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230115092807-ec19b51.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/86aa4c78c3db9067d1be10eab3a83d71/graphql-hive-client-0.22.0-alpha-20230115092807-ec19b51.tgz","_integrity":"sha512-FGK1kmrjlS/4TTZ9W3Zi62axcwcbujpL7cNaTAVMF7tzVBGW1kYZC6y44nJTRVWnM0o3Eq0GaNId+VROz6KT8Q==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230115092807-ec19b51_1673774921710_0.14208912967796494","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230115093758-a80ea9a":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230115093758-a80ea9a","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230115093758-a80ea9a","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"1dff71ec89741494d14ff2d6f3ee251ee528d044","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230115093758-a80ea9a.tgz","fileCount":60,"integrity":"sha512-ESERlSMuC7VzbODgVGnCXhKdXPmCupBy6IIAkL3rJc6toGvkpvwWo/C7aVRJoTrevIWF8ZatDZic84FH11TVjw==","signatures":[{"sig":"MEUCIF36AWQrB748SaCTv9kzaP9MzaKkuGKAYXHn7ZaNGAH8AiEA5nhv9OtiBUr5Dirl0+grAwBHqIBQmduD21CDZB625yM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjw8mfACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr+KQ//U7W4cFDNvTBDqQPx54KUYtUhO/0bLxStvc0QOd+/IJVu27TB\r\nxxD6W2whp7owiDBabGE+DEekQNZ2UYPtf5q/yvvaOnlCqjO48yX6DEon+/3Q\r\nEnZ8QvGFNYqQ+u4pMWHDgtKYKeOnquzX4I938gx+VYvYg/j403yTOwVkkGro\r\naNL69CNF4hQrICQtrKaAWgm/rlUrAV6InuaQ4arnVlmihNSmQesPtkA63rCK\r\nGZY/KsyyCG74bjpqHKsPkrkl4q+Jd/L+Xtrfsp6WHtlOy9QJanima84RfiCr\r\nt3VGtv2Tx5cas02aE2UpdgWfm6hKCMDpTBjCnLZxv4URxntKFWoXu0Ibb6jN\r\nH29qLpyHUMkIxYSF+ZsSf4rq6Zrt2fqwHer+QrY8+W4HxEGg0RQH8hxbVY8g\r\nGNYK1VpwBnCfcBJtZyFi+hcfbz4+ijVsPl3W/zGfkvPTYMrsteKwq+8k7UfV\r\nbPrymHLtXP0Aydna6eq2KXJ6F4ewqaTs39fzQncj/1NpEtd6HDAQnu2C/DIG\r\nW+WusBFFsDk3idzmOo08B3u9T5eN2yNruSLNKD50aCRBBT6psOvB7KaT6Etx\r\n/7HNb8JIs4/RKgNqp6dJkvw49IWUTrsfz7WrS7m9M4ky5qozk9EvTXaebzj/\r\nkOAOrDDZqe1DKRM7pD3DRFU3OGVD1JERRQM=\r\n=ly0G\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230115093758-a80ea9a.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/2a8cf4cb5e36795cde34587c11f008b7/graphql-hive-client-0.22.0-alpha-20230115093758-a80ea9a.tgz","_integrity":"sha512-ESERlSMuC7VzbODgVGnCXhKdXPmCupBy6IIAkL3rJc6toGvkpvwWo/C7aVRJoTrevIWF8ZatDZic84FH11TVjw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230115093758-a80ea9a_1673775519053_0.960717462839261","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230115130921-bdaabdc":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230115130921-bdaabdc","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230115130921-bdaabdc","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"0c99e88eebdb9777acaf3236093f3bffb6a4b639","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230115130921-bdaabdc.tgz","fileCount":60,"integrity":"sha512-ldthiXxv+bAvEIJUwt8Ht7U5+i2zlA8J5C3S41Zfhk0auApySBfZrorpxtvxjAvWjf3hPneC9snk/ciiOrSmQQ==","signatures":[{"sig":"MEUCIBgK5r9AYTT+vQV0HWkI7SuDWG/qc7h+OmJzM6ggYKKaAiEA8HrMWG8B8TxVRAnFqhzvbrj5GSuIv/v1h9C3E8yxauM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjw/slACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmqweg/5ABWdklC6/yibKqvBlYj26h5v6ntLUC7yfF04TEJSuIJrtEVA\r\nv9IFl67vMDjBNxyFVkK0iXlvY5ONwEOj+0w4eKab9F4vEh4fiStAo6l7LiNU\r\nk504LkVFY2rL3RwZPfrMs70MQgqBM0tTfFUvn6QF0O601II2t4nTEn34t+qd\r\njeXG64Ihm9OYUpKEhbvfLOJKp9EuSs4i5XEGqSuf35PmjpjeQSYlXk5MkOJi\r\n1Nuiw5r4pbF/t6HuJiQHS7dWv268znDImA5Xt+Yz7cbb+OhIV/8C/z8kUT60\r\nYb4eLcpWuirHc6MYkIvNC6HNi7fMSZE5+F++C6aAUqktlMZPtE3/mwidhlMQ\r\noNS465W55TXZbqM+EC8QQTq/LDcbsHrjrofBd643SNm+nF/FA9p5fFkQxJEp\r\n69eeG/ns8hX83mjOCFbFSg04hhBtGASZnAAQoTv1wCJLIqkz0vzS5xetzKyW\r\nDI2l7ML8lKeYk4NE+4ZeDNtN71CaXts4riGRMcYbkZc/iqJmlDqlEmhJiLaG\r\nKlDiQkNTAEVhvkOdppVnxMiU2TZ61jGnyqVdtYwSHSaRzIdnB3UJZeeQZsy0\r\nz84WTeZ82U1YVEgVGJWfoImlYkezMFT/9YV6lsN2lbH4UOttYqfHDkKxYGwI\r\ngPBra2EjtPxj/PQd2bV69YjSxV7/15Cvm00=\r\n=uV5u\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230115130921-bdaabdc.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/016c66358de3d5355dca598dbb45b24b/graphql-hive-client-0.22.0-alpha-20230115130921-bdaabdc.tgz","_integrity":"sha512-ldthiXxv+bAvEIJUwt8Ht7U5+i2zlA8J5C3S41Zfhk0auApySBfZrorpxtvxjAvWjf3hPneC9snk/ciiOrSmQQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230115130921-bdaabdc_1673788197356_0.8332185379559716","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230115131002-a382940":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230115131002-a382940","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230115131002-a382940","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"2a076054ddfdc342379a9371a3de8d363d5a6e6d","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230115131002-a382940.tgz","fileCount":60,"integrity":"sha512-IIGXV7C9kUETYZ38IZdXzxks5H3sdcSM/cHho+yrFH2SOXbPb9uxIixJvKwHFJnQLEsvTHPmPfbyWJMyqat6sQ==","signatures":[{"sig":"MEQCIColCftjERXvO+BfeN8o1+JCQ4BjylzHiXSc9TRX0BuGAiA4nZw5dp15rMgBOfBi1Ep/JluWNpt2B4m0Ps1+AY3vPQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjw/tMACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp2fQ//eFx84t3wJa+CAJr2qfAUSOP9DJ5yy4FlbWrEdFP7d8nbW9ZN\r\n0VMaQyMGoaKIoF+aSN00fSvxx+Qf8rT82xxUbLRWJ5QObxbNiN1K9hHDOjnW\r\nj8uP3v5wxOw771mDNIeEw7aIw66vyubi/rCVbEQJEs6cvzBHZYx8jZh0fo2Y\r\nyC67DZ1WOrn/w4stBKYgGVnq3lMdHe5gOljV3Q99iX1FBVniyj4q4lqydxXt\r\nI20beIKUhw2/61tKsFiHNHmzsYun4j59ebpHQb3Y+4DymxdRhJGM5xY0jt4h\r\nRNkDblk7II6haDD7ScdJ2nR6um/K7ZUyU1+9ZnkZ8b2eUqy3XyfuCb47hV0w\r\ns29MkOue6P1CQXB3qCG90MBxj+wq7Ee31V8b7ze30ZVT388RFVkt6Htt/EWF\r\n9otDxcLb3jGG8PjgruWHs6HvD3a7u6uYcjhagJ5HGOmcq/Iia69T14ufvRL1\r\nFGrEwQWA5yEwsfroirGOC53qDcPjkP3RLPm0bt6ZM9l+lZoymSgctxuuybhJ\r\nlhjIKgglSxGqYCWKndxq4Eyy5KBMMkRtiFjX+fhwQrJ/557vKgcYvhOH1EB6\r\nHr6bLnGJjMoEKz8ecHlfpiVgtzYhkhRJKdhsYUmaE9A0z7vDTQveFecb9xuU\r\nEGLQ3PObr+5bTqRdBObJAM9N8J1Dzwl/daI=\r\n=GUEf\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230115131002-a382940.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/286a3d90d39634c4398b3eeba86e7955/graphql-hive-client-0.22.0-alpha-20230115131002-a382940.tgz","_integrity":"sha512-IIGXV7C9kUETYZ38IZdXzxks5H3sdcSM/cHho+yrFH2SOXbPb9uxIixJvKwHFJnQLEsvTHPmPfbyWJMyqat6sQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230115131002-a382940_1673788236613_0.21953081864142288","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230115131350-a9d1a89":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230115131350-a9d1a89","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230115131350-a9d1a89","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"29ed9c4c6115a390dbb33a43a136a18e2e8a3ea9","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230115131350-a9d1a89.tgz","fileCount":60,"integrity":"sha512-pJxlbHOTlHDubnWR9afSWHys5VmhkF/3WWLF++B+EcYJma7lxp4fjwYseAOYtfmnVXA9lF4yI2KcgjlI+skm8A==","signatures":[{"sig":"MEUCIHBC4uWR8bVtTSLHSe1rIaOA2jWpptA1pOqdLmu45TOQAiEAxMYQw9DeVSQy87p4Uqy+Wdq+FBocPbp7aIvucxNk/wM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjw/wxACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoldQ//YqD12PrLaBZGxuT1Nl7wfKeB3ROIKsj8Tk5e659k+2KSaaIo\r\n5w8IF4oFLi1R47Hv2IuZma8qAOr09UH3dnl28yWZvd0DNoEJzKXvZWfVDsKS\r\nYdmlOweBo6jQ1wJefIP5ep0lEiAya0C9mwDn7LkqGreL2FtmSJ4g4/7ptDY0\r\nT+CbmC6awjPIZmUPGozaQlqYkGgUkFqKV4RuB0LrlqY+wa/zVLObVMsYuzyU\r\n2zTO32wU9gyBLp0rc6ma66Q5G86Q6N+tR70Q3aBqyKEqpE+ZwhBVWQDoJBHG\r\nMvGf5UGEgV/L9B+nl3UlBopecN/fmxLkE9p8A4JHK0gLl9IKIbr0qGgerNNU\r\noI7YbBEbtV/hplhy1fV3j+geWWF6Yrkbd+w/EB57nfP1nrS+asRY6V7A35kg\r\naRlf4A/tIz2Xi9VHtZmLnMTOPTeUbfM86ycEV5uDhfucjNHDYiImGPW7PP7J\r\nXzlEa8YwmWn+axyNS70kTQMVpDJ3QC9AZAaeIlJtVbzZD3kpEfgRAk1nkmv0\r\n6YFfolqanLh/0i5rDMsIA/yrW8HM/oqIvfiPJOzmRCRVE7AMrmufoBynwjS8\r\nYnHDYTR+ZGwk4nTHAFj7LA80R4UfUXCHGazXA3Bab4GBTe0hTtHJXi/FnH/M\r\nTsTyL1zPJH8FQjebeeQ7MfuDABnbefzTPfU=\r\n=AzFP\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230115131350-a9d1a89.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/221822af7c18ac13716fc3fdb204a47b/graphql-hive-client-0.22.0-alpha-20230115131350-a9d1a89.tgz","_integrity":"sha512-pJxlbHOTlHDubnWR9afSWHys5VmhkF/3WWLF++B+EcYJma7lxp4fjwYseAOYtfmnVXA9lF4yI2KcgjlI+skm8A==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230115131350-a9d1a89_1673788465491_0.1600073624829168","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230115131658-31e2631":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230115131658-31e2631","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230115131658-31e2631","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"0f9e0042286f5043b8bc0f58231ca3e952096b8b","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230115131658-31e2631.tgz","fileCount":60,"integrity":"sha512-BKaK0AVP6I0oteN8GXeymA/NcRp/hGC0sVcZEokC3EgiJBMaLU5tfUqoBU5I7VC+PGnOqhbG/5lnyeofREE66w==","signatures":[{"sig":"MEYCIQDwLZGITVqiUji63jnEmQHl+78Rng0Lj/7Nj+Glg4d47QIhAJBpaIXNexC13axG5TT9fmUAkcSe1cZ/GZfPEJU3Ewp7","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169643,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjw/zsACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoZKRAAh6Q2o0KjkGCRBizxqClChs2hTGrmRfuuMfzGgouWaK0Vs7Rs\r\nZ38Et4QZVzO/VgimBPkw0whGFfu34lX5J9k6oDH1my5egXtEEYkxtekACzag\r\n3N3H/1AZN5h47ePPLLX7m2e6g4TlzwSByTMIWcR+7jQRSQmL0bTlRTY7r/9R\r\nt4rXoc/HIDSwj63X7N6ix0fLbXMlkFuSHQ9vMxAcDxxJpg0yQ8Ty8MU0Nc6w\r\nlfqJsjjU6FgzKPDp8r3nJd7X0mj5IkrCP9B8hTLH9M4GRIgtk6NfwwFEtNqM\r\nmt5gNVMkmIy2QN38WHY7peGDeATmmuTCIY4gOV6WxzSU+Eg0k2Lpsl3DyWOt\r\nQTPt/QqidkgOio3bIirkqQCKDoZSq8I8JrsPTDzAZ7xWxEHWP8YElZrczeeA\r\nFscf2Fe9pqeP+TNlk4961r8OISTWzW4lKKiemxtkT8YbSbWcNPZWCPsukrrk\r\nXY/b5h70wcGUP8zPsQyqsida+ZuSeYhnq2S2a8hAZg2CvuyM94mvsUvOpO7X\r\nr+3re8leL1G1jKksZYQQp7XvyIOW42n7WyGWZ0OMK5cWbVmXd0KIT33klrQV\r\nEpqqHyrhivE752jCJghYLBs2IO5ffLZAca1rr7Qz5yPo/07yDT5wxn5n3pya\r\nYit/Sr5TXbEMWl6VXZgbnoZZSv9z/NDBD8Q=\r\n=g4wj\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230115131658-31e2631.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/fea4980988c3c66f47c5fdd732b4ba49/graphql-hive-client-0.22.0-alpha-20230115131658-31e2631.tgz","_integrity":"sha512-BKaK0AVP6I0oteN8GXeymA/NcRp/hGC0sVcZEokC3EgiJBMaLU5tfUqoBU5I7VC+PGnOqhbG/5lnyeofREE66w==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^9.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230115131658-31e2631_1673788652354_0.36065053766572697","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230115132111-d86ce28":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230115132111-d86ce28","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230115132111-d86ce28","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"5fa8e55062dbc72e2c79d58f20fc05cb0980d0f5","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230115132111-d86ce28.tgz","fileCount":60,"integrity":"sha512-uTHofNoelb6NBnTGWaBMVTdFinelTp1Jtl5Ao7qQ0ULsgiN0NS8VVKO0OYL7+LTQmHkiLPaQWFmvd99CrbRmcw==","signatures":[{"sig":"MEYCIQCLnwTxuycDdjUCEZMoD5sDj+qN+qBbM6mKlO8B/S/gGwIhAIeXdq96GJ8giIkr8gSBbNGHaDke6EPE8fNSrZhH+UwQ","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjw/3oACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpsJQ//YxRo+uEh8UtEfEQz61kCJLCDyYmEsr1GonaCN82trsm0AzrA\r\ndkFm4z7rFCY2t0c+x1b2VHNQJXBCzl5uzpPZvYUdKqdZgo7Z/gpMNRAcQ0br\r\nm8D9UQMMwu5m9mdInn9aBkigpvy4fs2tI0suRzHuPGHKF/sYdd8lWjN5muSl\r\nCdY4JHiggFsYtuGWgFgSzQ2FGHce29IJfJZCsSH9U2TozX8FZY6ArwbY47sZ\r\n4/PChqXM/phY+/nO0ChjtsG4WxV+coRBhNb2lXteY27Zl3IVsI5Sde36AKGs\r\n+lYzLFlOEHTv5B4U+20N2JdXJjKiov0w5kQPm4GhIk5LwDK3y9nhZFD0j6rs\r\nJyRYVaArOCEIqEsUQIqSXpA3nhuHTaL9oPzgeLmLy97aXMfFco8dzE37SLwW\r\nYH8VwgErOQ8oq35LqOt+17k36GOko3PGX6ZOWqwbz8IsnKwNr1f4U8QEkdrP\r\npK2qLEI+G2S7860XG5HgGqpDp4bd2fkSSGr2zm56Iusy4KU7oCwu4tXEbOAL\r\njEMcjbMJ6XCXEpCofnntsizTIX+0Y+3xjXmBQTjZ8cRFsQQjeNbKxtrbCF6v\r\nfpjZYahDFt+rjSX4GuiWYOSFWWV7iMMAbF1f2VIDju4xFxgeN5BGgkn6KhnH\r\n9AwFGhKWJAjsh+V9Ca+fGJvP0YswC0g8/Wc=\r\n=5596\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230115132111-d86ce28.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/60a24416f5a1d3249e08966ed723a950/graphql-hive-client-0.22.0-alpha-20230115132111-d86ce28.tgz","_integrity":"sha512-uTHofNoelb6NBnTGWaBMVTdFinelTp1Jtl5Ao7qQ0ULsgiN0NS8VVKO0OYL7+LTQmHkiLPaQWFmvd99CrbRmcw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230115132111-d86ce28_1673788904441_0.5032627947274086","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230115132341-f5d7eda":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230115132341-f5d7eda","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230115132341-f5d7eda","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"413959fb3aab92ef074a93d518b3e6f246d06eb0","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230115132341-f5d7eda.tgz","fileCount":60,"integrity":"sha512-gC/XNPC8M4vmVWMIWMNJZtPZb71GN7v5x8i+QHVJ8ar7d0Xic6qja0geB7d/Dp22CKXfQF5trPQuvTZNHvy+6Q==","signatures":[{"sig":"MEQCICoveujBd5U4wTgxt4ccWFdVH4P6ZW3h/agPAVG5QsjOAiB1nudvslDKDrsT5lGNPkCgHU4l/roWRPdrkv1Wyy/lBw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjw/6AACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr/dBAAnt3Qd1mPHfkKmPbFDOylYpWXzU24u5kSuep9vSAHnYouklZs\r\nSGdEsMrwqoUD/wvRfAU/2ny/E2TzgcPdes2zvkGmQf4XqSO+/Pks9OHqlA3K\r\ni5O3c0MnHbCrzjINo3M0RhF31esiRc0Bj7Ne8A6kJVIKnrwJ4L6UUKjPyAdl\r\nRc3n0Cn+OkpaZ4Puy4TT60v+c4m8+/G8K9GqDceClujvsa+rG1vHk/wE3XDQ\r\nC3uElUXnXNtBC56TiC5bKjhF/8IvGxH+qtBpJDj4amgP4K0KpJCvKFAqL9dK\r\nMJz7pQycD5CnxwybV9edFTcu/wgE9zGK5aJx+Ul3+yYbJGFV/NsSb01G74Qq\r\nd3zup8gEMKq6cEPm05z0Okb3xCbcXEbWJWVVXuZNpo8wyS1iDZdRMx/1wcm7\r\nB9U7DvrsiC/+tc3HN7J+Mn7v+xQzNsmRtOpx4m1c6wr+/K5GS/RSLsC4HRbc\r\nsoMxw4d5r+7P0bsitFpfTQOPoXKxVBuO1yHqtP1sR8B2vUHydVF+8BirBJyh\r\nmZEUEmyaKjeyEE60y00UMnFtD8dhhKyv7Qm4GZqB0TAv5AILIY87gyq+w0nO\r\nkC3wKpU0IpgweQRffun7s5i2EC/suZWiudBtfPV7bMgmG/hOO211szgMKlDf\r\n+McaZMBi8J+ZhBvEra082KawhWn8/mpTl9c=\r\n=BGZt\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230115132341-f5d7eda.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/0d2b43d296e473093431d97aeee072d0/graphql-hive-client-0.22.0-alpha-20230115132341-f5d7eda.tgz","_integrity":"sha512-gC/XNPC8M4vmVWMIWMNJZtPZb71GN7v5x8i+QHVJ8ar7d0Xic6qja0geB7d/Dp22CKXfQF5trPQuvTZNHvy+6Q==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230115132341-f5d7eda_1673789056391_0.8069932428538309","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230115132727-f03b06b":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230115132727-f03b06b","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230115132727-f03b06b","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"0b788eb28b8f91370af7da475d081b472858508f","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230115132727-f03b06b.tgz","fileCount":60,"integrity":"sha512-JkuLWwxf3yasCOXp5VLvvConEOmIn5nSh0oCLv/mA0++mX325oE+o9CFYE7F4gOZdW6xc6VJgMa1upRqahSECA==","signatures":[{"sig":"MEUCIQDgM4kZeZjaohUzGfjUVPzabJCFuiupa98P9fk8JVVUFQIgfpFPTfzrnLoy9IAsb88piNur59EcL1CXyPLSv8cvwYE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjw/9jACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr4Ew/+LD9JRh21vlmkUzREPvO9g1PzC6geW6biH9K4yelH9veegWci\r\nsZOV2xp2pTa/BCC1tAcdSclL7o7+htSByepizNMekA0xMfzxuk3wTf6zQF56\r\nrcEmpSoChU7T5N4e0aBbb+gMkvAf5Nmkfx3LzkbeTRBNeGo3qTEty87to2sv\r\nC32acvgMeFpcZDUaSYS30rC3adxWFXIsXDaRPYSXJ7GBSOpzf2OD43HHlb0w\r\nk7MXJmlEbhVXdPDjffNAG1H1ckCsr/QOrND+sw5v1Jzkuo9LzUuWPdX4j3++\r\n1aqrHyXjyNS40/ol6LrdtTaXI5L08dT33HovhS3C1r7YYxgl+nVCs32JQ6eE\r\naJV6ntirZ+CGoX7MW3RlQW5hc878S74VTRb2EOeesrousFfWB6KyZPPvSE0D\r\nyBMK5rbYmrnVqnyJLTJFCEfCWc5K3Iq32X+U4L69AVBJHfNdDJ9Up0AvrT/d\r\n14VC7UD8Bjp4IVbZpLjU/c0Ya7rJEpb695Iquxp8bi/1oAvHlWsgQ8WPmXau\r\n5zSVdTNEHt+cy06yq6LbLEQht0rG8uq+x6oAFt8nYouhXVi+loSL8VibA7Ub\r\n4ZbGJbFSWVkXQJ/f9SM6sxk9IXY0xcyByQIu9CcYCbGPpQiJD/GcF7luFnhV\r\nSBya8wrMHWmT1QC4agSUQMbz+Be2rTtBWBA=\r\n=X908\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230115132727-f03b06b.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/599d27bfeb2a84af5ec5dac874a530ce/graphql-hive-client-0.22.0-alpha-20230115132727-f03b06b.tgz","_integrity":"sha512-JkuLWwxf3yasCOXp5VLvvConEOmIn5nSh0oCLv/mA0++mX325oE+o9CFYE7F4gOZdW6xc6VJgMa1upRqahSECA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230115132727-f03b06b_1673789282994_0.9298705692438827","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230115133414-f61f4b7":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230115133414-f61f4b7","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230115133414-f61f4b7","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"de7eb6f174b8745da0828970077cec9003c1e7b7","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230115133414-f61f4b7.tgz","fileCount":60,"integrity":"sha512-6Cm6oafaU2cYBN7mI08OsA5iEwtYKvRCbVrfSIuFANHG1W5qgQgvR0s8gJfDi2PmDCRD97B0B6wnQwDJEROtYg==","signatures":[{"sig":"MEQCIBsdywq6Xcz9no8w2yGVSRE2qE5BglrZzruS6mcOBbszAiAH8zzPntU1QE8b88baQxJ3eQSuglYpuHrZdNoMknWNBw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxAD6ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrPMA//aZJUA/UnsWj2fz+lUKGemf0s3YmPRqGcP7I/afxAbe7/rTQ0\r\nad/U1/5gYd8Hnk/YPuQIpziJf/BQuokPFJNJbZvVj44d9WVtLLktL7+znam+\r\nO5AYCiqmbenC7I86vRHSnpgLwcKmJPOOAKaqT+mn1YiBkn+SEFJ8Mc6myc6R\r\nA4/DfCDu4se+F9etzv8eV4nrQD97ERr9sc2scZclh53fGk4lNRVgj/VSNJaP\r\n4KquSLfzJL7dZ2aqxRWt9u9+jRGzMOiRBLd18aNdXYHsEHPon3O5aCYTmmnr\r\naXhZlGzh+9WFu+5y9bjk/+nDwY7m5Dp3sW1IBETEhq86WgAhsFzT2e2Ow/Zf\r\nRhxBGZZv59mdb9BdBUTS1Y2iPb/6DCBcOlPSAKz+ViLCRPRVdqL35VxnYJsj\r\n3Ufb/vRWs7dp3ulJrVVr0ZImboZ9B4qE3aRHrB8UQBeyNhJ7gzP6IkLABUbo\r\nATCfnc9uJIywWbXUH3A+SVQndDrh7nlJoBSAVlIV+DfEp+GIsPcd2rPacbvb\r\n8OfiWtwPY9NKQzmYaeuSuYXMaEbbDPtQQXLeI6WOfjAjHndPMoZ9/a1sxFwI\r\nZItKKBXG9h1+/01BdQSbkbonXfQ4z1HHkzH5TF0/88rQof3hQz9LHEFqkBx8\r\nZilGH5AW/28Y/OPXGCqe9dB5F+kYCy2lfdU=\r\n=Ce9/\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230115133414-f61f4b7.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/a141e75159d3a89588113077b43b4881/graphql-hive-client-0.22.0-alpha-20230115133414-f61f4b7.tgz","_integrity":"sha512-6Cm6oafaU2cYBN7mI08OsA5iEwtYKvRCbVrfSIuFANHG1W5qgQgvR0s8gJfDi2PmDCRD97B0B6wnQwDJEROtYg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230115133414-f61f4b7_1673789689787_0.6640471650438369","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230115212914-2a13752":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230115212914-2a13752","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230115212914-2a13752","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"88b404d102d9f9788083eedeaef9349c0617fc33","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230115212914-2a13752.tgz","fileCount":60,"integrity":"sha512-o+FFDOeaboOmCP95Jr2tS1yS1v+zKUxTK0BmkXoyp3Lg38hV8+JNF2CZ+pTD1iXc1tsTknSDB9FRZsxj+YHuzw==","signatures":[{"sig":"MEQCIHvPIqgJCVkui3cHmB1LIXoqchnxEVvXW9SkPiyEoOj3AiANy3OPDC8jG5p6gc2pdmNz2PrL1/PcPQY/VmutHy8vxQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxHBNACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmobrA/8DjeUd8vG9DTXVbK/LDa+unInbzTh+mGsmT5I2zJBwsxs+2CQ\r\nHxHKPpmmx3GaEXssdwIj1cmHabFhHEUeQ0c5nrzbpA08/AXntOKRzFawXa+E\r\nC58WiMboM+buM1r0xi2h0TEbGMCB/7q3Xqys4peDmhcisODJISUAS8LUNLHm\r\n5+YgxaVWvbBSx3wiyv3EOTZ3RvWoweL5l8EV6N2/ywN4Y3hEbfLz2OvzvlwM\r\n2Pe/atGdCTGFJRWfxwaNQDYzGpBR2/70e1ASChJpFPKyxxCRq7rtSASNGn2Z\r\ntG/hYy/XshsOiK7sm4uxagNQHzFJIbhqFMjxDmo0XAy7xC87SOszwAhHe0nb\r\nB0bt9rzbMN5vPWyTbPSQXRa/peQlT4Bn0WMCSOYGGqOU6SyoAeN7assWYunG\r\nrUCK49AQs8GZA/pDpwLUsIRTNBe2wNZWfl1ez1o54zblaIVaGe10Gx7Bcpjj\r\nWPMChXWHnZXHvE5O4Eyyr8EGtX1WPn9odcEorLlOkdeKa8LuQbn+UmGgzq0Z\r\npCi60JOX665TyOnA19MS0O8EP6/knk2wGCHMSxDqrGHPlTbFS4g+0kmLbxg9\r\n2y/tAssoSOQYVFV0QT3iloDCPlNymrtyOW4VCYLbm7LTQMzCrtVp9fkrBF45\r\nDOZbpBgYOagK5/OlzFTcgnrbmulWPfpoAuc=\r\n=bY5D\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230115212914-2a13752.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/145329c4019353fcd07a22dbb307b4f3/graphql-hive-client-0.22.0-alpha-20230115212914-2a13752.tgz","_integrity":"sha512-o+FFDOeaboOmCP95Jr2tS1yS1v+zKUxTK0BmkXoyp3Lg38hV8+JNF2CZ+pTD1iXc1tsTknSDB9FRZsxj+YHuzw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230115212914-2a13752_1673818188864_0.6892709344011643","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230115213448-097f80e":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230115213448-097f80e","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230115213448-097f80e","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"6ed515a5b510bda1b62cb520de04f0929ca607eb","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230115213448-097f80e.tgz","fileCount":60,"integrity":"sha512-gcuXRNNyTuS5ggd0CsBWFCnQqSTZhPLwCnAFpm1HVDb4bklhTg7oXsIODADMazJM6Pmx/1bxJAhLul7/2IoW6w==","signatures":[{"sig":"MEYCIQCrNaGhddV2xWk8Xuy+CB3/UGzHRNkP/BNHdxd11YZ8AQIhAPzO3nDW4UV9ttKaJNdVuVT0VhIRar38jHRANars7TLW","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxHGcACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmq7DQ//VeFszP5oepJdmsrDD3SvSgUTztIKRVFPjNGIZEIQeaULyxXq\r\nFtObmhxdJZyqtiEeDrmIDiJBz7YtFB/ZskxE6LXoCUJq7z4IAPI+oZ7WOvbv\r\n6Uq4/hMfDSqd0FASZwTcWp10h0Ybxm+y0WY8kDQMqFGB1B3ZPcXEsGSae53D\r\nIS0IQolf2W0LaAiKdCmgSL7C3g40bxE7yMOx1KS0FNJEuQarIgi2HIqjVqOZ\r\niVrDu4MXJ0dKP+34N86BGGq5Nmb/SU/q+8nhSfIoiHm7oLMKs0USQvg+hRIz\r\neb/Rcy/bTeBitaBcoFoXkW5mG4oqP+WoScbESvp9y8tf6rYoHzAVnYe+of56\r\nBZ0S/C2MP8MF5QXpoFsoRv22WlGcMO3SoKNvUGePeyhMb0Py4wOxRhmio7Cb\r\nvIDrz4y9fqQ3H6B2UtfWENKszwSaEfQ5JqfUcph7A4a6N/ToZ75W3cbLs+3Q\r\nz+D1ScrapwuCSBjWmS6IWKg+swx7vHEgGvn+VvFMqG8NycyqwJwTLEzn9scd\r\nmS9S6S78xMktLvMAlcYuJd2okbywavt/9IEbdVe52brQyAsKHku6uKDum07k\r\nN8A/emqVOfLvKh+C6ogh6IKY2LvVRjHuxv2gaSGUsCEbVaEKaiWbl4tmwn6t\r\nSSCAN3rVWG/SE/Kq9C8+CHLiJpZvDKemCP0=\r\n=1yOt\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230115213448-097f80e.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/46ed664099d5ff33e5d805c958b8cb50/graphql-hive-client-0.22.0-alpha-20230115213448-097f80e.tgz","_integrity":"sha512-gcuXRNNyTuS5ggd0CsBWFCnQqSTZhPLwCnAFpm1HVDb4bklhTg7oXsIODADMazJM6Pmx/1bxJAhLul7/2IoW6w==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230115213448-097f80e_1673818524530_0.37675175514884063","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230116005832-5b3e48b":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230116005832-5b3e48b","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230116005832-5b3e48b","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"029ab82c5644b6706b708110c2644af9bc646e74","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230116005832-5b3e48b.tgz","fileCount":60,"integrity":"sha512-c9jJcbYSRScAJ6ZkY1U3+LF86Mjpy9qgfR600JQurZExHqPoSpvcDJuGkJpe2R+rY2Du7B4IaiuL0DE7FFNyKQ==","signatures":[{"sig":"MEUCIAXHyv/Qd0TEQKxKyWSryDjWr1PmXDYPkxuEzRSnOoZNAiEAlNQK9ZvaNac2HeSTYFcgXzvp73InGnHiv9RMbdf8FmI=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxKFlACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqS1A/8CVh693N0sLaE2aUIWL9DOkpspBIT+ZV3mCN5aQYffGba1UKh\r\nDOsYmjw7Pf+CtGEf35p15S6JB2jx+dTt+QW1uREldrRB7cgzSpIEFIfzflA0\r\nyFhBVPyacgxTgtNV4efVYzfjftD8Yif/MsLxjNKBtTo6yetHXKSOuLd9sj3x\r\n6i1VabBSLymWbCBm/N/d0C1onwFxxnT0bk6j5iCCoWXKzur+LKiYBkmwJYKQ\r\n0QW2rVXVs4UffQ0Y/mvyq0nYa0szNad1iIrfM16dfDYkU1JeM0/ACxhCpiv5\r\nBwpUfZrqtVnKJ1sNZT9vMllUJSGpj38I249UREgL/p9jlgGczV5uB21XdOKy\r\n8reOqh8Ag5C9VBWWY7Xh9P+SSf7Dm/KSUWmG8JJLLlqZx6XMRYj5rzs9U7oc\r\nCnCCJw24DvPsVD2IgLe/F4VPa/g/HuIAD/6JbI2YVKxiYGve+S1yZxQhs3dK\r\n2S74HeiNobNpZVfNIaD5USV5Q/0H1aHhwHOhVmgJHt2aLE96DmP8Qp+Aeocp\r\nO7uGtQPAnCIuRnCeVX8+BptOBtltMXiEeSySN3cbkxvSEwAFlitUXhi6uRBy\r\n1W8J6o+iLCh96ItFu7Txa+KE73ppye2/F4jHtW7BDRN2A9ZUw4JljXpOpsk3\r\nACLMZ1l1lq0bFYqTqRHgvAukpJXgZG7m8E0=\r\n=+wVy\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230116005832-5b3e48b.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/d0fa3585e08ee8f97281f7549e8e5374/graphql-hive-client-0.22.0-alpha-20230116005832-5b3e48b.tgz","_integrity":"sha512-c9jJcbYSRScAJ6ZkY1U3+LF86Mjpy9qgfR600JQurZExHqPoSpvcDJuGkJpe2R+rY2Du7B4IaiuL0DE7FFNyKQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230116005832-5b3e48b_1673830757784_0.39634296367526756","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230116010229-5bf8870":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230116010229-5bf8870","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230116010229-5bf8870","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"6dc68d2651c2be295383955e3300a4a601f188b5","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230116010229-5bf8870.tgz","fileCount":60,"integrity":"sha512-N5PgNIDnHDSdBWGkupVDPspcO/vJVQs4rgF0myTXjOzIK84dlAVwkwCPuA0a7YPa01IZ1Qcay74ff81bnu0UNg==","signatures":[{"sig":"MEUCIHk3ElQAoUtv3qJt666sCi04G1TanWJQYIlkq0CiXEeBAiEAvSTBGV3ycz/sPB5/FzWK5qPJJBEGxgqTx9GvYytbitc=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxKJJACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoqNA//fWTQAvpGYgu6vIwmssjLG3rPrzGnyQ65mAYfsd5sqa6wHFTq\r\nr/lUkZUauQ0AngsLcSwDDk9Pn37dAv41U/kjUNxvMdFX1Np6Vb1f1gFyVX3R\r\nBUv/SuayUwbWNk8tnIUeAIi/R2/Ygftv3Muigc8HxOLYhSht1Dn40cs5ZN/n\r\n3gGxL+ih/dYZn4Dj5Gdj2vpoJrSypMSObdhwXY+pgSWB5N2ZNbX9J17Wn9bH\r\nX0oJaJQj5aWo/TzpaMsQayahf7TZvP0Vt0wHOi3Jvt4PWxEKQ+1Tj5bXGW89\r\nxLvSILsjY/Ondpu2/h9plQ+kx7y6PAD1J8nLDhJ1JuASoBN6txVwZcsG1tss\r\nKXXq6apv3zwTQkFGXXQ/LjF/iOyOIiVZqj4NmDk3CM9bfBNF+KXkCBRrczhE\r\nQOusqJk0CZvBHpQ1LPoL87OQJ2so7NonmnDbkcnJr8nihebJ/CS21EhXtUkO\r\nVnqwQqtdqbF+A3KFtINpmCkU34iTp3OMCSXhFPQAdZYWkZfAFOrHi1sDCElE\r\nEeiWCr8/sgpOfyYpMCidN76P8W7dkCadPtr8Hq3i3cyxzpvNOg7q0rxK6DcC\r\nw/0TaI+r/Z/BEm+xi6nK/hK+DzC9S4qt3/ElYaJ361SigE6S3dR1f6pchMoD\r\nAGh8le8Ls7YI+QGcRi8P40dtNi2YzURGykw=\r\n=GG4c\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230116010229-5bf8870.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/57b24b32b3ae12902d76d4523d93a926/graphql-hive-client-0.22.0-alpha-20230116010229-5bf8870.tgz","_integrity":"sha512-N5PgNIDnHDSdBWGkupVDPspcO/vJVQs4rgF0myTXjOzIK84dlAVwkwCPuA0a7YPa01IZ1Qcay74ff81bnu0UNg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230116010229-5bf8870_1673830985455_0.44757383965176123","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230116042730-f871ddf":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230116042730-f871ddf","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230116042730-f871ddf","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"c8602763c7cf0f972830b517663c0238c3bde9fe","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230116042730-f871ddf.tgz","fileCount":60,"integrity":"sha512-gVjOSHOdPgiFURl6N0aQA/ZcZbOfz/3HW05dBKooFR2hBvNawq3GuH3Du73EfCmhavKYUDpJhkYYHpsuTKQMvg==","signatures":[{"sig":"MEUCIB1Jl0c7/2UiwcC9JOBpw/QwK0GsC0rIuh8MJqwZHpidAiEAzMoqTaY0MHBtDXHDrvlJm3cQlARl63p1u8qPRgqEv1I=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxNJVACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoEAA/+Jy6Koh3+vxOzw8IBILyLwHWvWPdPFSsrBIl3DYXYd6OSvyPn\r\nIANYRU0ZQsQO6Av0QlONhQ9l3AsRDE5LwRBUsEr2/zf87znv+93AvEOlEaNh\r\nv7ZomYnvf7MiLsqcY7CEVRjajYklWoAL9tGyJ2ZHgiT2dSCBGqX2Rbn/AfwS\r\nqWvW+uneArHeaVevgkI4eqk++DuTLdDyRNu2EvBip3Z9A3Eh7mVKw98l3yRD\r\nzmSQxL4CmPyK8KlEzKLnPLHAOlqQVSKPAnhDPyrZPVOsp+U1C8L+lb9GiHMC\r\nbasdwZHowrAB5bZJ1cP5VGd3HcDPvzR89rGvo8AON0frS56+qLNH6K/Mebqb\r\nIezPrbWCsJuVkIxNeqehSuOU4GnmVFU2T3q0LiW5Q9kJVwclJMEY6ioJP5nI\r\nRThUVbH3ReaYDf4blFYMXU/fk9wRJxEYzqH0mUNg5zWXcbkzdwTN4Fcr+G/D\r\nMIb1E8PVQBW1jyCsGIF5Z/achmI9xE833h4s4SyxKJIZL5aVeR8j1WMGwQcw\r\n2Q9ngmr6efq8g61aGK8qT2jF/2ksxFLX/imfziBbQOZsa6LrtEAUDT7fITCT\r\ny/lf0AH5tBoN7nLnqbbq5oL106+Gn6jr5ur2CSHI/vSKC/bVOZbiJ8wMSb9f\r\nYzcb/hvCpEQxS/Q3NiQbTCN9x5hCEq6weoI=\r\n=3YJ5\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230116042730-f871ddf.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/8038086b1f0e54e612b9386c88b7ddfa/graphql-hive-client-0.22.0-alpha-20230116042730-f871ddf.tgz","_integrity":"sha512-gVjOSHOdPgiFURl6N0aQA/ZcZbOfz/3HW05dBKooFR2hBvNawq3GuH3Du73EfCmhavKYUDpJhkYYHpsuTKQMvg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230116042730-f871ddf_1673843285472_0.49417802478850215","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230116043302-95fa504":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230116043302-95fa504","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230116043302-95fa504","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"8fc3150285d120b7c5d81521c49003c5c792f766","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230116043302-95fa504.tgz","fileCount":60,"integrity":"sha512-36perAlNIZaFGJuMYt3qm19Ff4Ob4oc3pBAUxaXlnPn8vVIS6PtLkBAP6MOlGA9ejwpI4p+rNmNVL28BxCShOw==","signatures":[{"sig":"MEUCIApcITLFDka2nmtmbyfUWFdkdIGjfV2yFeU0mIzITwBdAiEA/rKluAtG8aRg6OivPdLTeBuFIqGj+E2a6Y0gaJqxJ5c=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxNOgACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo6AA//QL9rBhJWOAkl1i96Tmkjo2pYe24Jk4jjfhu4yl/nuQsW9lqN\r\nmaXJR+i7Cf0Ld9dY8yAjW6lLLxU9Pm/Etsu6idWrfd0Zugn7A77S+AiUd+is\r\nHBJzpvN5naDBso1YAi+rt23xoNcCQtqKPr2eVsP14l8xG3qfAt/eUOkLwYNt\r\nsg/5JBmyUyZJXgJk6so7ItkuHLDaGcoQllVcdtJr3LvRSA+Di5QIHNJufRqs\r\nnLx2oL+BLwCIcsBa2BAVQ4QBAq9BC3vIEwIyLQxYG1DnLrycn537mxWsV6tK\r\ninbQB25gfIE0BDqd1ykxsJ0zp6MDvIToT5pMWTdFoWEy7EmaykX+REUowxRf\r\nGwWvf3gUPNQ+aVjzfxr/4c8ETn1i/xdDQjCKZMTiaGiRWEXuashlFuDjJLaP\r\nOToFFR2hrylnnQmUeMZr66TZ8afyNnUj+8YY83Jy9mo8tGcMRcOeStvxnLKU\r\n/sZCB0y5zKDV+4bMdqEPf5hHx3Zc+FXlf4nmZEbGoC4Q4iWtbV/BI+LoaaR6\r\nwJ1Y9zLDMBeicYPYnod0wlxi6rvrOle9S4xG9/KJdIUfl1wB4D0R0rlrTFfq\r\nJLLa/uXy/H7ilEMG1V80WGv/UZxXX2Krd72sxE5qJhGFMCEx9kZI09Q7gJhm\r\nF/f9/DUvQTdxl17VpcJA9adOYsbLcnGCpO0=\r\n=EG+y\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230116043302-95fa504.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/fe23ba3dfb28085c36c54602783b1c22/graphql-hive-client-0.22.0-alpha-20230116043302-95fa504.tgz","_integrity":"sha512-36perAlNIZaFGJuMYt3qm19Ff4Ob4oc3pBAUxaXlnPn8vVIS6PtLkBAP6MOlGA9ejwpI4p+rNmNVL28BxCShOw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230116043302-95fa504_1673843616032_0.8205223051413688","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230116083441-d0d477a":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230116083441-d0d477a","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230116083441-d0d477a","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"143dd6a56ecfd8a8c5d6b3fa92ce4cd42a279c2b","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230116083441-d0d477a.tgz","fileCount":60,"integrity":"sha512-529g5VDwD8bEdFe0JN8/iDXxYxaDhz5FVIv2CYsJEHryjJCEK0q8SfCayCLo+9jmioUApPU8zZN7z7gu3Oo6Aw==","signatures":[{"sig":"MEUCIQCiT86gr/PwMMx7f+IFtPEpUqzxpWo8W7VzHSVmR/vGEQIgBaQ4ME+/DEaePVzQiM0M+FIYJ9XdRLVdamJ1xv6NyRU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxQxEACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrbFw//boNwjjOYHMO5IyZoIsIaO0gYvw8C+Yecitmg/dGQQjq9vib4\r\ndLNbtrs2/HAhwoGpmTI/v3KBc0cyyUc8nYBcFDAtFXBzppF6VGIMA2PGPhq9\r\nVAGMwknmD8ry6WJyz5EKCTwQavqpFTlTV44/4B6Lw7VLQ/CzdmxcsAXT+wS/\r\nBlvAwkQS3Bv8ik4N+rw2oWdq9dBheJC4G9ONZ7plrTdfPxuKk72AMknwus0C\r\nM+rKQ5GIRj9KlwxdDIT0IJGmSoiL672e0al95tq6NYYgFZpMpDoLKbAGSo6v\r\nnNNTiYWnd/vbYWySoBksZ6EG98NWdDdX8/0coDUyBe+VQzyFkymYadEWofLb\r\n6DRzg0fkoJH3mIhyRGYvPVVEnJe3Tkluf2fLIHxEqzusFdDIK10M1w3BRzz8\r\n8dPw/IXa262WNuxRPAaYJZYICFe1fSQkitL0rhGpE7jr51nyoPo0CeQRkHhZ\r\nHAxsWTV0XYgAInVDYTaPl4yuWIY+nFNOsZiwInjXCLmFRZ81zJHhMJW+s1qD\r\nVkHYwbJL/aAgaTRjiNXzmCtWWUcoKemfLpCdmQ7yy3mSch+SpxFJdtrnifAh\r\ngEyGMTVp8MsSsYBrUtIOnYMplDKNZWBp1zrb3CnyGt0HkINi7Nyub+3HXGL9\r\nyFz5qZJxqxp2GhukZktSvIzZruwABWh/o0Y=\r\n=Wlnn\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230116083441-d0d477a.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/65ca9aeed9410ca3f954b52009f72c97/graphql-hive-client-0.22.0-alpha-20230116083441-d0d477a.tgz","_integrity":"sha512-529g5VDwD8bEdFe0JN8/iDXxYxaDhz5FVIv2CYsJEHryjJCEK0q8SfCayCLo+9jmioUApPU8zZN7z7gu3Oo6Aw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230116083441-d0d477a_1673858116408_0.9783746968824807","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230116084436-7413816":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230116084436-7413816","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230116084436-7413816","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"44340d5137b32e41c8933f0a5f02ea56631a48c7","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230116084436-7413816.tgz","fileCount":60,"integrity":"sha512-jM8NQgqsbJvPNX3geTxnHbgWLgEKL8F/D9h8aZFptOxGJYtOJmNx7cvjOsoCbGmUB/q0q6CChas+0R8M/6ua5A==","signatures":[{"sig":"MEQCIGkG4nQXhh6z/PpqVW0b+aL7oV4nIYM1Wh7sJ53oOymRAiA1/z074PT/SqHd/E3Fv7Sm5h6DGmgKpJpKYRusAjRu0w==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxQ6WACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmpu7A//R2tC+DiSYWwUsGngMOOmUQiTPoU02xoRzuoiSdYzxzkK+qpE\r\nqzTRGjdllDhlfCwWZFqIdQR6kEL4AC0fkDUkQzNz9b9BpoCmHJMnqaamxVik\r\nKGg6arKUlkIm4bsdAJgZhKf4HbJ/+reIgOpgwz8MFXpcBA9GSqfFDvwE92V/\r\n5WdXrJ9RMti9iqa693WlXrZyM8FrvJfbIMt3pGH9megyl+PV3aG+6//2lIxn\r\nJItigD/58ZmQA+CoNEZ7tvJb29aFhwuyoCuWBxQ5zpuWbxGY7NN4VCwCeeXn\r\nzB4onVhS/TIu9+DvQ7Ak7BkPJplm00uix59qE771wpQwjhDYwZOo9QJog4di\r\nZpt2pfONFYN7Ouc4/p5Sm4zzench3xoOMgkv4XO00EtFFEA5vGdjkpyFhtEM\r\nwYsagRxx9+ewOoxIVj7XRXx/j6HrkCj+ihm25XCkuqt3Wi9yvWbW8eKZbmzu\r\nKLrQgMN/sLkK4cdjEEa3x4/YNQc+EvbrxP4T4rQDvD8N/uRhHE8pJBoXPTE9\r\nkAYXitEDfYcoGKqimzWLXe8XRLMLWjUpstOzg2Ey/Npogau+eSHvb+U542wC\r\n7ejLwP8ok70yqgXOi9/yqZoGyjM3dsS5DfBoWghPUB54m3OnhozuhmT7bB2w\r\n6+PG2e7vtX+SXL/kR/EOrb8KcHBdshUwCLs=\r\n=IHFH\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230116084436-7413816.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/47381bc9dd9cb7f484e84b381c9e3f89/graphql-hive-client-0.22.0-alpha-20230116084436-7413816.tgz","_integrity":"sha512-jM8NQgqsbJvPNX3geTxnHbgWLgEKL8F/D9h8aZFptOxGJYtOJmNx7cvjOsoCbGmUB/q0q6CChas+0R8M/6ua5A==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230116084436-7413816_1673858710473_0.09461291195938881","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230116084927-56e6299":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230116084927-56e6299","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230116084927-56e6299","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"48b208ba7e4aeaf0c1b706fb81d158fccb194c7c","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230116084927-56e6299.tgz","fileCount":60,"integrity":"sha512-tkAiJD2oIEpXqvEQGdgYviaYu4eQucdm8cNL9P2kfZ4lb67twH6y9+isvtqibdZvbwJOYPjHeIeD5Fq4Rfy66Q==","signatures":[{"sig":"MEYCIQC4Xat2J5swPAePAegw7cmYPe/lrG6Y9q1jjoQipY3zyQIhAOERFEtHaUa8pW+WboEq5eACri2ALD/85vIpMUZSLyEr","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxQ++ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpOZA/5AKqnD+TKvP51VmQUImYDibGgmQtBAncc9h7K1r6X/LWUzQQ5\r\nMIGrDIfRDdQX/T/M1TXF1q7WP8iB0Qlvw3XmriTTp/pyfOgSVBc/wZVF+HB5\r\n8L5CZOyWmvk7obbKR+K7ZIX169jU6KGdvLxFfPNnU0tJA+bpxjm248cBKZyp\r\nCaTQRYCLbGbNO+BhoPKGM11ML3kV7TBuRcXfGbIseXSEQMiG+syShJDPwZYR\r\nQZX/NPy3fpK4k7btzUE0msBe0vovlhvfmonHhWRmdnIyzUgRxcoQvoDU0+dT\r\nTgLzBYhZ54FMwb5U0fgD18EyL/6r5zxj4n4UZFhjkdmOxVwmiDghwJrI9NXP\r\n1ghqyM6EywPpEp5OiLMoKmhol9ENcxHsBCY4eUlj3d9TmPz3lEqQXFQg80Lh\r\nPKKjjxNwZduuW0D4QQ+XVQdxMvRK4m2iB0X44LvVoMgBtLnhUW0sVfVobtLf\r\nPmRjEhMAoWoLIQc8ng8rOjPetdVb8QqylFUkrEGkL9zncrGYkWlvAqUzEjEU\r\nGzvgmSGn9Ra0M5SWnrn8lcX+Toe3n15x5o4QmRqgJFIJ/X7rKw/MHC17vyhj\r\nOqI9OzyW9VoAzeWpTHI5pkLmyGgg2HE4oY4kPgo/fQCU/9lNZd7ac4X9meIb\r\nUVRqfSmbo+ZMsumfJ5+74jxEyiMMckYgz+A=\r\n=y/b8\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230116084927-56e6299.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/a3c680212bf80513b3bfbf9539db2701/graphql-hive-client-0.22.0-alpha-20230116084927-56e6299.tgz","_integrity":"sha512-tkAiJD2oIEpXqvEQGdgYviaYu4eQucdm8cNL9P2kfZ4lb67twH6y9+isvtqibdZvbwJOYPjHeIeD5Fq4Rfy66Q==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230116084927-56e6299_1673859006040_0.7756328606741008","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230116085119-456dd11":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230116085119-456dd11","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230116085119-456dd11","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"71ea7a4068d46985f7e58246080d8f92c2fe5336","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230116085119-456dd11.tgz","fileCount":60,"integrity":"sha512-8sdkddtScJCheRS9vq6LkcEYkixa+9TLgQzNRQHVW/j3pTWt7EmS+6Aj9R8nxub8Xqa5ZLRsvnZ1llAtZq/wMQ==","signatures":[{"sig":"MEQCIElCjiIfinI6fOjRW0B5DKCY4L6v5LLwbbzLQvJf8fuvAiBTj9VfXzZYBwWIdSGqsd0sDYQ/ZcOtkz10oK3hgkzpGA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxRAtACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp/6g/+MFlNzzqSI7CNIB57616rHSsoaEnl0/wu773WcT4OZqE7xk7Z\r\ncMtRK6z7Y5yUbJ19WsqfePO87uyZayq53AublQA5S0o47EyV8ZuJl39pwOpi\r\nO+G8PoWQmso+iy+wqTdwCVJmRrU4tFCRqxKx0JP1O2CCgtE+0jXo7TIxZ1sH\r\nPxA3FvisyBI3HXBWuv5qvwJUGe4XSVZ0GKB16MXoft4AZD/SJL7zypL0ZxDa\r\nbltthV2semvtOWdIfgPk4TQWTGmJT4Ygbugkk1gdG6ZbViKozx5VxQUvU/pF\r\nUiMQp+8s1VBZG+Oh1QzqdnXuxyBSDMfsiq6tB42S4b6aLGQ0XUdDYmdDb7ZT\r\nALTP7GSuXINhXiUfWaRtzdvlsWFE6bBlH5Rv0QboLX1A4tzi7C5fI8XeNvz5\r\nZUiVDYhBpMPNceiHUzc+92WbndkZQbUzzM3ZZFNz3BFeKEdrm32mEYzCaL2a\r\nXL95c7Ja+hgTyf2eB/XsXabGn2oa78bKgTisnaEyL3MeGy95YkzzuBF530sB\r\npJaMtGI31v8ourKYllgB7wxDKOJ1de9J4N3hTstvqFJMKRvdgNEQoHwUtT9Q\r\njFWmbtkHZ7kScKmCzV7M/CYRbSkYbzkZt84s2GpNcw6TsPT9jNlVSWUjUCVI\r\nR98tKZW+9Rkcp7/T6VtE+n/iWRK+MaEGCIE=\r\n=6mrI\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230116085119-456dd11.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/fef3873469f2dae26c3cca81e811f67c/graphql-hive-client-0.22.0-alpha-20230116085119-456dd11.tgz","_integrity":"sha512-8sdkddtScJCheRS9vq6LkcEYkixa+9TLgQzNRQHVW/j3pTWt7EmS+6Aj9R8nxub8Xqa5ZLRsvnZ1llAtZq/wMQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230116085119-456dd11_1673859117662_0.12899912998873808","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230116085614-0cfe55c":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230116085614-0cfe55c","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230116085614-0cfe55c","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"1d06e5cd6f90c85a60580e8c3beb7f227d40ef89","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230116085614-0cfe55c.tgz","fileCount":60,"integrity":"sha512-cve2opHs4TzLYRiIzVQ4JTPnRZbrTk0w2bIhrciATEDfuONlgc8z9DcaOq12o/elVl++ieKHpBRWhWT6xCse1w==","signatures":[{"sig":"MEYCIQDDTNhN8OELUxW5CyZgXr9sWqX/5bb1E9qt4Jr7eepsNwIhAIMYRkjHF8/Gsv7YV24XpFh/wf4eyWP1EELoarvvzdez","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxRFQACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoaCQ/7BE77gIkE1sJbQEWXiE9otdJgYzSRdqBaaVggTMjJEgQjacl9\r\ndjMLSe3CV1oEFl7fVO29fYfbhiY2vztcDA0jsb0GgpJpAbKLuLY54hscw6h0\r\noDY76OA7nEWiEqYulRF0MNHYc8NER16cAggZrbV2xnZQLiLZlXm7x1NrQBez\r\n8XcXSjZEeqcgN0Vb88IKA4Hs3/nRySEpa65++Pt7X9rpm9zH4q0K0HcuKfds\r\nTRAHBUsFjSAurc0oHfjVO8K2JVTCp/oLfiQQYPGWXzS/4DI5HFpH0S/Afltb\r\nde5JA7kTxc18idXMSDq3qn+3/mdZJFxGSFcPD15K8ZDGXfBn4cRQl1PDLxii\r\n41C13FpZ+0piyWsd42yoTT3mypgGCUL+rkW5At1kxh5ZT5hwaaMIn0LlnH5m\r\nUSyn2yqhDS+0/m+OTbD6+9pcXNGyj1NZQsYLh12Ma/8uaIWZLyuFzHlUbkzq\r\npikN5/sSdwtsJ/Ws9YZIoh9o70mDMA3V6l5t1hGncX6r2xhVM9ENODzoPDvz\r\nepMRArbvO6JLXtFNbLTTztxo3Kla/nQ/ziaVaQpAZ/2GeDxoYCETlMs1fX+5\r\nyX6orWMhZEqfFsATSVol+eoE6ytWqmowPmyM4tZAvPkiNc0OX+3bmF979pE6\r\n/CloLMp41Wdxev4JJdecIiISxmiC5xMbwG0=\r\n=nxd+\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230116085614-0cfe55c.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/998bad60728ff59d77787c6511e43332/graphql-hive-client-0.22.0-alpha-20230116085614-0cfe55c.tgz","_integrity":"sha512-cve2opHs4TzLYRiIzVQ4JTPnRZbrTk0w2bIhrciATEDfuONlgc8z9DcaOq12o/elVl++ieKHpBRWhWT6xCse1w==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230116085614-0cfe55c_1673859408410_0.7394412329485216","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230116090102-0ad85cb":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230116090102-0ad85cb","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230116090102-0ad85cb","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"c0e83c72a1dfde4b6a16ce27eeab24e6c1a93e6d","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230116090102-0ad85cb.tgz","fileCount":60,"integrity":"sha512-RLHVn9trrbB+cIM07009wBRcRvYhnHpUGmvG4vRN73mFj339mAyNuMy3zclskFuUpLzJnG8cTiby56IodHIAjQ==","signatures":[{"sig":"MEYCIQCit+7Rhq8xboyO66rN9znDI6coVNohPxDRd91srP6YJQIhAL3ntkRsrWFViobNe3hVZCr6ywL/9W8/KQ3vcVildbFR","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169643,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxRJ0ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpKGw/+Li6GcHP/jrLHdFiAk1CJH7I+KpzGi6rAI1pG7A68+g5Wozrs\r\nkCAuur3kpqKX+2zS/48pWXs3lvT8Zbvu6VQ7Z5fP9rj4do+cBn6eGjHzS9l6\r\nGgQGzoEZGVn2b7ND+2/n9HXAUl3sjIhNBvBxJGkgsD2xULOSG3K0tDvuve6t\r\nNsQZWC0fBLHAmsyuXTY0q3sXcjetEuZIMi7dvZb8IEge8KZn4r1inmetfMF9\r\nBtZjddsQFyCIaMcTSG4DWjggToZvhHNbO0w3TL7NuO+T2KA95sJOxSubI9PW\r\nlaJflhJaulY+cBEyUcHcA7+HnR29G7AqdcnbHz+vd+dwOYSjGCZHnbScxlz1\r\nxYe1SnS4y/+yqNpthMK0LYY/oq3xuWepTTGraIbJsYzWZYa+UR0XOo+wea/B\r\nw8qjrCzsuF7YEEgYbgjmCJkoYQac5J4rzddro5MDFfVE7qrFKH7XXR5aC1VV\r\nZTd8EmriQbYRtmLDC0T4QvBKC9J33x77SebVyXrONtILWB+kfgpBZznhiU1B\r\n/+KzFeFaUbQOHN4ZfRpNCw6qqHB2cextECMCS19f6AMyMyzFqjh0pHt70pnB\r\nPdNVhdlzNNhgVlhJJUuUEKdCALKFMQ7D7/9d5xUXqO/L3NjwwV1ZtUJpr3LY\r\nlLj4wxB6SsA+psema2/amGxHZXD00rjm71s=\r\n=dAg8\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230116090102-0ad85cb.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/dd0d22d3e1313b7352c82c69119cb04d/graphql-hive-client-0.22.0-alpha-20230116090102-0ad85cb.tgz","_integrity":"sha512-RLHVn9trrbB+cIM07009wBRcRvYhnHpUGmvG4vRN73mFj339mAyNuMy3zclskFuUpLzJnG8cTiby56IodHIAjQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^9.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230116090102-0ad85cb_1673859700148_0.6249423700933827","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230116090550-f1c4580":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230116090550-f1c4580","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230116090550-f1c4580","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"8e40faf7c31e93a2dc8acecb28bf9dae7c488505","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230116090550-f1c4580.tgz","fileCount":60,"integrity":"sha512-18xBA32r28LdxZl/yKR49idIRq0+nE442pywH680TNIzLqVdWu5W5/Pjrswbs/yChNq3xTAyDjDdPDYsK24nZg==","signatures":[{"sig":"MEUCIQDmBEBn/RQGfXDAkr+x2wf5zyg0sBcTXZ4NKY54DCmijAIgAm25q2Z4i5IDg8n32FAwGou0ylkVK7Brk2HPxdpX+oE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxRORACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpK3A/+J54a6Y9AvbyyQ8zAb+crUJNPgacuJlKq6jA2LChkaW35Avp/\r\nVPigr67Lhp9QqDPintOuEVr4FMP0EeTuEIw2fIeLylDxwdmF2BaxfXSdFwcB\r\nzjomDPtlu1w2U8qECKslGhl0/IDCY0JpGzfuIAvjGd56sxePvrPWEn0ZOAoF\r\nh+8fmPrg442zZeecLXMUZZ5mb0mRrY/U+/uuH9qszWolcQwDkSL3bMQE07ti\r\ns/IVykFASzaDQ0R5jO26s/7fA/hIA37dqxffw/aFkAp45lWKl6ZsEIS0O4B0\r\ntfKtkN2RDJNqCadqZx5c3M6Mq+GpOUvfvvHouk7aLaVSv8cuQjWHbeDRbwzG\r\nRi056Ejqd3GzhbQhyu0JNhgQiJTk+pOHqabqz+b3lFpVw9WAqou8VgcuO+6E\r\n43F7xuxLPZlejsRkgJ9bX0hUbh1slMmIwY2XWpZ2PIynjpVBwLwab8rnKmcc\r\njvNANd39n+G8ANk5jjnogUItQLfPU20kR8u300lj6cEzG2djJWmOR9/SP90D\r\nQbyA+W7cW5tFF0rnf3VXJtd3a9vD+k4yt68xP3X4JfyyRemLhL9K4V71yVua\r\nNUMopxSiMnOrua/tDV+XX82/KPtuAp7d0m2OIKpVUVlHhs87N58sWh0TTt43\r\nTdVYzhX522jGnHVzTPMDRNEBchFYRy41nSw=\r\n=X11y\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230116090550-f1c4580.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/89b362be0a1e16072f400e24d9815ef0/graphql-hive-client-0.22.0-alpha-20230116090550-f1c4580.tgz","_integrity":"sha512-18xBA32r28LdxZl/yKR49idIRq0+nE442pywH680TNIzLqVdWu5W5/Pjrswbs/yChNq3xTAyDjDdPDYsK24nZg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230116090550-f1c4580_1673859985581_0.4289573793359607","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230116091040-755742b":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230116091040-755742b","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230116091040-755742b","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"027b682bd1bc67d23b420152367d5ca70db02b25","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230116091040-755742b.tgz","fileCount":60,"integrity":"sha512-CfWcMbl7PeQbCNOQtQEGhpM1k29Q4F0Xp/0+hQiXWo3oaLH4iJy+IkDzkDk/uV5X9iwcqUrY7qDo0gg4SpzirA==","signatures":[{"sig":"MEYCIQCHNNk2oyQSmaqrLkiv0GjBf0VPnxVAn7MMiLmyvSaLkAIhANlYpUZJXdSeULa1e7ILj9lHsTGjlxD/oJsEaB1LAjUr","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxRSzACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmq8URAAhSh7ey6fSOA/B9qENkVExdzRNhHs+ZBNkcHmCq25kcy590Jb\r\ntvvT10kQCwIYGCP46PmcOrgRVVlVbKUM2ArxcsNFPdSKTj3RrbyhnjNUxrZ4\r\nErwKBMUQucqymsaQ4bAdLjf7wkstNIFX4pgJGmitEGFpZHwm8WpE/fh1OaqT\r\nvRCuZWv1vhyQF4gUcA0NPlEbluF+4BVjbr2JFL70r/u26hv/8QuYcpupPrFw\r\njH3nZ3FSqjmkILmHd66B1RMgIc0NSmLINBBP9I+U9/MtH1m42iQTdcjxilLJ\r\nmB455tS06ftndfNvalltfu8eo3OodtoSauWvWEkaILJ16ewxAvlgc24PwA8N\r\nR/nV2ccQRGq/tKxaItAatD+7pFAT3OWL7ScNGOiAUvas2ADqrpq9sI6Oaxf3\r\nYxbFTys3BkF14tGCWk7a3cVTD1V/v0OzOODA9YTlHevJ1swroFu0hB9zkdPl\r\n/fyipbTQHzXcII7zI0Ag612x8NPEd8GxKtmJ7lVCkehySPfL/ZjgagcscJQw\r\nM5wO8hAogCfpynM4lLLm0buXRd7QNydrrl5au9VN6nFeDcT/CduL/AOuZbrA\r\n1hlmUKmw8uHwnt6kRHMeu+VLB7gtNM5+CilbvSOhSHRDusIF0GrueWRf46iB\r\nSsBFli6EnbHM+iRLo/um1j9X5R+5XSNUp9Y=\r\n=NMlA\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230116091040-755742b.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/8b15433934d435550e84bc4b01348351/graphql-hive-client-0.22.0-alpha-20230116091040-755742b.tgz","_integrity":"sha512-CfWcMbl7PeQbCNOQtQEGhpM1k29Q4F0Xp/0+hQiXWo3oaLH4iJy+IkDzkDk/uV5X9iwcqUrY7qDo0gg4SpzirA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230116091040-755742b_1673860275084_0.8328727812993082","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230116091534-f104130":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230116091534-f104130","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230116091534-f104130","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"8e355be115b3f6c28024a55b797abaab58d1f59a","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230116091534-f104130.tgz","fileCount":60,"integrity":"sha512-7pcGgB5p2g0reM/WXnPERX3tpp6lhxPDOiwgFsEeH3sYOFmDNkSi9S23uzRgVARlR5XnNbGXBfRKeFZMLdPgjA==","signatures":[{"sig":"MEUCIQCQT/AtiZKv577jBPHvklvzypdFvuh+o1KmJ6qXQpmGRwIgEutAr8HZkEBxDAXT5V9oiLC9InahWci0dHzMkgmuWR4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxRXYACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrYog//Xpy26fwElcWv4dElRuCizSiKesWw+5RRAEtef39Zfxp2DWyR\r\n1/kYKghL6JFec1Xo3TlAsvIQ7gfJu+AR3V9pCWvx0tvM9K5zVoA7R0p9EOLj\r\nUGYbExmBwn4FvDkngDSg7ijqsViMOSg0Kqd5uVZurEb29LqGj9MXBP5qv1FJ\r\ndhjCRzTugXrEtNR+tKlOnNcHs9LnXeI3qnoUhMenjw39vqo3dJGlDyL9g/FW\r\njbsWXTllrCR8CEU7M6mCLubRmE4osUEHbMKAB/JnGXQqdMNMi8UFFewIJvPt\r\nDUaSrfSp/TAhJyx5wqa5uIv24FofncisGxzXVr7QgtRCciIDugTTvp2lTL4u\r\nI5q9pRZbcbEQ4uPDOA1DOaQXWE1UpOd2zrgs1ssvYiY0LzrJ53mMWYeMoFaK\r\nnUYJA7Mwv19Ig8kXLatbDfwO+RzwwRzNt++M/JKPDfs0FLGiWEFor7ZoyfHB\r\nwxega2avk/fCdqfZ+IpIlFnA9OYDAQo/gGnz8Wzk/eryz7YTPC+4vPM8GQ/v\r\nwxb3PMjxUdI/XsHQF8LpnM8Eh8PMq673PxmuFw7ghYPRErcYBxwtATsG0MdD\r\ny2XEwa2JvLz2JbN1NQx9qA0c4wrqOF69TEEvbX2KKZXciqQn9GSvoR5lv9Jj\r\nTa50tkJNw5aBMeskGCU+7AjBW6DOrbw4w4w=\r\n=yZ7E\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230116091534-f104130.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/2cd98c9f24e329d9ec9cbc5675800a1f/graphql-hive-client-0.22.0-alpha-20230116091534-f104130.tgz","_integrity":"sha512-7pcGgB5p2g0reM/WXnPERX3tpp6lhxPDOiwgFsEeH3sYOFmDNkSi9S23uzRgVARlR5XnNbGXBfRKeFZMLdPgjA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230116091534-f104130_1673860568739_0.13451848673772626","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230116092409-1bda877":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230116092409-1bda877","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230116092409-1bda877","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"1307a100ad90349140d2573f2a47b388f4454ce1","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230116092409-1bda877.tgz","fileCount":60,"integrity":"sha512-0Cdcloh/btg2ou+Aac4EwgzFr7tOTGAmtD7PS/BQMcGK7iA4DoKRGQojKYYWEjAoG83jqQD7LkQOeKRN/Oi94g==","signatures":[{"sig":"MEUCIH7Yq3ubtMGnnbz5k67nuwq+CMsmVcZ4EzGW2v6m82X1AiEA+tQg7mS8q9defxfjG42y5skX8R895oSgtNJP9A3J9mY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxRfbACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqJphAAirLtAAswD0vFJ1rgKDhX0PJ15CnH1KCH+Fxtpx8lCLs6i4Kc\r\nmD+nKrHML3Rk6hcIr/BjCYIBIJTKUfCklPyhXT07WwYneu0XZr157vf4sE85\r\nRJJEHR9GuhJUpHHJpq3FwM5/+CyHmnRWzDH5jtVoAHLpksoKaTSAmYTMRg/y\r\nwtphuoGQtSWQD+iTOUbwI0cfVcbuy1Xsb9UL5lJs861qc4o+yPgnUC/5VURq\r\nfzfMj6GtZcMy8SOLolSrfH8SlQGGBflOM7oO2SujIqB13k07WSPiDXOkaHWS\r\n5HsPhuUsFET4r0IUg27qePLxjoGepovemPYy4MmosI7FrRZ0isfzbFr18ktw\r\nmCepkeXAtyQ5Iw/lWN9M1dAyb6esUHnUaNK4t9WBaVccvRo5R3hq/95KPyWf\r\nGwYUkbTGcUBy8Vms/rTCYbhqxRID2S4pTliXTdS8H+/2hInL794aF0+Q4q6u\r\n1Pw1VF4CUIBgHhEoD2CkoDXdcFTXsSBOH/UJqu5t0Q60lYXaRsOZnvEQyP9i\r\n5wGd8hrg7SuRb3/Ee8NDIMPO5VXhG3WfRLURGlGekYAYIPlc2k2tbWjFxxNa\r\nSrAzrdlWD8uXP6AG099BsiwjU0RWnXs4FGTO0E/AMVrc+SW+C3aRfmj4AV9Y\r\nJRmVLZX7nLn+lCVbct1DJ1BGRMkSMQqoKd0=\r\n=BExh\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230116092409-1bda877.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/90ae484149ccd5f013ab6abbdeebad95/graphql-hive-client-0.22.0-alpha-20230116092409-1bda877.tgz","_integrity":"sha512-0Cdcloh/btg2ou+Aac4EwgzFr7tOTGAmtD7PS/BQMcGK7iA4DoKRGQojKYYWEjAoG83jqQD7LkQOeKRN/Oi94g==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230116092409-1bda877_1673861083644_0.40313570176113633","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230116092957-7f2df09":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230116092957-7f2df09","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230116092957-7f2df09","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"08f826ab8ac47c0af3c12e9b2c70b82e84743ad6","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230116092957-7f2df09.tgz","fileCount":60,"integrity":"sha512-uaQuTcadhlURSqvMroA55gdhiD8OED61WDKJd0l7n1f/c7xxwDmNP5e3fqPeYGC+SC7IwAH9BKM9zE7GlYFz0w==","signatures":[{"sig":"MEUCIQCsAdWTtIuqre8B7inKlK7jZpQ4bI4K3UJgoP0PBXCbqgIgWdfCNshKS5hECa+KwLuwWDInmxQvMiiwP5sz5SkuYfI=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxRk6ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp7Lw/+Ly+FnTdgHRS14GlmFEkvHz/MCkKK2yhwqiLNeWX6MF+EvN9h\r\n/tuOirhZgEefxYF0n6nEb/zQtdm1CEtHrjFiyTTOnxajGvr8wC6+O3HPzNng\r\nUYehWzqywjG8MU1UrHNFw8wbWH5yEdh06nkyeQRvMFHM/UFjqJKjtlCndx9M\r\nfs/wQ3aKKk4+kyAdPMAeDCPMJjY4vPPVKd3pbd/Hn9F1Uyn2QMP8+3LH73Fn\r\nR39mzwnQlSBFzd/xKPViAUC8zIbInQJochYn/EkuaoKf+IgafendBEkydRD6\r\n9BTG/zaVw9n+ZcsBDHPggr73zzWmB7+tTl0twkPq2m5OZS/3sj1Y4OG2je0c\r\nq/B3qwIPnlhdpQM/3pixeUDS8AWuCty0o/Bs9zare5cBrjbw7JGneVRQaeU+\r\nwbPGvStYYW+WOCFMMhGq/P7TZ0tPSPoqDDQNe+tU4tE1NdYO/HFwhaNPzou7\r\npJBSnToNUDnmEUxVB5gHz45Q+TBdJt5OY4mAGJdB8h8vz/TvKKDAM7s8SNsR\r\nZsctp8FS+bq8KHhMmlOGXEDNIUvEt44N2W3mgSt5oL3eGDbSGyoltg6/q9EO\r\nal9EPtAY54mBbSCZwycaIPGBWCyuml2Aelkk8q+w5xHzsgTvoiaPyYoIIguV\r\nLn/NMFb+D+YI4Z2fKYzzrS7EZUhgPMi5nqY=\r\n=9JOw\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230116092957-7f2df09.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/bd1e61672f4f9903b8d4f660dc569bf7/graphql-hive-client-0.22.0-alpha-20230116092957-7f2df09.tgz","_integrity":"sha512-uaQuTcadhlURSqvMroA55gdhiD8OED61WDKJd0l7n1f/c7xxwDmNP5e3fqPeYGC+SC7IwAH9BKM9zE7GlYFz0w==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230116092957-7f2df09_1673861434718_0.5494783376976151","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230116093353-f29730a":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230116093353-f29730a","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230116093353-f29730a","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"5d6fd80ae0cab61fe477bdded72c2b412d3644f6","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230116093353-f29730a.tgz","fileCount":60,"integrity":"sha512-pGq0XucnO5g/8z+5ro4e/7dUlbYmgTyYKW3RCQgi6wUPhMaA+QjzK8PzTxXV6zf8NkaHN5T0OGKnO6d4B0fLBA==","signatures":[{"sig":"MEUCIQD9RoH/j2Jfz6nMuYYOsTfkZrCMrIDlzun0cQGzhyH79gIgOxdSepwZkw5i8TlKfX6F/x1mMNZTiMh4TXLqKWEIe1A=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxRoiACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmq7jw/+KykKInLL42ONws7JBp8hqIbPPb00a998lfr0/FbOn1vspB59\r\n742iMkIRSHNE3Y3yBZ+dyowJn7ooPZ2fS193IdxzkEQpALGN3/ry43g7fjKa\r\n0qASrpo8Tqji7UWGau1q/t3a9HesJBdHzhYHlvdqSNVrg8pn2+ADGXWHRtbH\r\nJqglR97GH5mDgwb7QiIFFKWdUR7+JVVemNYotFMwMLYU11MAf0AD7bTbhSMN\r\nPsyDzgrquXY/ZkoAH3pV0naV19CgoHlz65a9hJfK7SX+5BDtNWaO4unvKiXV\r\n6vn1wYbTtG41rjcNSx1Oj4HVeplOXAJ4Tou6BA5YZzkZ1qdf9qEPuIYQEQfD\r\nqsroeuvRxM/K5if+JH9nfQVZPri0OaiIeZQVMMUWSd5Q7OyaKxu49HjJopv4\r\nxsktzTuC/1wCF27fuO3Jtl3AfjOmdRz53KT9cCboQ4K66TX2w1bYCuE+lLSW\r\n/X+d/0mN9dFO9h9aIzrWZk6onl4TLJ5ES4Uudd5Lbb1ASZTM8ZdpcGrErb2A\r\nXjIGtRyvMKWHyWvpc3tPmOE0bETy4mmTk2qaE7Bzt+GIA9bl108nVV6vRbqg\r\nJYXjKGvMYKxFqtDDmiKIumBzpdaL6NeZgjY8qQ9Xb5+WSr2WRk6gC9coWRjR\r\nBrmj1mKzlDUaEJ3uB9XAEx7VxpL07n7bXAg=\r\n=wGwZ\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230116093353-f29730a.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/2f79cd8e19505fcffb947f2bf85721fc/graphql-hive-client-0.22.0-alpha-20230116093353-f29730a.tgz","_integrity":"sha512-pGq0XucnO5g/8z+5ro4e/7dUlbYmgTyYKW3RCQgi6wUPhMaA+QjzK8PzTxXV6zf8NkaHN5T0OGKnO6d4B0fLBA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230116093353-f29730a_1673861666571_0.28431156510820177","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230116093847-4e7f625":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230116093847-4e7f625","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230116093847-4e7f625","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"1c76827d473843431fdd30e4433181ac8e8fae10","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230116093847-4e7f625.tgz","fileCount":60,"integrity":"sha512-B2adzkEmLrTcs37DwbbGQ8GWKwV1w1NqFAaU1zmKdzOy29KJZhobu1JD5c7Hzdexg3CcvKuisr4yMmtAxE3AHQ==","signatures":[{"sig":"MEUCIHtMRyMQ6FFSB+2Qwl6Xf5jdljQ5L36KeKKU85vf4RbZAiEA9xSebIDOcdQPYF4MOlaVy6paj29qaGYeDK6+fHACdkA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxRtUACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmqv8A//W+V5lzSOpvEC/76j1ANOg8q3ZIaW9PqYV1AejS6PrqwVY+Dm\r\nOS2aiMfgIIf+EDFsa11UpOr+6MG8UJUoRv4WMbCBkzqdKWCOSAGTUYpgpKK3\r\n7bdt7uLsJRTGpLcnqFhneX38vPzAg4sdoa+pc4sC6Of+ctoasJ0ZMAWKVe0z\r\nMGo+zim8o5EHd83E3tdYIzjsNu0aLSIFGe/0ohxkLtvB95KWgl2TeUHzVfxM\r\nvtAz/KbRTf59OyEjV9EXRoPmnTZroF3v63by+HTFuNhAxLw8MRdQfWt7BH8a\r\npKcZAFTCKYn97OdmFweliKcw8PoTYtAnpR5ZzysuCqx2Dhy0vpTkmNmvJi4m\r\nrR+lqn40JucS0jpHBo+5FMum/1fR3vSSAhedAuN60DkIBuZRIB97ZsjGRqyp\r\nehunZipiVWeq82odXNXZGixesbLKwTeugs/roCPfJkHLgCBp320888bQ1ASw\r\n/GifoEX7bGd891v7SvHq1c5YkYdwrMW+97+VGZi6LpyYeZ8ZnupVG0WmM0Hv\r\nz/AC/Pm0qx3zs6kJ3YDNyxrx2BMjX3yUIudGw7Cb8M7jSTJolTv+ZSHnuvRN\r\nHl2hiE3dEwz8SKhfbqm1RP0OPazunzMn7WR/+bwvt2heFuRIqSlbNNhfwHw9\r\ngf6rIl+G4qW0gQksJXqxN/tEin3/yXmK6c4=\r\n=FheN\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230116093847-4e7f625.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/c01d9ea6f399d511ffc606e4e5c78ff6/graphql-hive-client-0.22.0-alpha-20230116093847-4e7f625.tgz","_integrity":"sha512-B2adzkEmLrTcs37DwbbGQ8GWKwV1w1NqFAaU1zmKdzOy29KJZhobu1JD5c7Hzdexg3CcvKuisr4yMmtAxE3AHQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230116093847-4e7f625_1673861972482_0.7194577417174168","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230116094036-29fb454":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230116094036-29fb454","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230116094036-29fb454","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"b96e9bd6d429effcddc1b8d78b55ba4cab4f7d45","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230116094036-29fb454.tgz","fileCount":60,"integrity":"sha512-MDSMuq191zShuGTdBxdapMyFx1dHLBRyrfL6uInh1bvkU0C/A16K4sf1Cat0R0XF4dOhqtQDyeP9npJpkm+w/g==","signatures":[{"sig":"MEUCIQDL79UCDUfRTowaCh1of+ILMNTM3B7U3usWjTJVpG9x8gIgFjztzgN0vJuWQKPO1SHbVglN8Y/QQ3XFEvHrXVYUpD0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxRu3ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpvMQ/9GKFks2beNFbahJUPpS5kqMMLHGT+W+SzMa0b/7rCVA3HVSDb\r\n9HkydpkTKOE79lzysPfC0q2GNFvvEqluXix9zqQCpJvBHN5YDwu1d7ELcDvd\r\nY/QRsklZkv6tu2C3eGAbJMzghpUQGeNAambC/dGnoXAm8njVyx6t0ek7Zx4Q\r\nBtK3zPcLcIRiXKvGKqTl8pm6DNwB04rRbHEy3JUw1hs2w68rtw8zdwiS6AM2\r\n7+D1Wbzddjvpw7J278rRNFhEkwmrSr6RMS0KavZ1GmWrDZOUeyU/YfbkvlUE\r\nBj+Ueg4bewqDciKLFinwmPmVoS3LnywkHLe2Oi/nBEnbea1DYrWLrAa3Xmmk\r\nZY/vnbkfwxK0EBRLDMnmeXuuT09wjpk+PoLyWDYqIpnIaKMQJVGIDEhFNQnN\r\nIR52K3vqMAdYathwioyW9tw8sTlL0EF6VKof+3paPyCxhdVkXaxq/9l5OWWx\r\n2IYBInZ5fod0r+CBIh021QnO1chvZypWXqxD06kiDTMxySoruRSS/TOgVdbi\r\nLMZAbUGPK7fg0p3ZFBC0pDnvlLyEISptj8Aghatgz1CoynXGsWTjAsj0OnWJ\r\nrBE75hucgtgD0+YZ0jmWUOJ7HLJQXe8nWYCeOwcw1zUpLcmjhO/vJdx79Da5\r\nINPYbus8OuFlMZP3XhWLLTr4VHuDEp4IfE0=\r\n=bPi5\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230116094036-29fb454.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/116be8bd74e1792c8e0c2fcef28998f2/graphql-hive-client-0.22.0-alpha-20230116094036-29fb454.tgz","_integrity":"sha512-MDSMuq191zShuGTdBxdapMyFx1dHLBRyrfL6uInh1bvkU0C/A16K4sf1Cat0R0XF4dOhqtQDyeP9npJpkm+w/g==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230116094036-29fb454_1673862071620_0.06836496641439394","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230116094523-f475f71":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230116094523-f475f71","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230116094523-f475f71","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"2f0fb471ac5b45057a0f7d80f052bf555a8c1369","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230116094523-f475f71.tgz","fileCount":60,"integrity":"sha512-K1Lx9y4ZZNHh8myKTgwVNDvyn7kCjDE7nVKj66bqZscTbMmWwRDMesucC5MVvFTELeMmExp4PM3zKE+xfZm4vQ==","signatures":[{"sig":"MEUCIQDisSOKMRKTGiEM5ofDXE6N3QK32/Z4azhgthzxQSVoKwIgXShLOG1xtYlGP3J21OTF3lgsE0tXolEoSh0NlDONFjA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxRzXACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqOkxAApJLrtDiOv05VxP5pspO1H2Dnsmyc6IClkQGU2xylINFJwx8y\r\nzggU5pxzCcHyHaB1lkjdm93zEbBGGA6qtmXValCcfktWH/3gl47uDBw/VeGG\r\nl4eKO6Sark+/c6nJv0db3a7wBQEHIJechK9jjoFKHf3JLqlL67uexZJsNql5\r\nvPnzXep1ux5Zx1DmR7JfGh8xdg4n4xgIupq9qJZRiGFpcoRCIrrCbfm08V+j\r\npDG5kf3mNt3ySROZLnNd6N9srrfZUVtzPNVaxFEb+NYMrLapHo5+JUfVp5dE\r\nxtTp/ssSqH8PSf8vyBfRdkhTW5t55Q59YlBmUtoChhtfSfSIrkaGkkZmdCPS\r\nES8Xk3bwfr05QxBaYUSHg1q4aprI1M5pM9JZ8feRwrxTix1E+s091RFtDzBD\r\nwikBzTLfAEe59oWULYH4cW0rMbg/c+91CzmT1QekYyNlzKxZ5v9bdmztSI6L\r\n053gwZrukcBmqcSCy6fv75imo5LBIaz4n/+tfARSvmwYV0eQdu0/tjdJsm0a\r\nBK8KFNS3Ws3YffdJhn7zSeoOxeOQGLIw5W8YFJdAzQrn66VkJpPDMCU4VyRp\r\nebc4KO9e/aKah3m6Kswra8DreBe9s8K9lRNBsx2XawiZOkOXwlUYBCTcH6k2\r\nwNbAAxr6S6+IqMZRB5ik6YqiW7WUqcMbBE4=\r\n=Jpqv\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230116094523-f475f71.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/6e10008540c03006f303e92298fd5c23/graphql-hive-client-0.22.0-alpha-20230116094523-f475f71.tgz","_integrity":"sha512-K1Lx9y4ZZNHh8myKTgwVNDvyn7kCjDE7nVKj66bqZscTbMmWwRDMesucC5MVvFTELeMmExp4PM3zKE+xfZm4vQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230116094523-f475f71_1673862359615_0.960661006712221","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230116095013-484fb46":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230116095013-484fb46","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230116095013-484fb46","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"f4e643af11870997168849f3b98df5a7341ee347","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230116095013-484fb46.tgz","fileCount":60,"integrity":"sha512-w+7UavcAe4X5FX0zC2BVK8fTZINiBNr6QmyrT2+1KIRZjXLnEsZkABT2zLrC+3rkI3TONAcY/89gDSgEmznYSQ==","signatures":[{"sig":"MEUCICMzczT+WMeQODja6ZluuMLrz6SyoFntDyNea4lpVDQaAiEAxqXfWfXKiGCj9RDdMtDUNdH9u/ErNaWbdWRx089nckI=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169643,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxR35ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrSxBAAgrvfhUxhBIuRmIdnWPOiT6gcKq+sHIEnwrmG5cxzQHm+zocj\r\nYNPXoIfq4xDPBc7yOALNQ9b+MaflteOHGuX20Szt0O/v4R8txZ3RV+huPWDS\r\ntycVKSODNXQQJfaJlMrSw6kSc4glb4p89Or3r3QuyzISo7xE1LmvvAcnw9r+\r\n0V1trvqB73Qsk3mMv6S+RIIpvreuJl7PkZMBaSIZvjppzyLpp9hZQiSCJofx\r\n2xF5TvD8amQrzKXhwP4aiuTFpdOkjVdx9D2Q9HYLXx7imlzcOqO967yt9h9b\r\n6nZn+sMqILRx0wN/r79gRfpuG0QjSzb9Hf/Ola+u1bhhhrWHEWvnu1GhDcPx\r\nRI/Cy6YBEPbIJzCBUit65EP1WUWuzSwXL9DDfmPmoke2awRTnItyibriYpON\r\nvM+rExAEtfol9TlWxjj6ELsuElnTjVT5N+OKh1noNNkNz3/6nBPUPV+cVPpC\r\ncCnLc/0BEYh6gJ57eLX1/JIwvN0tWYPDPjUmx4IAmB0mWZNIeOGqx5iVUPi2\r\ncSwZGaVz0lXuQ1b1qoApBfX28PAwiCY45C6nEm4BQan5k/74/ldFOMPLcd1X\r\nTf6zF9wO0TffomhUOssgIbEcDBxC2wcTY/a0FuYluUTYveoDiXIw4Nv+YSJ3\r\nZNFCUAVtpXu1qOHDuhl3jL4Y3HazQemCNLI=\r\n=QQML\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230116095013-484fb46.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/8b875e66a229f34b2511e344377ab8e0/graphql-hive-client-0.22.0-alpha-20230116095013-484fb46.tgz","_integrity":"sha512-w+7UavcAe4X5FX0zC2BVK8fTZINiBNr6QmyrT2+1KIRZjXLnEsZkABT2zLrC+3rkI3TONAcY/89gDSgEmznYSQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^9.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230116095013-484fb46_1673862649341_0.5949738277853898","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230116095354-335c84d":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230116095354-335c84d","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230116095354-335c84d","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"17b82f787d1f25f794f7ed64386a958a4b9a5274","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230116095354-335c84d.tgz","fileCount":60,"integrity":"sha512-lLf5ErbnssTiTCno2C3k9VfihelLOvPiEj7boA/WDbqJYIshbQNmWvSgOfkPg863jTdX810eIcIjv2sOITU4Yw==","signatures":[{"sig":"MEUCIBQjizcNj/DIxQ2xZSfkYXCrHMfHi5nHBcYhNVNUSbEpAiEAhDqZhQ6Yofsv/XItWBck2jRFU2AUJd7VoWmT84QSRjI=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxR7WACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoFOA/+OOeufU+RzwVsxr7asVeJxhRwdelukJOq6+w308OiDy1OsckU\r\nkWRpgJ7stvvdEWue27uVpZhLMwwN5FvFwQjdoJ3Ar3mdbQdbo7R9eZ+sL5mk\r\n5OYuM8U58ZJGi3Nd8LKOQiLZzp/EaArQN66eqM+/bmvpEhF2JhEu5R7Zjk64\r\nAG6jZY+N3fCr1rWOTCw+UCmZp0X9501byvy8feWA0rMERb2dPbI0p3m/Ostb\r\nqNHkMwRiTNveET3IHSj2KSoV1z9vcHfqriwlyDz+Y5VYizQ0j9ih2pwetNJ1\r\nP4IOxv0ykkjVCqjhwgAcQPsHAhCkRPJ+jpIX+wkuPwcn27Vw/r9nl6qUTc1s\r\n637lJXhg3G3nAN3+VZj0NCWUqnQxTN93rrDeOl/tIG93GMX5IhdXCIdGp3mR\r\ntSHcXZMoTlstA6/xPm6Cmvv3pkwTyziImsDjkPtMMTVzvWCVqkL2Gca5hXna\r\n8DU4BucXxJ0Mte/71Oa2Qh48Oc2FVsw1clcLAtEECHiNOOwyDLE8oFkbmOQe\r\nWewtWkQ9rAkkZccySSpBavmIcVS/HIJNa1msn8Qp4LFAfM+10t4PWxSRz3w2\r\nvuCUxKc1tY1aXSMps4IY8uBw8V30EiHR56D+rBjey2mjXiTbDJGmrsqrVbAL\r\nZ3d4qXRFeRQcDexovY1mWsYlXl71PqfAmg8=\r\n=XKv5\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230116095354-335c84d.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/51e9d95540cc2ba3fd2fc099c0aefb3f/graphql-hive-client-0.22.0-alpha-20230116095354-335c84d.tgz","_integrity":"sha512-lLf5ErbnssTiTCno2C3k9VfihelLOvPiEj7boA/WDbqJYIshbQNmWvSgOfkPg863jTdX810eIcIjv2sOITU4Yw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230116095354-335c84d_1673862870142_0.8860133562330406","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230116095540-970a4d8":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230116095540-970a4d8","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230116095540-970a4d8","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"8dbe97eb86e2c85d3bf52601f4b11f1869df8213","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230116095540-970a4d8.tgz","fileCount":60,"integrity":"sha512-7eWgQkVgQyeRDTsu1K5vxZFGAbecQV0RCWVYGMhtogyz+hSBFT6lDlM7jZZuIIEtCh79xWXaOGOqdJwOA8LqAQ==","signatures":[{"sig":"MEUCIQD/hz5vuSOjGllXhgdHMz6E7lYLUuf36GOBg9xw/YvQAgIgDAqm8Od7ZLXP3tf2qaLSCZezSMCqa/76+RyMDRumXF0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxR9AACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqgEQ/+MDi6M78wGOm/3mVtiwXBZHcuBFZtI46x0vY0OGRVjDhg1c9S\r\nE+GYXYFNZlyjN5SB3v39vjMbeiBTuE5ItsIBQIGUz0J7chYgIQZOsa6L6rOC\r\neqV2I5XD5tZ6jc9PkyUeWwtW4NPo+trkb2xv36iZ4De3SaKfA85uHWz6b6HL\r\nQlKqwoyuYYWgBfEfZXkpWQkU7U6Z1uRGe653A3pe0imsZ4fPF6VTKLltAQaa\r\nhlr6bpkbNUj9bFkxn22nsdFEIXRbUYvIpXzIcMiwWPprJG4L1FGdspq/jter\r\nOFSMrGwZCCNBjotKOLyogq+wz7fDrLGzOut2+ESHPIEmtnPnPzzzPqJ2jYvL\r\nTgSXGj/+bENnhYt5G2kW1FgtfHuX7opnXQr+TQnkbMBanzS1F7+ZlD0fwxlE\r\nAovwVSp3VSUzgSip1qz24s+jWIrql+eHhEi1Tz5n/Lr0VEXqF3a5Ty+4+9cv\r\nOQlHTXug2goiQBXKNJ1gwdXYmfnRTJNOwybU+EiXFQVm4cXfNJaAfrS/p3X0\r\n7KAN92qsvkRrfObCyFA6Spw7jrBcuHQQrCd0aATMpVXktsWuwiJjAFat1unD\r\ngubXTXMMI5yLJPx2WGJWwOgMrZ3rlagS7YQIOYIISukEtlFW/VzykmSqYBdD\r\nv7tHmLqn1mHSFQfJsVW0f3XvISk4Jvee2Zc=\r\n=A0eA\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230116095540-970a4d8.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/c274e4ba85ae41d5ba858f0830a578e1/graphql-hive-client-0.22.0-alpha-20230116095540-970a4d8.tgz","_integrity":"sha512-7eWgQkVgQyeRDTsu1K5vxZFGAbecQV0RCWVYGMhtogyz+hSBFT6lDlM7jZZuIIEtCh79xWXaOGOqdJwOA8LqAQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230116095540-970a4d8_1673862976342_0.13952414380289557","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230116100101-76bce3b":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230116100101-76bce3b","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230116100101-76bce3b","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"2b9141245c90bed89580d763dfadee408f948175","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230116100101-76bce3b.tgz","fileCount":60,"integrity":"sha512-Frt6MTS0hb6o9XLaOwNjYz14rpXeT41vJ1BcVamte9dO6SsOsPRxvRJBaJ1UKrv/7CLopGw+lyS1E5ayXfQ5sg==","signatures":[{"sig":"MEQCIAI7Pg+99KuZNuFArlWWAcwJAzgzsyBc7sxtny30lZoEAiA9d+YDmHgmDPxoJ3GY8kFjgn6Gd787t4SFESiqnbxtjQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxSCJACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpCDA/+M4AeHFhN+XvwIpZJ5GhaAEMsdo6M+IvpIMKTatuFh9L3g7em\r\nWBrZh1LXYUNmqAux8Wgmpa/0S8Jp27nePD7R8W+O07K4k0BWyoOndbJuni5H\r\nZCjRzCdVqUK20a8M0qbpZPliAALFB9e/RJgarn5aq5IcrGIeQo+M8crXn2r4\r\nKHu13JF4QvkxRa6GNFbu+lALv3AGwJNjQNhomRDjRXC/2koNsD2N514ASCOV\r\niid2REnLNQGExsQ87fQv7VcxrB/03shtk5JWF+2t+VzwMIBO6prqt3mrr7fQ\r\nLkn+KgAJOIv1WWL56XSUvCdIqtFfU6BR1ZQAnj2M6qI6XPmEa/GDEjlTc+06\r\nv01bFYDt4dXt6KHHWLNmtFU4nm9zpKMjN/xPM+OOby4m+TNiPcYyQHvshUq3\r\nUYoZeZp/NJNM+PUfWI0v/NLRxFCvR1mN53z7Rb5wce1+feA36xK3+cNVrMPv\r\nIxtZYBF/70kybyXw1iomcMBFRgy9TN2lr9oIu/usL1UbgNYatn+RxTG/qg25\r\n6aXGksNJx9V2ZvCdtcwPe8MXVqmAR+B/ps7PJV2BZErrcopm+7RSqMiot311\r\nHJb7k2YSBvXCtcjUhSr4KjeGzUD/89883O0dxsGvnMhVWVwG32FPSg2sZGKU\r\nmb8qPWB9P52Dgi9gFM8n06TukLcNHqRVpw8=\r\n=wWCZ\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230116100101-76bce3b.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/01314b6942f8f1dcfa0fe624cf1f90ba/graphql-hive-client-0.22.0-alpha-20230116100101-76bce3b.tgz","_integrity":"sha512-Frt6MTS0hb6o9XLaOwNjYz14rpXeT41vJ1BcVamte9dO6SsOsPRxvRJBaJ1UKrv/7CLopGw+lyS1E5ayXfQ5sg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230116100101-76bce3b_1673863305548_0.07467350422483188","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230116100515-e795702":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230116100515-e795702","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230116100515-e795702","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"60f27ee3be8137cb633b99f93297f776f9e1308e","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230116100515-e795702.tgz","fileCount":60,"integrity":"sha512-AfOecU/JgyHa4g8qCijB4YghIHOJ1m+M7tNNYyBnkEnJ955eh4wrP34hYG36loT1CJ+0GAiYs7MajKs5s41chg==","signatures":[{"sig":"MEUCIEV4Zg7I+Y4KBeV5SVsgjHzzppQ1ztSDmj++7ORska1aAiEAmtRVbOZBKiJutqDrXEtgqOQ56BL9+QkIyP2T0eTNNmE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxSF+ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrBLA//Tke+YJN54nkrKxigUCbSq8jtW/Ywu3CepwbTM8zvBTvUvY9L\r\nwyiHB88k93CXqNHadDe/lmjMO9WpVCO6SUBHTGfSRi+yyb/v+yUEg62AAaHq\r\nTWHUBnxW1VOj4E9nFviVEVvNcLZXDvZMg8eoYoxBg2eCGT4TJOmOjmo+Tl76\r\ndsiErLWDmtX1jItX+s3PJ4pe3a6Oi7V9nLi1/pzUT3ztgoTmUH3zbMjI7v1O\r\nEEp7cMUfZuMyw8VU+cpK3SXf4xxp+DxKlzzNxNhTamyr2R3Ixwfv0TLuXsLa\r\nHCzzPudxpqUty5DUc9wCuP9ukUi5P9w93yOYYTb+D2Cc4KMcWDPEOn8X4Cpy\r\npeoNPQhPmeTjOr5W/RrBOLwgR2yNH9iKVgOXZlIElQCJYhSnncBQdwCf3pnx\r\nEHQl02RmYoWkauz/3zi5PNZ4oU3cicLcvwlfWdzjuSRPmAPS1xz/cwMRMZrQ\r\n+QFdTxd0gijrzfPk5w7HqclJaa5UM/viCF24zDg63WI7A30GjvFzPeRxZ1lN\r\nahs7oJSNrcMf31WogGjEvKEc+xH4t8UHAGUFsR6LHdOticBtVUiI/UvNFUn8\r\nLNcsr47+GjirRobK4BEW58bGcSqOOoOp+lLGlk3dX63L2XKeK4NVjZzvPeat\r\noFlDvqJPQIb+NSYnyjjbflB1AHYiJ4P/4oM=\r\n=lrZW\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230116100515-e795702.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/9e1205b62cde5ef66826c238f67af22a/graphql-hive-client-0.22.0-alpha-20230116100515-e795702.tgz","_integrity":"sha512-AfOecU/JgyHa4g8qCijB4YghIHOJ1m+M7tNNYyBnkEnJ955eh4wrP34hYG36loT1CJ+0GAiYs7MajKs5s41chg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230116100515-e795702_1673863550517_0.00512645126831579","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230116100919-8287334":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230116100919-8287334","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230116100919-8287334","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"0b08142febf24283b85cb5b5e98242c7d47f971e","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230116100919-8287334.tgz","fileCount":60,"integrity":"sha512-4+AUL3SkDoNg+pf/Lmf7Lb3Dvn0VX+PEbyJCiOYoljVjXVwTVtP2BbKF7eTL6a9KGzcdozCe3F2mO6y3BdV0uw==","signatures":[{"sig":"MEUCIQDg2J/bJKcTU9iyxM+BpZhO1WIzvXS/vVJkRagsuW5YTQIgP2ItcFhseL9JT8mvI0MchMp8lZolKpHctDTm7/3YBDM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxSJzACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoSChAAoki88RPTzNA961JPd0SWfEDzMBKnIwKH+OPPF04ANgrGxTeJ\r\nC2QakFqinNkjFw5SrZa41tYuFoCkv+YXX35Pbw5aO8WKhNBT4wt2xuK4Szhc\r\nUBcQf0coTMs10x5BHTwPdfaD3ZFPqStC3uTFGWvoTjRotTktoPcamDiFldlE\r\nShCwl6mf9y+ZJMAVFNtLI9M8l39z1bv3KC3l3orO8m5RQMSHDsT6YMKowQYi\r\nm9aBm7qf2/CU0Zib0nIYZ1ZhSbkZUR9sD1D5KNhICz1D3bUWDEo6Kd5HgHQS\r\n7rSDBUeDbl6VcoP/V9Pi0Cz4tefJKXH44AMHXJ5puwBOfG3DA/iHb71eTEDL\r\nbeguYYGWMw1NMuXS9p9vIis7xZ1YGopdo4iyYXb1AzQ+rFw9lkrV5Z3G5s0g\r\n8EBjm9z9j8Lh1J39MS+Ez0vpLWdmjsqiQIdojoVfS5N+33D5Jg/rHqcXNYa6\r\nDtSodYE74h/qHt9lNyi5VNoPBekQwV+sYR5le6DyIjDKN4cwAuk+r0J5JFOk\r\nNEXlhbvYS7Vppwlr1uhoRM05Okyp9E3k1IlhvO5ZfDC/MnNyJUrGH0Y3bhhn\r\nKhdYbJ9yXtac9aBIYh5GNywG3t5Z414Cg9ONsW27wPEE4m+iS+fZSXQnYJmw\r\n4CfYoEx5eLD/RXwtLEr8uduN2s0FLtFHqRo=\r\n=OIRW\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230116100919-8287334.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/ac2c842d5a225363669f18638874cdce/graphql-hive-client-0.22.0-alpha-20230116100919-8287334.tgz","_integrity":"sha512-4+AUL3SkDoNg+pf/Lmf7Lb3Dvn0VX+PEbyJCiOYoljVjXVwTVtP2BbKF7eTL6a9KGzcdozCe3F2mO6y3BdV0uw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230116100919-8287334_1673863794939_0.548507535284184","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230116101138-c7118bb":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230116101138-c7118bb","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230116101138-c7118bb","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"c0ccdbc90d6b99f894aa18a48c0e3ac96331c23d","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230116101138-c7118bb.tgz","fileCount":60,"integrity":"sha512-X9KbWehykTqEEhzL/AKloUjVVeNsuGhnK8zB/rC+K8NJh3QZZfpHiuBTmstlhYHa3TcTs169dgc3pEvwnymyBA==","signatures":[{"sig":"MEUCIQCbOqf3hs2AEitYOfkMkQKw+16mGv9mQqlQLETpAFdhjAIgLfGtbSuIS8D0uCx3qG1+g0YW3MhEtGbnN8Xd413rGJw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxSMCACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmq6+Q//UG/pVZG3gygQCi0HZ9gS8CQ8jWhQaqmNpny5Nmnin+3eDzzV\r\n3elzrxcsNUCFuISZ+0+yMTgCkW07mpEOP2qzBxlR1e8xSTuwP9tPUjUTVsXO\r\n/cJHM6Saa08wE0GZmIjykavLFWcxRs43+hi6MyKaSlWsL404a6QPhUL3CRCC\r\naAKm6pNxeJ3loCWaNgJXueCHK//TXzoZDrtejaavdpAZ1qjA6WMXB7c6oCVx\r\nFlHrQG5aqAklHjEh/ccxkERuBH3njvWsh8XJNjWwYV3sN2e4l06RihC2T1wt\r\nLT6YZOxwZfGpbd90u6jqaZL7UcaCIfgxIVoRjjy7Crw7t9ehZLR6XbqOqB5r\r\nnj5TPtKPQvjFONqYx+HXQ+bTJyr0fVl3j6hV/yio73LMSYN4kfpw+jrzE33e\r\nP+0V7w24b6+4jjgyYqTBDW09MQhqc07AYEdTAkVjh1QVoGhF1wB4vSm65SeA\r\nMUaXv1Ga6AZMhEYfIrywbsN7PbL5i/ICdeeZMnxHNwZdLh4eJfUxV/HZQJpE\r\n3XKHqlxuXBsc24nOeIso1soKGOpwB8RdL7L4/2wFJ7Qt5/8/2CCkd7v7OC4A\r\nJjK7C+9ZGnhsZNLOy6iXv6vLEf8JJnLWRthAGYUdIrWzFQEpofXQs9cve8M5\r\n8eQeYMRAcPKnUyb2yFhWlDTPmtihXuVUfiA=\r\n=J7Cw\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230116101138-c7118bb.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/abeb5e1164e3706c3b5e081fb690804a/graphql-hive-client-0.22.0-alpha-20230116101138-c7118bb.tgz","_integrity":"sha512-X9KbWehykTqEEhzL/AKloUjVVeNsuGhnK8zB/rC+K8NJh3QZZfpHiuBTmstlhYHa3TcTs169dgc3pEvwnymyBA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230116101138-c7118bb_1673863938368_0.07557046869904482","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230116101642-7122c62":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230116101642-7122c62","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230116101642-7122c62","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"795680317abb8d6fd4140cf18f2101017ef02660","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230116101642-7122c62.tgz","fileCount":60,"integrity":"sha512-7TWE7hKijZ/uVKdDJv6vZBpd8uwlQLr1wDv8Rx8rtm2eDZLkm3hf2cr9L2V07qfhUf2zvMaM68q/upKeexyCAg==","signatures":[{"sig":"MEUCIQCvdNNrbmMp7w8ARxEB1zcuyCSS9eHm+ZWPVU30pF8+QwIgaAATXJmK22adqvgKhdtQmS99S9QrbmvQzCS10SsMGmo=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxSQ6ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqKSg/+IAy76r6vJHpbyEpJ968p4Pds7LGLMWyT0cSJtOJcYeSEg243\r\nu+YV+9DxuXsF1zzQcqLaykxUDtKk4zDqsnquzPdvtY5dJcBQv4gUpLFlyPi6\r\n3LVYYKaNpvT7WWqIZm0RTrtEuaU0lS2/E9u9kZSdwKChiKqsi7wdRlGoNcAG\r\nRWyzgkWkEF6UicZTXkjpiOc4f/3mHqiIduvC3IuSuAIgpxuD22KraLvBJplE\r\nIlX0iP4kY/TyYA9ooKz7aYmGxzn95aUa3XhBgdNAp83CeZfox2LkzcfW37cm\r\niAWbEOrFwcudw8I0wWzobAgRiyQck1+xRyXRqZSTNLEbt4isIcySTJAob4Tl\r\niGUlDnrvoeCdctrZFKFao1GKk0xFg9G8JjSUDXvyVkMUg5vDG7uQddukliUV\r\nb3QDNOzBZkwwyEydx6GFjrfmNqSfsqUSx+cCw58fWSI4r08YooMLY5Pdzw7A\r\nUmN8HDyJiBhjsVBvVe9RnZVPiwKsOVTU7Tbtv2SPiQMHuD4AgPtEnT0JApUa\r\nqZziynzgh++Ge8km+9AaW7hMYzrdwghqTHcpsVvdnvAEkVIkMQkHt0++HHba\r\nufjv7gs0WcwWtTrfrdJsmwHklPc+hMm28Ch5yugOz7PYlReS0UHOdfjdU4DF\r\no7mRuOF2kTEHmTtC/w8ICNAD7BnLO2WG3T0=\r\n=9FSM\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230116101642-7122c62.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/94289e4e6defce915c3fae52fcfb3831/graphql-hive-client-0.22.0-alpha-20230116101642-7122c62.tgz","_integrity":"sha512-7TWE7hKijZ/uVKdDJv6vZBpd8uwlQLr1wDv8Rx8rtm2eDZLkm3hf2cr9L2V07qfhUf2zvMaM68q/upKeexyCAg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230116101642-7122c62_1673864250168_0.03953564502998774","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230116101741-9e28502":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230116101741-9e28502","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230116101741-9e28502","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"3f060ef1727ed1c8692bad78b50f92598e89e9eb","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230116101741-9e28502.tgz","fileCount":60,"integrity":"sha512-nG8y9nxpAsxdE2/+ydaA/V/LYJwEO7ZYht4UQfZHNx+rZ9DXEJyRuXQLE60R0oSPtmqj6Tc8vqwi+tMIUCy70Q==","signatures":[{"sig":"MEQCICGN7kR/lZ08jF8knXPq6SAMBMPM6fD/WCwyWF0vOOiYAiB4UPG6erafk9nBbUa9RUiLdszx6jihMmHstpyIuexLmg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxSRsACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoL6RAAigskgyYQu+24JuXImq57/RywfokKJ+kDzt6mqcx+hr5yVtE8\r\nkgPiccPJYtz2Ao/o7uxUuDHFNHVtLyA5pDDC5tq1Rs0l1EvTD05iKagyfI46\r\n6OrsK305Lz0gDbEoRS8FEgKzXXvYL02l8O5c7x2h4Ycu4memWu1BxC6aQ36F\r\nd7+8TF7xpaNIPVXCUAxYYP4sI8HlOR1z9Ab12aoSMLc0oAcZZswB5xmLoRmd\r\nB4w/AzqLc2BJqXgCVS8i3fR98X45HVTtW7KRUU0ePEero+HQ5oHWiAfecHj3\r\nGeO4OUe/bvvKOvTC0OzPsHe2OMQdUR3tH9J2ei8joYH3Cd+fs9d4+7dOo0Jz\r\nx5u/zgDk4DgKlaxI1bhS1ndMTs72QSjegAoRvNqOI6jfuRdEiC0qxM3O5+92\r\neYKBiFzRqTPz5/8SYiVmgdGmfpHK7xZIeKw/TQuxZ0QiGwb5B1Igy+/HweXQ\r\nJsmkSvJn4KHW8Gm1xPQdPlvtw0p5e892XgQTslkA5MwDGyAFkjmox7/ZzCxp\r\njNtZ97/JLoi9/M8mdHVlXyHpOKI+q5spZu86kNrHH+OZxg1BNvdOeFbBXXUx\r\nBsryAsZ5nGuLlCVqOooJcKPtVabaPtHv685RwQ7Ux3LsgqpJLTI9FI4ov2LJ\r\nXFPhhHZ5b0JS6xJ1R0idMoLkQYQaOOLSsrU=\r\n=mgl+\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230116101741-9e28502.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/d7c67c2cadcdae71d4ca62511c7cb658/graphql-hive-client-0.22.0-alpha-20230116101741-9e28502.tgz","_integrity":"sha512-nG8y9nxpAsxdE2/+ydaA/V/LYJwEO7ZYht4UQfZHNx+rZ9DXEJyRuXQLE60R0oSPtmqj6Tc8vqwi+tMIUCy70Q==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230116101741-9e28502_1673864299828_0.0024564797616601908","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230116102202-4c2e429":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230116102202-4c2e429","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230116102202-4c2e429","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"4e341b54c106c45ac84795fd9354ca819acbd610","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230116102202-4c2e429.tgz","fileCount":60,"integrity":"sha512-uQgenxCAhOkdEu72isNvezsNAgvdzbUTUlxu0LBzzlIRbfgyMxtQOprY4/DncTMrw7bRqAeiT/tTw0ahWLEc7A==","signatures":[{"sig":"MEUCICOlQYtDhN7fBjxMWjN2f0MMBixI3H9zuRZIcpMrLBO+AiEA6Qu/dlLuJsZU5qNvwecx4fD3YXvnwVkljETkMQX18L0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxSVtACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqaAg//ag/oCDzW9UgqGG0oLOAhz1cMSigH0VTUZo77ZIj2KaBfLJAD\r\nvS7gV1ke8qnspfJGUlfz5ItTdi/ZpsWOviAN1axeifhL/2wHh/CBECzJWlUJ\r\nYWNnrf2rOEPtMCPebPLqa2sQdjfzFU3C5CFaBRhOrhyfYy6B5i9qDUt/9P8x\r\nIK6JzaMmhcbSVjRCqV/1B0m8wzOXv1++6XlqjiCL7TyFVgBXwXod82rX8SCX\r\nxgdcbHgXjVXTjnIVOv/W8TsMwLut/zkpzigmyXEb9U6iNaCx5iApcPNtbPz9\r\nKXXY9i010uqTfggGwt579grhlXZv0vcVlGYv4om1gC9TANcD3ksVvZFz7GLE\r\nMBSSFEgKu+iP831iMVuIiYaxg+a3rsCzfqiQ0DkKugaZBDpX4684+OD2HVHu\r\nd7+JZqCPp0LqcGjzZ+u6AXo28xSvuBB4iQVXpInKPFIlfkRiD8WTSE7/PXtB\r\nBCDnLbcTfiTdOGp7ODiLYgNubfZj26zbx79v1GTD3TjY8rD8SAAS60olCNEY\r\n9kR1iNJXG4g5Zf8hI1LRTf1LlAjEQqCDIwRU3+1JuL+rRqilzGr+xGI53bJF\r\ncnRopI9BuxWQSEIU0Og/XHJoCl1NpVA/99qw/PSrm0OEY7aMV63vzCIKGqbd\r\nLdbZwqxlgPIjaHLwoe11otoqyC/dFGsIUCo=\r\n=skw+\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230116102202-4c2e429.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/0c0fba86f398b52952dc1f4386dde49f/graphql-hive-client-0.22.0-alpha-20230116102202-4c2e429.tgz","_integrity":"sha512-uQgenxCAhOkdEu72isNvezsNAgvdzbUTUlxu0LBzzlIRbfgyMxtQOprY4/DncTMrw7bRqAeiT/tTw0ahWLEc7A==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230116102202-4c2e429_1673864556899_0.7505653841587827","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230116102744-9e5ced2":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230116102744-9e5ced2","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230116102744-9e5ced2","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"ffff894d00f0d523eeda5cb21a0be340d210aa21","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230116102744-9e5ced2.tgz","fileCount":60,"integrity":"sha512-RbaeRho8G9QJtXKNMwn2PMtOvFFOzqfapCvF+c8ZUrMtqbM6jT7syRqyXnCxqFrjdd6VHTjl8URYt1EYQJgROQ==","signatures":[{"sig":"MEUCIQDlxbb9Nuy/LPaLWlbJFtetBGej2VWgQFq11eE0AYc/NwIgQq0dClwCgVaUlv3QJ3y7vOtlveTb5jupabSiGOlLrJ0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169643,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxSbGACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrLZg//RX/OYPZVQhrQPZV3SwZhqBKT0lALrwQ8bxwz+1aaU/eXkrSg\r\nqTCB8/UANskPKIzOG2GA4/32spMKjF91C0j9wBh4VlLHjUpjS4N7osB1cjsX\r\n5RYlFpop5Jh0cDfoQUaYC+Dx+Nu8Dk1k+6E01wvTqs4zIMBU3LtmagWfZgH+\r\nKIIZjV7N3yQ2iT8jvpUJunZxBcxSltebGXD+kagO1zpgLmefKBfs5ExVE27F\r\nWgFCZZT0p4PuBFHiRCI2Twqcs2jtKrSY9E/F61hl637Mnwp8ZcSsl70nvrmr\r\nuh9fGaMoLAGJOZeK80VvYShT4nMrEp/j7bIMcwitz+6kCC6yHyudJKc0nfza\r\nbvb1xQ0kAncn5He+XnahB6SGz9vsiCzSnOVeYE3/IrAItdl6uGHgMgcRmso9\r\ntmWmooEGCbDUSPcVGG026HXlxg1fwe9rMnKwi7hEgXGpkDJ40WgW5dGI+ibx\r\nvYktiwou5aVInTwK7aFXbrs72qOxbyRB09l+2ZWQridodpC3IFgfa0l57GjK\r\niA+pgHHa8xa9Of8+STKgvZAwRey3VH/v5AJsQE0PX1pvZqfYIDZ71vymgBUm\r\nV7nC2eSxieH3dKa758pvEyxh7+ryXEJb3wIV4POXaVQ2NK31UsySpcldap77\r\n62Cp4Np0qSJIblMV6lINcEPDOBSfyYucWlw=\r\n=59uR\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230116102744-9e5ced2.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/85e847375782902eb710937d7816afc0/graphql-hive-client-0.22.0-alpha-20230116102744-9e5ced2.tgz","_integrity":"sha512-RbaeRho8G9QJtXKNMwn2PMtOvFFOzqfapCvF+c8ZUrMtqbM6jT7syRqyXnCxqFrjdd6VHTjl8URYt1EYQJgROQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^9.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230116102744-9e5ced2_1673864902660_0.15548106185377364","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230116102939-bdfc03d":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230116102939-bdfc03d","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230116102939-bdfc03d","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"1f49dd5112edb71eade678103cb08f141a61009e","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230116102939-bdfc03d.tgz","fileCount":60,"integrity":"sha512-cSjhqlkZG6OuXXXdwpqVkJD1Na5enYZYgYC93ehnrxmpXCaThLANnKpBaX1QQnmZi2JDQEWjJliHXw7rGB0nXg==","signatures":[{"sig":"MEYCIQDs1yTQGzdr04ukFtS1wLpxMymyVe2/iIuuXhmICpBQcAIhAKhRPHpo/8oZSotx6125JPJRCwkCCY/9ACZv2ZGHIeie","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxSc7ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmps7w//XlD/d5pmwxzAYFaJo4j08q+leVKNdbV/D3sfpxwnX0H7acQS\r\n9Zu5hLC+9/dDuqeFQb7ZrSINNEbPGZirETLaOGkExcSZDCBUnK1RD8+AV7NE\r\nPQuOx0W9LGXGDf3wzOnfwre3EZwnPvIRU7jQ/4uQOG9fonlgKQvf5mwkkDd9\r\ncbmmn8TVuQdxttmTt9bUXWBTZOk7wAybxUUYClKmdhA73YR9/K9k+yUrgwVP\r\nwk6ObH1mcpIsC4BunrrNd4d3ZpVvJhb3hxiHsGSAJ9GZAM3RDuJrbG6VvvQW\r\nkK1fXq+j+ZEr5EV9VRTt0nAqFnUbNAP59kFadkHEpR2liVtkaaSvE0N2xBPM\r\nSXH4DPys7RLXDkwXWRF4BCrrfmV/psQ9u432Ag4AbIMp8zigHG7ioA66jHfe\r\nv+DPzS6oQ8+NN+OC3FSQuFkp/tawQxIz8sispJSHjXJtP8uJnenWoCfOc0D1\r\nQhZ3R3GaPiI/ill7vzsbFMkKCsJgQLHK5N7E0fNI620whMZhHR+75Gc6NmbM\r\nUXjqZnATG5Pu8XDtitbYzZ9BvlYeHf3Si2AasxLfiUMTuaEDWXkk/yyDfymd\r\nb1GV5ihqB/usaUeXMEusg36xNZ884AGznf0fp2V2WtuKkvTiZByWI7+Q13vw\r\nZ48KA/wntKS5bpYrlOob+m2CME8SMGSndTo=\r\n=TuPY\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230116102939-bdfc03d.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/56d35b595055fe5eab2bf391d5385292/graphql-hive-client-0.22.0-alpha-20230116102939-bdfc03d.tgz","_integrity":"sha512-cSjhqlkZG6OuXXXdwpqVkJD1Na5enYZYgYC93ehnrxmpXCaThLANnKpBaX1QQnmZi2JDQEWjJliHXw7rGB0nXg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230116102939-bdfc03d_1673865019441_0.3759587890031315","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230116103407-1261419":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230116103407-1261419","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230116103407-1261419","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"e65372b26aeb24e72bbdd744c5555c622800bd88","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230116103407-1261419.tgz","fileCount":60,"integrity":"sha512-0KeY/Koxaex3oF1dcxctMrFP2Io7i7K8W+6B7CHk/z6qcDVKEgTsVHDMVzZgNT/1X4/wkFc+UGV0x3giq2QCug==","signatures":[{"sig":"MEQCIB9WIUcrbnz0k36zRg8G0n9OATTx1hndtulCW64YKwjnAiAMpr+QUwYV+w2T0l6VgWWbn/LMKIZJuni6NT2YyOLzEg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxShBACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpApA/+MncnCF9B+coBytMkvPVPtJC8yHvZQtn/3mDuC7BJo3l/raQI\r\nGFxabWF1nVmDO4UZx599p7NJJ0NyptrIpk9As0ftp4stDyIVt1+sqKIA9joK\r\nGd3z5w4dayzSUYl+IKv5y+bnhf2yQgHTrqYbPYy3UEnMHyLbohNBuOPw3aGl\r\nkzt41+9C+EZ9vdZAWDqk2IzV96Gq/S8uacGrrHWY/7LcGud8tMlJ5T24p3dn\r\nrR+EQXDHuzTooz4DSgbcmjddme1/7MT00aVRPBDoO7Vwb/wH8FhnnVxVuuZO\r\niiSZ+Bea9dVYzlNVq0YZfxPiiqhP7CJqMlcPw7RPsMtHOpuPB+qexVRUSWXE\r\nmo5bYDvn229vs6IXdNohm8XZ39DweeITwRXEMVuDmwq7xYQoKtuZuC9wgGuy\r\nc9EXlI1KuzGwIMDHvI3br+eGD/KJD2mxY24S92RaK5V8bVCqqHUsfJM1dWzg\r\nex18pyzF8yvC6irReEnRx/WYsZFpAGtGxOeGrKYurzBtf96w0zij35CdWGGL\r\nTeak6oA9S6BgFxNX0RV2G9pazM8yWFxiUT5RF5BkmTzu1HkAYeHmBfbVeTt2\r\nnp7g5eANyatP1ple2MGg534161SSaLVK1G0wdimHi3qQfhURY2d9MTYSnqME\r\nN486tqkWcAI6d6KDYq2mko8t/ugdKxDTfZc=\r\n=mNge\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230116103407-1261419.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/1a83b89fbee9fa8fd03cc9076e1dcbac/graphql-hive-client-0.22.0-alpha-20230116103407-1261419.tgz","_integrity":"sha512-0KeY/Koxaex3oF1dcxctMrFP2Io7i7K8W+6B7CHk/z6qcDVKEgTsVHDMVzZgNT/1X4/wkFc+UGV0x3giq2QCug==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230116103407-1261419_1673865281358_0.5325760584533152","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230116103939-36badcd":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230116103939-36badcd","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230116103939-36badcd","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"3a18fbcf0e97947f4f517fdcd3b959fd89f3147d","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230116103939-36badcd.tgz","fileCount":60,"integrity":"sha512-i21DwIzOipsz6rWAQIR42avw8uvBM3nXUZkE3Uz4nLkgJ9O82ZBnHYgbvDmhUSgbx9DmSeGFrMySrqS9JRJmpg==","signatures":[{"sig":"MEUCIQCaqCpxGsXz1ybruJ6itoCCBPchjzDl2bWG/PGoVl1sngIgWI4kYX/jIG9RRRKMcnRuEiT/dSJROtkLFUwPNfBtaKQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxSmVACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoC1A/9FHFD6qmfvooSdQ0PzsrSN8tFK7VQvSXlcUqOTMOb+iEry+93\r\nNYF//J9L6Wr6NMIjjwRpt799l76WhST0Ytz7Y9ZB8KTLjJ3N33nhgDwm8rj5\r\njVAy17deFXIAYrTeru3RzoI04dQ3gG/NHD3y6idSeWwq/8M8Ch1Vfr8NhkbP\r\nnRKqHm0tfh2THHReaYQNN4Mer2wWN/+fSodhpdh1Kx8tcOarQoUbDbf/seNb\r\nn4dCcYZSQ9g1P0IAHEal4Fb5YKFnuCMmvtCKkNm5aEWGPs5Bo7fazAPnjvWA\r\nmdTzSjS6u22DK5fPu4l7pyIx1tkdXahosFyuoxFtQx7FE4WesheBZncMaIlb\r\nEXeniJhUgUJAEdJviKXEVmB9AsyBF9IMrYDP0tInVnEfI31807JnlrEQAbYc\r\nN2LXgxJzfkgy6Rbl5C6lzWH+NXFwaPMPFESI8rde/YdtliWbdCFcPidhjhqc\r\nyOq3pJlZQ+rAeU9Z1Crcir9AUAfgk7+irdTAEMoT04kfuJH2GUnNW08WxWAk\r\nNummQepA6rxxvPpQj4RVesaP0xBLItGV0uTPbWiuf//vH+vsWJ0GmGlXKB6E\r\nuDdUmebF9e1Nkp9IGCLApXqJurTQPszPbnjhilc0Z/faLpgQnctA95O4LG1P\r\nWgAqLmNK2T8axUI7Io/T47H8ZIQXJcsJ8yE=\r\n=vtXB\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230116103939-36badcd.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/06ff3620c0967f7ff1a736c952fba2cf/graphql-hive-client-0.22.0-alpha-20230116103939-36badcd.tgz","_integrity":"sha512-i21DwIzOipsz6rWAQIR42avw8uvBM3nXUZkE3Uz4nLkgJ9O82ZBnHYgbvDmhUSgbx9DmSeGFrMySrqS9JRJmpg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230116103939-36badcd_1673865621708_0.40329648996832335","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230116104617-2685e74":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230116104617-2685e74","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230116104617-2685e74","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"d050fe99fe1ebbea0a30add7972b14c600cd94fa","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230116104617-2685e74.tgz","fileCount":60,"integrity":"sha512-qUjTTPAIPmK814n7X/Znn9gbk6mvfHuEjcARKTCdeomLtaZMwbD59O0utPdGcKSoOrZ0LLCWBWMWZ0cKhNTWsQ==","signatures":[{"sig":"MEUCIAlKAMA9IJnkmWGkXeBia2dqpHW23SaAhxyrKfooK6D2AiEAvcvFYrbldVzBXjpUOBDJqgKBd6YkJ4QM67E79IiYlZ0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxSsdACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmqi0Q//fScgJHznbCSAM64ZISr3OEOjUrIhaZpKwVuVD7PFklRuiu2u\r\nQM9Q4eJ+SjlPlCzNhu5Qr+O54vwoz2IoUNFaYGJ6UcsjIEoGyCJYIUaSMta4\r\n8wBTh+HFeiApRBLeEb631j6/BInqSuUGwtS8xK55br2so03Cx2SRRP+cDRXC\r\nOkE6JnoTKgqQNYTnFSJ//vUnYu6NOpVooFPpivDjK7fzXVKYHoLwKaGa1kkh\r\nwcRKtB6Uf6VoasO/Vz+r1KS3A/EViZA7yyFYILjcCDKl/1iC32pOSHE4AWu7\r\nJzk2xW2xD9OdxLmMXrz6HzC+LIj8InewpUVjaXiNZ4uDYf8fIOhD6AbdCcLi\r\nlM/gLnRuUBkhS27+ODEl1LHzzfr8qnlUUNUeY9hMJN+RTcrLPj04hAwxDEpC\r\nJY5VlQpMl4Pw0G1hJnLdp4Xwl9Me2sndUHgnLaIEAbwNwxRJ0e26W+m5MdgF\r\nQNE2LmB2mi1tnnjgu+iEzEzK2+ztDiHU4dS5x3zYpqqdUWbnk5qnAYxvwI9o\r\nO02fdVWCN22aVSdRmSkYPL1OxIsWRvTfNWqo464eMr1E7HL8FdLGRk7hmiUU\r\nxQZ0CbE8h1G8cYWjNtKS4VMz1c3ZDASjpbZ03wSzGnHHM9fcFQSAqV4pLey4\r\nXx1vFo7YIbYgv7tEIWoanc5akDNLvSg3mfg=\r\n=Tz6W\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230116104617-2685e74.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/559d6c515ed1e932242bd44ffd72168a/graphql-hive-client-0.22.0-alpha-20230116104617-2685e74.tgz","_integrity":"sha512-qUjTTPAIPmK814n7X/Znn9gbk6mvfHuEjcARKTCdeomLtaZMwbD59O0utPdGcKSoOrZ0LLCWBWMWZ0cKhNTWsQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230116104617-2685e74_1673866013106_0.012705176266807339","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230116104933-0e60407":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230116104933-0e60407","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230116104933-0e60407","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"790407369885845de3025763b7bb91d948a8ac81","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230116104933-0e60407.tgz","fileCount":60,"integrity":"sha512-EWF5bGBK8tuZJ6tN5a6vsu2xoYY8FFM1/Q0PncfxfcBSbVst6gCg47V4rHzDdI3IyCJdWYmh4vwaQNUwnHYbkA==","signatures":[{"sig":"MEYCIQDJ74mw/adFrIjNHyhZ/MwzLIZaC10JepLnVEY45wkO9gIhAIaA4cSRWBcbLnHc42NfzxAFxnxuVSW+drwN8IQ7xo5B","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxSvlACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpW+w/9GchLI2uxkNb6HpB7Y1+IVKAN11JsxYrRsqnnUuGXGOnBIhtb\r\nB25dYzLEYmp+mRjDdEkz0E6nZMuVLnJ/mxCPMhMPME4wONTMM/vpbpDJwqA+\r\nBli2rAbc1yrqj4n8ACryPR6KYh1WxT8SNJ3eab4w4E9h77dS8pPev89saXDv\r\nrEsRBJFbWZENpxLZDuQ4Qdc21nyACP/PE87PeX9YK1zIKT44QUMDnpmGTGmL\r\n02HYPaxdZHBc0a8sf7/dcUIjzuelH8kEHrP3EUKWPbGewAIJYaLJo0AEa962\r\nxXzmMSo5Ie5ZVzMDpTgOnIVy0hO4ufa+0MirGf3ZZqJ0IrXsKIbS0cvaphr7\r\nIhPxfm3O76oDMn4QJIMIRLuChMhjaZsaCF0cHLVwgwLEC84YYgtFnYibY6yd\r\nFkCgRfX9lWcnEVVYL++gc0dMX+12FiFOvi7xo9Bog5TXGop/D1pxGNpS1XlO\r\nPJqmAnAHeMZLIoVZbLg4pJPey0KFoWFV2+FvU94xF2LFi6ArkksEMPB0VNij\r\nxyG4LHHa1X6YIdDhkGFaHdb645k/xpnbNNF7o25AnAud21SsyeTg1r9BWFWL\r\nafoOzzSxM7Qaga8B0ToTDCU352Y8kW3otlbf/aEva791v7EjM6lqdZIxSSw9\r\ngfMWogmuI3Lzx7W87ZBWrM9RT2Op2kePS6g=\r\n=IX2B\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230116104933-0e60407.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/c50225ad947e2d8f38b40d54c17299b9/graphql-hive-client-0.22.0-alpha-20230116104933-0e60407.tgz","_integrity":"sha512-EWF5bGBK8tuZJ6tN5a6vsu2xoYY8FFM1/Q0PncfxfcBSbVst6gCg47V4rHzDdI3IyCJdWYmh4vwaQNUwnHYbkA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230116104933-0e60407_1673866213563_0.15201317088758737","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230116105230-104cc67":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230116105230-104cc67","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230116105230-104cc67","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"e9c3df9b82960cdd1e529a5d90c81a1609089551","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230116105230-104cc67.tgz","fileCount":60,"integrity":"sha512-oQd7H+kTiYQ4GnQT3eepWkZbFvXsSV4u3LEuaa78zK7idiAJVDU8sU09hjyaSXbpZ3vQw7FqYmogAY9J9FyFrw==","signatures":[{"sig":"MEQCIBDafJqFIV1ItecMXRvSu80wrPxdwHy23WPgY3WHru2OAiBnF7SBepn8jQdmZPuzxqoyGaefr9w85tK3usRkvUxC0w==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxSySACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmqm0Q/+Ni/occPnN8WxF2zFfqhi/T/ouJ0yv7RKljE9olAjp8r3Nuci\r\nyRaW4RxhsjYe6Xyaxv6fOb/MbfrUhr1ljtiPSEl5HuCVcPSYl4WqOQFmpOd2\r\nSLcQ0K+M4pxB7uwMAw7ESKuOyrfjQlR5IWYPwYbZzwmgzXXJ5B21caDROmDK\r\nnLRHO0MiQh9HsuS0nCCNlSkSY/w2r66pyJHEJKih+tmNgAIcZT5my8q8lz6c\r\nuU1SWgcgfQkQ7QGqQRWH3JR+NQD++0wfe1543DrBXEPUoaNNqZpJZKLpqaUK\r\nLwHiGs1/TPSDVX6UiN5UE90u+AX8B0BuSxldh0tnop5qN6BHuJ0D67iuTqT4\r\nqPXcnnCgUkOtxwtkVjPk8sFmqHVv5D3dhguAt5jt1bkG/SPB4kyTsoYlbyNv\r\nFAkNzyFePD4/urTWlnBgjVtSQrmwE6Wn5H2TCyfmPwLzj/JLoQsk49NvBPp7\r\nrUzUbXw4VZkpGcUFn9BVMFAR1g50dVtib1zM44npYJfxBRGBabXAOT85rjEb\r\nea4QB3bGVYf6yJ6ogwwWzrYD4plg6UgW1cPAi3VSZCgCMi6WfC+y86RuDQj3\r\nddmSZeivnQ1JmcUq0eAVtUXgXR3fFhvbNVCAkTxB15rx5x7JsNogNLs3VyHh\r\npNWs2jIAzyLWgeWBSqkPofe5mbM8U+dcA14=\r\n=Pm40\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230116105230-104cc67.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/567aaac13e439402017d025b33499264/graphql-hive-client-0.22.0-alpha-20230116105230-104cc67.tgz","_integrity":"sha512-oQd7H+kTiYQ4GnQT3eepWkZbFvXsSV4u3LEuaa78zK7idiAJVDU8sU09hjyaSXbpZ3vQw7FqYmogAY9J9FyFrw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230116105230-104cc67_1673866386621_0.24982010378656327","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230116105413-8dfa03d":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230116105413-8dfa03d","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230116105413-8dfa03d","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"8574cb639de4aa673cac08e89c556f441b7fdaa9","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230116105413-8dfa03d.tgz","fileCount":60,"integrity":"sha512-BZ2XNy/Ub0y1kAqgKWM6q7UqOhKfLtz+EIkXKUIGtlDQsU70v4nzYqc/KSM1TyjHBdekNOdeUsHhOdglne7ZtA==","signatures":[{"sig":"MEUCIGYrN+8sl7231raJNUORhx8BGS1fCpBZjtzPaTYjecmVAiEAuuqNsiHPqXXg50qb78eMMkiGk4rm82QCPoe9JyIvBBU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxSz4ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrU0g//TjXLZakkLmphGaO9GzIYaAx74ANTAhbCNS3zDjKGwXVGN0J8\r\nfmabuvFNAZXAOp/yueM+lz41+wC+BXoMHX5znZT9NWX0dKMpMteTv1D0tVSp\r\nRur5eJBGiB7e8mX4mqKy7LY+UNoAUgDKGrcZ/AC5rIlRf7AGYz0t7wKTpeAi\r\nBJfQuFuF1d3rgcrQFjB8H4YU4sSr7k5MDWmwfdq50gna727Sg+/8gznTPpn+\r\nF57gdtoRk9TkC0c0dpnJXzX1BgezU4FxpU39nfPxMyXh7GN7dKV9GgxeSHx4\r\nO0u4IcgBqO9Df413PJtFW0is6NXCxFO+vPfDLigLjJyHOSXrJDd1IBojmU9i\r\n7/lWPzg4KWf6U7xRGvwriYZCQWkswukKSU1511IDIIy4939Fx/JdE+2FjHfK\r\nak2O8rXniymO04em7yITP31bOLuBshqIOPFbzhPGC74W/DpBZUfPIWgzXa3e\r\n2j+eeYp69xTwj8XU5oITjGUjGX97b7WLJiEIW4fVDv+o/xhaUNmOuPyea2vg\r\nkTU7cAecVucb7ukhffG42sm2DrURhNgcsC+WFfG1WvnMIetJN47q2XvdGa+b\r\nfda1eD0ZoGbgZwIgtKaRbB5q86M2t0mrf7J2Yiy2h6mQNqXi1SCqm48OEjWV\r\noy02LvBRbMCzeuslIi0qB+Go4OgLvpdtaeQ=\r\n=bWqE\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230116105413-8dfa03d.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/aa4437d3e39ecfd3e6a83458a776cfdf/graphql-hive-client-0.22.0-alpha-20230116105413-8dfa03d.tgz","_integrity":"sha512-BZ2XNy/Ub0y1kAqgKWM6q7UqOhKfLtz+EIkXKUIGtlDQsU70v4nzYqc/KSM1TyjHBdekNOdeUsHhOdglne7ZtA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230116105413-8dfa03d_1673866488277_0.09316590016644777","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230116105729-2343a81":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230116105729-2343a81","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230116105729-2343a81","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"ed5c57f75a92b5468a2b8e0d5fe179494f385a2a","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230116105729-2343a81.tgz","fileCount":60,"integrity":"sha512-i9c0WPM1EESdjVkBlBoSTT5GBKm5NKY8TRl8XOtTNasZJ9LUzz1Zah+1iN9uJSiW7Zzkhz2f4IV4bCfDWcl1zw==","signatures":[{"sig":"MEQCIC6luYoccsFcEQ00+IEZXvo3eVG0/jrcSrM1D8bFlVTRAiAP2n65IZC0ndlCyC/JazT6ByJINl6ISDM0MUcyU1Cz5w==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxS2+ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmqu0w//e/SK4IW5x926BrgJjP4Jv4OrxAEFvklVOU+ojmi983oO2lGe\r\ncspesVQZy9j4mqgmRcc1k7Ir7+Gyqr94gtVPJysxTWPs68uF37FhAFUlb5aH\r\nmhKgdaFI8bkyFEogEnZStndk81xp7sh2NBJAC9m5MTCTmgFN8AWhKSqDDoXh\r\nvY3UjNeufqw2cs4AlEJNIIXKjwjDLdG1AH22HAm3j14HXRZmm/3ScXLd4BX2\r\nN72QvYhPx9CCDdcmQb0QkFlDvcMRhudZqEJPsmgghwTLFhxvMpOdNXWhvJOW\r\n8jL77k9bg8zjrEIjJx3w6ZCjjN8g1eEbn4vcUsgDgbcD3tj5FyTtEK2P6Ni+\r\nKysU7q9yLKwHpaBCd5iS9PwhMOxlMsdUPhiz/gQPTWQgz2Rswap17s74vo/H\r\nlp/ZagCyeYiIQm2NAvmeqLQ2JggZhu0JizhgncTVerCntLevZHZna1nK4+pq\r\nChH7bM6Uy0ExFWrUlbgliBxx7Y6hp90TxseQ1XptYUi87MisUWx/OK/P+j1n\r\ntLbIrPPUmurI7VLT7yxkh2VuWurL/tX0htTLVi9eMWa0oUuq0XQPz13pwdxu\r\nLeVONucB/OWbrFJBoSraZUn3cbeuOwgC5qpzZthIvcvdtpwgBDSObRH4AKUS\r\nIlHkOF6GHQogCYncwO72s1/gmyF/ihUJ+Lk=\r\n=C2fG\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230116105729-2343a81.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/1269875379903555f8eda5aeb7d8ae9a/graphql-hive-client-0.22.0-alpha-20230116105729-2343a81.tgz","_integrity":"sha512-i9c0WPM1EESdjVkBlBoSTT5GBKm5NKY8TRl8XOtTNasZJ9LUzz1Zah+1iN9uJSiW7Zzkhz2f4IV4bCfDWcl1zw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230116105729-2343a81_1673866686759_0.4326473904001673","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230116110031-7a293a0":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230116110031-7a293a0","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230116110031-7a293a0","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"ba59b97d9709e9bad41a7134348c0fa487e15de4","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230116110031-7a293a0.tgz","fileCount":60,"integrity":"sha512-cdwAfUZ1SPsE5AKu28MNi2G9SqVX6o9v/Kt9k47QyNkrrOPDOzYMuOfwZqLvz6oGA6cuIQO0oMqAjgWmltsuXQ==","signatures":[{"sig":"MEUCIBawCkVECScOzmlxqVU+I3UwNMMXYPiVdJxnEFHagWg8AiEA2/6hFDEDNpd1wYaTHk4DkURSUcyYAsldLfP7HH9tQnk=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxS5yACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqpGA/6AzV0gIK3zgaxkvks25QMmW8WePI1/MeaBowkskTdkIFu8nd+\r\nUHoQxrCQ2CApUHDyODGeX2xrbjg+2yKIbil0jxNO8/vJ5APyIFFKM25YWI9S\r\nmJLvsCnJvEvFfgsOAqB6w5FGm6ot+W7pfUSyzKXUkvTebVdsd7FgGv/QLxr7\r\nhwGUlQD/cviiQ3h1DKji9p8hJi0DMgyNeFkmFjsj5XTCwiW8BEDWB2xJq4L1\r\nSHvr4hcV4bkYdo9F+uSCrYr9NtmXnUS4ZPeFvotaL8TTyZUjJXskV2m6gS4+\r\nSg4Nr3pToATHXGjk7jcrFNeQ3WvK7Ag22Vw4VaUyo0YYy2Qm4693AJnWlqHS\r\ncDPfEgrqW0R9/LXanQ3oPnxq1kGFKCs6AmPEEeL9l8OhK4pZN0IWIDqLIl1T\r\nmzLZ4MwYxtghGpICFTqIhcc2R2+a5Sy0Jk23F0T7WwWohb2plNDQtpgya+Me\r\naoeDnUUtPdKdwiuKz5EtlPtJBb48SevA/QYbFos5bUMk/lE8TjmoFYViLLtC\r\nsoVKhXMPjKyoKT0uhnLe237G6u8jm7PK0LaxpfLZ7QvaQ+5YB7x2zaN+XuS1\r\n7lxJ4Dnn7Pt6V2Bz5MHA/dfslm7oDZIFYfMLHCE7wLW4O4yKIFR/0soB5g2s\r\n7lC6M6doFQWmX9TWLwR4k6dUp/rXhFJf5J8=\r\n=CdUM\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230116110031-7a293a0.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/a3d642a1f290361dc8bb6948ac66f5be/graphql-hive-client-0.22.0-alpha-20230116110031-7a293a0.tgz","_integrity":"sha512-cdwAfUZ1SPsE5AKu28MNi2G9SqVX6o9v/Kt9k47QyNkrrOPDOzYMuOfwZqLvz6oGA6cuIQO0oMqAjgWmltsuXQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230116110031-7a293a0_1673866866159_0.01734248345059619","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230116110454-d54252f":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230116110454-d54252f","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230116110454-d54252f","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"c3a754cca5a568bd08a7332abf1747a463858083","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230116110454-d54252f.tgz","fileCount":60,"integrity":"sha512-7GUXEQZyg9I3/O/yXHod6HNlJK3nszU2zi0YQgN3cDsdSPzditSDKuAkzIMLmUFUBPpQYuEb6Pu3bVm+44WnZg==","signatures":[{"sig":"MEYCIQCNy5ciy9cWo23u/nT1mxcn9akfhkwm4PsUQDwqi2dHMgIhAPdEkHd2xw9ZPk1PmoT75eOZL36hC+xmO10ol1EPLflh","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxS99ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrEhw/+Io8FzeemFQdtUlBAYOyyzQqpnVdiBNeJI1SE4aQhAM4r5oIu\r\nyl2WI5drqvWKbJSDGovAfuTXCWY/4jBztHyYvVF/t70jtjT9y9pkSbmZzEbw\r\n4X5MF7wKjEUSBqBdfuxN/t3PlvZlbetjJXFJMsYy3Tywd9H0MWd5zXtv/02y\r\nrv/3fcNrsjVe1c0t5b+bq/v7iapSFVIYgyeZ1IADiPYrMbd0RUUJZqmDPWPZ\r\n8ZSRysRUKuBDmyt0CwpOuazwRrzYLtVbAcLSq+buZekBdYIK4T0/ndPMViLl\r\nOt9IRDVaxt9yQ6YiKv7VDQSBfp7X9wz/J22ERCliESupyQAO6bxrLLJI4v6V\r\nJd8TCpBTKrNf2QNiR1sCN8pjZ8zjgs7icIi+DzKDFI2sb6W9EijrS+0qsrCr\r\nRFlW0XoXpNsyUHBUYwAxVEk8CZ5egMIQIYZfQvwzoXrJy/qyWTEpPWHmEAZo\r\nrMrGmItEphaTXBYpmVXfvGKdH0sd5mof3ZQLlaAd/ND+oDn7ddKUg0S0douH\r\n+jrTkyo+D3QO9eLz3gFcKlEKwgKYfLCwxsBCumi3EZZPeDdpAvcQdX4uGcQE\r\nzOpK7ycr7bzf16wUuPS1fOoprMNrOR0WER8FBmrzIIpaEiPw+XLHrGZyLMXL\r\nS4R0ki9m6+Eaj+lPS8ypuKjO9GrrMp+TKDM=\r\n=7Xoe\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230116110454-d54252f.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/1291a837e716a12f7c3a5cbe44ed84ff/graphql-hive-client-0.22.0-alpha-20230116110454-d54252f.tgz","_integrity":"sha512-7GUXEQZyg9I3/O/yXHod6HNlJK3nszU2zi0YQgN3cDsdSPzditSDKuAkzIMLmUFUBPpQYuEb6Pu3bVm+44WnZg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230116110454-d54252f_1673867132825_0.01634392390443029","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230116111924-2c50571":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230116111924-2c50571","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230116111924-2c50571","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"cfba835a36e7a227faf3b5b59315a65e9f0b411e","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230116111924-2c50571.tgz","fileCount":60,"integrity":"sha512-5Ra2YgYMGcJR5H3UcAFAgR++Vw/yQskCEXDYQu0MTxUaZttLXMt8d+5wsEa6ugcTl9KeUkO5Mns3SjeUME9vGQ==","signatures":[{"sig":"MEUCIFycQtRcyzAmKnGuGpprhMqHyu/twLKrc66Wtk8RyXrYAiEAzyy32bhGWEMZNY2SIseD0WpkKHMkD4dQr6XJgyw5qu8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxTLfACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo+1w/+IxIf4duCJP6UajV74ULXde939i2MxEOtAqB22Hn6PZmhG2QX\r\nrDNvi2n0JFp+/uLQySF7zhJ8Bkgclo62FGAoo4b7V+8ZNHcN8SXhFoLMFeUw\r\neGu7s1uKO2RMXa3O4t/f1Bw1Ye9gz+k53vvqYkDNVLiHYhYdVXHijVXLrenw\r\nIEm3SUZNQ1Jy8Q7h4reDpFJCQrwI75uDwcLkU7roG2MHNujMjxSC+V+yrx5d\r\nzAkIF3D2gQ/82KmqF+jw0jyFDtIJH3knnweYrBzOHWDjU1ob+0mSuKfeyiMT\r\nPyguM3TBa0jj/8Izkeswlf/5qTgPkM7xXMWjndQ9Nif8XyawXEB0OgCpO1FD\r\n6ZYA4WTBEsbQ1WrRUcJgxeXQ33apDn7pJ6LpqplzulAqR9PUgJ43ERcXgtak\r\nhFMD9KVvzQoLPwzApQCG2h8fQGcojh6dvOeFgkoMiQvNc/2eSLCJSmL3CqQp\r\nFDTrLvvZwrc+QUz9Mk/RilLV8/7/qJAaO74Wa4ysu5Zr44ahLd9+olXh5rlE\r\nVbJNCJlHyc9kRueyMSmeJc212nBI1TGk6b2gP3fuVBikLR4QqDH3SJJIz7VG\r\nT+Hd+aXGHNWJjD0SDIZ3ZOo5lJ+5GDeWGyBElmlPxJyV8GRY+MfGatTDBith\r\nmtxN4jV9ztxqwdlS1FUHW41WdoVhrFJNa2w=\r\n=A8q7\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230116111924-2c50571.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/ac2d5b817413e24b870e4cdae714234d/graphql-hive-client-0.22.0-alpha-20230116111924-2c50571.tgz","_integrity":"sha512-5Ra2YgYMGcJR5H3UcAFAgR++Vw/yQskCEXDYQu0MTxUaZttLXMt8d+5wsEa6ugcTl9KeUkO5Mns3SjeUME9vGQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230116111924-2c50571_1673867998806_0.3253350780858535","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230116112401-c2370b7":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230116112401-c2370b7","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230116112401-c2370b7","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"5281ebbf941fb1d7e1e55871b4fbbb0352ab6317","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230116112401-c2370b7.tgz","fileCount":60,"integrity":"sha512-4lWocwHCvM5rx4pA+EH2IwS0ubLAuHwpnPBe1lI7U5t9+miuxTpUdE+eLyehJLDCp/8FSFnOw1vkFZF8Y6ht3Q==","signatures":[{"sig":"MEUCIQCyayKC2Ni3Lyk9D+NiHYn5ALkzzggryAQVdVSqbgs+ZwIgJWbjy1wLHYlOjWSUMXlUqo8uAUEPY3511eo+6gg4GpA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxTP0ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrrHA//dbtoX5WuAGu6hDh7waDIZccH2/hCRUN7QhNma2QWeRpO6sj/\r\nWr+YHESORzHwScTP0fxVWIbMZPs5cPM9NtIzJee3Cjw+AtfKLtsWhB13gttT\r\ncpuOkAtEc30/C6qm+GmsjtvrH+Jln5x4bfmGWp9jmqIRS5qmqxFS6DAyT3y9\r\nTt9xHxvBqF80hVdKDBtvaEuWQZ05GIKFa8z/giL738FhKdXRsHQeFxqFAQd1\r\npgC5EViyQvYsnm0CcnEStPm5/coV3mhw9/BxhJPiLkPAnga8LSQ3OpElXR5x\r\n75wlnrupS4kT+/jAxXALAn4MWk78kqG9tqg2LeJHtwWgHMjoHsTOi3FGITph\r\nrCJpjDAJJoJh91JVE+c8csfrkjedmrIB3Hbb6lXylBj7lnVrlF0HGEEqnIdQ\r\nGuM/wW18QoaQuWRGcA5SZCgHif8s60N3N/pKx4uB6GV9jUOAU0OqUbs7bhgQ\r\njhBtHQlMR4G0iRUv8b0+6GfbMca2r2BchdoLt81zsLDBv/9v9wcyrIo44chR\r\n7xEv76F0s5bk0iDCLScC5PHQciXtVATThXes90onmY2BBO3Jj9ftnNHd9/gK\r\nQMQQIpfRi3DKK0lC7QXt7odQw3t9HdBTnpd1DInpW5ZlOi2CLIfYz+WNUY/2\r\nOQQCzoRT8FfMmnzqgd+PnOAHBygWg2LLs+M=\r\n=p8u6\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230116112401-c2370b7.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/dce93099403722a83cef0cde94b80d5c/graphql-hive-client-0.22.0-alpha-20230116112401-c2370b7.tgz","_integrity":"sha512-4lWocwHCvM5rx4pA+EH2IwS0ubLAuHwpnPBe1lI7U5t9+miuxTpUdE+eLyehJLDCp/8FSFnOw1vkFZF8Y6ht3Q==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230116112401-c2370b7_1673868276132_0.37906643758852354","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230116113335-a82cfed":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230116113335-a82cfed","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230116113335-a82cfed","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"191919cb19f638c94fb44a9ed2d7868da210de49","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230116113335-a82cfed.tgz","fileCount":60,"integrity":"sha512-t9yCoLVpBoDbz2fzWsEyNBJfmOjk9g1sKbFquEKh5TYvzXogXsthqQRlbzgWUPrRqlKzwZQUDfJOpAhTASBfGg==","signatures":[{"sig":"MEYCIQCcHc0F0fUoNgF5KARQJbi0zHUIy5V3r/opZfAaeiHv7gIhAOgPJLjqrf3fVXEwl3sFI7FyT/U+Q6UhfCrRoVcbvVl6","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxTYzACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqV9A//cGcrqVoD5ixSmCLaB+WqcLPfbK0YnCFYvcBPZjniT26xBQOB\r\neElt03wmPuHjxoXWaVlRG3xMgJfhKedPMMawVrI7j7f2mf5gf/i4Vj+q9sw1\r\nzRM/a2aBecSvqolTrWQ4ZTmXZyf5/HplxkKjPJsUQi7w8obXqwtsZu2/Vven\r\n4hx/7B2C9aNl+kzDAyKzfyTfepZU3FJBAzEmXUIzcH9WpV3qbj9QpBzpMyDJ\r\nozyNcDMVhge1ji6D8hUUVu6VRUKY8cJZrZo1CHqPJW8nA61UnO+6i2IANLpy\r\nRcUwqJ5neQsnwEUSs2AA8nXkPgIBQ1y/1Uu9HhrMA+VceNpqiFsI5nH0YBd3\r\nVwG5BXMYOTL2vtDnK2cAADzkEjfQGVdia8eQ4Y+fWNbWsS3ZLQAO+FSwIeCN\r\naejXG7oWpFJzKvKlkRqGMvZcKsYlCt1NIQbjdjacIY+aV81I9QtLNlU+IYSc\r\nNE4Xe3axvx7INMl40d1gEXfqONgEYvrLmo+UG2aQ9WLNmGBEFrysoTAakABS\r\nvxAcNsQAmzDAZnffuBh2JH3ZA2MpJCfuD8X4zYcjWNrR8S0AIJEaFbR8mc+k\r\nJgwoGX0FfJKGlqLlLVTW6h9ovFYc9wfNLcEHF1Oou4dGwZTj86/H1rmtPpU8\r\nZ+JbuMYY5UA28qyNH2DOkWw9AxITLTJbjQ4=\r\n=Suo6\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230116113335-a82cfed.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/4477434a05cfc5d6f70579916fb0e19b/graphql-hive-client-0.22.0-alpha-20230116113335-a82cfed.tgz","_integrity":"sha512-t9yCoLVpBoDbz2fzWsEyNBJfmOjk9g1sKbFquEKh5TYvzXogXsthqQRlbzgWUPrRqlKzwZQUDfJOpAhTASBfGg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230116113335-a82cfed_1673868851133_0.11409325139605286","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230116113939-7ac8a6a":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230116113939-7ac8a6a","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230116113939-7ac8a6a","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"3726186c683a21aeb3be7295ea0f8e649cce79e6","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230116113939-7ac8a6a.tgz","fileCount":60,"integrity":"sha512-noQL6jAITIuhgtkE/yN5xl/es8rXyePlNmfCC7x30aAvfF/TZvBAUGzXzXS6LQd20kzvzauX+MfVXzWy1jfEHA==","signatures":[{"sig":"MEYCIQCXhKBGPXnlkzVIMa0vUCzQ+tpq37fPxmQfmFs9bywI8gIhAPwficFhhOWe8TUOwXWpZIO8l2PLeAH9/lVK7t2w37Am","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxTefACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmq+Pg/6AjUv4RqEKtLw6NIla7esCG4kp87z8hgZDT430yuxD4uXKTFY\r\nK2OqQZxotDuditrgdjmXdYUstPuJEc11XpcN2eYjzgEaDsAp/1BIP56DhRSZ\r\nprpSHkQrmfKTCSjcXiT2zhJoqPokDEQwuapvPm8P3idM9V7HNO1GPeTZWSN6\r\nvoqDBzSt/6RKugSgR3FRAk4i3yRQAxObBCjhBKKBlo6qBBLJ8dv5Fr1++9jq\r\nS9DMiXSouDec2KkH6Zw/lnZ6cJ7Qw7DTRce3Z4SEcytkM9Pu/cUIR8VGCm3Y\r\ng72IZw7IciUGbH/plv+p3IIJL7nFFnhBy9RrE1grAfO3D/SQygKaPSzuDHHk\r\nJl0bhdXesLwZjuX6ye9qyJ2i1lUvM+bn4Yzf6f4j+/oSciuUf7SFNHB5ZcOY\r\nsn9CrgvbKEcmPD3eqid337peeplgPfrUNfkucx6lqRUHbOJLSmGug+2heK0r\r\nUPO18Fh6pRDmhMBSc9J/p4RYL5A1KB1jFOz+dsVymgDyORmlGYRzfg1BS4AB\r\nhGX4KfgF/qMqKaZBTRej8lPxHxBFW+3DnQSfAKY23mQj/+mEw3DesAPvA6fF\r\nUpj1Kf5eyw1yIi0ZcHi3J7/OAoVp5pDI14jnKhj58ZQrZ4nbQEwrUXR22xoz\r\nz7yICiRpRybi8SGwc33w7SQe1kZXHlidwvo=\r\n=+u8U\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230116113939-7ac8a6a.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/44f95c4a785771845e2839952c6d63d9/graphql-hive-client-0.22.0-alpha-20230116113939-7ac8a6a.tgz","_integrity":"sha512-noQL6jAITIuhgtkE/yN5xl/es8rXyePlNmfCC7x30aAvfF/TZvBAUGzXzXS6LQd20kzvzauX+MfVXzWy1jfEHA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230116113939-7ac8a6a_1673869215290_0.11167882059135081","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230116114437-40c5be4":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230116114437-40c5be4","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230116114437-40c5be4","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"3c54515cebcc9b884d5b3be5dac45bf9dd90e7ed","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230116114437-40c5be4.tgz","fileCount":60,"integrity":"sha512-e2CP9sARcvYDZnjvnqW9ml/C8yTtgvvIjpW8qu5tWxvLB1bYFjvKK0NjUHqTpSDH63YxkndhwSOjuuKuunAuEA==","signatures":[{"sig":"MEUCIQCUO5potHojtAuGkYW0IMlQWposxvO/YGJYUXm1HaZFqwIgQNkT7f5z1iijVf9b9+uUX2EXziSDs3TQC/yRFYIVJQw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxTjLACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoHVA//RNtMn+6fSmb47EJrV301kr+/O3t8ObDRxR64uPFSc8TKQ68S\r\noB6mXtaQgrBcirv93P0EVPmRlNWjxz/GAhTf+JG83vNHTiIbz7dCtpdmGbhv\r\nDxuJW1Gelzl6h6C6JTD//5aDz3sLMKYvGq45Fpghg1N7fVX1FjJB5vj56fo0\r\ntQPT3oRIMgqSPkTkcmDUj8q0oF2HxrfsGtggyVHAGpgWYq3NZmk/pKX/QTfu\r\nowV/Yx2+eHo5gHpr2Iz+0lRM3XgrVK0q1KO1SedTSCTDczsXDvP9kpa0pyMb\r\nuUHl2RlipRIOFHKt4HcnnOW+GpWO2yXWBTtrYUH5f3WxrNNeDFvsO+oeGvZz\r\nAJBvqzfnsPaRTgckDAzyi0n/lzZhC5MfUA0t0JrXMVL1En2kRO6T79l0pkZt\r\nP6suwpwZUzifBLlOwtE72hVOF+LC+OPfnpSpeWDyYXHL8YOoO1JzoDbhPQAP\r\nkG4m/Is6nMUz5X7jhVoGieNoww0FxDQXc7iHJwJh1+XPSQMu8XwDOJzxgqDd\r\nFCZliLp3Sc4pzYS4WS8M08fBq089uBeUlqQ0BphsiizfrRb0S+R5r3bRnWme\r\nHfMenVrXM/VB2YYQquGdSqhLws5I0h9bP49CckP4b0WUyvf8UNogSOELK34m\r\nbu5DbRZHuE2qpo+Noiww5DkCw3pn5YGwbUU=\r\n=nlSM\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230116114437-40c5be4.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/27732870505e949a497b792c1f1848f8/graphql-hive-client-0.22.0-alpha-20230116114437-40c5be4.tgz","_integrity":"sha512-e2CP9sARcvYDZnjvnqW9ml/C8yTtgvvIjpW8qu5tWxvLB1bYFjvKK0NjUHqTpSDH63YxkndhwSOjuuKuunAuEA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230116114437-40c5be4_1673869515688_0.38882136021365454","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230116114932-fa529b6":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230116114932-fa529b6","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230116114932-fa529b6","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"52abf8ac904f12986ea999e7abf59bfeee7be76d","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230116114932-fa529b6.tgz","fileCount":60,"integrity":"sha512-lU8EsO2YxMhzz9rOHbOeGhYT3QVpgkT4Ab6Lsc7cbb/ZIjezHD7wI32EfRO12KVZEkS/s7VHfkbgZwogc1pMcw==","signatures":[{"sig":"MEYCIQD7xiEB3enoXi/3G5bAySKDhYTNuD1H9nBnjTVoLr7OqAIhALM9JhyFFRcKfhpCOEyRuuRp1y6Qnx1Istq0QEAWIs08","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169643,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxTnzACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqWrhAAlp3q+rngV8y8gg/YdV8Ocu/gVsbsW0dHj6j0QL6dxDFsFr+y\r\nePJo7PPu0BO7cA1QWJYcnKufw4diSqMoQwHPKvd1Wgqgqgi/Zv2Hw790yE38\r\nWbLHcbPFCuUEL+LVx7VRRu0R0ga/ufImemNtYKtFEmp9p5vzBrm1MdIpM9Bc\r\ntjMEIps5ycr3FtoG6iiJeMMZjC3HjVsj12uvAzEvxmnv+m5BIq/Sb8hsoeGW\r\nhytuxbAfMvn8sYRH9Pxqf9dkxJdp9rm0gB2Z0ael8/nE0gIJ4nV2eIPzu1ss\r\n9e3HiIGdL6naUaTGPhL5HNwxDHhz/0tyBCS+TZ7F/nzV6Q3GM4YReJhirKHV\r\nm7WWppz84ULhhIXHQaCxcRr6PF3NuMS4zf6KIERZcA5oldJToRXHxsRc7Mx7\r\ngzIPvDDAueJkqDdLJvMM8E7r5EVRexqs8Uk2fXBGL0urY90NP4fBITIxct1p\r\n3kbKB9+PnmQg30jfOsSSCnoWH+xKY9/Ve7DjZAdFTuHxLkU0Ck2GrFsg+Tpi\r\nW6myPLFlFUHVxeBQ7qzCjjarCvGnkrX+yOBP/q8p6O5DnsBMX3DMCFrJvzap\r\n2Nid6iwjkWu1+eYxtvRo+xh/IiRgzrDA5p0+00X8IPOnWU41OrvZZx/Vvd4n\r\nPWyIdWvu9zS+RPN/fnmqt1tqr6240+ittNw=\r\n=JeRH\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230116114932-fa529b6.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/5cf24f0fd95a60394fafab41e8a542b0/graphql-hive-client-0.22.0-alpha-20230116114932-fa529b6.tgz","_integrity":"sha512-lU8EsO2YxMhzz9rOHbOeGhYT3QVpgkT4Ab6Lsc7cbb/ZIjezHD7wI32EfRO12KVZEkS/s7VHfkbgZwogc1pMcw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^9.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230116114932-fa529b6_1673869811361_0.8356700112926179","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230116120539-d319aef":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230116120539-d319aef","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230116120539-d319aef","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"c67ecd0d0c33ff0998beed89b0da4f7a07394bbc","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230116120539-d319aef.tgz","fileCount":60,"integrity":"sha512-sOGtT5hwodsquC9Of44Nh6kvwShw8JSyUSVjFI7I85Ry1OavThUFreTtZyi/0X0LRzYDsa9Ly+rkGRv7n8bMPQ==","signatures":[{"sig":"MEUCIBir6lrp9yLshIzbUMuOdP0+Ko36M/E5SEiuPYpLhYMAAiEA8XijLULlBNSikj76Nx5Tmp6y/rLZmkx00WmHvp9i8JU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxT21ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpF1g//biFp36uRpl3z7flRTmkrqRzZepc9PoKsSV3LVmiumznxAGQS\r\nySq18AVdr6LJLdfBWxMOcdK3PLjLU6wYSlBhXNPhAaN+QHGQKCNUDsP8MmMc\r\nd9ed26GfuBMRGejaPuXqzw24EmLfAcznmc3whvLupuyP1TqEuhhDzgswKMwE\r\nOJOrpvwlhiTv6vwbXH9jgtQsCM3dlQvXc3W5eA7xMIxqvuIqEjFq8mzXsCWp\r\n17Be96vIZy8dNIE5furN3xtO9T1mkunyrFnXH4FHFvgCwgoUCYFJlmAtYGl0\r\nOAqaLA9ZKHmH1/paAi50Oy4fpiMjv23YwnBR6kHf6jeUITBwSRgtyVP74CRM\r\nvKEzIk35MK+kWMs7kBOwBHsT5LazTiUHHfG/coUZPcaSI2w1jkiUKlOWPqM9\r\njrd+FcLWgoTCo5+UssQ3c2uGJRzsld2jijhXQuDN01MVU+kFpa78mcGS6kn/\r\n89ZzD37eQoVjLbSqOnvN+BAUEWCvNm7+7WwiDwnqWnHt5yWOvA5OgXWSCvUX\r\naHcpouxLYQuP8+gFnVP4re/fUiUC9jKknSAJZlGtq1y0fgEHs2vXjksQmA4F\r\nXuOfufLaXWko9X+xii6Cb53dNJfbZlUZyqfAFuadM60NyOAiQCiZtIzpjOAI\r\nDlJVr3nSflJHYr8F96dXNZTfgaQVJpv38o4=\r\n=2CJN\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230116120539-d319aef.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/40ffb078c798688fd2ed29130d261b9f/graphql-hive-client-0.22.0-alpha-20230116120539-d319aef.tgz","_integrity":"sha512-sOGtT5hwodsquC9Of44Nh6kvwShw8JSyUSVjFI7I85Ry1OavThUFreTtZyi/0X0LRzYDsa9Ly+rkGRv7n8bMPQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230116120539-d319aef_1673870773376_0.2974121807548946","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230116121427-46feb02":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230116121427-46feb02","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230116121427-46feb02","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"cf38364896f47ee6a8ea2bfc7f5dab403fb03482","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230116121427-46feb02.tgz","fileCount":60,"integrity":"sha512-0Mm0Y/6s+CfcNKMO7fHYLZwHdGbu9fav/ljrK9FaLd5Pkq+4IXkxMEVderGz/ki7TztcDbuHSx3MOPzQVMH5ng==","signatures":[{"sig":"MEUCIQDaFrAFMibdg6UxGMblGJ586IGgDb+yuINZbTBeCnZDMwIgNdxL6RifUl+NNAZkWGDy4zaUtFeT3D1wgXtkFSKaRNU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxT/KACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmq1Xw//QYDpSxzFRnBFgjkKxRxDle1lls5uRC5h5NaoqioyNdiMZEoz\r\n5X1KNdAiGldqgy9TZd9V7dy/AcwTnovTObbPmxZeYGKDx6bX/JAxGwMLg6cW\r\nSUTa43Nr6voI6JPm72OqBmgk2nek2lybtgCBTDFflUNXeePVWVSdovvWMuBI\r\ncYFGXzwEsv+EfJjY5Tz1GrXjDS39qvuSJGP7Dv1X9hMY4SI6VUV/ki3nIvVK\r\nBWCedJmJbFRJ+pPyGTu7xNwPad53+2HmhXAHuw5lK4xeEv6hgJNctyWBTfcy\r\n+x3d8jxYMZqsg9CSPzreGsxFHEl9oWecUvRbgUSq16XyXwt6vbc4fS7voIKa\r\nwky4MGqdW2G6a27PScq1m6kcpP8oidE9sYxCH1VZxePjPRdFPYreHKVTowuN\r\n0WXZeda+d/RV0cpyS9c40UO3ZmlO117VC15tH2PW+WWqBS+P7RVn6224TKJA\r\nMatlqRNEvj5NXQ9z4aRSYRJL4wDBaUzWU/bwxMNiHKo88vORC55NswGHcTjZ\r\n7jil/7ITmkGb4yt8GMOnAUy8/cfel6vcsq5zMWsjQBcMhYuf5FLaEk+saaLv\r\nH69VEU2AyPaICQ1CPxa/uYa/e+AaxoBr+Prf8GHSoriFw3V/DrC4CP8ynbxQ\r\nmLzMj5p+5B5pCAyoeuMlN+vE92wk2l5xfO0=\r\n=qbql\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230116121427-46feb02.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/41145e1475cdd5a4d9b6aa1d2116bafd/graphql-hive-client-0.22.0-alpha-20230116121427-46feb02.tgz","_integrity":"sha512-0Mm0Y/6s+CfcNKMO7fHYLZwHdGbu9fav/ljrK9FaLd5Pkq+4IXkxMEVderGz/ki7TztcDbuHSx3MOPzQVMH5ng==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230116121427-46feb02_1673871306218_0.055041314190666046","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230116121700-49ea30a1":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230116121700-49ea30a1","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230116121700-49ea30a1","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"30d5bd7bb965f63100e6f5e1d512f2763479e9e2","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230116121700-49ea30a1.tgz","fileCount":60,"integrity":"sha512-St+IVlObFYyKK2W2aW7yZi3AZw/wH5Txnp1Ymdemp8g3I14U6J/dofKg9LK/uQGW2I9LAZCJYPW74pM9W5QFYw==","signatures":[{"sig":"MEYCIQDsfb1ttIQcbk+FLbppama834SUITsyB81/6o+UMN9pvgIhAKTtsnnj9C5nMwHRaNQX7D2TKkGmQgBbqE57S40QKn3/","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169649,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxUBeACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpotA//fSQj+Rx2b8mp1DInHHkXezZdPWeE29wDIZizML4TQxQqDxZN\r\nGRoylKbjcO7eDnR50+BpRaLt1aoY1EjvuTtFpuugnh094pedDpdP9336VgUc\r\nbXrp8iP0I+7RC9eBQHKOs/YYdRT68sF36LnmHLs+2lTT0gxdvJSlbpNi2Q8Q\r\nBpF5DM0yCP6m1ZY17fg4WfiuChq4aMy8DDwSVTsZiX1LAbZkccv+Y5XDbLPE\r\nYVC9lERvBNohKlmcC702keAzS1ngUnhU9SDUtZa2g1Pi25nU57xos/3hJv8B\r\n4KlQKMhgMXy+dOiLbmqndS8NafCVylJVr/hMesZJP1KKxMfwZekuEma+tUgM\r\n2eDUqVkyTHFBMue2CRQBhMfgvu4hJd9d/9kRxogxogp5UmrS/Kc8DOCyg8c0\r\nlMH0pyJy/O4hjvXSTO4Bh0LlZyqjiv3BSyacoszGNTL87jWZLnueer52iHvC\r\nlGBiX1JgF1PHKLl98IKMTEUd38zWXo3hUSsguxjPBjkhpQ4oYPZWS8BXPKt9\r\n+hsCjMNQITylT8gkyMuDNagb1JKYh6ffwJI8nAjSTegxdbDGrb5NySPxI85o\r\ntFNHWPKNrrmZaBd1JvA3Hqa5+gntmfZ3kCpkjCG5V7Qj9WOiqfhap+KKd3m/\r\n6eEt7h4Vfq0dlGUgQLScQDprRPKi8GP+qKM=\r\n=AOE4\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230116121700-49ea30a1.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/74824133d1d7afc3c95e205a5ae8effb/graphql-hive-client-0.22.0-alpha-20230116121700-49ea30a1.tgz","_integrity":"sha512-St+IVlObFYyKK2W2aW7yZi3AZw/wH5Txnp1Ymdemp8g3I14U6J/dofKg9LK/uQGW2I9LAZCJYPW74pM9W5QFYw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230116121700-49ea30a1_1673871454131_0.23440879668511716","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230116122123-d503484f":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230116122123-d503484f","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230116122123-d503484f","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"7d429336fca408cca1fdf2b7df460ee1125cbdc0","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230116122123-d503484f.tgz","fileCount":60,"integrity":"sha512-xDqTYle+Ct6VUm7QZwoovjpbt8vdDAie+GreLQAbOgBHsOri46bvWnwcaVVy2DedDCJ8IZ14YW/WfKEBddm64g==","signatures":[{"sig":"MEQCIDN+qde2BDngrVbLqIlQupvew7j05SJPrtP3VKARVe1rAiB5EMCX1D3DiOt26yutpEZb5cc1a13G1boEkjotO2jT3g==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169649,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxUFnACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoNvA//XCzm0P9WoVW4koDF/ZamQHdm7I9Bld4yqC3ef5wE/asqn/w4\r\nUDby8kPEy0wBLb/KZgqjNZv/WqIYeVM5IeRyiRiyX52IZCRsV/kDA2X/Fb9b\r\nlJnQwjrR/7qKt1pDHTJxlhz98EZed3ort0hjzi6NrwLH7iqGT+TqXg6GdTl3\r\n4H7qsmK/ti/PiH5KWZINb5KM4LWv70fUzslrXIH/PHYfSPpcwOVCZhbO7Hbe\r\np3iBgbNTHkjrV6p0+B1Mhx+HPTLgEKNvvda44pdep8CWuOSUOIY7+ZtawBhf\r\nBGAm5+XYc0Xjtm6gFPlgggQR48YpN3g5rD2CEl4e8XeEHJxyOVZspW2XK+PI\r\nnyhdpAr5VaA2r0EIvzdT4uPATLDM4ajOLPzZIfKSKmZN78lZE9hPKpx0Nt/s\r\n/wVX6+wflH7+O2iIOvXSSneNMr4lxPkxde/rMpj4cPGhdw9By30EOf2Kv+lO\r\n0z1tVZ3TbKGJrIzMXkus70spUY05SwT8KUgCrPpqRXD+IQF0jEhfPLSuy0Fc\r\nmpbXCpZstCqzUesQVfAMyPdz4dUBKlUfFDqzZmU+EA94lzRd7JCdwI3M68Yw\r\nCa0pKh8XW/lXG+aOingSHS7nBnuVyVv2/jLvbpR5ErGEyw5xZhQ6OIoIUH65\r\nXuhSu+M2n5TwQV04EfGTbFRHuLVE0BwklCk=\r\n=dGpX\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230116122123-d503484f.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { hiveApollo } from '@graphql-hive/client'\nimport { ApolloServer } from 'apollo-server'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport { createHive } from '@graphql-hive/client'\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { hiveApollo } from '@graphql-hive/client'\nimport { ApolloServer } from 'apollo-server'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/d6d188a32d6a2969349798a02faab0fe/graphql-hive-client-0.22.0-alpha-20230116122123-d503484f.tgz","_integrity":"sha512-xDqTYle+Ct6VUm7QZwoovjpbt8vdDAie+GreLQAbOgBHsOri46bvWnwcaVVy2DedDCJ8IZ14YW/WfKEBddm64g==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230116122123-d503484f_1673871719058_0.7585540421330494","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230116123800-fbc99c6c":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230116123800-fbc99c6c","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230116123800-fbc99c6c","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"1c63b33ed0993159cf8daaff245b338afae2c54f","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230116123800-fbc99c6c.tgz","fileCount":60,"integrity":"sha512-MncRsOTYOdlp5qGZBTHv+SSgZHRvXv9Am/XIJ39QVHo88Arun1PU6SzoHPjBPnPG1HFgOZx6jcKfWhUauBXaJw==","signatures":[{"sig":"MEUCIHgTN8ifKqB9mwf49woll6D4NUKtKKcsXWB4cjpyTIAwAiEAnWciuOKyiAYRX8TQfSHE53yN4pDBzAnSnicIrvslmrY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169649,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxUVMACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoDHg//R/bnLu6utKK4LRBz5rSEuwQWq9GbljdfRgkK842sFayv6m3J\r\nEnwy2af3tOjII54gZIiO+4pKB+BnYOaBnOpcX/CQB2aT2Ie71UgtSnSvsf0h\r\n3/obscQOwqRW/reKvXPCXsRDzS2GVdZTduOH3PSPKBu7bjTeggl0mlPx1/op\r\nrIIotFfEautAD4fkxoISE3LX92bI1cL5dJ6KVHXqNdLKqK6YxQIoL3iZxUSz\r\n7KKlVN9xjb9+qYmQKmfENmaLf8ZIq8oGj4O9T6f/aTH4QuRMT//BqDWjnBuY\r\nQyR4lifRNN9UrS1C79hELS9bYrtJ88SaSmHMK1p5+BMa2bv4tTCRsCIyFoLN\r\nyyyZAorDuk6TOWgygLu98bcSeGzOjuxYku+lxJchy9Cl+Wvf4h75cIfb3JnH\r\n2MFJ7iXwWRq3vdbtS6VdMIl9rH8ua56PRux9P5nFGRhFWOGn6TJvZ13zkuN+\r\ndF+zpT6Gxupw9cQ8POekcq9iaQMHVyGzfS5bW+oG2bDBEFA8+yovWcvmVs0r\r\nOFiabDG6kPw1d+ubuiZxkRqkl3rxrs46KH5J0E2Cj8luST0eTZ0gtJxZkdww\r\nJiUKY0SGRPXlEwByxuAaZhx2PQhmXwOXTTTy+nHD1jLMRaM070uf3v33kctE\r\nGRqKUaKQTJokD/8YWBuIPqjc6PYbayeGMxo=\r\n=xxJS\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230116123800-fbc99c6c.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/1157f354a662c2d817fb20fae4614402/graphql-hive-client-0.22.0-alpha-20230116123800-fbc99c6c.tgz","_integrity":"sha512-MncRsOTYOdlp5qGZBTHv+SSgZHRvXv9Am/XIJ39QVHo88Arun1PU6SzoHPjBPnPG1HFgOZx6jcKfWhUauBXaJw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230116123800-fbc99c6c_1673872715973_0.17308491477829624","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230116123844-22f69250":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230116123844-22f69250","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230116123844-22f69250","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"c8758b237742e5cfa6842cd1e39423e709c19b5a","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230116123844-22f69250.tgz","fileCount":60,"integrity":"sha512-bR0Nl31LecmXTw7C63ewpGQlHj6hK73kM1ZLQHZTEx5gz4POvR7RIs9M29JhkDhdr8+Z+CVniO7bacXD4/S+6Q==","signatures":[{"sig":"MEYCIQCLAcDytRzRHutcBnmB6x6Wv14e9vDlHYKbMPP8fhWW5AIhAL1R1YDuEoWagOsOJl1JCirDua4atZq0aGPQfD2bonh/","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169649,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxUV5ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmovyRAAmoJ/i+pYwAX7d4Pyw0Gn0jCN3jmGr9lgWT75gkbgS2GrSLtu\r\n+FHw5ybwuJwPltuD28jIE7GnxSI24UnEGJ5g4q/ALtt4wrSlQ2LncxMoLNuF\r\n6j8wp8Hp0LnrjHWdf2IIWWQukO3vtdGqMWlbhOO5WQCG/aJ24cGyGHEvVaiK\r\nGzJn3e5SpIlO71X2OrFCWnlC/6b61GcHTA16I2jJSEyOqMdpc68wURCLP//8\r\noSL1r7eYHptzPqJbQ4dshnqEjpAfa8dZDwLlQAVBvM+5xVJEB9QM2iWNU/6H\r\nAEvvAKOVTq7/mQ8HC310f05tcuwwX3+/lAidDiwT7YFqX/zkCtU9GPEZHDMV\r\n+YNqElowfbxGSKKE0yTLCrJQsgqaeAOIcgLgHcG1t/7dP5SENK6sqsWjDijS\r\npqBpbPv06dUfVpjtuAB+07JcyFfYiAfX5cF/K1vaffD+V16AHCrX71vb8zrx\r\n+j3MwycaY572rX7Jr3oAWRgVrmSwCOVj56y5+MmjyddnSPWC7UKL8DmJtjy0\r\nyEj/UzX/981zzBn/q6quUTCK6iuFB7WaaiFHmLbQ8iuXvWwYUA13gWde+Rwx\r\nc0/O0gZmUFcy8KqRvvEzWs6kmmRyltVmhswjH52KDGtQFAxBiKXV9s+Su984\r\nVGUy6ZEoHdkYIA4IaBE5de7FQQ5MoZCQr8k=\r\n=HwBB\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230116123844-22f69250.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { hiveApollo } from '@graphql-hive/client'\nimport { ApolloServer } from 'apollo-server'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport { createHive } from '@graphql-hive/client'\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { hiveApollo } from '@graphql-hive/client'\nimport { ApolloServer } from 'apollo-server'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/3cfb195ccae8787d29e605db87b8b9b8/graphql-hive-client-0.22.0-alpha-20230116123844-22f69250.tgz","_integrity":"sha512-bR0Nl31LecmXTw7C63ewpGQlHj6hK73kM1ZLQHZTEx5gz4POvR7RIs9M29JhkDhdr8+Z+CVniO7bacXD4/S+6Q==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230116123844-22f69250_1673872760966_0.08684251428987344","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230116125736-1e9371a2":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230116125736-1e9371a2","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230116125736-1e9371a2","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"c284441d6576c4931ec900a2fe03f0581259fcac","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230116125736-1e9371a2.tgz","fileCount":60,"integrity":"sha512-b5N1aassjWehtrJGPPH8Q74uqXia/KhJ8egPrE0Sfyxwn2Vd6vt3tR6KAH5pVJbtRMW32EOCh2O4JHq9Mzt5JQ==","signatures":[{"sig":"MEUCID8vSpKscMPtPhdfnT7TYFSeR8zY5+uZ8bMevQHvBExeAiEAuPfZhywVOJrEPtEmvURIQ1qZYN6Li4lbk9HWFTrUs4o=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169649,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxUnlACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmprfw/9GyzJXETDyjdw0dJVqIBHuFlQCRRIeCXj488FBF11+OWcTfmi\r\nTWaBnDNvO2xEtP3QWv45Jp7IpvTw8/aFrnlIdpNsEaDy1ZWqRGydjfhJg6Ka\r\nDf3CSu1fr5TQUR3JddmL44zCY1K2k0tqEfGICSfY3mBmg0buRjpwbxF/6hJ6\r\nJZEd4TPLFduw5xAfZDMXwYLWLCemqnGMivrru9ao/087GSbvXUk87A8o3Vy+\r\n9NRlMW6GtU8EHbWIEcg+eLVv+0Q5WuDa4CdkaVvu0JdMASUjYLpaBJ0fNtPC\r\nyaw0uNtzQPbDyKU6UfpqNyQwNtlejyTX6jaUYQmojAPILCcEM5hmzm0OBVyI\r\nQbsx2YRSknelOiy0vxWlIRgEobAUQllKr9OIqmWdCwxcm/9DWv1S9nrSg85j\r\n4DtQmMRw3PouzaQbv7F7GMeKSm3BRU1Tu0xKhjEQBDlbRPcCTILa4MwKSOSY\r\nWrbl5JgxELnCgXyWFRkn689MFrjp2G5XdAmdWUHItNkApsKdFOqTnl0qutn3\r\nPlX8nJMx3GUGHjoPdlT3N0gMsxP8o8pXgsJBzptKedy/4xNTKzOD8MeB/qHh\r\np3BP8+I80RGgU6ieQb9PoQXo0KyRDPosvbu1EWFczbWxv9MCr9VX15Tbb0yN\r\n0CX/mWtpvs7cT+jSpIOr6nNKVkKdJwvpD6k=\r\n=CqUu\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230116125736-1e9371a2.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { hiveApollo } from '@graphql-hive/client'\nimport { ApolloServer } from 'apollo-server'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport { createHive } from '@graphql-hive/client'\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { hiveApollo } from '@graphql-hive/client'\nimport { ApolloServer } from 'apollo-server'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/9899408a44e7f41a5d91f446067b3fb9/graphql-hive-client-0.22.0-alpha-20230116125736-1e9371a2.tgz","_integrity":"sha512-b5N1aassjWehtrJGPPH8Q74uqXia/KhJ8egPrE0Sfyxwn2Vd6vt3tR6KAH5pVJbtRMW32EOCh2O4JHq9Mzt5JQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230116125736-1e9371a2_1673873892902_0.9638810987089854","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230116134633-48698357":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230116134633-48698357","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230116134633-48698357","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"278631c885654d36e1be8b6f00e08c470d20ff6b","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230116134633-48698357.tgz","fileCount":60,"integrity":"sha512-MS9LJz3+Ud7taplEdBvEhU2kfvK7tTyR7a3kVQyT911YneaM9NEFseDxHTyze7n7WpaTwWVltKn0/4C3iLXoow==","signatures":[{"sig":"MEUCIQCAJDuq0GVhI29wUnDCjRiuoMkgawbg0L6Egr3cRYqE3QIgYTwqwhaRZ8EWDOpyvNd6C2ccUU8bBe6/xTU8ZF5S8UE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169649,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxVVcACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpoDQ//WV5VQ/qP9EG4CHNalPW/i4RYSU8Vap6jLx5R4FI6pbrMZNkY\r\nBzyBs/l8AhcHVez+N1ofNA1l4mQoztDyZRauGOzqmw9BTIIt99khVyDMoOGq\r\ntHnixBg8MfrUbqnziASSpMIp0Q18AinchTJhlDLpu0XpubeE+jrOieDV9epO\r\nOUCKe5HpT3RDGZSjjafBxOxcPEJsaW+Ctf0JqQ1O0wkY10FYDFEV16T+tVU1\r\nX2nTxc+2lrec/92DIWmb2unio4V3saOh9GJKPMVnP4PL735FO+elNIXKCQOt\r\n2WesiZ35g38FyULsmCgeAYJNlCr/PbKAUiT6VVO9b6O5KXLKwYjs1RqZMkZe\r\nxXIlxVlRYGhcsHmCoBkDasebOOR6IqBX3BgIUNbBiAosV3o+PMIrU/hy/v7L\r\nbaF33pVgmCjGpiiuIa80PitXE2S54PQiPGsqSeiW1/D0oh4XmMC+Eaw8v5c+\r\n/sdtmIXzNJ8m1eo29BaR+00qYDaV4PY3nP4eCdwN9T19/S/Dy6oq4DWwGmBc\r\njyi0rnM0udVED3dP21r7otwz4sEsKQ+F2GfTSyOCceV2P7sH9+B/FefgYeDa\r\nNfSgoVf1yFctoeCY/rBTSKKN0oywSxh4aXv4x09A1JByGW0iDsxVCXWSmAGe\r\nYLtAcl69OnRTxVKa/MZfaiw4D0gR5k/kLTA=\r\n=rch1\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230116134633-48698357.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/57b59043504fe53a00aed1fd26970ee2/graphql-hive-client-0.22.0-alpha-20230116134633-48698357.tgz","_integrity":"sha512-MS9LJz3+Ud7taplEdBvEhU2kfvK7tTyR7a3kVQyT911YneaM9NEFseDxHTyze7n7WpaTwWVltKn0/4C3iLXoow==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230116134633-48698357_1673876827968_0.03885658433600936","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230116160257-6cf3c1cc":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230116160257-6cf3c1cc","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230116160257-6cf3c1cc","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"ca00608e3490c4777ea0765a30676fd12fce9057","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230116160257-6cf3c1cc.tgz","fileCount":60,"integrity":"sha512-bNtE9Xifc+oM4DfBkp7kO2KLlrKTnUvSTrH9jkOki/G1Ki59URt1/Ebt3N8A8WFZBh23lqPyWHv9t/krGx1zvw==","signatures":[{"sig":"MEQCIDazv9rYIQoMzAuZkoiWRsqr+R0mHPeBMZpfN6o9j2b1AiBqxU7hNvhHsMSEz1FshCcfyBfygEOlDyPcdqO+DYDy0w==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169648,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxXVTACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo2JA/8CLJau4dht9wTIonyIq2lTE2W5zh2AAwFsWw4s2NJ4a4vTOQ3\r\nB+oSALa7InnUushXwgHVgWws7a4KJbcFvT0L71/3PJI7uwL7R3p+knohTqzX\r\nPMeOl/g1yU9iIZ7huKtUxlEBN6OP67AXBx45Wv7tM6Qu/zNG2X1xlrRVhbHA\r\n32ntWAmD4MdBmD9d4A61mtUvyXf9wr5+4p4GZ02MJ6iCb7I0ZsW1+cWxnWO2\r\nPDoAus/RF/Nd9l/08o7kNbYu2Vj1od6/NyFTyy2e8ChX1c0dFlE4VXxw/yId\r\n9CO5hrDirDJlpsAe7YHGv5pwX9kDtqhLEZtwvP2hcLc4O8/opqhWgvV3TFjx\r\nDDJmw69aWAavyqWgGawMjK5d/zjannoPzycZOF3/F2R+Hb708hUEsCmBEKC0\r\n1FlZpsHAlvVvcom9pkFKEAC042JK2141zEOe1Yt2fSzY6sq71mdpvA2N+5/P\r\n9iPK6Sy7fKoro3J4zI/tSsWFiWImmPGYDqCgAdqhfH+wzbFPCnnPK2xkK7IF\r\noBbewuaCpp/FW6pjmAkApt8o9EYVcJaxW0wmJDBPmt4pgByqitta+qpRPe7u\r\niKG8zgZMX19ha4omhX4b1QgKY8eGJpLbPGyfkJ1jZvkA+ag+gvZLgmg24h8w\r\nDWJ0xmNAeHllqzm6tDocI5aZUvnwyjv+Vak=\r\n=zUQp\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230116160257-6cf3c1cc.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/ae681d307234b56cb58e089f1a3891f2/graphql-hive-client-0.22.0-alpha-20230116160257-6cf3c1cc.tgz","_integrity":"sha512-bNtE9Xifc+oM4DfBkp7kO2KLlrKTnUvSTrH9jkOki/G1Ki59URt1/Ebt3N8A8WFZBh23lqPyWHv9t/krGx1zvw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^9.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230116160257-6cf3c1cc_1673885011402_0.7737019234259985","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230116160842-1a47e09c":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230116160842-1a47e09c","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230116160842-1a47e09c","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"8fda87373bfef2f70f472fc7619d773e955ae44a","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230116160842-1a47e09c.tgz","fileCount":60,"integrity":"sha512-Mb0/uAgPu2z3urTb7X9kpmoDx7MeHlGvdVHJqu2qzjUVzyDZJzPF6X5KmwdHLw1bKRsFA7+dkJfmTqC3P3lTEA==","signatures":[{"sig":"MEUCIBuk+KBV4YbfY4zjBsjxJj/CJdhZfPUx5wWHravBKLdeAiEA6eYwfb928DrkGYTzh1Lt0B3mibutXJAPw0i2N1XSZzQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169649,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxXatACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr3hA/+NMTF+dWYWbqDYTfUG7F74Tw+pgW+1NyDjVzAzY+7NpM6Z+h5\r\nkDlr9GjVDs1jb0eYbdJmRQk6D6G1FipeNFHz/BiuRB9AnJlEvHoklKw53SOl\r\n/kXRpplw4h0wr5Taf/LKTy6UlHbaFLxmPIGVCVcNC1QDmWMovM70KhAVUeC4\r\nRglX1FZw7ahTll7NwgiGng3A+/GhiSagD8xC5eyjpBsoc3OWDjGSsMMwhG1G\r\nMOoRNWnPZe08O+LJCAu8VXhYEyPH2esSiIEi0xyabSqdqF9XIcFksAzBcVQ1\r\nqigv/eUwXy0oQhkafyBfgermvUaMhlk9bNrLHBkWlc2tpZsOj4hFDys4n/V4\r\nk2Vp3EtL27v07JhNydyF/CNwD6sRSLGVYxxwvHTK8hO/jVKrlIbzPmD4RAie\r\nbta/fa8n1HSazXN9Mgb1LzcJ2mWyHpeAUH6wSc85Q7SrxKN92jWHoBcKkqSC\r\n7vsHI9UoWM+ipnbPfGTHUkEbBEQYJAZfq5pr6Ht1jg2SteNuzZvjb1iJEfyf\r\n3DeHUMW60vfdVxEGwZJFR3HPUdRPd+mwladFrzizMOZNWxrpz94EOd5PEYKF\r\nGrPRWNXEaMRqEAjiKEQS7NrJU2158h0ciHVyw7edCrwJuW1T+aIqYxamZZrv\r\nSb1UdP79uOJTacxc86kCzB4bXBkkzMVziAc=\r\n=HAtx\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230116160842-1a47e09c.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/61e3a23ff4f9b3bd369400bec0d1ffdd/graphql-hive-client-0.22.0-alpha-20230116160842-1a47e09c.tgz","_integrity":"sha512-Mb0/uAgPu2z3urTb7X9kpmoDx7MeHlGvdVHJqu2qzjUVzyDZJzPF6X5KmwdHLw1bKRsFA7+dkJfmTqC3P3lTEA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230116160842-1a47e09c_1673885357607_0.16851136831308122","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230116161405-841c949c":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230116161405-841c949c","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230116161405-841c949c","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"3de2059e154bd608590ce0bcaf413b4a91b7c638","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230116161405-841c949c.tgz","fileCount":60,"integrity":"sha512-EzOhBnc7+17Edp7/ZI1kimz4R8e9j5LqNBriPq+MV1h9vrLgGB+XE36ZnRw9d+Z6+qvLt9N8LoXvZ06tNlK51w==","signatures":[{"sig":"MEYCIQDxyrulyDpA6z9o/AS14xo7iEDk7obbtjmyUNzVNFx1jQIhAOdQM9C86fV7xx1kdVFpqfpa62cYUfecp0WBaUs/G4s+","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169649,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxXf9ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqQGg/+JQUoUfWHRomoZVStCj8vBB93yL/htYuq8y5YbY3+6txEotXA\r\nYCcyMGpHdgDmqRYOBfv0BIFqbdu08ZZjWsfE3VVh60B6rlBpOcVDITlRxPQy\r\nc6w5oXNQGn3aT91BrSSRTmQn1cXgfty/SHwR5tn/TN2dTtsNvjYKS8F2caqK\r\nV4BI7W1WtSsTN/pxyZRW88GkghIhzIe2GzInf2BsAodW9m+zr5sssP4enXKA\r\nyymNASrIdq70QdUhZSE4WAkqQfeUSZIu8e+OMKKgDrx0bfhhzefcw7DZCM4Q\r\nyxENw+UxiktiQf0svCE0LA6VuuGejkoyuJi1akFSae1zqByRujIfBpkrvDhU\r\nLLXbeEW46mBSq/BwdCAEOR2DbO/rpkHZfIJm3my7kJlDvIBnXZi7uOl4eZ1k\r\nXQFvzA1Gnb1C9ZwGJxAmwPwerajqOjMzD1ILF04LHG99yMP7s2Q1ekUEfCdb\r\n3N3td1H4DvkTPkmAqvGyLG+dfnPdcXl7gqJ5jm7IEly4cxv4gmpHJ7iptMk0\r\nrjPK4Jr3GI/WnSSYNaUYDltqHLm/nzHf73JQCO2LvcTZK/DCMZ8GZqy8esWE\r\nq325H12QddUAy1/xDbmdT3d7j0lFcjAVO7gzbD6M7rTF2TmUrW/QNdK4gb4F\r\nFE4M7f03XZDzgC4IFAd+MIPn8Iq3awV5M4s=\r\n=aJrj\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230116161405-841c949c.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/cf15e0a94c36c7f9bcc104f4f875ea60/graphql-hive-client-0.22.0-alpha-20230116161405-841c949c.tgz","_integrity":"sha512-EzOhBnc7+17Edp7/ZI1kimz4R8e9j5LqNBriPq+MV1h9vrLgGB+XE36ZnRw9d+Z6+qvLt9N8LoXvZ06tNlK51w==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230116161405-841c949c_1673885693041_0.8629644395054668","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230116161706-6df97595":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230116161706-6df97595","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230116161706-6df97595","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"daefd4037acafd85e7adb7505a83ba634209aadd","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230116161706-6df97595.tgz","fileCount":60,"integrity":"sha512-TeaXVI/OCAleuZbYbC4QYYFw4GehsTD9QVICV2fovRuj0cm7HMUZzwsAx5CxQaXbznxpVaQKh94bZeRhMxBNrg==","signatures":[{"sig":"MEQCIF0O7BFN1od5lmUtm4gBnpogv+RJz9TrtZUvfeh6Fsn7AiAqe+d/mYGgUOg7HwJwJhuRDzANCx69aq+z1av+5VV9Fw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169649,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxXinACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqYUA//aELNe/1CfEW7hf+EnMNijEHVMAz62fofZqy9NKlT5xT3vkWk\r\nRIzV9kQdplhH+ChuOTF850OwytEDvFGjwmQkDPsW1tzNoCXByGt4IziMSLEh\r\n02UObLBNAaQTp9rQkCpSCnAp2nM1JRHsHBY9U8JFAn4F/2sj/xuSXsRlnTs6\r\nqp9s4VLPgrNvOaxpceQ1gG72i8mpYtadLyr+ncyw1jRYmqVLBVtMciCTy5aC\r\nRlR9TnnLNeXdPsVrnFIdhYVU5KHnunUQOveniqCmgSyWkejWM0/QYWsIJcne\r\nfBoLpCv57le9ViGQUCtvUAhpGoast6EiDXthO0r0AieCYIoTL3t3JLS0T+ZI\r\ngdSqDmPn5Ohti3Lsi8B3cdNl/0bIqE6eDPBjaNoAvLWdkI/Z83B7Oki7kdZ5\r\noySKe1YM0MxT4RGy7RjjSxg8kfVpKrazK/LWZD8qUMJmkIYaHIsSyEC9Uqpz\r\nz8Hq1rZ0zsJSeSn/OXTdwik/ZsJ7BehtAIjVZhPhtcVqTBaOUrQCNmSX7nhY\r\n3qnscaZAU1Ds+8HxrvIMUR4t1uxK4ooM2VR7DjcoR5+YHKA/MqZT6tVT1YAt\r\n2cAmjLM0piQqDqywPHpgn8IuFWXVNiXmcFV2/o0zi/bruMXp1XXnoAwOIYSU\r\npLj9xOEHFiqWN97CaqgomQ/LbbngPNOMeGA=\r\n=dgvy\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230116161706-6df97595.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/4f3df275c4040b270cd624ae82469b7a/graphql-hive-client-0.22.0-alpha-20230116161706-6df97595.tgz","_integrity":"sha512-TeaXVI/OCAleuZbYbC4QYYFw4GehsTD9QVICV2fovRuj0cm7HMUZzwsAx5CxQaXbznxpVaQKh94bZeRhMxBNrg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230116161706-6df97595_1673885863386_0.4758157842451327","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230116161903-3e9fd9ce":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230116161903-3e9fd9ce","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230116161903-3e9fd9ce","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"1507f56b201e72194a82df7e2705c252069cdd52","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230116161903-3e9fd9ce.tgz","fileCount":60,"integrity":"sha512-pOOcIiJulT1ylg7yvXuWtvLppoPMe41Mt5++j6TVAlz9yQ86RJxZDjl3l5FpbT8C32RC7RSYwxBExUJbiz0Xpw==","signatures":[{"sig":"MEUCIQC6gprMxIPaMLswa5kj9Zor3+K4BpFzaC6A9dTnhfg9xwIgJOwqJl31i+ggAsxWYAsVNn0G9DbNyombGba0d5JJxlg=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169649,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxXkpACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrYOw/6A2vd1RgXxavrogSbfEH3ZTt2adIT/iwrV52e323D4M+WiQVO\r\nSEtMoufIOJc8sqfAPVPZDgWfTvRvHHAnKGVBUBSGlAocQ0oqR7fv8g8frWyd\r\nwcEFoo9IDi+XFQ8iCLj74b9wTcmA/Sdc+dOHVdMJpOmcIOAbG9JvBLiomYvy\r\nnu2RLtDTpFPwkCzsDSbgRmhHbu2pKB/oLg3NGQS1aY8yMhvlNnsJ4tWq/1V3\r\n2jZaJN5AOTdpeIhJmZPCgmqn9ufWuqX6TylXLEfeYQ8gefuXJ9IEht3CF9OW\r\nrxSHFoRZGX9wcjVav5zdmOZPZ88upoGvBGawnhsGHmtEYVUx9w2W1SF1xpxu\r\ntPyWoc1AG8ha6r8RgTqWDhbV3jD2ev+heHWG9YodwWSRLnGqFb6NqjgcVYBf\r\nzA1y+GNhfcRtYGJXmktmw0f0XHo0GAXVrr+0cPtfr3nbdieZG7rxqgsO0tG1\r\nwXYCYy63A7H2B0w2DVXMyuPDFlpQXwAs9ZLyrCMejAaO0vtSO9qZ8w5ep2sh\r\nDI+1jQpD7BHfPAaEsfleqJMFcCoubZ+Md73Tma5tqBh3+qv3wJAhC4HMPP2q\r\nuzxaAO4SaSxNTIjjMmUAug695BsqBUwyrSAnalRt1sKSf1Swj08q+nVcQWpO\r\nCKLO1u3N4FUL5fgfNbP5AISn9LEDfWNuEsI=\r\n=us1f\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230116161903-3e9fd9ce.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/76ea0f169a60dab35d32818a44f80d51/graphql-hive-client-0.22.0-alpha-20230116161903-3e9fd9ce.tgz","_integrity":"sha512-pOOcIiJulT1ylg7yvXuWtvLppoPMe41Mt5++j6TVAlz9yQ86RJxZDjl3l5FpbT8C32RC7RSYwxBExUJbiz0Xpw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230116161903-3e9fd9ce_1673885993500_0.9916394564017212","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230116162717-f25fb8a0":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230116162717-f25fb8a0","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230116162717-f25fb8a0","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"f1d25fd03db92ab45d2c6a9d8effc67c27bb3a6a","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230116162717-f25fb8a0.tgz","fileCount":60,"integrity":"sha512-vqwhKivRtyyGvLtTr9X4K6yixaHQwC1RDqa94VFszZEcUuipwpE/MEzwtCJNg9OTDWjRBeTH7oGHqL6DqGEZTA==","signatures":[{"sig":"MEQCIBh8NH1s53IQhQKs85gJ16QlZZR1nQgpn67/AcTUeALSAiBXaQD7beuCkelqWUxzjnLdcbblX3O3iZLiG/LwybIZCQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169649,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxXsJACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo0tw//e037hDO0RWYrfQbZTJ4MlYoXd5EIgr1eZFT9E8j5gNMHK5qY\r\n32Pe1Hdnq+KZtoTV6AIBv5tRV+vGJ6A9femeVoVkDtxN+LJTMfnp1aFPK+aG\r\ndFUleEWLGvQE/p9EYsEvFd/wXw1NT18WBRcZnEmBakUhJkVUFlsKYu+hlCYz\r\n3pey+MzPiRgJcsHGmAsSKhUD7SaIFkple5A56NTe2JLz4dpoHixIMQTkp7ZS\r\nOjnZAs64L04vo4rSbm+OCDJmhTw4YrUYl0XBfk/pQRtarKhL2qELLSbm2oxG\r\nrXEzGXAxBQr5FqHizITrw3TJOEU3574/obGcxj1eWeBcFDrg28ffccQiAX+A\r\n06Vz3/QLkYpZiKCRd3S1WIw378nikhl3XN0woHaQvyVbag0ctBS8HOquWC+k\r\n+M1u9mLv/RZ90dqGHiEundovmg1kChdhJCE4e6Kr9jl3ffeGZ2FrG6sPQ2mG\r\n6xy8mi16bEnA5JUEZ2BaT6K9o+45ZcWtcGgj6D/s50H/qU3yd5Zy9naBqucM\r\na8sKuFQhbGPdBgMP1fH8+OaMSA50Ymqi9o300R/l1QZbQJkopJZrxWjCDu2z\r\n6/bSmF0u5B3HL9OUyZEIUDheK62VHjQjZ68R/fIzXPQfujkwJXeLL3l/o/Et\r\n/XVLYPhyWgbKnmTCEwBGkX5yB7w/TO33SKs=\r\n=Bs3N\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230116162717-f25fb8a0.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/dd1b9bd0bd66a27b15322154f85e49c3/graphql-hive-client-0.22.0-alpha-20230116162717-f25fb8a0.tgz","_integrity":"sha512-vqwhKivRtyyGvLtTr9X4K6yixaHQwC1RDqa94VFszZEcUuipwpE/MEzwtCJNg9OTDWjRBeTH7oGHqL6DqGEZTA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230116162717-f25fb8a0_1673886473042_0.4571666792460727","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230116163507-2962fd42":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230116163507-2962fd42","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230116163507-2962fd42","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"023dda64cb6d422200493c874a720a3eea5549eb","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230116163507-2962fd42.tgz","fileCount":60,"integrity":"sha512-yXi6Mq844hfAt4b99FWvrsuTo7G+J6YokDcCUE87oQAdxlz0Fq5x29VVYrkkbG67mhxGrm5NJYEFC3FwZvKzmg==","signatures":[{"sig":"MEUCIQCTQZObImMh1aMwffjNsPyHYrey7bNYE8ghE3fpGSF0tgIgOVy/gYuT61Sdd2DhaKuK1/pZRKgGx+RVDoMm1MnN610=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169649,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxXzeACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr3lxAAibqsfbcDE67sChElVnyUiH0FbpGq6+bINCNCJ+IJoV2YbuYj\r\nBSDKpscx5FkpTvCEB0EuQ3rrkNk1mtxlEbwDXye/GmFfDI3CnsRDOie02x7Y\r\nR7or+T2hDuYwnBiAbaax3tp9Bw5Yn6Cs54uvXhQUFeMSbONzzrUq/Sfdup9C\r\n+kQiENCAfInQjBHimxwiav1WCWgfwq93VdfFJuqct+ET9+fHIgKb0uueLWaY\r\n/NeuFOEEnUWPmPMYL1np1i4gl6pIPvD5VmoQWX1HnWKYcC8HQQIcynBj2J5u\r\n4g9NH9VxfXCAizgRENjLgdkm1JPdoXgAcYCyfqq2DffV/gZJ08qOm3QPEaWb\r\n8sYItIWqs56G3/zKKi4uXz814Rc7j5P8cOp9TJGvmyxReZEOmWlx8TpSz8Zx\r\nlIUwh88VakIvkOYF40XE9BAijzjRn7rBwBXUklk+hecU14YQe9CoJWa/MNk1\r\nfCb0iWtRfh6w6iAc5PvPwd0/eHJha+jpoFPumbYT2ZLSiNf4wfABae4yWd2s\r\naphhZe7cs+NfncfFjhXpsDZieFs2HWYqYsrSCuuhw//ivUxQyRBg5QvPQpGB\r\nOWZ2NP30cQa6Zb26J3MfSY1+pAKkG5peRsy2KcsFju3NbqiaLGiXVcYn6KmP\r\nCDQBIxGjLceQiov0xdjaOX1THz11eoK199Y=\r\n=PqYQ\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230116163507-2962fd42.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/767aa54746c461d1605aeaef652a861b/graphql-hive-client-0.22.0-alpha-20230116163507-2962fd42.tgz","_integrity":"sha512-yXi6Mq844hfAt4b99FWvrsuTo7G+J6YokDcCUE87oQAdxlz0Fq5x29VVYrkkbG67mhxGrm5NJYEFC3FwZvKzmg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230116163507-2962fd42_1673886942203_0.5154337918396423","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230116164823-18776615":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230116164823-18776615","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230116164823-18776615","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"47143b68b993d7a2ca00fbbff99fce689e30c91e","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230116164823-18776615.tgz","fileCount":60,"integrity":"sha512-z2LPf3Adqc2oMvUdVBo0QqWrgUoZ9QqtNFUnShgYVii7q1ALAJ8z29TGTiUZqzLvui+nN9k1iv/9W3i5y8qFrQ==","signatures":[{"sig":"MEUCIQCLn7ME83twRV5xGQbBY+uxpS4qUTfYxglN4oZ7YCItgAIgDjQQ8QY1Kei36BymdlagGCd9btDSutJs6zFELfHk3gQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169649,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxX/5ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmpzuw/+Kb9MUfKCTF5VGlEFmZHFOc10T43IF4iyUy9tt1tHJzqYkvlz\r\ncNGB0QAGYkWNVi04iC+kJw4x6n9ub6tNlk4aP5GklE1cj4Lyp5EzSL8Z7kgK\r\nhJPFCFuFFG+JzNgLEfkBJliBoB4UeZI7MnU1nE3SMaaL6BblZJ0rpKNShvDX\r\nUWg/AVWbS++QAqnyMpfcGOT70wbBFsAq0JKebVHf2Fr2etl4CXbjbKKfHZ1V\r\n45Q0EL8vm78xGBicW/HLVfhmC5syW56svopOoUI992FvZs60oA/FuZoebLlr\r\nY2RFRM0TJkAJOKg14O2+5eN4c/SpK4UXXM8CiuN4+7yhyTfbIOvlSI9YFDYK\r\nNasZxa0t1Z4bcABOtAT6wipDLK6z2CXkLkt6L4g8b0dZcWnD8zsw670fgKmL\r\nYQmNbaHyy5/hh7t2pvQbq3RSWmpdeGPMHCeof56hEOpQH7qTxTroCJRVuSyo\r\nI51uQPIVeqjHFWhHccQ7PxqP7W9uM3jn5xrB8XU9CYfibqgbE6KZmK/kwu6T\r\nT1+54sfTm7waNke10tGol1BR928P56xWoO6FncOtOmi56CAH5O9BGuZFbS6w\r\nrEjDSb2L/jY2spNCRngu+m6epca/SAtVgu5B4qZ1m3eYEKO7+pn1CVMLQPqV\r\nfEM4rHslLrCcD9gk4jbDLb5x223SnndH4AU=\r\n=gcns\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230116164823-18776615.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/d58718ea4c20d812ec26c6f885aeb0b3/graphql-hive-client-0.22.0-alpha-20230116164823-18776615.tgz","_integrity":"sha512-z2LPf3Adqc2oMvUdVBo0QqWrgUoZ9QqtNFUnShgYVii7q1ALAJ8z29TGTiUZqzLvui+nN9k1iv/9W3i5y8qFrQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230116164823-18776615_1673887737002_0.8868193815271928","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230116190134-2c405dcd":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230116190134-2c405dcd","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230116190134-2c405dcd","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"f23a1e0800f11f0976947af616469a5b9e0cb571","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230116190134-2c405dcd.tgz","fileCount":60,"integrity":"sha512-ywcJ48H1pwnIQXDfwTcI6IPI+TIRunqlApvorrXwVwnXkOKx1Ujx6+sVDdqiNBk4NiOwOHwSTswHVeCROXM/Zw==","signatures":[{"sig":"MEUCIQD8LIwBK61gg4tRtlW5iEWnTdRpEPv1sj2tC7uei7yHowIgaE5HOcixvrwJlHehhOi+L8XV/tXJyJ3iMXCKoqwkxoI=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169649,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxZ85ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqZ1hAAk6Rrdu6c62j6C0gXeEMWy8DhtpI7ho3ogP+0QlIIxiGxX1MD\r\nW0LMNUF41bTPdjVRJIpwanaxEYO3/iPvl+0+FAevzLXtZmgdE0lNezUqWNN8\r\nCmSFkIseIIWgRtKjammzp4P0jPgG9AeZZwi6tOEJUetkSkVFpFoJe2fVbKUj\r\nnOD2UE7jNoSa7TdVddbnJfliIxberr+KiwVHItAOI3wnu/Tc/cZWEFdn83gj\r\nYLEl8LxM9xQVoboukxfnkn3oULoHgylf4Ceibi3w9CsTK4/QKMgWo1qAYevg\r\nSBNkGdsntepOWdlMXb5MyU0kH+bmPG/v4xDJvRfRb2KgjajV/YbXsI4fpyh8\r\nbYMOOgmKHz9zcJHa7g05rKW5wso2EgmpxAtCq+mVHihdKOhNXj9pL+gTH4Tx\r\nPZcOGr8u32i7Pu+2pefd7VQCwU37xHiM32JqkFwFHFG2eXY43tFbBOsIEkws\r\nPzsouUURtAwnK7tD23tkos+INH/LGnhAf3ERHrYQdqrOHtxQlXY+7EaHd4Vy\r\nOQSPa7kRgsu3mz/R8bRCIHGKAzkNhb6MHaJYTCm5OFBCUAA8JBDshKyslSMR\r\nBWlIiPnK6l1aTOrUW/GzhMSsa5jiy0gClX2Slw90UQAN4I6jSKhg6CE5v/mK\r\ndunlN6UgQj4+1slwfWaCQh4uZjP+shoMgBU=\r\n=W7qM\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230116190134-2c405dcd.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/e90ad894861682424c847a869f4d887c/graphql-hive-client-0.22.0-alpha-20230116190134-2c405dcd.tgz","_integrity":"sha512-ywcJ48H1pwnIQXDfwTcI6IPI+TIRunqlApvorrXwVwnXkOKx1Ujx6+sVDdqiNBk4NiOwOHwSTswHVeCROXM/Zw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230116190134-2c405dcd_1673895736814_0.0004543349888284087","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230116191612-840352d1":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230116191612-840352d1","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230116191612-840352d1","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"c1507b8fec8edac8753515c6ce67e939df3e1874","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230116191612-840352d1.tgz","fileCount":60,"integrity":"sha512-GcRDEPHZL43bZNbH6/PyXYmIvvC9U98VO2vH/EBOyy6rUCET1EtOKdgkBDUQf2rp3TGjNWHltQdSZtqY6DzdrQ==","signatures":[{"sig":"MEQCIB7QqxY9/2YeUxPiVL9gfDArYqgYuVx6gjDTcX9iptjmAiAEHE41DxFX1ncjToCg6A3xQO1i1AK/zQznRXkJLLmZuA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169649,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxaKgACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrLNA//RBmkN+mtTTuTzHdIABoXdZrUouJhGSPfu5Ue3ZMY2xD2MrkU\r\nmqsZG2DVczpyPvy7XanygJW6tqjOHFdn211FbGKZgDNkPG9n2quPOVy03Czp\r\nmDtLjDpTwekffM9/bX0oHqrALfyxchB9GAbjaWydaZtSzg6da3rjI7XRaGaL\r\njbmScx/lgPZ3WnBBzbmsjNujSptJqknyVtlkq7dxl8k/fZjdWboz9wi+/NoE\r\nerQYPmvNdGw9h6jKyLtAPht6+Zr7DbhP4Tjcw4cxLlb2BuH3IT/dE9jv0Ngk\r\ncoc7+UBd/M5S7RR+G82oIL8/kBaR6kHBeEabGTIvh+TiqK6M2tlyz6TnoHfF\r\nmNYXzU8++pEpaiyHa56YSBlqHhGy0eJW/9l8tVCS1B2xKeK7X7B1xCK0O0fe\r\nMY/MyWpo5DO0TtGuY3i3UnGiuIU4TbV0mGfsuKuMtulznJzLs5h3HsDI6SkP\r\nSPjOpuMI+WSDIeae1l+yQL3zVJVHuy4SBwJhhXOxtDaYA0Vnigl3iCcZK+UV\r\n9TsJ6KFxp094ux5fI+1U34Pvl7sqBSWW1/flCXWWtjWkSxpxaL9RfAsMdJ39\r\nS23/6VeiiVriF1LyZTgGDtiSw82tkbXdGM37LKGfw2cwv+82Cub88R+qSS4V\r\nvzqTWKU2zXCu+Bkmc6/0IjMLS30zRN0h2kk=\r\n=D7dQ\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230116191612-840352d1.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/97a0d0487328df4fc9d72664da64b72b/graphql-hive-client-0.22.0-alpha-20230116191612-840352d1.tgz","_integrity":"sha512-GcRDEPHZL43bZNbH6/PyXYmIvvC9U98VO2vH/EBOyy6rUCET1EtOKdgkBDUQf2rp3TGjNWHltQdSZtqY6DzdrQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230116191612-840352d1_1673896608389_0.4659616250662104","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230116195953-1b6c00e4":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230116195953-1b6c00e4","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230116195953-1b6c00e4","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"16dce532782d71d80f9aa8a3673d757989d6ef91","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230116195953-1b6c00e4.tgz","fileCount":60,"integrity":"sha512-+8cLjoBr/OX6Ai83vMuviBbCr0+b60JpewYj60HGgAYPqLpRAI/LGTXbUFBBTaKaCkwDKwl3lwtlMPiBWfe1uA==","signatures":[{"sig":"MEUCIC6kkTG0EEn8ZuPHhuhKQ6sHUGtIMjYAPjHFSDn/PBQhAiEAmuO4OcV5pMSKAdGoCUyTFb9OlWGty63Ka2J+UUm4UBc=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169649,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxazbACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqOLA//eMBrm+ygR7iP4dRt9wRolA9WpGZcYfMo9DbDN7QjeSHi5WrR\r\njxjaa27Lo1rGkJhD+uaxfieiio04DrDm6I+C6vNWN4OM1ip2sX2vKv4kvplP\r\n29sbL62NCMzilif8kJ2jQr9OvlPkqFY1O0S4eYdwXyMAtCGGybwA3HPgAtGv\r\nNK/Hqk/Adf2cKlJT+pyJtE9oo4NQ7mmqDK65Tc0JTagVXOctwQgEcTwdqxXk\r\nVcLAzJ61ViE+r0iHgyfjauoS6XJWEsoUlh+suKhPDLJ3mezeR6t6nBHIYcLD\r\nJInFA8UYG3o5rtuhmJAiY2Vr9SDl4zNLuL8oVF02LUf4WiQpuuIhSCPH3hsc\r\nHOP/Fa7fkhTUHn7trW6wGvr1ekw+YB0Ek9Mjv5pm5wRWduUN0osrAuE1g/dv\r\nhbMkqbORTjpv4Ar34pSPjPz2jZvnR+y7RTwAJXk+JCEkKDhwZDQ27S+LOOlj\r\nwqoRYgRRkZgKj3EXJTcFanjZKiK59lEXeNO+4U81AYoCjoP5sNRWTYTJeg77\r\n92NMYuqmSL7G2Azgqg64NgrOwdKSJOOAWqBKCqxEvpOZgxUv+lEpu7DjpBtH\r\nwZ7x//3LVbeeMlgXzvXubEqsHgpaiR4X1PhDh4UHbL9Hmj19vboc9QMlWm63\r\nOhOAYEKNx63E8aehMbCjiSTxwXqoavUWErY=\r\n=Vfj9\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230116195953-1b6c00e4.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/b2208df3d552427a4c7b3ca6e4a2a90f/graphql-hive-client-0.22.0-alpha-20230116195953-1b6c00e4.tgz","_integrity":"sha512-+8cLjoBr/OX6Ai83vMuviBbCr0+b60JpewYj60HGgAYPqLpRAI/LGTXbUFBBTaKaCkwDKwl3lwtlMPiBWfe1uA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230116195953-1b6c00e4_1673899227037_0.6087615374793631","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230116200037-611153ba":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230116200037-611153ba","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230116200037-611153ba","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"3f08c730b7c3f13f82d81bf8e98ac95bae4d3525","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230116200037-611153ba.tgz","fileCount":60,"integrity":"sha512-BipI3UDW7fls6Mm5BFVYceMYY2T0f1eGcRMtZ8fai4vwSOHNIDX42j3h1dlrCVm8EpBXNq1gyUd7NgwvG98dvA==","signatures":[{"sig":"MEQCIAnwfN0VWJjzzWXO6SaQlumvOCGSdKbpN6AQAQUJSIoYAiAq40AFGi8MMNF7xYZDKKNcu5ETwmo7Sf6fISQpOfBKEA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169649,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxa0XACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmoq8hAAoUGcuLvztQJjsRBbh2tkdrv5u8DciJvbwap6qVYWX6ckfKvb\r\nCwviZBDOdBM5Ph6/DrBpreEbQlMwslSbRs7CgOwxHejHDI64rMhUb5rFrgI7\r\n8R+R+O/kaPOvPh46UoEPpCHfE2gIUg5PPAxnHPn+qHLkOfoWmCP/EUdPaNap\r\ng6CzvP0hHLEY16f2DHLHDlR5iizZjrozvlAfs5QM4UQBwQ63lSboZaQ0iG/8\r\nTbsQ8RyHrFCBgHJAJ2r5yR6x8HWprIFSwkQcqNJUM1PNmJgjSpFG0AuYhKKv\r\nZw/OCtn+HUtwtmr0M4dZbrt/FBUWTyYkE+5Oe1v5W3HpZ2duLzAV1sr5MKCQ\r\n32ToGjiwJiyyva2k94TQWJ69MZobTp0v0TtTErTdQHWAkl/UYA6yKLZ+N+5S\r\nkdLdoSZpIWy+8TexvzrnwfYlqnQbkyhX5bVPI+HfiFzz0zIrTK8fo63jrqqj\r\nZnxx7oNOOS8ce8eQmEOsZuzFsfpJlewfMFD+IVrqHpGEE4jQ/ThIaNtYbaNI\r\nHdwik+l7uq2TN/TCZ8QULHTkET8U66itpPS+LFHOWTOWhFS9fMWVA5zsCykD\r\nGwFdjPI2kC3pafLp5TAzBhlz2wVrvDOV0hCXZEJMwCjdO1aptheepePy0yyq\r\nAc006p3a3II3BGEdRdyG1X4MufhN1Nk6jM4=\r\n=RbRW\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230116200037-611153ba.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/114c5418917ee60ecb5a2c3b021e8fbc/graphql-hive-client-0.22.0-alpha-20230116200037-611153ba.tgz","_integrity":"sha512-BipI3UDW7fls6Mm5BFVYceMYY2T0f1eGcRMtZ8fai4vwSOHNIDX42j3h1dlrCVm8EpBXNq1gyUd7NgwvG98dvA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230116200037-611153ba_1673899287353_0.08076323186407186","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230116202532-bb077401":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230116202532-bb077401","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230116202532-bb077401","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"bd6b1c68efb8af5cd46660c997503378b16eb332","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230116202532-bb077401.tgz","fileCount":60,"integrity":"sha512-ekRwZEjZhduhlaz9URTWJH0OEZT6bFsd+0NMCO6QaHBDvGvbpnK6Sc3uVsjpexTlRep43neGObUzJygSpNmH8Q==","signatures":[{"sig":"MEYCIQCfIW9r3LQlFLhvCAFWi0QBZ5EHuEbZ+4IiuB49tWdx0AIhAN1a1pIh+08rniGLLVf64pcqdfUKvYy9QdodiNpzt0at","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169649,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxbLeACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqjnQ/9GpK2j/QTalw42azPWwzT4005nKuxDlKuJz68fc7m5VYjSWkR\r\nD9iYsHOkn6I1jA6BLE4susxaxX+wSLXaHXOKMROS/P85NSPDC5b8t8sjhHVb\r\nYJb90m1jzpFXVTL5zGjyl247fyo+lS/1MeoNE+7TKSFr1DbutQjJXyZdEZXk\r\n/OH63c+fM5jjR+iUGUawa8nIenV7hF4q1fbMk3TcdvLhIs/knnVQLbEmfo5r\r\ntmXvQ2QjXkQaS+wIBhavDPdzgE6hJmQwxXjdu0COB119ohqEwm/dz6GzdNzo\r\nq4auiMeJHO3KsIEzfUbjvWgpmEgKYtggYvv+HnAvUeeRI8vCpcJC1TWW044z\r\nizKYpPrghk+Qb+wGcE8tWDyTwjFB/luNFrVJmt3yLfTVLEaIr/KTAk8wGXwx\r\neO7RAGgOehK2z/uI6vY/cM8fkEhAcU/LQ1XO/JBBU7WZEIl/ZQWem5pJEMme\r\nQUmhmDcqx+hKH4ELL5UGfBasEfAyJYFO8LVKgfOvIXDwMgEowW9kcy2L1Jy8\r\nW9qKkYaxrZOPkkA7NynYaDJ8SwHHydVzHDtuQ8mBQsmbMz7tEsMYx+zkP+9N\r\nrK8H0J0OAkRDfoSf09KR/KY0Q7qab3SkaeRyx2zUh4QTp7Cd7WD186tSzwEV\r\nMFMPjk9Ykuv08IxBdTLm0A7YOFn1DhMabuI=\r\n=udYj\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230116202532-bb077401.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/7f138060678606c21c53b251a35a8e12/graphql-hive-client-0.22.0-alpha-20230116202532-bb077401.tgz","_integrity":"sha512-ekRwZEjZhduhlaz9URTWJH0OEZT6bFsd+0NMCO6QaHBDvGvbpnK6Sc3uVsjpexTlRep43neGObUzJygSpNmH8Q==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230116202532-bb077401_1673900766679_0.02387074610636386","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230116203526-7abd41a3":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230116203526-7abd41a3","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230116203526-7abd41a3","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"356e1bc17d5d550e65aa919f97544534fc06a492","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230116203526-7abd41a3.tgz","fileCount":60,"integrity":"sha512-7DXwi34eDrACpvyeznbiv/eWq9Lrw7OwEmXewXNUu1XU1r2VJ+tBHmSWdORBroloPqtOKGzChBVrnxEHE6XdTQ==","signatures":[{"sig":"MEUCIQCK3VVjRPM2MIFm+g1QB+5chg4tjH4G8gQP4r+PzM5lzgIgeKM2P5zY5qSFbj5BwyOzf8GvSZGDVmh+MaVOhTb2GdY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169649,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxbUyACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmogmw//XQUdGwqQuMiAZLmv7yTJfa5oyfeBh+W+wskAqrfwLo75fTQ4\r\nYOdvU50yl2W1pT4B4r37vtRbESLA+EN2q+gfh5ZBAjNj7/dDu1K9OaGMVThS\r\nMZnIPmygCA+WK0HZu7j1sFYSKomz+Tbd4UpYX3stl61V2yivRyZtH3UvWS0H\r\nZK49kuvbljR30s5KrRoi9xGlkC/JesOB61ebshPUoLpXKGG1gW5z+k+MwWJg\r\nR356cWg1zAcHuvOFuLtWqFo7V09tuKPJWKp6sV9Uz1eLXeUhfRRotTmWEH3v\r\nb/ontlbxoPUbMBqf4LrlxvuvKoGM+2YU6kQpUJ/4sk3p1b6wafF6+DsomGEA\r\nf5gkc+w4WpMclWGxvRubqGPrPnyyzVCjnDElNicXP2UnBw1fqr91eFQzozdL\r\nym/p8uIbwHzf6+HSQYk4AlqyFUhAcm+b5NppQ+ZhYTOv/V3ILcEcRAQqp4PB\r\n2YvdYwCpG8Jg5QftXm67CLeeUCfILhShoVMPLnpBB21Ganf0UznDYx0H7abq\r\nUD7qphUSBTshqMfRFTBubEjN/H+EC4NDsgDaXZG5nX7Te9tHcxYRfi7Liv1l\r\nFqxEl4eCJgdXhZrub+cyPG7D3VuQSri7Wl9cIxpYSdq6osDhhBDH0zebnfHK\r\npvX7zbzgYG+ssHNy2+Zj5sXEDGl/GfLPL6o=\r\n=JTUo\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230116203526-7abd41a3.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/bcf80c3529e3e57746911f36e8cb250f/graphql-hive-client-0.22.0-alpha-20230116203526-7abd41a3.tgz","_integrity":"sha512-7DXwi34eDrACpvyeznbiv/eWq9Lrw7OwEmXewXNUu1XU1r2VJ+tBHmSWdORBroloPqtOKGzChBVrnxEHE6XdTQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230116203526-7abd41a3_1673901362040_0.641934800570624","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230116204613-f6f410cd":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230116204613-f6f410cd","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230116204613-f6f410cd","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"6fb5ee660426a9c28d2b857c77defd06cc7e3950","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230116204613-f6f410cd.tgz","fileCount":60,"integrity":"sha512-ZN/VKPCdgnfaYn7NPAD9WUMuR/LrDRbJaWZmrWGXIWn372heurVBTkq9GmShcgfscKsFutUmzjouloHd31lzmg==","signatures":[{"sig":"MEQCIADLSSM60/7vP7+QZ42R54SwOBs3R0i3l0Vh54YNNAN3AiBrdXB3DJ0s9au77RhsT6hKXhatDoa62XiDEhXNEEOYNw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169649,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxbe4ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr/eA/+KjfcW+ZDdA+cOVlCXLQr/IHgIOLYbxNkmW5i5OGo2X9jMuqA\r\nIM/LW+hL0iQEyzf8VPUu5Xq8kc8foI51a2ly/5ZjUQhoB5n+WWdtlvR2r1SJ\r\ni6Loqxgz3yhZ0y+ybPaUwe+r6IG429Mu3EMdZkVR36VIKv+FZlgbQLe5GRnE\r\nY7wd+MfabkcVb1XWQeAOX+1wX2GPgXTrsOWNo5UuMn2ODHx6qfTXVVd8dq5D\r\ns07DWsjjClZYdPL+3fFbDEDiYHsHiabBw8Poh7PXtoyFOPqM7r904jPlGSDJ\r\nc/CLIMHuKALcuRkmr5eV8pGk//aZuCaXi9ZpCTYzoYQ2bYvMb6NGZ9ulZgH4\r\nxoPMxgiIXesuKNAdC8yQjA1I1bo+xRu7Oq+h3i+k0AITnvnL2XjiafeqtbID\r\nPoO4DGvjI0TNTHSwSqgAll8kg8oQZJtQ3inJNP0YpxwP8GlntqtjFTibWJrQ\r\n/W2RkdmlHJOEbyCPCn05ILBUwoIZBe9GxNapWhJXR5J4fqiOniGy+5ZbIIwD\r\nWAf31LJb3WpcwMADtO4oe8Ae5fuLy0WgyhGrx2exMPspsYUAdtZIBC3bJRKY\r\nWhAB9vsn//K4+fH64NTfp7xBPMvAuVdptTINkY1uOcXF0cNyykIygbMg9ftO\r\nNtARszZ6myvej2ZUu0yK9TLq4inPgEeMJPg=\r\n=vXUX\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230116204613-f6f410cd.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/fd4ea10bd275771dfabfeacbd967a88a/graphql-hive-client-0.22.0-alpha-20230116204613-f6f410cd.tgz","_integrity":"sha512-ZN/VKPCdgnfaYn7NPAD9WUMuR/LrDRbJaWZmrWGXIWn372heurVBTkq9GmShcgfscKsFutUmzjouloHd31lzmg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230116204613-f6f410cd_1673902008027_0.8817851077100622","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230117010919-61820ce0":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230117010919-61820ce0","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230117010919-61820ce0","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"2b40c4af84ec54a930ce6c7551ea5b1ee6c56fd3","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230117010919-61820ce0.tgz","fileCount":60,"integrity":"sha512-wuIupy69qgjhr7bBvRfrIV2FALU8WECT9tFOcheBRCWuoL5qllleLOAADqgmy/5O+FepBcb3XLsfWx9xRkT5FQ==","signatures":[{"sig":"MEUCICmnJ/Isn/gX0vMJyrnaVzxcwEp/dJi2QrowUT/EcxbHAiEAsQ5/wngswl/UyA3QbQI0wv7tfdfBdTWhl1MyDLmYLmQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169649,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxfVxACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoMDxAAioqeIDryOaKrMoFa4jTXAvlDps5nY0pR1emuCIcV5EBvGx7m\r\nRI7WFFnEjGeAjk4l51YJzjBLQMPz1ih6gwp5BCEdV4E0xGmskEcWjA3hpS5I\r\nY5FMOsE44YlZZbKB8x47ODNe/r4BP6zV4+CzKyYnxuHcRIQOiNoewq4zII0Y\r\nSSyBCQz5AdGpsF/IXdbUk744S5uCDWA51/+gXo2OtC3yjS9qQPq5HMhJI74l\r\nfrdLzZHzSUo+wRwetZnvPQrqkYvao19ZkyE6p0qwQzHVnX41+C/bPsioKtPU\r\ni6GlYYgj+BJHrxpOgEFbIxgKbRWEsDsnT4eI2BN9+8JmlUAFi0gStn03qCA7\r\nWvndnbg+f8MXkjLPCm3sBeUwUpNEXKgUmTL0BTwu8FA/OVUUWRCiBMSW3NL2\r\nEO98p2ZUvE71z8AfKcAvY08k73uNv0BwtHH8OOBNpR7WacldRoPPc87QPCvi\r\nrImufDMSdQZGE1cc6fACxNzGe6CiQYa9CuYDkcJhK1vKfFG3WoDgrSc8YhU5\r\nHGBPTVuyzsI3gWZO727Ei7cxSPCulVlwcNAxUSpIb1qf5w2tCPHMqdzHy+qj\r\nJAnml+bbyh4IUdfXPN9GGgjI90flHx9SHCCDa0Z3eaPDDdCf50BC9dOOXKMs\r\n2u9XWF2ProtIpfqCf+Yh1ey0S/JviylrQtg=\r\n=9d/l\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230117010919-61820ce0.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/1816b526d3842189e9c12557665a9f08/graphql-hive-client-0.22.0-alpha-20230117010919-61820ce0.tgz","_integrity":"sha512-wuIupy69qgjhr7bBvRfrIV2FALU8WECT9tFOcheBRCWuoL5qllleLOAADqgmy/5O+FepBcb3XLsfWx9xRkT5FQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230117010919-61820ce0_1673917809305_0.4143356587670577","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230117011032-c3ea5ace":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230117011032-c3ea5ace","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230117011032-c3ea5ace","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"0f0c31dc5776c2c7c9909e8966e2c8ebd7637ea1","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230117011032-c3ea5ace.tgz","fileCount":60,"integrity":"sha512-90P6sY9XCh9apaPXUTLjyLH3vMO3kccZzOT3zesObnLpk8V3MRtYLBfh9OqOLnVbaLeQpsC/9RHBpYiZig0EVw==","signatures":[{"sig":"MEUCIHFXhXfTiOzqLCc4BQZhkdrllpBSRE615zN7aqE7dojWAiEAy2qr8SbZxxiGl+iLJ3ubhPYwv+AM6Y4MF+vbkYjwZCM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169649,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxfWwACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmos3hAAiFauGrasMdPKeuBdCimzRRPElR1vCjTBbpuY1rJwqUeHo2aE\r\nbUa22j2yB21JYrFcthDvRt804sX06vLZATBjJpxes+AUpsONbkNV0B9RI2Xb\r\n2pPCSLf7CJXtQscWlebaDloKHOn7zRxLoppQQfGck7QprzGDpJrjm3NAXNyr\r\nHpuzKhOylWadeV8miryz8SE4J4EYtNp9Qq1P0vFgRBTUIg6KcI7UylUYUho7\r\nuRXu/0Hx5zA1XymrR0BlOYXNoSPM/bulZbWXHrtd9budlJpsAlr6YEKXI5YT\r\n9LrxaTBBPc/oqhKrQYAbBhWt0hYrRG3Ymiz1IVQdRWmI9BSae/zjZMsSgmKj\r\n++z27vDAY9aDs8Jxj9cg3q/tI9nEB/3kYrEP8r2z/02jvxT+ZB0yFA44uPNa\r\nPAo9XIcWCkfx2y4QHYAuaMJsbxN3lcB4oUdsAobFwJcy/Sg5RdvSFzHJvreg\r\ndpZgEUNigz4iRG0zSp2KiYoIL+LCNQ8ztt3VvagOsJwKduTy4KgzcYQ2Msqi\r\nAP2b5701Kfz4IS+I3Coxmynaxx8/tlPn9mmBYXzIvtYXUkYpORv/liEehBt8\r\nOUMka8EHbulDmC+V4Km7Um9RjYWXB0IeN2GUItKeLwMZyUYwQZTSLA8KV4jd\r\ni721/jHe/bwRf1OnWNs3GaGX8KHPzczl/sw=\r\n=HKW1\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230117011032-c3ea5ace.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/8180cdf6fb733672daefd6902d61e0d6/graphql-hive-client-0.22.0-alpha-20230117011032-c3ea5ace.tgz","_integrity":"sha512-90P6sY9XCh9apaPXUTLjyLH3vMO3kccZzOT3zesObnLpk8V3MRtYLBfh9OqOLnVbaLeQpsC/9RHBpYiZig0EVw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230117011032-c3ea5ace_1673917872796_0.008960120787927961","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230117042550-822e1d34":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230117042550-822e1d34","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230117042550-822e1d34","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"730f4e11089c8c82b95d735b5d863b1cd7505ff8","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230117042550-822e1d34.tgz","fileCount":60,"integrity":"sha512-6kAt9SmmkJTxwGg7xXWXeKETySt5XbCvw+lgewal1SRqDRSv0jjTROo8+BFIoC7w+jYmOOPo1nVHqKUBJxfREA==","signatures":[{"sig":"MEYCIQC4ORZJkm0316CU5ot6W6ao/T1GVpbhupTgfP4FUQP6SwIhANBTXXTx2GVtD4tBWcrFBZrwH9gGAME4XoliVvyHRIDy","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169649,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxiNyACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrBZBAAgoWdhBT3HzQl6akEgnJXJDid5UQTyjiEf5690hvFJtwSpDEd\r\nUJirKpTf7zZfJEh8zJNbRwqavr0MWb2Qm89d2YspHdtje5MVcHDx4e6bSyY9\r\nsilvkpTqNs6nyGGal0dNySEoo3b4e3PS+gMZLHZKLwZi2XOx18AU77WNJOlT\r\ncE21Zpjg/gnSA40PoD9zqR9zjg8wxqiXTV0Q1ccM7xpO89HTfiAHqddgi+c2\r\nc9190swSBfRpUEH/FPExY2jfJUV0FFJI5kHIhHXY8Lw3alNMyWhBckj47NMR\r\nEubsXRO3ksp7iBJHYlBzXk3CxQCMFSrh/ek0sGP/0HaPIaa0FIisobS4o3Wq\r\nGqMwL37edOzA4fg8WkhWVQ/9w2ZrRN7k6iF+RFsCgUtTcqw2vqUoKl1rciwL\r\nT5+WjPODU2TMTYctPI5fGqB840E0zG5SRzqssL3Em6a2xDLYEdwgQFofBgEs\r\n+pB/nVob37CT+C67WwirSLBN88LGYwxqIyKQfJjmFOBSTZ3VVzGhDRYcf+8H\r\nWcQVdjEZzrKsQIUQalbzxiQI/J4DwV0eXaW7ASj2H7TuA0ZMoegXY2X4E7Jr\r\nNerlrsxBBSnmkgSl5G6ksDhbaH2J5Gvsp+sFKOEoiEG577MQ0yph/gsbYi/L\r\nufTFSGdiRB6YZfw0n06bFNuW58T+2BccmBQ=\r\n=37Sa\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230117042550-822e1d34.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/566ac16c086cc149131b86bf876f488d/graphql-hive-client-0.22.0-alpha-20230117042550-822e1d34.tgz","_integrity":"sha512-6kAt9SmmkJTxwGg7xXWXeKETySt5XbCvw+lgewal1SRqDRSv0jjTROo8+BFIoC7w+jYmOOPo1nVHqKUBJxfREA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230117042550-822e1d34_1673929585753_0.12238650347363622","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230117043059-b4092e43":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230117043059-b4092e43","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230117043059-b4092e43","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"feefc40692da5406c1950ba6c8884a3179539687","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230117043059-b4092e43.tgz","fileCount":60,"integrity":"sha512-XevrMvVIsJrpTLbi4CeIsXq1JmEiX6JhvwQhfa8U7mzc/DZ1QhyuHEMdtgDuXCW5b10fkSiy/lYLZpQOI4DzkA==","signatures":[{"sig":"MEUCIDfwPS2U3OtjeQYPtsXJKXh4u5aFnCmLle/s2RJPQW1tAiEAoE3jkhXvLDHHWlf8nxb6B2+ZZkkk3eUXRki4sXirvmk=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169649,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxiSlACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoTKA/+KZxhfc+w9pJiTA2VlnN2PvLwe1PC7rchQ6OAXhIxDL/Bc2ue\r\nz4mJzCCO/lumz2kRrL8EvHPypX/FBIu8sq6trXm3zfKt9zj31MQwsGqAT8/A\r\nGSjKGYx4N6/6WryHdN4BOHu3if6tSeLWNUTbch+ZebSFIQy8iNmxRXjDpULw\r\naSVvMdW/q7QBfOfyDftwwD9J0+DQmkkVqD45XaWNsUgyAKBddwQKbDTidRlR\r\nHoo6rmGfVORGssBAJGjNlJ7L2aTGzFq53Krqx8bjTRN6C98QUwuknuAxfPl7\r\nP/lCK8nnsHwfUq01GS/u3QYQjoVyO8L3B6X+QEd9cxxLVepoMQeB25VF0J2g\r\nXKucMqR696YHnsElxwPaqeJWrI6th2aWf71oLeWBhP8Glzm6thyWENAxLE5w\r\nhh0UZ6x6ZtewoTzp7lpLwLNha8mcIm8IyZahDc+jgGNZ7DrtV3a6+LWt0LfM\r\nNlO6ylIe/SQORl3Mx0o1auahgBZdl00Zb6qrcoSChryF8yaZmi01KYBFOvcT\r\nFnLCMDeZNzla68jTw2xcKvpwPizAXYG806iNy36mB5B+4I/AhC+IcZIf1Gum\r\nE3zAdWI9buaVEeBunTD5axkmrqGnJiSPpks5knBszn6tXjNjuiD93dD3g3DM\r\nVhfe0ln889KdnRgdAN/JX8RraxExrLgyjtI=\r\n=SZX5\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230117043059-b4092e43.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/ce99ef88b62a7693b480de1c577ebed5/graphql-hive-client-0.22.0-alpha-20230117043059-b4092e43.tgz","_integrity":"sha512-XevrMvVIsJrpTLbi4CeIsXq1JmEiX6JhvwQhfa8U7mzc/DZ1QhyuHEMdtgDuXCW5b10fkSiy/lYLZpQOI4DzkA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230117043059-b4092e43_1673929893177_0.010377509220103054","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230117075639-2e02f6dc":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230117075639-2e02f6dc","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230117075639-2e02f6dc","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"51a40a093d19e452631f69001108fd4aae16a5ac","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230117075639-2e02f6dc.tgz","fileCount":60,"integrity":"sha512-CTIxtVC3q0u+DDXqBl9SE+ZnsAEMGjCA5UMWQgxEHXzD4supiN7qSjWrFMCtOrjqrM/P7y5TafoQ2JRPH+mdIw==","signatures":[{"sig":"MEYCIQDy5y9KMOmDSp2zsovAZ+YZkPOfJYjyHBsQf284tkbDHgIhAMzHwF7k5h6mGaLSnZaseTy8+cNdhUZiQGlIRXAlrmhc","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169649,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxlTaACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoQHBAAlv3jSBc/RECYkeniMrq3KFtPXlHNYUffpawXa1HDdTKhiB0X\r\npnzSw5E5hTxwquKDmvLDMNPDd37O5UL0I73XGVYYxxqWpa51/f5FidLTmNVw\r\ntqLmRIfN5yGdQuXLGt5JquOwswAyWjpSJX/LFVQe+WibFIqLmQt6l8yp3kb1\r\n3uhpqHONWGCW/YU5kQ3XoyRZWtR2W5V/yZ2+OzJVm+v6DNqxAXVXjWvB8Zwp\r\n3EAuPZygp5Kq8B9sC/AqLUQ6Ru3peaUPyvYaSv1iZIoUNWzDxN6EsuM7hgOV\r\nVsXX7gghLIqDRgW//L+UczGBP9KoisuVI844NW78laPxltDsHoKeLsXSAjCb\r\ncLWFUiR7YYLkaQvkU3gN08Xhl6PeEWVLvAOXx5AJUM/0Kq83HGOqAyx/Qr9Y\r\nIR7OGna1JtuptTSNOX7ThuPXr9PUuSMWmwiw92/CWHXKWnduH6pKcsyaHh7L\r\nOnPUjgqLhokSwJQiUD3sArWLQOZU+Oey9di6HFJahab9x0A6r7+w608709lP\r\nS0hJOqpAjvqZ/xeyKt4L+PdJpti3+iuGA0Gfr73QvYrNVgJJ7TkQpbIK0ShQ\r\nq/d0UOSX21a0FSkF7TT7SovUC639LMaHmn3oN2HkidXvJrzGd+Oak5CVSvnl\r\nuphz6w+j55UQnc4m1dv7+qfDSbhWAkNfZZM=\r\n=hpQU\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230117075639-2e02f6dc.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/4d73544bf9c9ce1dc0ea3dd1ca54dac2/graphql-hive-client-0.22.0-alpha-20230117075639-2e02f6dc.tgz","_integrity":"sha512-CTIxtVC3q0u+DDXqBl9SE+ZnsAEMGjCA5UMWQgxEHXzD4supiN7qSjWrFMCtOrjqrM/P7y5TafoQ2JRPH+mdIw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230117075639-2e02f6dc_1673942233812_0.3507654336577173","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230117091419-8a0791ff":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230117091419-8a0791ff","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230117091419-8a0791ff","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"b85c64238e8b7f4bcf9b868380c5382c77abb712","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230117091419-8a0791ff.tgz","fileCount":60,"integrity":"sha512-aE+5LnK2HFMGgJBA4GOpVlUNECRVshlfLpKAIlUSnPmc6zUajV6RMsEP82PjYKLx6Hjwe86HNlIcIj1pK44XCg==","signatures":[{"sig":"MEUCIGv2/B65Q5A9GkZhNS5lBGo0wBCzrzZLKC3yq/dYRo2rAiEAgF23pp33MvJ33PtCw6eunnRESAC4A2r6Nm/iqSCGW4I=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169649,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxmcPACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrMuhAAlvBC9GCZ6s4sDFMHzHJ6n0LgPtXXbXyeemQciXNWO/So7rx8\r\nH7SNQgZjy4BSHqng7oMsKLEH7QO6tmJbyuoezEYqpIHMV4fEcKj+8TxsHl++\r\n16COHD6tOo1drI9ruXhL7hSh26T/0awffwZJ3L66NZBm575xNfXLx5uh+fvz\r\nVxS26/k8po8eldo34SS8hZrSD38hyY47+HcVQGweK3aBDesILcFUhaPm27UL\r\nAl0RoQpzxBOKaFKGb8cVJ8Z6seUVPhiELhOifWzaIGiTsSOhogoZSKs1UYuE\r\nN/qKglVLfBhCsvE56529eD759ux8r06sU7uoTVX2Cu9gXGnCmMAVa4zq9+WX\r\nFmlveOo33GDFaQbM7vWgtjCt00TzeAgn0VQPpBxi1elOYrLR2SDT0jo40ARj\r\nVsJ6F2hbylQZEZ3Ox3iBTgLXVlHOfahburYjcS/KrG2GWLv0pQcjW/lW0hmj\r\n7kHw1H3TSdb+e/BoyBsyskMGMZkusbh43agU/2gFoWd2qYbC1sx78UEQbCmE\r\n1DCP/hqJyPfwp2snJ9AooMIozsx3ap5Do21QRumNhZUbe1E6KNaFGA9k+30v\r\n94Zk9rj6MMXVWFQLxMasJlhTjY7W8V4vi/O8y2GbSnNznQemJck2PqTwKWKk\r\nDnbXwmr6KtQUuqv0wdGdgyxMG65b7Y/gfoU=\r\n=DLaD\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230117091419-8a0791ff.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/1228bc357f1484e971f9488f3819edd0/graphql-hive-client-0.22.0-alpha-20230117091419-8a0791ff.tgz","_integrity":"sha512-aE+5LnK2HFMGgJBA4GOpVlUNECRVshlfLpKAIlUSnPmc6zUajV6RMsEP82PjYKLx6Hjwe86HNlIcIj1pK44XCg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230117091419-8a0791ff_1673946894796_0.5802941506084525","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230117091655-d1c08aa3":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230117091655-d1c08aa3","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230117091655-d1c08aa3","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"9d330e177b98b052d874e40c1bf4b6dfbeded763","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230117091655-d1c08aa3.tgz","fileCount":60,"integrity":"sha512-S6qOnzJOjpgGjSg/KGjK7DYTpjlF+YcX9bfQaNwsFWKogP+y1UvpLFMNvBbtAODQkt8ew5mWgVMQ3jnAJSBDEQ==","signatures":[{"sig":"MEUCIQCijMq47P5McsYoGWj0924Q0oPNImojlTnzbt1Akmw41QIgTgRCWObFG3mWZe8lkRdnlHbjS/G8yZeQatNQeN0V/ys=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169649,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxmeqACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrNOA/+Km2LYG6YsWcrUIzX6HhJ76t7wjBM+70zXmdAA0VtcM+lRH0R\r\nQZdLb+Bp23nA+AO2loHUX/EsYDG+UhIVZl6WRKPkn3xYsA08gHc0LNSqN2LJ\r\nUzGBJNiJtZ/v+NYiwlVROLA3yTQApf9Y7jf7RghiDhAVKqxlyxoTPlmGDJbV\r\n/bM96Iyje1iFv5+5eJ1c2W/UNF/ahMPgDAZiXvHVmml0ipP4OkHPhKkDLqCk\r\nUTGVWQ0xMe8Kb61M1KkZNTtXEp60UYvihZGbyKP9ZWVa2C2KZArsQG/YDeNX\r\nkJF5nVVaMaLauCtTOzke5paob7XbHSUmxKZVIBkX8bhPmNX6vM/M6UtF04dk\r\nKxku4eDpzIg8pxLRTcqTucN/fhjWEpypUUpV+cp3r75z7iGgmFP/MbqQOzaA\r\nX5Ufw8NWio6+Kq7Ux8wwpbro1Edunnqb4R+72abru0TYwdEXuJV1lbr9L7RX\r\nDc3ZiUIPt/cqvhXaSvLk6IizzQSvFo4dskXLsSSXTnMuyQD58wKAD0XLwdoV\r\nPTlB8QYQcvaV9urecawdxZitlCqiZS5YBcvK+10q2PF2oxmiycCpUC6zrfij\r\npKf8+L8gXKYvBCKHdYWt0yVNGyzmzZnnkipV4Sd2EsJKQ/1H4BOPCOnYDZPe\r\nn7luhVuNFP4xVaCeMMkU2yGj2nhlTnJFQ90=\r\n=Hw8o\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230117091655-d1c08aa3.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/d0ef41d745ff426df2c296acdfac9911/graphql-hive-client-0.22.0-alpha-20230117091655-d1c08aa3.tgz","_integrity":"sha512-S6qOnzJOjpgGjSg/KGjK7DYTpjlF+YcX9bfQaNwsFWKogP+y1UvpLFMNvBbtAODQkt8ew5mWgVMQ3jnAJSBDEQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230117091655-d1c08aa3_1673947050144_0.8732124773530132","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230117092035-c26fc3d1":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230117092035-c26fc3d1","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230117092035-c26fc3d1","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"bf900fad86ee8f9f7732a905fd3b5cfc68c623e9","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230117092035-c26fc3d1.tgz","fileCount":60,"integrity":"sha512-qol6OLKOGW9SvxSYW7NJTlYsoQ6geoRKPqp6Z/6Z81pGMxxZVE2l93LmzaCP43brFTo2mtqQoLWtKl4sm8cS/A==","signatures":[{"sig":"MEUCICXSFLKsUjUoBVmSSCLS9WOcWuHMOKRpKbGwLbVYbuNAAiEAnEl8Gvc/F6Q3R36a5zUVCu6SFvPexwdmf28uUm/A4Os=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169649,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxmiGACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpJsQ//WvYdM0Xb8m1ql+TydbyoL2d/PrONSN+pQguY8bap70A0CFJq\r\neh8dgx2Hn9Gb+yg4XzINNPvi06D0i3WFrccgGHeszJs/y/CrGXbc+d4wh6SL\r\n56uAhxPiWfaSbmsMsr4RVAqzhpyEuv0FhoXDVRQ+S9/SZ0xiLQJfl65dPVQQ\r\nX6M/j8DfKD0UZTo1kBIAdHUeiZ5TJ30BoFx3PTDKy2reiAqgEKld26KEFTjT\r\nHTMRSS5Ri1WYnT5uOWFoN9kWJkFflZ8LsQBtilDHmep8cdI1mEkwO8FggAya\r\nbLeBCTtCX+JUhCJyGLppSbOFgdFYB+TrTa3zkp++D+RgJxk2/IM4zIju6y8S\r\nf38tbFnvdrfG8vCHP9s5AkEPtZWWEXyzPkPGGID8kp7qCzALguPcFMlLQd7q\r\nrucr18QJw6Qral2rE6tNNrUDhjhtBQZ/sfagY/ghxvqADv1jfRAgQmmRpH8I\r\nU8c54wvxGq02WAXVxRp3xEN2EWzaesXjAT4arDU4fE5X2QUvZzsdOsYqcFbV\r\nj0/94LlmUsuRwfo6cAaShnxklk0kwJTJFNXIXgsdA14zZtJCtevQ9tbTiOt6\r\nHFaej7zvUwvFnr468j+Y0xq27Ik24eg0868disyNTs/eh2wV/mdYGdbwbsz+\r\nl4eMH5Fb64Js8Zvd3u4Tv0qnATISxvKTXZM=\r\n=oa+U\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230117092035-c26fc3d1.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/1f1cc9f86ab36fdad8f68316211ad920/graphql-hive-client-0.22.0-alpha-20230117092035-c26fc3d1.tgz","_integrity":"sha512-qol6OLKOGW9SvxSYW7NJTlYsoQ6geoRKPqp6Z/6Z81pGMxxZVE2l93LmzaCP43brFTo2mtqQoLWtKl4sm8cS/A==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230117092035-c26fc3d1_1673947269817_0.3494920194182345","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230117093458-e246bc41":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230117093458-e246bc41","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230117093458-e246bc41","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"71d7a05ee1301afcf80a41296fbe7f0b2e1e3792","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230117093458-e246bc41.tgz","fileCount":60,"integrity":"sha512-xLxBw7A4w53JHMfvp83LDgjbuLqDiZkBUzfgLFBrV0+weEm6kdJw7JFy9gKuc4DksybCNsZBYM+tyfRSi584mQ==","signatures":[{"sig":"MEUCIQCrwIiF/+Tr8BKcIrJifihsJ+lA/tHY3xLNe/7MtuWh2QIgez/6cGRqFCdgH6mMOY2WjkZKbpUcMOAyBUDO48MB8sA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169649,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxmvqACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoLrw/9Hvv/pR87ukLWsOnHqiXtmbBvsTuBnirXtleRjU5IFmnISw5J\r\nc2WO562MRTTn/M8DXdxz+u2NkVTMhFDtXGwISJj48AlpXOjgceM87Ec//tNO\r\nAJ//70cCa+gwJvIHYgpj3v+dNvLwJRAG51Co0zTZPrdIO564tUKMQ2wVqTML\r\n7mPDisjtQBfKDbxocgK3Gh9IzKRnYCOevtkYhER8wL+nPzpldHeq1oSstEws\r\nr8gofTvk1VNOP+sIggaPxBm420Engjxog55hiUzyts5oIlkWfbZgOsPqU39a\r\nO/TBwjxmA/oCBFGwqi4j5FaC1+M8pj6K8B777Fdj3ugXSzFW2amk0S1C30PK\r\nwrhzYalrTethPSiNoN1A9nwr48yVlcOFEnUWcUB1bUcmoiC9F8LzMnAJQSwS\r\n9gACJjc42yRxwsmUfiXpeuPdcoOp7JpF0BiSuQp7n8qtmPS/1lj8q3484bYb\r\nL71R/g642gc1DhWLyJatIvjUv+RtaFpoGy9+LyK8B11KLWaYb+l+lXmiXg6X\r\nW105dobADLffnNH16VAcxA407sMaXzYy6FotM/03Nm1RKtygwm9TsjBj+npT\r\n1EsgBGJglJiyzRiUCya39jt/GPeRIflkfdV9SzER0YtHjF5ih8tuDEjB2B8D\r\nJv3zmFwCFZyoCadq8Ag4+Fauspqz7Gz9zgY=\r\n=9dUr\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230117093458-e246bc41.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/722c728d5b69308eed5348f09192a3fe/graphql-hive-client-0.22.0-alpha-20230117093458-e246bc41.tgz","_integrity":"sha512-xLxBw7A4w53JHMfvp83LDgjbuLqDiZkBUzfgLFBrV0+weEm6kdJw7JFy9gKuc4DksybCNsZBYM+tyfRSi584mQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230117093458-e246bc41_1673948138340_0.9623340997396559","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230117114320-584ada21":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230117114320-584ada21","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230117114320-584ada21","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"f667c6af347c5925a6b922538f12ac388b1ec286","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230117114320-584ada21.tgz","fileCount":60,"integrity":"sha512-ySEc69vbud8W1jkhsP9dztPim4MyEbOgzOnVulBM3IT+hPHh6v4U3I2HRfn+PWQFntZQt27gq1XAf+gojqv5Hw==","signatures":[{"sig":"MEUCIEIfPBYWpus9SCySKh+NrPAPJhJBD5b2FvkaVgu4No7IAiEA/uv1+LD+SqBzVEZsJPEEWg5mOrBL5EuUZSBfqOK0jOw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169649,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxon9ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmq/RhAAkOS9XepM68CBiLIbxWshhN0F8+IrphUP55qcENHfpC98THb7\r\nitikLEG6dZHGpTZkHjLfH/Y4KD2lOcVAQKhEvNuaKtVD7MWlVT9+Ox2kny/x\r\nDNLhD1HINHZLTxNvjbWWN6aXfJN0MgTGhVqrIT7PHTMuuA7JxVubg9/fRACr\r\nYler6/UnqTLqicwR6oe5ramW4uD+n1tfavjD+EUNeobcFsywJJFTBliMjCIj\r\nbmYe4bSMD4R4OShqLi8PDJSM46mtwZIsYGjPD8L/knMJV5sFi8aihVOUi+RM\r\n+vLiTiNVPAELfF03eaBIMro9JHd5kjywXt/9O75e4YHM9Oe+bmjUtC0krygh\r\nB5Qf49lyX2uY5oc1NvQeGgeamhrLNRihQ5q0DyYdCV64TxHHBIfmj+EcZO/D\r\nhH4jMrSYXo5hkp+aDaq9sNdW49XpUX4cfPZ2mdX7oCy1fXlABAdyG6CN0YP/\r\np9KoLYhHa1VFKS8xxi2pGgsMHRXWXAe4PrUtOEZWnqbBlL8PMta8/raxAEYQ\r\nBhgqZAGYIuij48hU8hVusnNttg5yKR5hQVXcqC9WEyvW0cg2LTqtofI66pTD\r\nX7gWy1ec9lagTBQvEvAiufRf4K7W5CngoTdHBfesLSHJ9fUxeHphCoSY9DPW\r\nbZUEjkKKemHIQvshlT/IjgfLXdfvQzhccgY=\r\n=6lYn\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230117114320-584ada21.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/e22b8854600ba70384c57303035abb58/graphql-hive-client-0.22.0-alpha-20230117114320-584ada21.tgz","_integrity":"sha512-ySEc69vbud8W1jkhsP9dztPim4MyEbOgzOnVulBM3IT+hPHh6v4U3I2HRfn+PWQFntZQt27gq1XAf+gojqv5Hw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230117114320-584ada21_1673955837359_0.10880845849538212","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230117121240-f70beefa":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230117121240-f70beefa","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230117121240-f70beefa","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"22ce0931392971a49299af36e66f3eca657c9238","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230117121240-f70beefa.tgz","fileCount":60,"integrity":"sha512-wNrGx2Dnsymu4kyWM3VpQ7mD4HMkNebczCUt2sxp1pMZn3hRTDqXzi3JnRZDPsB7m3m/h74ZLXukCra0tKpCcw==","signatures":[{"sig":"MEQCIFdX6Q76ROv2fRo7n4SwTfSlIASos12cZc7NYOJB6oU0AiBLaMrC5zfYYmRZP5MYvVXHyz0v9jmFsNimaiJMmhamtg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169649,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxpDhACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpBTxAAg2MC6yDxeoY7O70Ya1cM20Wmg29h4Xhgt6DLfHSksXjbe8go\r\nZ4mA4dgUsfA3ncwOv3g6wy19ppU92j/m11zBg8YofiK20OxwMhR7UgNvcK6w\r\n8vKlwXud1Al6no+Ta7WGo2uvKlPSh9HOEtWpPS8xjBHZP95lydBJ0mRzibjy\r\nDr/MvTiaAsDqnkajH31VHUahJafkqseV2agOGoQj+qnkPa8w1dUxPMASUAJ9\r\n1oImPB6vTdWw0eX4t3sCEDiV4XCoby3WFonydZU0lB22ccE8XWJkE1LQI8ht\r\nq9QRylu7lUVq1Wf4pE+Dfh9N1FYVymWvWhTlQpkROSnWpmA/P7pGksa72c5p\r\n+FqTKH/95isbNOti92YKQLuedR6nYPh/MmJXNNVyjQf7E+Wj94rGH/jTMW16\r\nIR2XuVoCJfIndUA4hcEV/2lvlQL4fa1VF6O3ROzf7AiK9H7JY6Lo7U7fe7Ds\r\n0LBjuCEyRziwFetNsvsasGNbw16SNZK0O4YVnxIUJwZxnq+pcQ8ap74QbFfr\r\nIbchWPzWYwiyGjbtM/8cjO6OWsO+MQeoMKvpJZIhJmGBz/edIONiAI5aICfr\r\nMUcgSxprRzC2oWnyvtKtqG5IvWcWQO9Y3FUUxZYZIbB8sQF8M2eeYdTtiXdh\r\n7RYAz3KIvUHpIqd/ZhmaUVD4LiNYmTrEArI=\r\n=8DPo\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230117121240-f70beefa.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/8010513ba7d2a60db5943152458f009a/graphql-hive-client-0.22.0-alpha-20230117121240-f70beefa.tgz","_integrity":"sha512-wNrGx2Dnsymu4kyWM3VpQ7mD4HMkNebczCUt2sxp1pMZn3hRTDqXzi3JnRZDPsB7m3m/h74ZLXukCra0tKpCcw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230117121240-f70beefa_1673957601702_0.7125416882239635","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230117122627-1dfcaac1":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230117122627-1dfcaac1","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230117122627-1dfcaac1","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"965ef8f4ed0d5cda023d86f3023d6395304b9967","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230117122627-1dfcaac1.tgz","fileCount":60,"integrity":"sha512-5pIFifYC+HlY5fZpIbcw05Mp7rdnLhZaNswJPqD/ZW6CceeV8wPBVBkp7bDl8ou6A2nvCE2vCX2LDqNngFX7Hg==","signatures":[{"sig":"MEYCIQDl+Xp3a6hlYPs/Q2snghGkrMKOVqPm/Lxnxpi+qtZAWwIhAMh/KMR+ITF2OSDDR/I+rq/3d/mI1/mSPbYgS2NJCMjR","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169649,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxpQWACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp5lQ/9G6iwMKf4WZX85LJBSJHtSpwYBZ3oig5tQ/gSSLWhgH8W4yi/\r\nJIbtZo3B8YsF0z5abLbdimoKyIg88QG4NExgN0BU7JrPQ3nPc/NVXFatk+T0\r\nxrJ7zgjdTDIHMBfn6yzSPYHwztJg0gjRbilsjqTIq3Y9WvuNcsrHYYErewUk\r\nD7kpVn22vH5+wpKD5NNV7aRecWQHXtJJX55Y+5ReexI72DoH9cY047WK/dMh\r\nr8vfbhJzH3NMNJEashsLCM41R9gvPtEyP8Lere9suEfPxQH2MFmnQDXiRlG1\r\nHKkPSZbZobregqNxEGGTh4QkEGF69JMKbK0t+xZEHNdre+jo/RgN+UMqsBeF\r\nuGZ3wW0ILWosL4aw/3F0p6t3tKWCuEA7CjhlT2LAbrnWKoMZDj+yKZUVB1vz\r\nZKdutxT0o5biMrcbh5UZzZOr0KSw1a8ZQZOQVIt8EfRUm+Hu2nnsq0kEAxpP\r\n24bJKz8jLeYVqYp1f68DGF7XS6Fp42FdZlus4Dey7M21/xlj8/bmmnRQILWF\r\nL9m3JRCMy2IsTKge3PHY3M59VeAh7nw7n+Ae5Y78JC0aWfrBYkLW7Sjjw2V1\r\njJ7B6lLpIW6jC1PpyUmttnM7HA1AGrYb0/uk7HJXdbi9Roqmz1oX5uzPpqLK\r\ndB+NBylw6mHixsSe1lM0+JafNLkXVEGZwsA=\r\n=VGKQ\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230117122627-1dfcaac1.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/786619634f4e24a15326c0e5430e47a1/graphql-hive-client-0.22.0-alpha-20230117122627-1dfcaac1.tgz","_integrity":"sha512-5pIFifYC+HlY5fZpIbcw05Mp7rdnLhZaNswJPqD/ZW6CceeV8wPBVBkp7bDl8ou6A2nvCE2vCX2LDqNngFX7Hg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230117122627-1dfcaac1_1673958422410_0.16646142440840905","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230117122635-2af243be":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230117122635-2af243be","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230117122635-2af243be","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"df92f42605a9a66b7cb99fca8a88116955d02e38","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230117122635-2af243be.tgz","fileCount":60,"integrity":"sha512-AXFDiOla95Tt3cMnPvIkBP2KLdL3swS4u9VnrIS2OZ5iKOy5bVVRgym2IFIQhRDUrvFAUJhwg3xH0DMsAPB9nA==","signatures":[{"sig":"MEYCIQC46Mf6Y198a/QK030ju38VyQusA/GG3oyTx4e9sjVxJgIhAKcJ9a6a3FHWyugvXBC7/tXPrkkURmTHJ8f717eJruL2","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169649,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxpQoACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqzhBAAkYfeTIQg5z4QsGJN7d92z2hUTn9E81FKIv+3x9QmQHfK7vrP\r\nJuHp8z1OeLZFCJadfwCNwYO2H2G0wSWGf4kMevII6tFfh4/uOAFuKn7rYDot\r\nhuFLvdTCBADwW7sCzoFI3Kt2iI+xxawz25O5YaNin90WZPZmR8EKwkuXxMgA\r\nyzyU421IqyBPx2DYQgt0MUoOcCxIWawZHxA/T59LTww01lN2tnrJg8CPyHOk\r\nquSdDOvChBLozf7R0haubxv9HCKyPM+aRvKTICBjzQb6ddeUBiRsdhEy9Ucj\r\npX+SwkWaN8WgYe1VBvQgSYcxZTFWI5l8GIx0XYPviX27FHuzhkk9YzOgLnlz\r\n1pLRWpCfZK5qb2qO0qk9wt6bkfLITJReOZ97bUtnYf4hD+UVkX7Xt67c11i9\r\nNRaYAyRViLuDGaFRtObi59EFonYa5K9sel6oe9gaHC8TV0JHAl5WvYz8EWuM\r\nhYp880gFroRZ9B0xHs75fhidjVHNYeOq76dYjwMmT6I+76LxlY6hRh/4QhiK\r\n52dHOV8WJE8aYijm0qjpKiG8eyAp//MRVjwPuGrgrwwgogFD8u82kYasFKlE\r\n3DY+3oQyo8vtqTqaB9fIAybVsasN6gjfYiny6zQstxh0N6M458HrJnyu/2d6\r\nd8rfmcZQEJOnynCg4me0SOmeYmIRx1I8ScQ=\r\n=9AE7\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230117122635-2af243be.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/5bc7bb30262d8743316087af98bd9a3d/graphql-hive-client-0.22.0-alpha-20230117122635-2af243be.tgz","_integrity":"sha512-AXFDiOla95Tt3cMnPvIkBP2KLdL3swS4u9VnrIS2OZ5iKOy5bVVRgym2IFIQhRDUrvFAUJhwg3xH0DMsAPB9nA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230117122635-2af243be_1673958439818_0.8847093634885217","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230117122924-d5711e85":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230117122924-d5711e85","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230117122924-d5711e85","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"63ffe0f8c1a0a038469651b2375578ebcae152f2","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230117122924-d5711e85.tgz","fileCount":60,"integrity":"sha512-J+bCKuoligAo7N5cXsG6Qm/KjYPIem5/PHXxqD+eNFog+XhMAkCj/4Vov1+lZDIAHYZMdrMO7sNnSip5hv1TTw==","signatures":[{"sig":"MEUCIG9Z9d46wunC6gAj41UVrxBFaJ6cZKn9ePcISF0bKpiHAiEAkEXzBLsoArnLF7Hl6HYbVQjpNhJz4UeoIE2BT4euuEM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169649,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxpTLACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqRjw//dfwBRWITHwsKRHHmeVWCD3Oa2zw2TMLUQnXo6+Il74Ygl4Iq\r\nlOrolQYV49iVmesWnNSsgzcCnEmCKlwf8l1iGQwqNOkx4tlbGybVkO+ktYJj\r\nSOR7R3KEzN1JZ/35cQwjvO1BkFkfv1/Q8329+7s36pNfJpbush1MnBNI+7iW\r\nQWAeKMRpyUxDvlqzDofV3Owfk81l6hSe3tnt07CvV8cUHEQ509fJq3PNV/eS\r\ncL+B8nbJ5V7Ksax2Jtw/MubBNA1eATyIoxvS9n91so5Fbt0Bl80jOYZZFNNT\r\nzWMkucPY3ICCVbA75b945J2xHHGjbtKxg1d9PP2XrleOwduS4Z7ENXPlS9Jh\r\nr6llvgkMyHcgQqACVBbOlG79APXypIxoWrLLHpp4UItILDEtCyzmIQvBN1or\r\nDpR/fhJZrdws7PnnWvQuHbIuTdcij/ThzUJp/Dd3tIvfjTid97l8bbvXrZj7\r\nmsceu3xO531tCg0Xp1XjJ7aRcTLlaex0HiJYduVitHfvp6v4WTR0KUkpoTt7\r\nCqjguJkl0CcBCq9IMjKucBvEJ7+ikgJJdjURLt0xsQCTR3UiB16hBxz9Qp0h\r\nt7HlKVq7AFU/YhvZ2s0ppUCO2yf5F/y70cbB9k0P5k1dp9mRa5LyF0DzWDiM\r\n8lXiewBACYctyU9ljZyWSbFpP0O9FSsX5Bs=\r\n=u71F\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230117122924-d5711e85.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/34162f17258b40f341397551a2d283d7/graphql-hive-client-0.22.0-alpha-20230117122924-d5711e85.tgz","_integrity":"sha512-J+bCKuoligAo7N5cXsG6Qm/KjYPIem5/PHXxqD+eNFog+XhMAkCj/4Vov1+lZDIAHYZMdrMO7sNnSip5hv1TTw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230117122924-d5711e85_1673958603610_0.7681622500860315","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230117123422-cecca3f7":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230117123422-cecca3f7","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230117123422-cecca3f7","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"321b19fe9740e9d4f19d706b7eb188023d73a2d5","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230117123422-cecca3f7.tgz","fileCount":60,"integrity":"sha512-kQE6VxEN7CJVc3s4qwRWkk2r1DeClWuZlBXiCgo38r07sv8IlbuZ8MHFP5AALmKCZbs2mwzlY0SMLRETinCM/g==","signatures":[{"sig":"MEUCIF0frK17K1Hwm+WggACs4tYdrATb7CP/yjzYqKRLVYTiAiEAgsK4Gg0HE+ppSjc6ZsGYD1yvICZLbgaszShyL1K67t8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169649,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxpXxACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp8aw/8DUZCLrfJxQVxqZglAdcbZeWITHczxgjDPaJfIHNWWqITMdAz\r\n/KYqF3thLB0SA0s0uFrQv3VjiIch5Ykbn0318Fgpu6CmpmB/B7U1xcRDSUSD\r\nBnbymUmyOBJZ6HatSOk79DrsyCJvGrfgbTzPALrKdTMDgVUodNVGi7HIJCYm\r\nT2ZXa2vL7uCR4LI4C5wvC6Kd37UGDpfL9r54ZWbg4zk0tgZNLUotUb3Ph8PB\r\ndmP4X8CQHQeTtWa0jNZVozlWYW7eVk/Ic7qtn8HPT0gfzqRSaTi7+xaqh628\r\nBrf/ybEnmgDQFUxzc5GNbjhd7hY+79llea7BzRgnOcVqPDw+uzwWc7m05bGW\r\nVYL2mA0Zbbzn2May4X7G/Ap76pXmV1AJ/CG0pXBKqTRTI6x4RgUcUcn+vArI\r\nfx8x1h9mFWSO4EUUyEh1lXj8S9fZhKdWkvyNfLqga6kjgOgeofJK/C7V/kGe\r\nA/4jliNs43ZqrH2fH1hNXNLWQ7C3aFGym7baFynd1BwRPeSh+Iv/IyVQUtl0\r\nxRdZ0nd4vGqXQbzWHYxiNXsb7c/HUYi4Plqqycw+Wd77kJcsgsnmv3rHdqp3\r\nBo3BHvAaqsigrT5T24RXF/q3PwMB9woh7YTGyWZAK5n2K+5C8PnztcZufX/k\r\nwGVB4N2F1a1SSjgP27BHqvDKouAO6Vg0tT8=\r\n=/RKf\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230117123422-cecca3f7.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/073fb16495c9486ff40ea887122ddaf1/graphql-hive-client-0.22.0-alpha-20230117123422-cecca3f7.tgz","_integrity":"sha512-kQE6VxEN7CJVc3s4qwRWkk2r1DeClWuZlBXiCgo38r07sv8IlbuZ8MHFP5AALmKCZbs2mwzlY0SMLRETinCM/g==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230117123422-cecca3f7_1673958897568_0.48030000665555583","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230117124400-7e148070":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230117124400-7e148070","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230117124400-7e148070","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"0a6de904fe086d73802ff78fe7841540c1bc9778","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230117124400-7e148070.tgz","fileCount":60,"integrity":"sha512-cz3r/VVLYTaIjexJzA80A6c+B3P7qbB32Nmvd+XTTCRK3/AGfR6TK/YKD4mSVhkr5NtRsHNhvwL1RPBxMnk82Q==","signatures":[{"sig":"MEUCIGhSn3qdjzx3Et4HDPOWAd8sJBbZQZlYvWyDO140bfwvAiEAnFKevctEgDQlbWSZbHz2gOA8Fpl7cM9dGf47lhqb37o=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169649,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxpg1ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmryiw/9Fp2QGDRlSnxU4CIfRoUOdfgK+DHVzq2iyQVJK53x+aGAIvSJ\r\nlOiKcwYhT3eRARDHfcsOpkqERE74kD6xS4z+vKSv/lFyIIOz3xvcDP5W238f\r\nZDMWVI7pYPWYjv4GcwDqwtSqMvUNupBAaCRvTXW/HwdQu6RonsMmOz/Yfsjb\r\nc9GLufbMPqG8UsK9vpRWG6NaLNoH1meTthV7cWY7+WRJgfKWVJHKRnXFlwKV\r\nEMpeAWZ/q+w+tl8jnq/1W43mKj7UMTYmxAbnhfK8DEDgOztPaznrrsmfqh+F\r\nrn5D+gKEqOg46iH/bTfOdYEnTsk9xHz5eA6QB5rY7Yje7CiGFr9BAVmUBVBG\r\npEoSVVtL1UtlJft+2HHf7KAO3q97DUgnGGfxbOX2k+DXFP58bmPbm/CT9XoE\r\nOqiUXMGPPTxRshCf1bqpOSwLrq5Wh0NNV/uyYkQSNHkv+YqOViX1Wn1qMj86\r\n8BOTzLfzTk1GbOIZZJBbRp5u3ZUqlrIo68UUy0ziDfBqx/jiyCYrqcM8fsyx\r\nMI7FvDGKfBDXd+ost+t2IlYbHvMvsXlEoMnxM3O+gCCicmBSwIH06asLQ04T\r\niUKQiVzsC9zkRKFtYRZSEgAl7qKg6gvdY0h8Y+vY8u4oUzGK8+6OJl3a9Ewq\r\nVL7AORnMJ4HGRPaIUYhP9tTxYSbwa/gCFxE=\r\n=ccbt\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230117124400-7e148070.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/730d26f0e29e9f0aeea3bebc94b662ec/graphql-hive-client-0.22.0-alpha-20230117124400-7e148070.tgz","_integrity":"sha512-cz3r/VVLYTaIjexJzA80A6c+B3P7qbB32Nmvd+XTTCRK3/AGfR6TK/YKD4mSVhkr5NtRsHNhvwL1RPBxMnk82Q==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230117124400-7e148070_1673959477023_0.9464301814277467","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230117124910-461517c9":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230117124910-461517c9","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230117124910-461517c9","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"1f26ab8d9d3e07f4448b61e8c9f81cca7fbaec93","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230117124910-461517c9.tgz","fileCount":60,"integrity":"sha512-qCCkgDvY3PyBZHDiwOkEmZAxIpR+GSSx5A5yzKA+8xxp5EfW+hc1mb6BnxVmXDOo+dHivEf0wgcABq13i5JgBw==","signatures":[{"sig":"MEQCIBZZldgbGXsPxhYrVQt3kyWjOLmncDFveNQGr+9KgnA5AiB0WFfsdUG9N+U0xBPNYjifOJTw244DxNpMxdUpbwcAmQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169649,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxplsACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqOwQ//QXbSdXoO4z8bzbxCwTUNqFUVwUCSqQDQaV7HcI1EF6FLbEic\r\nVECAl5PRonqfBgeQ4/syTsyxX53L41l9XD8FszunSHgUiF+YQGjt/M+Sr5pP\r\nNuKIJeddYA8WqoxX9JeLdIkYzyZOyqwT+J0vO675XiMGbeiaIaIbEdhCGli+\r\nLdudAKVtQGGp+PsHXMj5Dvq5oecOu1gVb0pn1ELrwydfHofHBlCcPvOPWvhf\r\n6YtoUpwbzajQCFKDG6SchA0ZFO7OmcmzD2V1rVvDVIvtrL8Ir7RLZ2qr8h5L\r\n7st7Bz9g5+rC/Fs4xVgC4+d8u1EbVmt/xi1tNoHkS0U2qPnDn87zPHr0JY8R\r\nn9RJuaGVeD+6LH4BUPqKvOSo/vNC9fa3Fp4ZLm43qibHOVuoYLtr2llRLv7x\r\nPPV1+BG8mab4HR8HR6XE/Mahsid4Jo2gU3tuFzjndVWkFflUWHlDf6u6JwCC\r\n8RQOkn/mGNaOvWE5k7px3KxMIp06aSh74EuU/rC4jvpGyXJS+AbSaljseVOm\r\noiFI/kpgPe96nKUYwl1ov2zMvLFcduZmGLf2iubvErd4cIHrngSeMeq2N2j3\r\nV1+BTjFI+yejErvO8Is/k6kbW+0TNmjQKbr6T7BJYxyHdjH1jiPGJ618p6RQ\r\nkbgk8Lr68bLAtXZDYap0JgRGIunrN784npY=\r\n=Z9Kx\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230117124910-461517c9.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/2e4d6d4ee034a33d44be67797ff421b2/graphql-hive-client-0.22.0-alpha-20230117124910-461517c9.tgz","_integrity":"sha512-qCCkgDvY3PyBZHDiwOkEmZAxIpR+GSSx5A5yzKA+8xxp5EfW+hc1mb6BnxVmXDOo+dHivEf0wgcABq13i5JgBw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230117124910-461517c9_1673959787815_0.6077474460931711","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230117125523-667520ec":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230117125523-667520ec","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230117125523-667520ec","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"04197e92184c670a72230717e1a51f4c1ce095b3","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230117125523-667520ec.tgz","fileCount":60,"integrity":"sha512-nXSzWapl9GjoPyc1mdHJkIA7yzUOKcYD4I2uRhPoqvvozWLWF6ZwDL9O16DvGLZyPskhBVjSYNBmEg6hN/vwVw==","signatures":[{"sig":"MEYCIQCbsSBAmbL3f4EsBXqAp/AfJUqlANIdIu7//VYSLvwGlwIhAN6U2OOsSbCcjR4R9Og3UT2zSVbKyGUDbHG2LNS5Yvpz","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169649,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxprrACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmpo6BAAivsGWC02StFsirrZnjZedHZxsxmxv8+AfG/WCc+FbRtiZ9eu\r\nYEPFVfV6eZdHJR0N5uxqJ84Fe1EYZX3b6pnGUJo9vKKYxEdb/c9X7QzCp+CJ\r\nYvPXNL/JjZ4cFk4PV09nUiTUGfaVYVgLUa+4V3HU9zEMkPeNztujergWmfvs\r\n0lQLttPSWYhB3kC2uaee/mPcCnLZIfmwOPhtBOL9GMaOiDHOm4u9aK+YNFwQ\r\nabpnwEwQROeexu8TkN1NAW8EHmH8VG0RbmugHMtv11lwmJa1wZOf9Ec+nCXI\r\nYa39BwsJ9mmLsG7U4j6dIdu99lwWHHNiiRdAYJ33Wx4RJ5RYTssCKaAs09OS\r\nbg0ZLqI6uQLNpHlv5yWodenryegXg0/zfKyUI1xj50q6VbEh0U01XzioIKog\r\nWnEL+gk0lBTeiKgL0pVNu8d5Y3rZA95/sxvsnLSnV0wfrPM6//P5k/tScgCb\r\nGz1fz1rfOQHaitlyQzHeIRvN9LpII30UumTsajKw9hEoCrar28ME7yiP6YEu\r\nVoeNHhwSCW8SxeRMIeUAuTGdGWqJh45t4nHaCDAUQStpz1De1dvrXwLHPpUA\r\nfLsMuMWXg6Bvii+QiTt99DFSh3jo9r9TDELbIJRprTYCaX4u6EO1eQpFLDj0\r\nRojV5EBCWCUxJzD499s6NWD2MJeJ6ozhxBo=\r\n=50e9\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230117125523-667520ec.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/4fc534e98a32f024aa409529b780d722/graphql-hive-client-0.22.0-alpha-20230117125523-667520ec.tgz","_integrity":"sha512-nXSzWapl9GjoPyc1mdHJkIA7yzUOKcYD4I2uRhPoqvvozWLWF6ZwDL9O16DvGLZyPskhBVjSYNBmEg6hN/vwVw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230117125523-667520ec_1673960171619_0.05311093868116634","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230117130008-03459431":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230117130008-03459431","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230117130008-03459431","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"0969da58340b5001c4c7ba666ee6284d59cb2217","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230117130008-03459431.tgz","fileCount":60,"integrity":"sha512-csRPoxuy+x2q8szYAw7YVmVPfwm5UbGlMoZqD3Z1laeIXQOnBZw7pgzXJEGT207UuP8oz+jc/C04RsrA8z478g==","signatures":[{"sig":"MEYCIQCA7DSuPGLeV76ldIGGX31yY3/JCNDEGpYsfFvPpITrSAIhAPAKOXahQISNh1Z4DjMiLA14FTt4VfKkXzAxWgNbq93a","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169648,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxpv9ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqWcg/8DzcMFpuG5zIKxJMPfgJ8IVmJXfXIC89az2UHTxc9AKIO19V7\r\n1LKpEWNkv4IVSjK4AGiXmlL5mKAtc29jT5E5Nb8tWG/Ei1PEKdFRqeSzdI94\r\nc6zLrPIR29G6IGNOAYMwSUIoaCJ6YhUHCNltoK5wHgoE/ynmuw+x2ekCq/CJ\r\n/sBrTjGsOh21LZmh9hC2kgMoV9jiACq08S8GprcWlfZWNcwDm7JbVimOaq0i\r\nxAECl4HTDDg1PrmQneNfp669pNCok2Ve0LR6Kd5Ccv3qQMfsdSI6G8kl+UF8\r\n3Fe1IhVkhGArJ4IatT/N4KP2Pa32dHfWSdtrH55rtZ2wUFpvMhH2TNOX8seT\r\n6YeyBaGNSCCMFv6zDaHMGGETvGiN/bSu13iwsyVagyoRt0gsjnFua42kmZxt\r\nipA/U5l3eHV1B43gEB2deIEaADpJkmhVvmx+w2mdDmNvV5FxbKUHBS8Z8/B3\r\nkFqOVLwKRSVP+cLzYPiCz4emfP8Nl/xhNsB5Q2KRfauJhO8nznKIuG7fun9P\r\n2fdAvqCA4RYDpaVEDm9q4PJuLcZzElTMF2+Xbr3IFEqC0/NdFza/F0vEpvWt\r\nz6nDwSgRLDN7U6wpHxzVVWVG2LgulD16KN0qO88dhqKjitbm08qAHM4YZXw/\r\nqI+gQguYfFAXzFA7KcZnsqrTbwiHZdwdEdk=\r\n=SIPT\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230117130008-03459431.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/5d965770fdee6383092a2c2d4dd2475a/graphql-hive-client-0.22.0-alpha-20230117130008-03459431.tgz","_integrity":"sha512-csRPoxuy+x2q8szYAw7YVmVPfwm5UbGlMoZqD3Z1laeIXQOnBZw7pgzXJEGT207UuP8oz+jc/C04RsrA8z478g==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^9.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230117130008-03459431_1673960444827_0.2825700655890211","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230117130501-fa70f757":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230117130501-fa70f757","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230117130501-fa70f757","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"3c12ad4e8a85d8dc9dfa561e7f8d8e7d74c1dc10","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230117130501-fa70f757.tgz","fileCount":60,"integrity":"sha512-2jPX6b3R6lnevSPLFvOkxE+5El01bl5ap3pIDEFBdXz6qb11UB08HgZzhc3yaLLTA0NxSYaApEwI1LLnWNQ8Cw==","signatures":[{"sig":"MEYCIQCbvON5gMvy3EqlJxgc7HpztMn1XBFw70FGFClgZ4/9CgIhAIRLl2BOJq9pIgcHYkFu+dgvQUUMB/CdXO6OFJMrfJ5m","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169649,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxp0iACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrZqQ//dZ7UQaTpte9s/bjMv6FrCECFv0ZR5yQcnNH7Drbj7ARYV1QK\r\nEmxlFUp/97rI6NoMdOpZWlcHuvubWZdQOEtIqEvNfOS+iEE8c+oaboQFXBzX\r\nvJ8fgkXPiQkaW/EDtfB3PiTL7RPfgTgc/hPW/MmSD5dDGjrPb++E0qCso4bj\r\n/ZUfB9sz9vORJLLDEBHc06UKth6I23U+KJGarOGvtE2W28z78BtWNp1KrR84\r\nitl7PtLt+UQfjhZo/1W8mcjRmVHYvlCJnS10O6GCQgVmm0Vl17hBjoip6nLr\r\ncAPBW33k/gwoC9vme2m19vxZ82pr1a/7TBKZG6H8Bous0ESlMhbPE4znuGv5\r\n2HDzNcqX4f/IgnS+sgXrYANiIxClt/aCeUp8dPdtwl6WfMFA9PP6hafnLyB1\r\n74q9lcAuBGZ+i4YWTfMHCUvUi6vrbgWTBHRrPVHogOynZPyWp+qfJPFnPyEd\r\nXt3HmyB8P/0ip2I4PSRMzx+7dhkIaWZvici746F8erw8KVCf/sHsc7hIp56u\r\njcTp6A808fMtjo8vUwL8NJ9INn+XfIEDLVQiMwnPs42oGHmxib7e8cBF2vpG\r\np0Ne/pgKqY4zvO9UcvvyqjPeD16NdYKU61ie8EEoZ8aETSSlWdAN67cSNJg9\r\nzsKhU4T1Y41IFsmukJl3NbejoxSPbhWUujY=\r\n=UpQR\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230117130501-fa70f757.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/361e5d10393cabbf15959d42d2bc0b0e/graphql-hive-client-0.22.0-alpha-20230117130501-fa70f757.tgz","_integrity":"sha512-2jPX6b3R6lnevSPLFvOkxE+5El01bl5ap3pIDEFBdXz6qb11UB08HgZzhc3yaLLTA0NxSYaApEwI1LLnWNQ8Cw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230117130501-fa70f757_1673960738678_0.5440866998957388","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230117131024-2dc63cb8":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230117131024-2dc63cb8","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230117131024-2dc63cb8","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"e5e096a659e90333a740e8d63de3d7f82412aac2","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230117131024-2dc63cb8.tgz","fileCount":60,"integrity":"sha512-YMWhEnAuI9l32rq4ODh/y/V7ZfwgI0cKWFs7Hp0Gm8TFT1c06Zn9jlVKJmim8EzoIqxU95fhVcyXLtnGsCP1ig==","signatures":[{"sig":"MEYCIQCIzt4WLArwDDJ8s6pgugVBpCHlHIRzGRwLgggaxXtY1wIhALekM4aWnA6GrhAT1q0lSyKvjTcZ6kDKTlX3aBYGex3A","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169649,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxp5vACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpQTA//Ri7M2P0huGoNNyeO9KuAKPQ6Xb/0BNBylh3YVfd7mia+MoyI\r\njehVzfCxtD6N6UEsdgpA3dkY0hmNWZJOiO+wf+wR7/Dsp9rkBrznHJ12J1iU\r\nTlpRHABLaGLbrpJ/JpYOaPngwVvf3cFTlivR/mGCDQ6zPMxEZZOZBxISz1mj\r\njpy6UQzJxQ49tJH2sKY9LIATZzNlcpfnHVkcB28/NXr7q5JtBsNt6tswfxDd\r\nTABDQg3I+XvfHXDvwIh4Z1goU/9xfI+9FAUUKFG3UX05Z1uDxxAxwfi/iDxF\r\nXfIcXXrcJz4ygxeKYNBb65qU9VomDsDz2PEudwBAxJfFJdkde3k6FTdcP7SN\r\nFryi8d9aipIkve7sDIUFdCNmv6NAXhUwWfD+d5rTODlcczjkrOZqYFD5rmKo\r\ndDD2IV+nG8NyoUf+8GDIvZ3ywS6ZojF/Z2MRkn9qZziG1wcaaqIN2lPm/INX\r\nkElH/Fy5Pi3+IKNcLFOlBdLXK56SBvX+wikmoJRKQQ8X8K36eR9xbcX0KEoX\r\n4i8+Z6hRdVDnYUzXN2qxVjoXMsi/xJ/k28w1aY2b66zqZ4FbbF6pclmPXAKX\r\nvbBJ7h09/cX0wprmDwIXiMZHhTLCY+JNhkE0/bC3lFfE/ZUl9YdITheitVk7\r\nvXPb9zxLzRqUaVkPp6EHRmX+iygzVHqAy04=\r\n=u1kW\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230117131024-2dc63cb8.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/08e4db8da8d36fef1aa476039b4ffa79/graphql-hive-client-0.22.0-alpha-20230117131024-2dc63cb8.tgz","_integrity":"sha512-YMWhEnAuI9l32rq4ODh/y/V7ZfwgI0cKWFs7Hp0Gm8TFT1c06Zn9jlVKJmim8EzoIqxU95fhVcyXLtnGsCP1ig==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230117131024-2dc63cb8_1673961071198_0.4530208047642792","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230117131451-89d32f33":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230117131451-89d32f33","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230117131451-89d32f33","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"95da6842bf340c801af4e57b4d5ab6a638634ab0","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230117131451-89d32f33.tgz","fileCount":60,"integrity":"sha512-0S5WcV6usuWHQkkBbU3U7kUCPpxhAaPQabdAUPjr80gCn99ES1DQ/a64Gb0djE/TuVtOT8Rkay04gktQ0haXwg==","signatures":[{"sig":"MEUCICgeE7ZShQLKOiCm4QTXdB7iwA0PbbwU5GZg3FWWVRdPAiEApxPuIvI7g7FwCu3ffvm4pt2LbJDqxdLrh9fixjG172M=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169649,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxp9vACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpyTA/8CSus2aU+m2JLEtd4sjElpcTGiRQWCdfCCCCw2Wq86Jjy9CUx\r\nG+rTti7HNPl7yJHb0hPikMclOPscvtYmO7+b+I9uqGro1vA7/N3/woSYfBTV\r\nGr2eUi70BGR0kscRQFIpMCEsbMa8wCf8WF1j2Q54YoO5nde3Me7XdeLCEG6Q\r\nWlv5WOUL3r8umT8hA2qx4qQDhya+ey0UiXPxt3sEnkuyxaeyMuxwmDUPiS5q\r\nxCZISDd66yg3lWJ2l1zxcsTVnl+yjqMJ9WKSbiZM8bHNVOj0ozMKvywzymTo\r\nCTZ67Y9U19HbOZVfiKif5f9BSKVNV10Jr/JldiZ4ECS7EKTER+35ZK7bRmvi\r\nxL7JMqqXT+r3qTq/uDdJ1IneYrUUZHX71ApDayJmt85pyhZ57/NwHsQkFZdO\r\nRZ5aoWR+PexgvT5uwpZRz1n1gLQX/ZoWdS0jStlXhe47cJfyUgsPmp8cohzv\r\nRpw/kaBq8uPFb+LZEO6bJRAaegC2dFXvIz3lcUfZqaqGyRFnE9ej/mkxDxc1\r\nCNJJsUPiYmY7ePVyMb9T6rCObvsB3bcL7/Viw7JuUyNg3ZA5r4LKzZC5LhIu\r\nzsaQFDi0EGyU+hqY/H725YZ217+UQ8W00dTZPkjI2a+ZlXCFEm+mlU52ovBO\r\nD0SmOS7OJPo7hgIpmym3fxu1tm2XCbCdO9U=\r\n=abw2\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230117131451-89d32f33.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/7463704da6fc7e914955330fa00c5305/graphql-hive-client-0.22.0-alpha-20230117131451-89d32f33.tgz","_integrity":"sha512-0S5WcV6usuWHQkkBbU3U7kUCPpxhAaPQabdAUPjr80gCn99ES1DQ/a64Gb0djE/TuVtOT8Rkay04gktQ0haXwg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230117131451-89d32f33_1673961327763_0.7941564231542813","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230117132116-819c49cf":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230117132116-819c49cf","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230117132116-819c49cf","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"0c5227fd8320199be1b63f7bcaacbe17635890b6","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230117132116-819c49cf.tgz","fileCount":60,"integrity":"sha512-XgUR/3Z50Xq/22EGCta854C4jhNMHA+kk1R+T1W0iE1WhEn5u4u0RpFEK9otjNZ0thoAZlnCnpJke7YGn9iO/A==","signatures":[{"sig":"MEUCIED8d/JYnE6XCFYPM+Qnl5Z9yYqjQjZFsaEiy6QOiAKcAiEA65DKXKHqhlEJZRokASIPJWj9AZ43HSdUIZTnuv3U0wc=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169649,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxqDvACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqIbA/+LY7Fr2riItNaPn3qtwRlLXOK7X1+HgE2AjTbvPMY5U0A9yxD\r\ncsQsjrUlLmlcafNPKIMStP2/Ckwtzz5qOyO0A5kGqsRU2Sql5FNwlb+i/NWt\r\nZXtoRFf8nfKxydhIPsEHJ9DpDpcpQVMZ10fCRTliKmiS/sCpqi/d1YUnPrKN\r\n3nawDCrnlJhYoQ92PvwFiXV6CJwtEfythrXQOH0MP2hUpMd9CNF4kiNHResF\r\nJVrPMVmgDJ52je2vYxH6rCc4cDEcjYz+MkH5dyJY5h5AzkE/xyiams5AsL2T\r\nLHJyjAXO0mqbuhrXkFh0m60n2otNH7AzAR5L/BtFfVY9veVbzspjHaiuwEYd\r\nSXL0VpEaNkihcTU6PDkWaWWdtZ/R4tBqQOeaoRVoLBWGYK76lUfF2UBNDQu9\r\nMuqpxhgIiywcUm4kPD2RtbfMa/dSpAHWnueTzrFDTvMU8R653WkbfM8upYIn\r\n4NMke70F5pB7fwAeZrqf958+uxNXwPbRYDLMVnsAu6v1ka7mHKYdGf8riOEG\r\ntzSnLCax04t+1MfnPHDbW0jTzNKZ30hQle6irTT/oZHZ6MAilFzuCAJoC+nm\r\nR1YDeIq2RUS4jDAU7NPEnT+A9rCft3pLuDJIRdN6V9jK3TNkWfuBC5gfwaKu\r\nTEnway5KCSOAOJmiWREj9ciXftY9sTl69C0=\r\n=9vXf\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230117132116-819c49cf.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/906fd63ef111d89f991e9207487128de/graphql-hive-client-0.22.0-alpha-20230117132116-819c49cf.tgz","_integrity":"sha512-XgUR/3Z50Xq/22EGCta854C4jhNMHA+kk1R+T1W0iE1WhEn5u4u0RpFEK9otjNZ0thoAZlnCnpJke7YGn9iO/A==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230117132116-819c49cf_1673961710913_0.41577206396183475","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230117132301-28229e9f":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230117132301-28229e9f","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230117132301-28229e9f","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"4b52baa6c27dc0ee857a7355468e95b3552cc4c7","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230117132301-28229e9f.tgz","fileCount":60,"integrity":"sha512-QF8c0lPP2OGVjtQjU/oVIbMRlKvi24WCFdpTBt+mIg5pUAw0AE2QFgrRQ6TOd8Ayp/OTtxzOMT5sN9dkHOq+kQ==","signatures":[{"sig":"MEQCIDuOwyu+dUpN33iayQz0OFVMIWu1XnvLWnjWPa+rFOH9AiBJ8tbw0HHLEBOoLtOq88w3wySaWi7qTZpjXYD01nhQvw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169649,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxqFdACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrIaw/+KicGfbMzCfnHuT8PU4IXWkCfJjZt8/VyMnn1hta2J/aIJ0uS\r\nugUxVW4b3puW1A2AwNRPVUJPqWa4q7clyPcCz5k2b6HMe3LUx1FvGXy9K0n5\r\n+bfjIHiXEtq+cOIsxcUcH4AgnJR6Tgg1MtMpyKnwviqZvMXaNPKhqbusG9Ht\r\n9ENDVjCnQX4H58auEAuCO4rVyVJa4WFLs5xMGHoiFiQqDEt+6F12HRX9UYuI\r\nUZ+mxRY5S0VLkj1uCCQ3bBeLINOlQo6upkvQLAKppRocHE0qZLDfh94szwGZ\r\ns9o6z2vLJgs7eyDA0zY+qCY5gtRyWh2FHXlKI5B6Ss+5VggUorAZgnMYsWfJ\r\nesiAVAhi4o1nq0+jIqgWw9YEukyNUJl6O0sDopd9Vxn/qv/92sFKZ1G3s+IP\r\nZsh9AUEPWZYnHau3JDVXWGFBsd2aO0n6g62J5BMRDYaxEtcZrRbe406NW8UA\r\nY2et+L9TZOGF0Z+Y8SMgHynZtJ0XHlGxI/wOZpLkaUSojRilsrTDKPU+uoCR\r\nFhGmemEA9GjiY/YeyVklmczaHONp8Wn4/KLmjz38ge3A7WCo5UB+j1v8U0mo\r\nzyWYvdH/rHlatVuUYgN9JZM1NgDJ2n/ZXPqZ46hCQY2nsxnrxaQYbow1a4e2\r\n1XDK28xgxiBPucSQepS6tjCo5PAwhEw1/SA=\r\n=7Bqt\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230117132301-28229e9f.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/0edbdf164178026cab5c2f22aaea4626/graphql-hive-client-0.22.0-alpha-20230117132301-28229e9f.tgz","_integrity":"sha512-QF8c0lPP2OGVjtQjU/oVIbMRlKvi24WCFdpTBt+mIg5pUAw0AE2QFgrRQ6TOd8Ayp/OTtxzOMT5sN9dkHOq+kQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230117132301-28229e9f_1673961821627_0.4785048956305151","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230117132520-0bf49708":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230117132520-0bf49708","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230117132520-0bf49708","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"4e8205ee61f7adf16bc76f55a75242dee7329071","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230117132520-0bf49708.tgz","fileCount":60,"integrity":"sha512-NRMO6slC9dawt817T1lisbhlB9HrWwTrweJMiz4DR7oPBUrm98ofBc6PmfpGK/H+Gzb5stpSeJKTB3Mpd3flsQ==","signatures":[{"sig":"MEUCIQDzc7bVHE3uhgnIbLnbe+Y6J8g3Xbfl3VcLlbaxFdMyBQIgWt5GXF2gMaoKVzlZCKV5vIeRI6APRXES8iDwPa9R9i8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169649,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxqHyACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoXow/+Jvcj8JqyjRSMoN0mkFV6W9Jw2iplTU91aSd+GRBd8ZrqoBYb\r\nn+kkkhk9YCDq7aT4gR2CuA7StNt4k48Or+7qLZqekIG6nL73Rd9vnXU1KUJU\r\nvu2ErgWgd5LYgS9QoFohIW6zB2zIeN6uDnPfN+9/HePEqL89N2oUah25SYbQ\r\ndReoMbnjfLUVA9ET7OXWw/xRaIMAE7BYcQyrHM5H/KzhuW8DnVmSWixLpMPl\r\nDcguHGT0T8Jjh1CB++/xIqDO5JuZtgDIMvbKzGIJeExYIZyX5b6cWTfcPt1k\r\nWcQAOuZbwQLP/k/MxYHUfa2ONwbZ4a+casUkbBKtyodEcCLbh5huuqonnjvo\r\nKuclVDePPF7ey77O5pJA9raACnpVKesdiJpul6XspBZwzXDPx02ufuCPMAU2\r\n1jvM4fChvHsLFKu4FDYx7rvGRlaLnvhJZmAPUawuWbVQqcX9U8gMfiEvL8OE\r\n2c8zUioAoltg3j8tVTLGtbhixRGs4xidRm2Oeamubd1VQeuuzTMPDaDjQt+N\r\nUk1sJNB62BUTLmzYa1vv4q+ltVwKslQB8MOHjUEbmqoX53TnxaUgPwyeU24T\r\nWWdR2Y3aqKxGeaTdBeQc8bUaG/J8vkBPxYzkX4b/d05BYsdOjQ1Xc1O3Qywj\r\nAnnFE72gyGgQ0oVLsrwTWMqNxIbPLVf62WE=\r\n=ytwh\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230117132520-0bf49708.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/caacfa052cffb6108fa751f92ce0b8f9/graphql-hive-client-0.22.0-alpha-20230117132520-0bf49708.tgz","_integrity":"sha512-NRMO6slC9dawt817T1lisbhlB9HrWwTrweJMiz4DR7oPBUrm98ofBc6PmfpGK/H+Gzb5stpSeJKTB3Mpd3flsQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230117132520-0bf49708_1673961970690_0.6319323147848308","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230117133150-cac8802f":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230117133150-cac8802f","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230117133150-cac8802f","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"2d9a302e590485df1cfa62dc1c87b2d2382479bc","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230117133150-cac8802f.tgz","fileCount":60,"integrity":"sha512-99vUau51OF3Bd+UvLceVfapC4f+DF2zepYfSblWSQMtnaNRbrKa7QIoHlkxbBDiarUdhtGYCcxpCc912Lz+jzA==","signatures":[{"sig":"MEUCICLBOd2vJkhQhgA3zEd4jU47zqudq7VH7MdfvcVMlB1WAiEA4YO7gdbIqhxVEw7zdnVFXOmZI3hOGUhK3JG6E3gPXOQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169649,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxqNzACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpyEw//Qv1yBBU5vHaD3chQ1a4B6xMRgSnwVwyGm4ibsDUGrUDA4V2u\r\nf+dVplqGDXQENafdzTAxYrwmc+ASF5IvRlIyMoZvxeuxW9JhXvcUPezRz7dQ\r\n4InR5B97IR5FIgb1xykMyhT0s2sfZwQ7GNQFZ3glFEcGlF9hQAlWUTDwp0Lu\r\nA/v4DUwu/UZp+UivTWPBVJj33vnx7QYevzJPFv94JSUY94B4HY++KsXOFnwu\r\nCYBqQhjVEzG2XSYs3xv2pln3lRGxwgkqm+R9D441OJhYw6yfzgW6weuTuous\r\n96Q8KDR1ynpMvAKGvZzJKBuqvYgi29j2zsQZfANCQPHcd2tGUvQAH1UGraf5\r\nfrUyhkkE8/Jmysa4kjaswpJvgYkQJH6nm6ArOj2TQz3uTN9UZo8UMUPtieCE\r\neFA4iXvKJ/aYpRppZErWM7XpZ+YhiUdVFQX01G7ezOhNrr/CC1RLV+zw1L69\r\nl0P0Ska6/ieEiuDdViry5ZPFezbHaIaZUNuYix98BnAsZPYQIyQkJ3Zaw6gY\r\n6vOkBpv89ScC0ufZxOffgjLEh6L6bKMMCMubVgjD1X2m3tSlB0keGdpNAnTY\r\nkL+lR3bJD7NsWS5SVaQ/RDtbrRU5LthaOqCAxHFq8MDWUT/ifkRm8eMLV3PI\r\nf0ypcsNTn0rJuhuQUlzwPI4SpfR9q5/SVE8=\r\n=FnLD\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230117133150-cac8802f.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/d2d1ad505e9924a50db940f2f472d466/graphql-hive-client-0.22.0-alpha-20230117133150-cac8802f.tgz","_integrity":"sha512-99vUau51OF3Bd+UvLceVfapC4f+DF2zepYfSblWSQMtnaNRbrKa7QIoHlkxbBDiarUdhtGYCcxpCc912Lz+jzA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230117133150-cac8802f_1673962355543_0.0011330044325637","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230117133635-ef5e92d1":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230117133635-ef5e92d1","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230117133635-ef5e92d1","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"b249beb02a681d1370714ee8631a1e7c2d8cd061","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230117133635-ef5e92d1.tgz","fileCount":60,"integrity":"sha512-T52IDuPbQR5vjpzJ8nD47J4s9DX3JQa40ta8p6cxuQxtB2+ADTHKLjZdoPBRpu+7mEwoDb0csRZ0P+kC61F9JA==","signatures":[{"sig":"MEYCIQC7rJqTrih7G/NYEI2ulJIP3wa4gLYMSGJAp1k4J62H4AIhAIqPxpCFl2YNPemryucqb4gbqU09AvuNoVP2eB0Mo4M/","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169649,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxqSFACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpCeg/9H4MT+ovuDg5TuJ1Cx+vOZs/8iLQrLZsxtSeIwWsQ8vfmUYjD\r\n1E4rqX07orghUVxcwV3zLLpPGgwdLU9ZS40pf/QBy1tT1cNDORwB1wD7p/PA\r\nE0KBjRY+FTxvalaOuBIB126fhEtMiahXAZW61ANEtXlwG3afy69k69nG8sxp\r\naOFCiFapeJZI5EIIJrtm7TOsVe9zpKzF4lF08MX9cfAg0SG8zBE6xN2kIgav\r\nFIAyi6t7uTlInJHOa0u1jS4fpcI8waXGxAViz9HS169Nvr4XB4So26Cpm1LE\r\nQQr8ElkO73WrqXeZBVUskSTmH+Wr95TaxZ2Ty6GBbysyScx1fsppT96W8SiO\r\n8L4jzIXMAMg2hu1cXPwPIncpF/1OvHKfpXHBZn5M32RoqHMuQIplyrrcDekR\r\n4x2PyPMAO07g2WGLcdptAG/ku5QVdJJoZxAX1dZ6uRS/3aFFv4+tQXQYvTvK\r\nzBAk2m2Gq4YNQFJaXFVVS0B2MXzLLeHmC0S2PqpNb90knBANEgopr6bCCQCF\r\nRvi+1MeBSz/evWksqQsr/Z7f53zE/J/rCIOd3ZY2Pcz4x6myYpKagFpTtE5f\r\nO9dkCRzDQRXJFX9ws0R5z9htre1B38Z3BO50fXIEHmuWgs/i5LZifZ7zUHpO\r\n/rZwbencr9S8L7lb9c5eLHbbcpBLjcyF7pc=\r\n=n+re\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230117133635-ef5e92d1.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/6b2f3f2e6fc841365de45c4c8445e3a3/graphql-hive-client-0.22.0-alpha-20230117133635-ef5e92d1.tgz","_integrity":"sha512-T52IDuPbQR5vjpzJ8nD47J4s9DX3JQa40ta8p6cxuQxtB2+ADTHKLjZdoPBRpu+7mEwoDb0csRZ0P+kC61F9JA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230117133635-ef5e92d1_1673962629665_0.11566818337196993","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230117133952-a9857651":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230117133952-a9857651","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230117133952-a9857651","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"33a5f0d7aceae8f7b6aa6ab7aa6f7ad481e92fa9","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230117133952-a9857651.tgz","fileCount":60,"integrity":"sha512-1vXiiu5cBhi/BUG51DreShy1emOgBSeLIeQBNqV7EJjUwiR7Ydxa8q4RYAk3Rzafx42kFCCrIa5G94Q3gCbhSw==","signatures":[{"sig":"MEQCIFBU3zdnybZU7RC2GaBqCpf/55NuwHbFdn/iubDT80VwAiB7RAyy77/oqPZUVV2ZbTGSUANCYrRl2NOFCjM+CgVUEw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169649,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxqVMACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrzchAAhwJouDyXzeBdRfKrBkrVtBBy0dd5D9gNyKpD5QUqTbPI3zc4\r\nP8ARDMMypiGxzyJ0W68LK04iWioKK0BAwCTi5lBU32QbJteoYRBN/ACgbuI4\r\ndymEbqnG+oMazTCi97PWsQLxJBzWctK0/P5qID9qa6wvjJrApl/K8cfQcf50\r\nPTZEAbXx/YbXiYRlFwrdIfQ2sFaeEvuioy5XsSXX6MLwQ9Qz0vZgqp+c31Sx\r\nBz/MRtlfxPVBZdTDN7zupMu5DhEnVtkjRAYBhvzwt10LGhzOq38Ie7P2/CFf\r\nMpkU8JO/yzlALcY4uBipiJh5ZX/NjsZ2bWDjYgHUnDpMPC7OiRJJ3k1GqU9w\r\nV+SFahNi69GhApTv1PDsH7ZML8q3YedtnLhiCDTeLqim/xDkjsKcg14iXDaN\r\nZZvDhYzYTQuoyAtdJso9vPar5G4redm1OBd9Zz73/SmGagXUe9+XV117l1zd\r\n5Ep8IenLZQJITLA3ECgYAv27m33B631kqsZxmWB/B51qPC/e52WK/Qgb6WDf\r\nPTOnqvjUL/mckOnoP//l2X5DSTiP12p3SFRhtvmhQD7l3KwmZOSyYD5j7iyE\r\nJaMM1k7crjt3vVgPKMPTRU9G4F9Jgm5IrAunwc0fM0vWl4HrFzlYtxlsYRnP\r\nq3d6349vx5TbKUR9nBNdTL4RqXLEysplX7o=\r\n=xsOe\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230117133952-a9857651.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/173e16893c4b63cfbbf9ca0d161ee526/graphql-hive-client-0.22.0-alpha-20230117133952-a9857651.tgz","_integrity":"sha512-1vXiiu5cBhi/BUG51DreShy1emOgBSeLIeQBNqV7EJjUwiR7Ydxa8q4RYAk3Rzafx42kFCCrIa5G94Q3gCbhSw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230117133952-a9857651_1673962828560_0.40085029332441247","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230117134223-8a0b782c":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230117134223-8a0b782c","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230117134223-8a0b782c","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"d1288d6327c395d182f20c95e3dea13ec82ead2f","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230117134223-8a0b782c.tgz","fileCount":60,"integrity":"sha512-EGYyTB6IrmWsl79xSieG2QhKlHlKI/IUjTpfzKrE8WR/rrlxJuKOLG5cz5JJOpnhRNwlJgwrIKAZ06Dud56PSg==","signatures":[{"sig":"MEUCIQCPAUCHcmQMOcUf3I1DCVuoe6o8Fe7A+jv50DNe0FXncgIgG2MLqIJWIZQmzSGPFUi8fewH0z055zJLF2pFxoneKu0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169649,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxqXiACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpRdg//X1M19rWSFyRJiFXhrmv+bs7BuijAr2B0vanuwyeoz+Kdsonk\r\nGMByWirL2xJa98tzEbCIyi5EmiozVIFSF96JNgeOEofnBwA/UA8Ao9QGsPE/\r\nshIb6Sx3vPfTBeWaWHzROc+fh9L/RS4/M/U1NxIc11bM7WooUFcv5U2EhVmz\r\nzc9NOTMBGh07rwRg2nhIKMe2J21aX5yK6KRhyIco3mF+eLEw9F0rihmnDBVi\r\nsw6HJwnkL5M8seayyZryORsWf+Ks2kAZTP+FnXe24DJVQ/6ZRVUB5avHNwaR\r\nBgLLTFRycqQbtFfUi3j58xb/E1qaAw6vSxTCY35cSUHnMCLwe46a5Jfy0T1/\r\nLnkDDTPaDEMb9D5TUjtUCCAJIi76OBteIV8imJALCIVESHKyY+UIk4PaMXtc\r\ny1kvhxltBgULBPZxkV6/DIWvxEyduM0bSu6YcA6TYJVOVoH0o6q9fIjG3oox\r\nWyxtPezTPNNvZqDP3qbsegkk1auQ3ZxTFlcOwmbizOE5gTluhCPql0gODGam\r\nAU4TZ3miJYimNKvkJoEDA0pLVdykRuziSPmI/qvlLHeJDpMBvN5h5sTzJ8vg\r\nsIKraFqIzfsQ11RH/VbHwnltCqC1CjaOThmZqSHRADLxQUBdh0ZmS5J8NMhe\r\nBRWuNMX7IlPRZfMq4u9wIkOKYiQfQanKSOg=\r\n=XDVn\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230117134223-8a0b782c.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/cf62e6da600aa2ab260eb4fd2f29f8c2/graphql-hive-client-0.22.0-alpha-20230117134223-8a0b782c.tgz","_integrity":"sha512-EGYyTB6IrmWsl79xSieG2QhKlHlKI/IUjTpfzKrE8WR/rrlxJuKOLG5cz5JJOpnhRNwlJgwrIKAZ06Dud56PSg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230117134223-8a0b782c_1673962978546_0.8323694743336012","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230117134346-89e63304":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230117134346-89e63304","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230117134346-89e63304","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"3ad8668a08fc0dbaa1c152a24391ff0ff7ce20ad","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230117134346-89e63304.tgz","fileCount":60,"integrity":"sha512-+YcvVI6ja3wZ/ji85p9x0Pp2lsmpuhGpCO9cLz2imGmtS3oUsM5LMEXK1ecO4Qp1vdvdMAQv5KGEvhWjh0zqFA==","signatures":[{"sig":"MEYCIQDQcW83zb6DWHUrqGeINrHulJF7FAl7VTiThrUghPkjlQIhAOjStr4ulVvrYuXZqBu4Wy1upM1nCGjW6+1z6ntVEWoG","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169648,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxqY9ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpPixAAn5WPu4dAl0HuWdI596j1Jj8qPsDjXfU+/YugYUUI9TURml2b\r\nc8UWDszEgilMKsdJDSHd3flbEXmhOkeQvCuL801PdhQObeO/4numF3RzOQrV\r\n7BuL35UIFzwADc1n6U2m+NHHD96vju5VJCFPCrUe18pCueBx+xGrkwebBo3i\r\nSPQNiKCvHSfEvrz2de9wzUhkTEWLnu3IQY4nFwg1bluVIBV9fmf3RxV8f1BY\r\nXoW+E8zYphzCFtLmLeVEZXhd8Fng1FC8uSMW4DgyRHxo4uKcCCxlNDMCZ7Ri\r\nLZ/FR0ksXuO9zQY9quENqbDeQx46T5DfF9Gkz5ac460DSKmRhWKdHHPY2moZ\r\nhpYGEdQTc2GMvorugGxhkWxjDMsgziKfc4mN37O6E2vjEOeNPb45JtXyWN8g\r\nKVo4FdXze6Z+1r5wkhq4jMtw/PCWFDnWkiZKaCD2w3SCF93oVNZdLETQ2ap0\r\n8e6pWEgjzOOFxV6po2Cht7KZlxoXYHOGDrPpjknEF1EYhQFvPIpvVppecVw3\r\nM+nDt8NUjTSS5W3dGl/sMoxtFgA/bUt2BA6BZZWh+J/r/Tl912b2rfg+mYRA\r\nWt/EliCriSRbnWC8ELM+tCun05I6jzMVpcNQig+y6GdUzsgfksuAcLajfZLl\r\nVxMVoXYrwtAxKl8qlc0pgCEZfmJy7nN9I1I=\r\n=vpfm\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230117134346-89e63304.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/aac07b4ceb31ef2bdeca484d76bf0ea7/graphql-hive-client-0.22.0-alpha-20230117134346-89e63304.tgz","_integrity":"sha512-+YcvVI6ja3wZ/ji85p9x0Pp2lsmpuhGpCO9cLz2imGmtS3oUsM5LMEXK1ecO4Qp1vdvdMAQv5KGEvhWjh0zqFA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^9.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230117134346-89e63304_1673963069058_0.716413678362894","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230117134742-7380b1d3":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230117134742-7380b1d3","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230117134742-7380b1d3","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"e21c41f2e9f0f1043f6a26ce9d792cc050f7c57e","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230117134742-7380b1d3.tgz","fileCount":60,"integrity":"sha512-mV+QpqiaLugJuPiOr/oXYofUSjUEsbok7+dzxNze43BiJvB4zmJhR7n0EzzSJt8LjpB1u6IydAAAYh0cdQNsqA==","signatures":[{"sig":"MEYCIQDrhOAnMya//R7bnVUA7NLd8yzRG9GQ376nUnrgUrjSbAIhAKFPJULJrsWTggGkjo5xC3NRjcK4yCKIPZbOXDje2S/Q","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169649,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxqcsACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoonhAAk/IDGiDojujZjXQxOvNJIyemSOnATRtlRVsx9zgkoc7zLjol\r\nQeCtMrwmrrmYkc5H9/TLxHECDapCzqwmOMfka9G+ssoGhvFoObKpFbetR+f1\r\n/DYDSbR5IuchWOtENY2DMEdhXGJHyt73fSJKcmF2JXu/XAHkxPZOx1jKcJr8\r\nP5hCJQ8WjUreM+Z9vBo2nsQFy3m49ZDannWCNfuXlIYXtYgHZfXnEQHkd5IA\r\nZNdJC8yUdHRFk/iW8Kitjv3X7T7+GhmbXh/Ke/4fRaVdHhTCXfcn4OGCtXSq\r\n7hHVcxa70W9uO5mD+I7xqEzTh/75Q1gSTLJXHafsIQKsnqv12OH6Nx/jHYzC\r\nsNKsqzn8WXjDcnx1GIMBgB7YC7yR+7LOklL0FFI9g7Gf8tNKW7oh5/1Gx4Sp\r\n7rX6nYh97M/zW9puqpKMOfp6aOiBSchDLMvHHKTMmOU5ePrGNo5oLZR6BJbA\r\nn+iBVFBhBdkAvTabKvK4sjTIpya8u4+grJy/hvdDLMVyFy8rj5lSTt2u7XHb\r\nWxc9XLBgGXTIRnSPcENwqEHLGD+BIyGM9qKcykJU1hWk4mvB0kALc51rN3tQ\r\nRe9CvF11tzOugTloc6esens0jKIFzO3rqmpoXkIgtRsL7Qh0AVrU97RDA+Oq\r\nHtbBNgGYCuk8VJ+SH4se5muVIIx0u2O/K3g=\r\n=Butd\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230117134742-7380b1d3.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/0365e9c96385382becbde64f2db41168/graphql-hive-client-0.22.0-alpha-20230117134742-7380b1d3.tgz","_integrity":"sha512-mV+QpqiaLugJuPiOr/oXYofUSjUEsbok7+dzxNze43BiJvB4zmJhR7n0EzzSJt8LjpB1u6IydAAAYh0cdQNsqA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230117134742-7380b1d3_1673963307985_0.040263408705001336","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230117135014-84ecc572":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230117135014-84ecc572","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230117135014-84ecc572","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"5c5d9ebf79c650874dd395f9b511b1f206604681","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230117135014-84ecc572.tgz","fileCount":60,"integrity":"sha512-yiQ5p4q5tctN5OMiX0YKsha3kRVYfXqBawmJGBYmwf8Ztp4IcrKYnZMbRYYGrXvrZj8aXcJ156nykBczTU9ypA==","signatures":[{"sig":"MEYCIQCfgo7eTeQBGxYoFP71fHhoL3mPCIJ2WG1mREEndJbJ8gIhAPYFUltzEyi5nbANKP5hMQgK8Ozo42IN8ulChvDh/Kym","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169649,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxqe5ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpvKg//QAZ+f+K3O8mB2GPPV0mE2WWV039xvjbE6vPAdXv/Y3gP6OAY\r\n0wnT5sA/9wzZabZLELmeN/+EGMDq9qn4YaXMzqPm5QvK8b78aTYq+sgXbGKH\r\nkRFr3NQcUK+dgSXI2AQoLb3MhAlYGJZl4qoOD3T6IjrRUS/xLpEN5CV6D4d0\r\nKPZaL45hx48ZE5R/CQGnh8m7+kRW2cqV2xeTYvJwxaCv0fb3T2ZsnlLOEbzm\r\n9TZGnwf25bHlfYuhEWUb8wW+QQN7QOeL3MLDJGRycoXO4ivTzi4JWH0+Q3bu\r\nPOxgTruT4T0CgL5t9AAPF4mrOW0asDPMNIHA7vQpxRrMPWZYaCt375gK7WrR\r\nqZaNe+imT4ePuc4vBwjwlk8AEofwiFZu+nd3XkKjuYqzcwzKShIGKluOEmXf\r\njPxMGR0XUK2uLHc9Ca5CwBTUidWIIV2v0ZOUaPj2B3llT2kgSXM9wQGEaCYL\r\nOnavjt0yIXG/q7g4j+n8C8pHxiHmLRE2NsarWxo1ZxH6TemKvVl8n0QS6hJ1\r\nZVQT0GxEYVkM61GU84xA7cQI4Kj3ccilTxCPw+5vQBbei6rTH0O3Wh3tA0D1\r\nlyC8SoTIu1ISWGskXgD7Sjg2t5TgrvNbgWHak3BQ14lllVAz/BC8kRyZkKYe\r\nAEns7pINIlrZcMP5qyZaIfsALWFx94hqT5A=\r\n=/jO+\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230117135014-84ecc572.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/190e6ac2ddde098b888066239bdd0220/graphql-hive-client-0.22.0-alpha-20230117135014-84ecc572.tgz","_integrity":"sha512-yiQ5p4q5tctN5OMiX0YKsha3kRVYfXqBawmJGBYmwf8Ztp4IcrKYnZMbRYYGrXvrZj8aXcJ156nykBczTU9ypA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230117135014-84ecc572_1673963449490_0.25565511783534833","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230117135046-2796c6f6":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230117135046-2796c6f6","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230117135046-2796c6f6","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"cc298a5db2a66238226f00f806caf7514cc33d10","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230117135046-2796c6f6.tgz","fileCount":60,"integrity":"sha512-szapM0ulVoJd2XMgupBvJxr//jhSGF1mRpuivsFEuJwtZTh8HxY3DU/Nim9XVq8iiR368xFLharkV64FS9adOw==","signatures":[{"sig":"MEQCIF7iOqWUvVk0cltOo0Giubn/z7T7Md7d0Zn7hnyV/O8cAiAHYv5usTfPv8CCjxBzAQdNdIP5EU5KhjofjNfN+w3QZQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169649,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxqfcACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoN0w/+IqnyUBRBxydvxJjSxGo70seCK0QbHc8DuxUqINQcL8XPoRUR\r\n5ABzkghGv52DldSPpduEsogStTShPH2u++DbRosNi0B3vukYJD+sBvdkmFkL\r\n2MXef/bYvCoNmFPOBMXEsnX8l7onKw0EaEv7YN3FV4YlE3pbsqnLPSChZnuW\r\nv3cZE4/yH6Rb2UqFjGFcZO+3r4BxBXW8aULiyimoaNqgE+kTmBiTMlwkJdUK\r\n2ZBhZkQ4dQm5rncQKN2y45yWzAjL4m6GrpRKRn90fGOfjm+rfQDuFIptH0+D\r\nLZx1/jLcpcCudRSKS3IaNLqfNT39pPFT+CrmqUuUL0mw9kNO8NAXrpZiPxIO\r\nY99MDhzBmz5knFz72+mCvdTv49ctcGROMKBGDLq4NS5xGHGsjT0esDYHzSt3\r\n4EA+IsAj9BB/l7ld4w2n2v/yWIwmHjRMUPzB0+PIH37L8vHQFo8vQBD8/5mU\r\nQqImUjhtJ0gv5qBbmSYBYGioXfZCisg7+GABlL0ex86/dE5+7IOuOAAB9x06\r\n96FQtuGpTrh2rVKdfhUd4Wgz0tywcftvCWOQeW8HNvn7/KmxY4ZXqTXzVPgL\r\neWRsv7iHkPttzbWiau37gGSaK4HK+cEtblgpJ5kigS0LLDEh8fGgQAcPSjKl\r\n6oqvI3QAE8s/FZgHbY4LdLLtx56tcnSJZ28=\r\n=1A39\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230117135046-2796c6f6.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/b3e573fc80e85c9c60a22249674fa4a5/graphql-hive-client-0.22.0-alpha-20230117135046-2796c6f6.tgz","_integrity":"sha512-szapM0ulVoJd2XMgupBvJxr//jhSGF1mRpuivsFEuJwtZTh8HxY3DU/Nim9XVq8iiR368xFLharkV64FS9adOw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230117135046-2796c6f6_1673963484573_0.4180429840798159","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230117135330-3c773dd9":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230117135330-3c773dd9","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230117135330-3c773dd9","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"f0ff31fb9b5f5b94ec51412d0a29dee33696b12e","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230117135330-3c773dd9.tgz","fileCount":60,"integrity":"sha512-Sh8BI2T6ribcxOquWamgxUEzeTJw2f4XDGGVqpeCT5sb7cAPQecDEx/wXleudt6ZQWqIzf7Cjzyrf26deC1pqg==","signatures":[{"sig":"MEUCICSCnaYIg9kVlKjcpjCAPGbjEPW3ICejUFjPiZT4uVT6AiEAlu1VIq6SKtjOXf3qrqT72TGXCF/MCWy8tHKHbrRgaoY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169649,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxqh+ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrnOQ//WZ77NpfOoQZzk9QEC15H7H04KWo48Xomi3l949X6JwpSV7Rl\r\njntf4XQyACRviIx/thpV+XW5BfuNa0n1/Eq7mA0J6p9Kyk2DmAP081Wp9dQ9\r\nJpLo8/fucr3mUEkT7/UHfjx6TE0TTM9SPiPi9QjFHbtICCAOW5C/KXIWB+YF\r\niXwN4jPZS+M+cgiEmKq7T52v+GR3vP+HOINvDAR2ZC5sC+/uMu8oSbZQmRm0\r\nQpVARPejaA2a86WhAJM/TT/FTM3lEx0ZYOolMwFousekegFfQEWeXz8gsx5s\r\n7LVvn9L7RYNh7IHBEVNcaToPQWCJ9lGUqNWKBtV6ACjp4ZGcKpQieJ5kfoOW\r\n5a34gcXcKIonCWO1goUK1TCIbEPW2xpbU7slHS3xknkigYtV4ObY6Kl7e9Gt\r\nl7g+iKRvhOG2DS2VXOSmWroeFzzyDVhAnsbTs6dKUgA7uUGpguMJeRqCKCbQ\r\nsQYa9nh8g+zKqIzMnRwsEamaXQsyGoHWUZLqBy9oN3JiTlOxtWHrjQg0lkKj\r\ng60xTPQcuDsarEmw9Z0q/IwKXXc/YXiVmBHW80SL7chON/3kj00cbhhrBRRu\r\nGlIoD3QoQ4IBnC6Z3B3x4WdXNxZcODUK7ze1E6Bv64mQWGUeAh16/qyE4XNB\r\nF8I5feO6WS8afSZAjDa92oMIJaxVCTWXQVk=\r\n=byTr\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230117135330-3c773dd9.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/f3b8db33d22943103a31472222ee5614/graphql-hive-client-0.22.0-alpha-20230117135330-3c773dd9.tgz","_integrity":"sha512-Sh8BI2T6ribcxOquWamgxUEzeTJw2f4XDGGVqpeCT5sb7cAPQecDEx/wXleudt6ZQWqIzf7Cjzyrf26deC1pqg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230117135330-3c773dd9_1673963646608_0.522050968039556","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230117135455-95e4a8cb":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230117135455-95e4a8cb","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230117135455-95e4a8cb","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"af4baee23e23fb16d7f1ed016c20e8ef92441dcb","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230117135455-95e4a8cb.tgz","fileCount":60,"integrity":"sha512-vMhBVYUmoR8PWMks/zkKDXmmSOd8XbzQHz2KfiC7aQYDZHJhEIblpjkcvoHJwbggbXa4OwMEMJf9gChOLmWVYg==","signatures":[{"sig":"MEQCIBqCmnSX+/6GgEH6EnQW92u0sA9Jvzl1S2UT4qyYn/efAiBs3tNDxtTu9M0GJO6tLF0qKq/MV33psN+IsQZga1/VzA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169649,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxqjcACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrKkA//fecCZnBpimqDPy2YxxaF6YnQjYTSvaU1vMaqb6tO4qkK4URa\r\nFR8cBYUK1taTZcYqfvn+U9tRPCHil1K9riV8QvxV9EeB9I/cT1A1KwLb+ztj\r\nzpDUVJIRE3wvU4nUAHCIvxG2ibE9ikiKJpR3L7Qy87agLW66thyUp7qj5hUM\r\n+RWO0jy/gSQ0buxexM74B85YALgQNTEtNHxLVfnezHCfNWAL/oZjYglIxBuJ\r\nyge5lsXriAkefR5v7bJY2I3rUC2v0AkW4JJAL8bVIY6lvblvP//9S3Q/4YTn\r\nW4htEr96CC/GlbtFDKBm2umVWK3/drZ1jd9D5lDtaFT/D2zZIRY4/ryb1tkE\r\n/7cpHz5kCQaP4tCFC1nU0mhDBMqVL/AhWgV+VaSbwqApO9xz/Tgv9/RRtoif\r\nURg2nEqTs6jzXln1Ft7KJ1uC0ezXfd3bVw50IljiW2MiES3EiR7DIB61P0T7\r\nEU8/NWEiX5LJOorCFzF1L/9yRqnCmOsXREjemPFTJER1IrRXrVAk62KCniR3\r\n+Rmt23gfpu07hXwGXH/IXPCAQ3SRzVY/zdvRTrQCoREIPS2+g3YoFHblXuKH\r\ncpt5nBvsDVCWtYagruGiH0GjT52OCfxL59God0ee32PCfALn0I/5t5Yoii3Q\r\nF6l4USsY+QLLIwdR0V1Sikxluz4NeExwtYg=\r\n=WXf8\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230117135455-95e4a8cb.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/b965731416b901c2f2a79186b17c08ee/graphql-hive-client-0.22.0-alpha-20230117135455-95e4a8cb.tgz","_integrity":"sha512-vMhBVYUmoR8PWMks/zkKDXmmSOd8XbzQHz2KfiC7aQYDZHJhEIblpjkcvoHJwbggbXa4OwMEMJf9gChOLmWVYg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230117135455-95e4a8cb_1673963740053_0.35796308884540506","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230117135752-0c426d39":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230117135752-0c426d39","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230117135752-0c426d39","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"b90175f296e2d9bc921b0b48d08a356f47bce79b","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230117135752-0c426d39.tgz","fileCount":60,"integrity":"sha512-q+Rcnuzknn7TrnQIH1cM0ucOgxZKtwuoxBJVhSRCFDmf6yV5dzYVo6aG2mefB/VZjzTxM8gjXsqbGRJ9yju2AQ==","signatures":[{"sig":"MEYCIQDar76/XEcLvHwOFKlX+vfxfGza2HSuV93t/gCsdmUkBQIhAOEz76AjlriSGJKmpRtrQMnMAwoc+A805Z/fG6fIdhsj","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169649,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxqmGACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoN9A//clWIdoRT4iwbjWX4Ia7PCMkbN+Knd67WtHYIB0+GEYRsjFou\r\nx9D287kXBXlX6sBTEAkvrEk3hBNQf0tancEE2eT1yF/gReUVKlTXvSTjVwOu\r\ntUdcSD5QZ/TVWoO6hjXSBUFym363q3juE75aiR6lOySQyeHuUvpshLirBKqZ\r\nlvKEiO5vqyrQwap1/bIeGjmG6yKAiMcF1g/kjyg+rT6a+Jdm8AWwLwEmL8VG\r\nho1CUCNDTk6uRb5C2EmO/OxCaMCfhHsndCKY0IThl3q3v8ii/k0XYkaWWOEP\r\nNHCXikkGzkbuUpVaApUoov3HbX0wPtBDmlbbJupxYq8UK627z1zuI5Yyky2j\r\nwjiO6vXmge2Y33tG9snEpGkeSK4wR3S9q5sOepDDNYDsBz+hlDcTLUnecA9a\r\nX51ESIVDO+2BARUM3k/tTORPQQCERNN41mDeh1tNfT5GkajGw/343NocPBJk\r\nypKh1cBCCMCo0Ri+A0gDYcyOzMhBgJoeT8QQfEwzwALY9/doBS958BLZOi79\r\n8KcjE447+pujqMr452bVsRoaOU7i8P6cDCCjJ+OmTM1t8eQgNY1l5f0zMmc0\r\n2rQTbiu1cQHhIHXj8H5g1uSD31gWixHjEIDdyxH+ZJ1MFPeMlvhwLk4U3rND\r\nXBoeQxTsjPJ1AlgkMsZrEu+cNFip/qEiPl8=\r\n=W4Bg\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230117135752-0c426d39.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/b75431444979d716af7a2de28d3d334d/graphql-hive-client-0.22.0-alpha-20230117135752-0c426d39.tgz","_integrity":"sha512-q+Rcnuzknn7TrnQIH1cM0ucOgxZKtwuoxBJVhSRCFDmf6yV5dzYVo6aG2mefB/VZjzTxM8gjXsqbGRJ9yju2AQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230117135752-0c426d39_1673963910289_0.1620924268989219","host":"s3://npm-registry-packages"}},"0.22.0-alpha-20230117135808-bc879aa0":{"name":"@graphql-hive/client","version":"0.22.0-alpha-20230117135808-bc879aa0","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0-alpha-20230117135808-bc879aa0","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"ddbdc4668c2db6c380d2aca05d580d5d45fdae7e","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0-alpha-20230117135808-bc879aa0.tgz","fileCount":60,"integrity":"sha512-YmBWL6O9NEIdxmxmx7mgWI+5a/YpxFm3Lwyrc2b7LNbeBQfKK9YbdOmGyym53zdtgDSlXddKpe9noVIfwAxTXw==","signatures":[{"sig":"MEYCIQDNpbZ/u5t9r8f7tkQr0k4S6IMEzVyZcLk+UAye0KXCRgIhAIDUwLDbia1LvLkaGxTXmGfWcNPARuZlQcKXym7HqVBT","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169649,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxqmgACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpnjhAAi6Uy/I9jA5i57D1lTV3bBH2p4FXdAa02APRIYKLLYpxP/FFz\r\nrarawGsw61AdoNhPISoNERcUUWSMnYCCyl8u3nNRa3sCNZWKRIT7L0ZP+0z3\r\n6GvK2PA5tqkhmMiTgceEpnWx+d4xswaZnm6p5VFN1a2jfEYz5MM3chZutYmZ\r\nt8nDbuxNmLmMCywxl0yGDBXHmjCA/lHjV1Z+I529UWXTfTJZXkHXSHF1yneh\r\nuUzwzQzfVGXjJwJlUzWveEMb1xNCGrpg+r0wNDVw7SQXwWPVM+58QQ9LgZ6E\r\ngXy9GOSdZRqkRLvJ0/6He2Att8QAqS0V8JH91s+OSchuAzJMiGQvLTZjQo/T\r\nnzv/Tpj31SXoSIRe6AiUUXfzU8lXYAzGjyMnRlOcAuURhI3you4HL+VuoNAG\r\nb9xWhsaHY0qV+KQyL7gr023gl3qkkKGm5JiW03Y1Vz+E78XrvoGhipNj5a2e\r\nV43gcoS3BhaENo+ABS3mHJl2mUN6tMqf19pwCO6Uggf2AN48F+/Yme1xJ3Uy\r\nSJHuXwXDMgrFa4yQQZiBtSoGkRIPdO19+W2wmgkl/stQAcYT+PFtirHP6Jx1\r\ncE+V3SeXeO0IEr7Gu4gNIJo3cTAYqqaSy8GeGqkpsZfmgacmCllzlwk7qioR\r\naiav9aqa8S5lUgPlNFFCPC8fqfZ+7AX1u2w=\r\n=tfyA\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0-alpha-20230117135808-bc879aa0.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { createSupergraphManager } from '@graphql-hive/client'\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\nimport type { IncomingMessage } from 'http'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { createYoga } from '@graphql-yoga/node'\nimport { useHive } from '@graphql-hive/client'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/aa5b94c0d20d8c6f7aa53c9a4eb20ea5/graphql-hive-client-0.22.0-alpha-20230117135808-bc879aa0.tgz","_integrity":"sha512-YmBWL6O9NEIdxmxmx7mgWI+5a/YpxFm3Lwyrc2b7LNbeBQfKK9YbdOmGyym53zdtgDSlXddKpe9noVIfwAxTXw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0-alpha-20230117135808-bc879aa0_1673963936394_0.40037243139011514","host":"s3://npm-registry-packages"}},"0.22.0":{"name":"@graphql-hive/client","version":"0.22.0","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.22.0","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"3e9c3074a0b18a4d0d7738bdd101a1aaf3c5a8de","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.22.0.tgz","fileCount":60,"integrity":"sha512-O3ig92HpRuY28+osRrpiJjAZ36C0UPoKBfkgDyew7Xhgafyb3QC3HrJQ5KTvFuynIKQ0iWjz7CKMbiaMOclGbQ==","signatures":[{"sig":"MEUCIC1+Yus8ufgg+Efo3iqz2UM88iZQXSDN2fkJ16WUtVp0AiEA9cWkWBYB92wdeZH7KpNg/FYfevkS96yWS0L1yL7vhbM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":169499,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxq3AACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoJ4RAAgtMwyfCY6+GzTeIBarjA54CyNNiSNoX8Z75UHT4lA4dEfnMs\r\nl2sUWOoRCpwLCYhbYYYxUiZZWlQ6pTHeNYFYUynZ01QOn3ATlKHKF4AHnbE6\r\nP/W47COgXGuCaYIYMjhek+EqjBPf3RinT4u3bfqMtG1ZUmzXTq5MES/3Wlxp\r\nXxBVifX29mUUTB1sL52fkkxUZwEUhfVPR4bafKRUamHmByEPVre2Kt2F7aDj\r\nG58oear52A3hpT32McR3YL5NDaiokPt54HOxgDWLnzt6+npCGnBKPog7KpnD\r\n2Hobns9rmJEVLNYyDbR0ri12peYjaeZr7/w4KHq2tWYqFeqVE8IFsHhLzqJx\r\nWUhvR61HG7+lkpoIcdwwInEvBZ5Z+TF5AEidtupDCd8sLAXkfsx/Hn+N4zLu\r\nc+FvbFYinj9OwEhbtY4jzq0Zt6QZ/526t0EWq/8vxsU3HygG68+HlS+RZmhd\r\nMhXMyYtpp3/yHHRPrdbs86YQoS66DM1eYkVfw85QMoiPdM5IGThxgmOcTf4B\r\n+s1Key/jhxMjnhFHq6Uyny8bjSSp/lrUJd99tUuhevCcbiGdTpFh+WgsKVW1\r\nODbIcBcUtD1AJ6cXvvilDZ8N+gQX1AAa1PjMVPeTXa3YiyfHfh9naG70SNjJ\r\nEKADhgGuEygk01wmG00N77UlhYo0fG459Ds=\r\n=GXbK\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.22.0.tgz","module":"esm/index.js","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/9903eea66fd38f5f7fb6852d8fc30fe9/graphql-hive-client-0.22.0.tgz","_integrity":"sha512-O3ig92HpRuY28+osRrpiJjAZ36C0UPoKBfkgDyew7Xhgafyb3QC3HrJQ5KTvFuynIKQ0iWjz7CKMbiaMOclGbQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"8.19.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.13.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^8.12.0"},"_hasShrinkwrap":false,"peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.22.0_1673964992072_0.0592521313880392","host":"s3://npm-registry-packages"}},"0.23.0-alpha-20230208100219-8a154e0c":{"name":"@graphql-hive/client","version":"0.23.0-alpha-20230208100219-8a154e0c","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.23.0-alpha-20230208100219-8a154e0c","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"347d604fdb51ac40bdb0ac8b5828d65f48623085","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.23.0-alpha-20230208100219-8a154e0c.tgz","fileCount":60,"integrity":"sha512-fqgphCPqaSl86E3qwsCtU1+qfbBu6zMdiJZwz+pSl3rvy8eAjegy2rXTBnwFy5LagsrVNZINxPsHbbfLbPyZDw==","signatures":[{"sig":"MEQCIH8V973tqcrqDf7NSaEDg7xSgqC1zoc+f2weShWhrWC1AiASN7HShjIbjGuHcHIRUncPjmljywrh68OFWDmkj68tCg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":177572,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj43NWACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoqQg//bZi34Z9RsbtdQHwKjZ6PNDkSRlLNjZ6tBB4eGugqBLswXQDx\r\n+VIqNEPRo3aQ012pLqlVjiaNpjOsB9G06ehPvTEJM4/lqdW0/yCe1gvm/LC5\r\ndI7VerMfqDcPapXmlbKIN5k1DLU090KUVuf7UrDxVEAUsz7lnSeb9YtHsHtX\r\ngE5Ic73JMtMJ6/9y3fHz1CbAQkvGU2HvOJNYUjbgjtx4BlCLQtGnJPcu0OeQ\r\n7IooKYItLKyA5gnRQ6NKpKDpas7mAEBzrOmV5XkYkn3oruqhu1VbnP60v+9+\r\nIHnatp+IdlEbyBPL2eFXzykQvfGt/IqdK+QKsppyFBtUvMH0KxucJW/mW3o3\r\nTPewKOxHRNItEat/Qv5PguiHh1ak5PGqrnt9llUQ5DNvqSVCRSuMNuRkZdCg\r\n3UP0gpav3qD2kecmR0Ghyk8W9GOYzODmf7067qjp4NT7bxlmaWcTqPsy+gQF\r\nHUEehtgkWiZFGPLdXN6wlin8gXIIvASlq8RuLRU+/L5POOszFSR8DNjajdjt\r\nOPsCv1wNL+TBKxsc8iyCZb9KEMclbrQvsccAdBve4TvNbfly9HyZtOa/3xN9\r\n4lb9GSSeVUz9bTXk18D+gNz1SXKNPQj77qAT0QH/MDOh4Go5YR443zOujgZ/\r\nYj16IQS5+4qSYKpsnoPhaGO/4QhQaffpMd4=\r\n=VRx1\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.23.0-alpha-20230208100219-8a154e0c.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/73fef2cbd66c1b2dba48572e67d12a55/graphql-hive-client-0.23.0-alpha-20230208100219-8a154e0c.tgz","_integrity":"sha512-fqgphCPqaSl86E3qwsCtU1+qfbBu6zMdiJZwz+pSl3rvy8eAjegy2rXTBnwFy5LagsrVNZINxPsHbbfLbPyZDw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.3.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.14.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^3.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^9.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.23.0-alpha-20230208100219-8a154e0c_1675850581952_0.42773212594654697","host":"s3://npm-registry-packages"}},"0.23.0-alpha-20230210090506-c8dbfe32":{"name":"@graphql-hive/client","version":"0.23.0-alpha-20230210090506-c8dbfe32","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.23.0-alpha-20230210090506-c8dbfe32","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"49592910ad614c1b6052ffbbaca4da7af097ec2a","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.23.0-alpha-20230210090506-c8dbfe32.tgz","fileCount":60,"integrity":"sha512-9GSHha/yXJhopN7EBI+JW/E05sC4yqvkNawoNT7sdBa8yb64wjlBs0gPgbsrWnSRMV7B4cmlKVkEFGn+2Yctig==","signatures":[{"sig":"MEUCIQDXRAg0hToacQkrLJIVYnAmCnTNrno5+w4q/D6eU6xkoQIgNU5xeQO8Pe9/tvzrB0VlIp+UguKK3QGWxzKRZkpGeMM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":177572,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj5gjlACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoDbw/8DkaNbS6Duo3vrZxgCD9evOGSz6gc2RERxgl03wrqDW9yu5Tl\r\naymwL79A04sEMv2W4OZppt9SaKvZDeRHvzz4yZcGD2mIbyLIVHoEsPk/yvLO\r\nH1JeJ0hesCU5nxZcQHuctEACRRkwEj8KSMg14VhmAmFlLGHnw/xHiBFIHRDV\r\nMtgtVdK5nPQm2uLXulWowFcZrJtmivj4MvgXp6cyub3UCGGWuJ9+hxLU84RH\r\nWkuvQ3OeIeNBlpm5UEWjheJ9FafvYqR0bLImx3JfgcLi38RxzpwOYqYEyqJc\r\nOJaRD/3IIhT0sJDYcblO7Dx2VeLTFsRZLvqsECeWckALjdKpFGY1Xc0CXAfI\r\n9hRjwiRVFV+SinlcGG0vKqG2XWBlieCIP4xCHN7Z2Nj9q0L69uT7mHeFbVi2\r\nmCKy0PnOIJR+M8SfN1irLkNXKh4YAsLxdUApPVUf1mR6ZeDWSGHbyYCY9+HA\r\n9Qv3bW6tG79WS9jKqHF+up/pv6Lw79cZQn+eEObIIRT08gd2bzjUzmz4JiXn\r\nDy4LOUuJuXPij9qKwV9Bz8MzgoE0/sWIM1AyDKcxa2cRnleBI1q3xBC4Bty6\r\nUKD5KobJS2DTWD5OHj8HPunCsn6mpBOklod9sC9eKkdsxVQIOAscLSJ/Qi13\r\nWLXktaE0aZuC5qeDuF1wmclFVmWfu7mmDNw=\r\n=WlRb\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.23.0-alpha-20230210090506-c8dbfe32.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/0e5939a618246860b71b7b053c68fbc6/graphql-hive-client-0.23.0-alpha-20230210090506-c8dbfe32.tgz","_integrity":"sha512-9GSHha/yXJhopN7EBI+JW/E05sC4yqvkNawoNT7sdBa8yb64wjlBs0gPgbsrWnSRMV7B4cmlKVkEFGn+2Yctig==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.3.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.14.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^3.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^9.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.23.0-alpha-20230210090506-c8dbfe32_1676019941207_0.8811721236306194","host":"s3://npm-registry-packages"}},"0.23.0-alpha-20230210090742-d5b11a5e":{"name":"@graphql-hive/client","version":"0.23.0-alpha-20230210090742-d5b11a5e","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.23.0-alpha-20230210090742-d5b11a5e","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"548d246249fa88cdfafdd85432f2b59e1b17e1ab","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.23.0-alpha-20230210090742-d5b11a5e.tgz","fileCount":60,"integrity":"sha512-puZSGuUozRrdJUXL6xrqR8CiaRIdJxqYFQDMNcsgJ561p8WjUumYsi7XlRhXRSDfcqOKLgS6WuHebvEn4SdQWw==","signatures":[{"sig":"MEUCIQDtnMM3LsOy4qUD87DHI6dX1OVTIqi8peO8sTz+ZQ2+EQIgP/o6BEVXRhN95CCxenJ7XiMmTP1AmPt4Yg6uWivdNps=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":177572,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj5gmEACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpixA//QKvLlpQ1ImBTf/36hDi6XljuK6zrqOEQQ11IpSNTDxJsPwEF\r\n/7qP0TtZ9dTBIjpLjOH2EiTUSTMs5st+S5trnubhzjzvxZGtmqYn3B3kFhsG\r\n+PdOW+uFL7AgkEnr9QATx6e6/ftJbJDTXn1ubQdbymT1SfXz8oORAEMUX9yu\r\nAmzH58h2aUV6Fw+9zQTMCwHOev7AJ8ckKgmLZaoH8b9vvixfOJ+W6WtXDoUC\r\nOWmC5s8agOADnvGa0WnN5SDJ8XAZN+H7X1xu6IrOqKmeE9z8aO6VYszhgU9C\r\nJ/p+mevwUa0D6e1z25gUDA2dmuNmL+sV1rGk0cbvgecCsxBV5NqHbEkfwjI/\r\ndnsmZ2/x1QN/k/iju5VWp0kxW+pwpylu3qJWiLblpLJsIJmLP135WyI4TALH\r\ndl02QcYpbj5R+xdNo6wncPMlh5DnEsHhXmTiHEsuwSjS2k/+u7xHKA4L/0nO\r\n2cQ0wFzIVfWO1r6aeMaYIEA+6oON0ZjBfG+8w4yckKBxfzmcR+mTRLMF54ab\r\nbIQMxAx1pRkr8phkJokaVBpcOzv9WI9kU0/DC7ZVn41UopAHjQ6HO8s46ZZt\r\naUYukCHxPkfAXFYn0qyIcyoOOSnWmcYRMeWXQeDVeyDRxDlyOEfHy3FnFpJh\r\nnyl4o8ICbzeNhZgS3RODGWYFtPDCdIQrXQc=\r\n=Snc+\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.23.0-alpha-20230210090742-d5b11a5e.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/985c55d67e7a764754ae7e0d90b94220/graphql-hive-client-0.23.0-alpha-20230210090742-d5b11a5e.tgz","_integrity":"sha512-puZSGuUozRrdJUXL6xrqR8CiaRIdJxqYFQDMNcsgJ561p8WjUumYsi7XlRhXRSDfcqOKLgS6WuHebvEn4SdQWw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.3.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.14.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^3.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^9.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.23.0-alpha-20230210090742-d5b11a5e_1676020100473_0.19584442820841774","host":"s3://npm-registry-packages"}},"0.23.0-alpha-20230210091245-be130c15":{"name":"@graphql-hive/client","version":"0.23.0-alpha-20230210091245-be130c15","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.23.0-alpha-20230210091245-be130c15","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"db7a13a457baefd049047d1246d7fe33a2ea87f9","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.23.0-alpha-20230210091245-be130c15.tgz","fileCount":60,"integrity":"sha512-7n5fuMWrW0RV2fY0cdLhlL9+vIIbGCuu6KAPGzIw3FXXBNPXlpbeMILQtYVKwOd3WZ5aNSsyn7EPjVq59jRxoA==","signatures":[{"sig":"MEUCIQD9PqRet1zYrTUsWgUvB7z/axs52nsWhAOsGhIsMM+VOAIgSdsfIZ7+liRi8cJuLC/6MFLDrPzNpLLGiStlFVxOiCA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":177572,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj5gqzACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpgYw//U8P8LnDcgNDFoZPZ2eXeq5vjLCCS39RKWbI3HADsuViIPzt0\r\nI6pzvYTs32bDyKILfNNX/fND9GITXppk/f29VZmAB8T0Qa8xtG8euTvh5Zes\r\nfyHrOzWY3cO2l8NgbNTJfC+2drQG3KajN170YUZxH2eDgLtlvPBySGo3TCDt\r\nQjWy19lKg+X7x5+Urn3gjV5UzpLIUc0/tsC6kLQtPEp0JEBehg95h+tOlzL3\r\nLKFyZLsTv8uYDIPiQZ83dEXoFpgyfBx4Ovdgf9toCCoX7pVlW5dBsQw/+kav\r\nKGre5TKrXxnVgqXlZ8/GSEezNG8PhuouaXqbSqLJkqfWxEk7HRkRdzPyDl3K\r\nc2R20dyYeDsbZBh870uQwGQZE71GxHKJ7TYWFjAePgY2xtXMMWedZEqFm32P\r\nQP/Y/kA5c6cj6DccHYEmGtHbJQq+KRuWahXIzC3Za+WXrFJiOe5gxKutFLY1\r\nLYr3/srgbecrR/y96kbj6X+A36DhQ3a8hGXv0v8BJo2S2RukCioAN9lFiqHF\r\n+i6qg+Ot7uaxKlaYirb0tOHYQUMTP8Ei9O+1QHoXjoDp7hkGvIpbstM14I3V\r\ngu5gxAcToqdyzEF6v+TaWyIXWxVJuwBiNtLTJYpOTesLBMhWW7NWNAVz4oG8\r\nXQcVM/VUJmwGbAxwZ3HM3RvAtnDKT0THIks=\r\n=g0pk\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.23.0-alpha-20230210091245-be130c15.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/6d3095d5195d306320dc7c61ab0104f4/graphql-hive-client-0.23.0-alpha-20230210091245-be130c15.tgz","_integrity":"sha512-7n5fuMWrW0RV2fY0cdLhlL9+vIIbGCuu6KAPGzIw3FXXBNPXlpbeMILQtYVKwOd3WZ5aNSsyn7EPjVq59jRxoA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.3.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.14.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^3.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^9.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.23.0-alpha-20230210091245-be130c15_1676020403107_0.4926644183581723","host":"s3://npm-registry-packages"}},"0.23.0-alpha-20230210091750-fa501ba0":{"name":"@graphql-hive/client","version":"0.23.0-alpha-20230210091750-fa501ba0","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.23.0-alpha-20230210091750-fa501ba0","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"c3542ee3ed0f97234943d9ed999d79da495645f9","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.23.0-alpha-20230210091750-fa501ba0.tgz","fileCount":60,"integrity":"sha512-d5tMBhKbAnqXGBEDJhl8AJ/tvTDUUdpjCfXJxOsLQzNP+umNzmYt3bKDGE6aThr9ZP7YmF2YlOMZieKkw+orLw==","signatures":[{"sig":"MEQCIDd/A65bW1aslrUvMUg8Wr2I4Slt+yJwm2WQ4h9qKzBCAiBSQH6zSL7o5S1yC9Vewel9iHaqmZ5rc+wKrFTeOn27gA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":177572,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj5gvlACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr+Aw/+JNbz3Oi4QeQkS+08/lecqDKvBnlSqrWP6LZ7EN1wcBIUHYwu\r\nqqyg9P4grWjajKEmAkI4haWeZkR0ZRZR5YLlSrH4wLcOkFBi0WghT+gsWu5G\r\nO5FmBVJ6qV0fgErvlYvgiauSqST4ILGdOm8kOLPoWaTs/K8M9vR1K9Rw2T/p\r\nbKzCw83a/n8h9EBWt9QHN+ac/QBTL8ySXPWm7p9fhs874fxnKqQO2johZ8H8\r\n/jIDNrDPnD3vt9BQJFzwROlImRUTOSQ2UdGLrYWmhxpyKCoh+Wjtnct3zf46\r\nDld82pC5hPmLhrOhY4Ez+k76q5vbqd/ilFHGk1pWEJLdC3d15hEc0mlx5ePa\r\nKFHJOGPf+ZGczZCnEc/8sbBmG0Ux/D9zFFq7RPoZUCLXvHRuf1cFBNWPoV7z\r\nDcO+UVHv3cXn4a9bSkUWnFmPN/YBKy5uTj+4kl6ppnlcPoqL+7SosT5QBXlb\r\nn0GPpNZp7jGXuQ8r88QFzRmyXAdz5PhMGul9P7lZWxxltTd2Ql8+LsNY9rXZ\r\nNC7qM+GSmowDHh4dE3ipwYv3RDX6/t+hyLYEth0ZE5T7zPY6wX6osxw/AwVm\r\nTQRKVlZ0oJRy3AmpY7Sbdaf3cwdaK/y0+2Gac4TGmWhkOjwUkXzaEcaIzpmX\r\n1e+W2T07OG5VSTom4e/bTd8vtbwMEPH+1zw=\r\n=k1L0\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.23.0-alpha-20230210091750-fa501ba0.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/54930a617ddee7a9f0d4b8664fd646d6/graphql-hive-client-0.23.0-alpha-20230210091750-fa501ba0.tgz","_integrity":"sha512-d5tMBhKbAnqXGBEDJhl8AJ/tvTDUUdpjCfXJxOsLQzNP+umNzmYt3bKDGE6aThr9ZP7YmF2YlOMZieKkw+orLw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.3.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.14.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^3.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^9.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.23.0-alpha-20230210091750-fa501ba0_1676020709624_0.08077366330277691","host":"s3://npm-registry-packages"}},"0.23.0-alpha-20230210092650-432472b1":{"name":"@graphql-hive/client","version":"0.23.0-alpha-20230210092650-432472b1","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.23.0-alpha-20230210092650-432472b1","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"518da12f28d360529aad585cf7f80597aeab383f","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.23.0-alpha-20230210092650-432472b1.tgz","fileCount":60,"integrity":"sha512-sAFeaAngaGMyt1NHffeXF2f3ywB2A+Sp6OFaRiA59NI5ii7omBEG54rxUVIhRwOCdJH7Gg5gX+hq5g48ZbUMoA==","signatures":[{"sig":"MEUCIQDyNfCZ+EopBhHbgx4kN4WeInumEZaPWG+E62iIEWqSYAIgBoEs0+aTlW2yekKryHpiXY/v8NwFSWRTBGUrgIHZHWw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":177572,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj5g35ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpD3A//aaI/tonTIVpF+veBn4CF7b6Oltla4mK6aj+x9RjwCaikFYG9\r\n2cg56WSz9ie5Dj97MpzUH6IVSPUruY5qpV/kWFSWl9VhsTODn51lD2ydq6kg\r\n0CGipJtcHn8n5OxkqIIf+L6zk5oUe0xVOPrSnV8Uv9ot9IvkQ7ndjEmByssa\r\njZIoQdOejv+iJ/X+18PeIf9EcYxLiVrpHOugdoQisX0mw4SFj8ofe7HcmyCG\r\nVdVlzhG/xqvPC4aLKhoMpvy4ySOc5AGb3Y8FRG4ZFE/oCYfQzRHwlmtj2dIz\r\n0JO5xjoQ9Awb13nD5f0RyneSXJbbx15O1IhUtdxWEpFd+QAuLmYAg0bXDAq1\r\nvbNfOODdAfhfU7wvlPbiKEGmc8xzXyoGH64lnyKFTgU/mVQAKRc4SPN0lW6i\r\n8EiZIZBefmSxgcre42ziNteAHhOnQIcViTlLoms0zsdzvhlGwozw4VnDJpCy\r\nJYeQAWeOrLKJE6Bro1fMq0APQnuo7rSdkie25xOKzM3wun0lzcu3T2v3fALz\r\n5UI09waLRTGTvQSAeWkm1JxoOpnPZXs1+i/pgYRU1HNSs4qSVFtL8WUI376M\r\no7/vC/my2W6ioL+iG+CbCYAk2rnoDXxq03MTsG8UBxxmjJYIQO0GGQb8Cxp5\r\nWqQs87fUBc2fFvlJNpdEuQLO3T+Wt1LlI/w=\r\n=f0LI\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.23.0-alpha-20230210092650-432472b1.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/78baa9ca2cee2293c042ad9b5b058fc9/graphql-hive-client-0.23.0-alpha-20230210092650-432472b1.tgz","_integrity":"sha512-sAFeaAngaGMyt1NHffeXF2f3ywB2A+Sp6OFaRiA59NI5ii7omBEG54rxUVIhRwOCdJH7Gg5gX+hq5g48ZbUMoA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.3.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.14.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^3.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^9.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.23.0-alpha-20230210092650-432472b1_1676021240797_0.24609580226483518","host":"s3://npm-registry-packages"}},"0.23.0-alpha-20230210093144-3e1d7dd3":{"name":"@graphql-hive/client","version":"0.23.0-alpha-20230210093144-3e1d7dd3","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.23.0-alpha-20230210093144-3e1d7dd3","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"ea52ca3d4ad79e7f70bb46d02b13987512ae069c","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.23.0-alpha-20230210093144-3e1d7dd3.tgz","fileCount":60,"integrity":"sha512-bKa8c/UXRVOUUPDy45CQJvydZbUNxLSOzDuJrmEAe9JuIqPaCTyjxgq63UQOym06u6Y1il4wlCCfN5Lsp12teQ==","signatures":[{"sig":"MEUCIHxmlX9zSfGGQwphzxeoVE4CkpWqzElpHGdaWX4xCn67AiEAktl0zW4lf9KWcque3mzBJRcVfkuNOcPi0/dOmFdSR00=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":177572,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj5g8mACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo6Aw/+Nu7ZV5N40kzL1xQPwMlQttKB8VR9rlGHTG0Bx/EP/mAPDvxz\r\nhWRyY8AbVEvtJWsphwWeFYDW1xw8Bglz1jMWIdWPWPx2cUjBdRVURTyi4dQv\r\nkmrhX0HsmnPrh70g4fy+UsjYAryEndHNXzBIzR6eES14X/tvabRFDmUHiwp0\r\n3B65YETr3/6+OBWv1qZmKsvPVRozcaqcXr2jAvppjdaJuD7o8WF1njEvkbRE\r\n5vR8AgVJrafi8eMDivrwfE3nzWLgh29fLipcfbPC7KmuaiQ4VjNdHI0RRGf0\r\nd/8aY0yiTzRvl6DRou8ENUtRvXeWKVHFG0kOFtmsregTLvfHXzzcWONipL7r\r\nAl+xqbr2c2atEEBfogr5bcM8zcVXOlRtTjBvIfxVpKNQxWi5NhuHjovms+Oq\r\nqyRSzqONp41JrUk7dfAl2xFaD+QslefORhUoOSI1PSBO4vlYpGkVRLjAkUmc\r\noG1Ud9VjJbTNc5VqTwxZp26p8qeTD4lb0NfFQbsN2btCiW/qMRBnk0EfODdl\r\n6HhYcvPWM/hP/Vw3mzrq/aT22x7tevZJY/scj6UDKfAGzuI5qtEWjIhEaCIo\r\nDDxrM5zMsFL1LN5fYiHKx8OY9qHmnGmKXd4+ZCbIskRaAh1osj1NduDmXGVN\r\ngAT+ZFtV/O3+ooAaE1RX/sT427lwfSgbiJ0=\r\n=iRPv\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.23.0-alpha-20230210093144-3e1d7dd3.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/8a122ec98605fca69c64711d60a6cc14/graphql-hive-client-0.23.0-alpha-20230210093144-3e1d7dd3.tgz","_integrity":"sha512-bKa8c/UXRVOUUPDy45CQJvydZbUNxLSOzDuJrmEAe9JuIqPaCTyjxgq63UQOym06u6Y1il4wlCCfN5Lsp12teQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.3.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.14.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^3.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^9.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.23.0-alpha-20230210093144-3e1d7dd3_1676021541731_0.7072135593234932","host":"s3://npm-registry-packages"}},"0.23.0-alpha-20230210102108-737e7786":{"name":"@graphql-hive/client","version":"0.23.0-alpha-20230210102108-737e7786","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.23.0-alpha-20230210102108-737e7786","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"7fa51aff0609ac58b6a02b15a349bf9ae6ac3eef","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.23.0-alpha-20230210102108-737e7786.tgz","fileCount":60,"integrity":"sha512-Ds499JQnwDj93YtvAGWYHI2MCzDGnGMCNEaj6+xn3NC+64AILqo4hbPtX7rAGkQ+Km/WiYi5N1fgVfQassIE0g==","signatures":[{"sig":"MEUCIBblJRlfGh0teBxHnPF5UZAvNMjKuwa293wqCapt2wBNAiEA9aRKoMAQHHpaisYob0W7wCLrBj0b+kiE8Vcn7Bl2WwQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":177572,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj5hqyACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpVHw/+IzOdzlSHpb80CKy0zkf0WptE9ohHvXu9CJpPgwXAxb/+6tUB\r\nMNAKGFDbPzo5CFV39ce1dFRIiTLez8y2uNLvyaZZ/2bw/pnQM3sBg8j/JYpE\r\nsjYDQRQElbUbnMAichUVcgZPgrFcfyjoxvgcqsAgcV5qtNXmbs5LQ5LSuK4y\r\nKky3yuOZ3szi8G6Tc5wDsdYMqYioi53+DZNWtEeMSCXW7/U1dhqcYvPeKVRZ\r\n5wzN+MS6U28ckOoJPpTZutfqMDtwmLpDGJ6ZgXN+YcGy+6RFK8rn+ktdeACW\r\nuqBLkK5cUnzjv0cSiutOgnuiztJUt8scy5YL4uIdmi9fQEY+awtWfUKFxtkG\r\nPhUprhT0qxN7FhBtSOf3Dx6oKZ8KdaD0Qenb/NvqGYAFLAEJN9qVVG0mukXC\r\nCSI0E6do05JM3PQU+jTEDwT6tAqOkeEr77x/UEbgON7NnWA/7GVyQ4XIzRkg\r\nWKzhL9Vr3/JLUfVfMMywR/wKCU9bbkny89B5WJWg+TlrltlbodFLZKOa1zls\r\nTbY5PHjdsjBp6KEewC8tugvLd4GQhLwon9E02/9mzEx5h0V6X0XFQhoiPIPb\r\nK3gTNeXiLgvsI/tbGaGbxGBDlFN5X5Re8khgBac7xDGkCYXpQUDaqZ0JY3oc\r\nZ1pcKsRoGv4UPPkGOwf+MU5vMORZZhSrch0=\r\n=24K5\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.23.0-alpha-20230210102108-737e7786.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/430b17246b6d73ff8be75eb2f4718021/graphql-hive-client-0.23.0-alpha-20230210102108-737e7786.tgz","_integrity":"sha512-Ds499JQnwDj93YtvAGWYHI2MCzDGnGMCNEaj6+xn3NC+64AILqo4hbPtX7rAGkQ+Km/WiYi5N1fgVfQassIE0g==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.3.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.14.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^3.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^9.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.23.0-alpha-20230210102108-737e7786_1676024497950_0.5310373448580448","host":"s3://npm-registry-packages"}},"0.23.0-alpha-20230210102618-0681f9ff":{"name":"@graphql-hive/client","version":"0.23.0-alpha-20230210102618-0681f9ff","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.23.0-alpha-20230210102618-0681f9ff","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"0ed2a6389b3a181eca8616b98dc070ec554eba39","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.23.0-alpha-20230210102618-0681f9ff.tgz","fileCount":60,"integrity":"sha512-sfJhRPt8sK5RFiMnwvfDFqZOR/Ih9TWxGkwyTxBalm5srEYTIvb7wifJaK0JF8ZpUBykMI47UbLe1rlNFEOb+g==","signatures":[{"sig":"MEUCIAQ0HC4WWxD+YGJ5hpKwQu1kY2FppDWl6TUpvsa2jg8MAiEA20fnhWkYrQjq88bOVgSSTCVX5RCQMA/DsNrfCnDr610=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":177572,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj5hvvACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpQgQ//aBgvnHDfpYjyNWeyiul2QNFeXhxWKgg+XsTbff6sa+nWNaBm\r\ni/o+Q8ymxOpp6cK70izIE+LkIXsxjaMdQSPTd6O4lxmoXqCvO+UaXCdAh9O/\r\nZ7n3M4pI6VojoGOd7Rg/U0y3vnff26a0xhmCVXNJFEBHo8cE1mUw5dP9ufSx\r\nQMhrGCu6g05YnO71cK9BElF5z8NkaaROYWlQCRErS792/c9tXpnWM4fOi+Tv\r\n6cyzkcAFeTWmPsXeyX0hAdTfsFHo3nrvLFUcObSIMnT9wuIDD5bL+bXQ/42F\r\n2TTERYE/1TDvH8OAmAvGF8cHCHFXzw8X8z/9Vx8L8nKpQB9o2++zJE2xvG6R\r\nw2WUAJYJ4nvhtVzW9YxjZbD+8sd/A+AICs5ieWb6ScJmUEZFDdMn1CivQJX6\r\nygk1JnTI9+6h7iTDf9W09RWu1zqQDUq8358ok5UKcX7GJ1K5B0COU83iTbdH\r\nDeaxGpegQu+Fb0xLGMmVFiCHyyzJIby2tNi1OP1n4CeKqHC1TMdQm2irysUv\r\n5WdKB7HYVW9gKqn5kh41CeHOMOarayitW7ChpQyW34FhSReP4cbpa1eJ8kuq\r\n0BgoW4P1JmD3Mnofn5lMTWUFWObrzWP1Xl7IoZYdbs9VkOFwCVUrO5dYIrjc\r\nGpFg21qTDFpgsRBr5yRJx7kxz1NwkMl33uI=\r\n=Q39K\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.23.0-alpha-20230210102618-0681f9ff.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/385347125352337b6ba5d4838f2b23e2/graphql-hive-client-0.23.0-alpha-20230210102618-0681f9ff.tgz","_integrity":"sha512-sfJhRPt8sK5RFiMnwvfDFqZOR/Ih9TWxGkwyTxBalm5srEYTIvb7wifJaK0JF8ZpUBykMI47UbLe1rlNFEOb+g==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.3.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.14.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^3.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^9.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.23.0-alpha-20230210102618-0681f9ff_1676024815164_0.3465453316365732","host":"s3://npm-registry-packages"}},"0.23.0-alpha-20230210103039-877edf21":{"name":"@graphql-hive/client","version":"0.23.0-alpha-20230210103039-877edf21","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.23.0-alpha-20230210103039-877edf21","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"7ff5d22bd1d165c3ca2d4b37427d0bca712b4b92","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.23.0-alpha-20230210103039-877edf21.tgz","fileCount":60,"integrity":"sha512-GFxZ8+DE4Ql7sOai01YdUzzQALmk9zGUaE01Glmkd5aU0MfV1buDmCk7XbEtvwA25txayNnXJvKKDJkE+zLMUw==","signatures":[{"sig":"MEUCIQCvZd8wNgo64cFdg3gn4BkqpvmY932OFGzHlMaCrx6OnAIgfKCFCpWBl/tr8LFyCD10Ja2f/anr8hqP7hx4QCUhZeI=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":177572,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj5hztACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrBbBAAgrE6g0yk0kMIlnHBdnuFywHJwAVa8VpxYgKDKS2Tg7PNC4us\r\n01Jt7eZoIMhGRgXuqu3JiRiXZRD/pucKqdYAGGHzdP9+afY3c9WhPK/KlBM6\r\nIuorfTlvld3PO7hhbPR0CXxPCiM8nHm2zDsVYEaKwKRmRpUtLgm3vx/0/q41\r\n5+aIr6qs+pFgGoa66M7DSpgp4FLopmXUMYQjQLbsfEdZ+ahKJ6dK885i+Vjr\r\n5wclj/iQ0I2VBWONqVVcbRD12gL3urIaTWIOFvtBXGk6pG8sT5RqfWMGUvhH\r\nJKWugNUuFgT8XFp/t7tcgmul1QArhO6ZRl1vqknkOs6zk7LmYRWAG5+d/mfB\r\nrIj+9omMycSGHTKqlQutbBcntw6ruY+sVPC+efWzVrMgJEbpxn4SM1tbjXpi\r\nCH3DJebFEOwCaDJ0l2spERDeXAGN9AHFXf0qjvMBi0VsMU2m+XmrzR4cJkIy\r\nYwE5KevcE/UQcihpoEePQuDVSKyjCs0QnEuTS3Z0bV57EnA4U2+iR4+QXm2n\r\n4PIY7OKNLD1ZcNa2SdrAiTo/pUUhEbI/JYIP+Wbce0AB+SdO/pgKhOa3hzJm\r\ngriFusvJUQy+4mXjYAROoU6kwXN1KTHchCRoiqLclhACnjSqM7xQ5pYCF/sy\r\nb89MOQ2zbrjK1Iz4PNnnsZdKNgXuSb9m4xI=\r\n=NTFn\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.23.0-alpha-20230210103039-877edf21.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/8a5adc811f9c80d50c7f84e68c8f0072/graphql-hive-client-0.23.0-alpha-20230210103039-877edf21.tgz","_integrity":"sha512-GFxZ8+DE4Ql7sOai01YdUzzQALmk9zGUaE01Glmkd5aU0MfV1buDmCk7XbEtvwA25txayNnXJvKKDJkE+zLMUw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.3.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.14.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^3.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^9.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.23.0-alpha-20230210103039-877edf21_1676025068825_0.6708081876338674","host":"s3://npm-registry-packages"}},"0.23.0-alpha-20230210103545-1f509c78":{"name":"@graphql-hive/client","version":"0.23.0-alpha-20230210103545-1f509c78","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.23.0-alpha-20230210103545-1f509c78","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"0e08854d5eed1dcea5a9cc69e2d217d4a5b8e12f","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.23.0-alpha-20230210103545-1f509c78.tgz","fileCount":60,"integrity":"sha512-0sBmSbSHG5bWHEuu7SDLAwl5FPa76KjGcnfcyX4JKx4ftlE1JoLjfqjzG4hpVZSgS5Na82GrFaMe1W8DzbzRng==","signatures":[{"sig":"MEQCIFe7FOZm2WVO0URumtSL/ntBGJuRK/J4SE20kgju9fDWAiBLFWmKvJUYzWRQ7s5V1s5XHwoKhdwg2Kt3Eo6A53yvbA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":177572,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj5h4eACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp52Q/6AxUPz7F1OifOz589CJdCdHik9sqzODOaUyeT+NVieQs3/3AD\r\nDINqNgRRlt4HSa8DEmvJfnc9jroIoQTWgnTBmk27W+1X+9Y9JW0GQz5h+Jvv\r\nOzSp5dD45ytQbw26HFM+vmr6OSdVfiCbx2eoPSQrAv4bejTTl+gO4E6EnRuc\r\nldiDPQCMpKXeryHnUiUfVL+ayBJ5lXUDFsftzjBwly6doDSZNX2C6mk50EXj\r\nTloD1b3TwR+FtECzYcsRm6lxsvSfqJ/ywwmhHwffVQa8LtISH2ib7I2uF26t\r\n/EiHGPX+aXpRZ5fwG0UNQNnAcAO2U6nriJNSZNmticmM+p7ePx4l7sKB59vQ\r\naw0DXqyFxDdwZHOoWErlx8LTn7y611hlPqH7LgqdIp2u5ghadFF0ioJmMvze\r\nY6eoob5t3B9oGOABs+cYcVMl5Ef1UZDm+PhbVXmiSUQKMRL8PkuRA5Mgdt0C\r\n6IhJTqQb2YFirX94b/GFUJhw9YOAfhg4BMXM1J3N2jWIqOqM4UvwgF0P4QA0\r\nfbbE26eJHotBlSsEBKxE0Aim9dXQ7oL0tKl0e8hLq6UrPptT4ODFc91EzX64\r\nGOgi9ET8DzWlzEItL1S4U9TvHna9HoAgIDrotkVnVPUjjapM7e6r+g32deVt\r\noQFn2xstA7g1Ao94n+9WrGuPnmQUkg634yQ=\r\n=YGWa\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.23.0-alpha-20230210103545-1f509c78.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/11710e4b0dd6ef8a2c26a03ce1a22fe4/graphql-hive-client-0.23.0-alpha-20230210103545-1f509c78.tgz","_integrity":"sha512-0sBmSbSHG5bWHEuu7SDLAwl5FPa76KjGcnfcyX4JKx4ftlE1JoLjfqjzG4hpVZSgS5Na82GrFaMe1W8DzbzRng==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.3.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.14.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^3.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^9.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.23.0-alpha-20230210103545-1f509c78_1676025374679_0.8085148166298544","host":"s3://npm-registry-packages"}},"0.23.0-alpha-20230210104023-4c24ac57":{"name":"@graphql-hive/client","version":"0.23.0-alpha-20230210104023-4c24ac57","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.23.0-alpha-20230210104023-4c24ac57","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"245324595a577227ad44899aa50278e3b3a91faf","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.23.0-alpha-20230210104023-4c24ac57.tgz","fileCount":60,"integrity":"sha512-HMQwGVWSpFbRrHvh5XmZF6qv8LqVbzrgktaI8hCPMugJkEL0pHuQOqyHRBfhN7SkzDZaRJVKVseZk9dH9WpP9Q==","signatures":[{"sig":"MEYCIQCdWdfnnL4dHLK0xEqscQMFgHwbTxpAGp+o+6+okU/wuwIhAJc/XRNe3z54M8WrSw8QL01tHhG5y+NAIOS+BVM62c2Q","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":177572,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj5h85ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmpofg//Xlz3YsKCyJsA9I7jB9Zmulgtz/c4PcfU75t3367r/xJVH2UC\r\nyA885+7AuPqgrN0M7pnfxYSbrBiBRSi7E1paadzzY8DFugE4xnMX6BzHBAxO\r\nsjpTVlGR/i7Cjc3e0DRlMJsD5PQAwMy8ZsuJofyn7aPKMX4TfT4dN+TsV4r/\r\nzo3wtHNlKdvaj9tyOzDkqfAv6TtmEw/S7iZuiRM7h7P+pRPjMs1l+gIKlhHh\r\ne/wWyt2vuGJMCOldkflMi3UqdCrJBT3TCziX7j7t52CQDBMl6BhFBvhD/wdz\r\npv3cq5byFHrf/ivWkYvekY1PWDrOuTntV+9K0Y7Hq6kewvzobTmxopkl0k5L\r\nH1GZxZoEJig3jETtAIERYiXjLolsFTnaXivoWBuE8U2byYBXZ1ZULfzYMQ6E\r\nN8S50AiMMToOUopNHMZbpgRmhdwBu3Vc7751h17C4n8DoYBjc4HYO0T5lXWz\r\neSUTg56CQMrz5TUdVB7Uzv8o0gfv0iB2Jq8zdmEEE+fMkZctmaObdjFHry1Z\r\nG1BaXqW0xs6+IevPKlAiERZHuCumBNgtDcOyEU66+ys5PNJlnOSHFGF3CULO\r\nwtSrZDutFRkyokBJAB40GZMJS3vmdwrY9EMAn0ZUZEqcUV2ELXMNbwyvKG3E\r\nfbM1/hneqEv7WJXa2L8jAXiCvfHrC4SJKOs=\r\n=cVH1\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.23.0-alpha-20230210104023-4c24ac57.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/83f47dca837084fc12870ebfb1732c84/graphql-hive-client-0.23.0-alpha-20230210104023-4c24ac57.tgz","_integrity":"sha512-HMQwGVWSpFbRrHvh5XmZF6qv8LqVbzrgktaI8hCPMugJkEL0pHuQOqyHRBfhN7SkzDZaRJVKVseZk9dH9WpP9Q==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.3.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.14.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^3.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^9.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.23.0-alpha-20230210104023-4c24ac57_1676025656876_0.6993869130280244","host":"s3://npm-registry-packages"}},"0.23.0-alpha-20230210104946-b40ef0e7":{"name":"@graphql-hive/client","version":"0.23.0-alpha-20230210104946-b40ef0e7","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.23.0-alpha-20230210104946-b40ef0e7","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"f81408204833e2b04602363d0f0314a2a30db185","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.23.0-alpha-20230210104946-b40ef0e7.tgz","fileCount":60,"integrity":"sha512-inQFfP4Et8wZmizYVqDphoo3EzThnZixReNNkew/cs7280kFtMoznwgWfLgrnz45EBsCinZmywRIZ/lwXgMEPA==","signatures":[{"sig":"MEUCIC5vhcRmHnUMS5QeWD7uIdGKj0elKeQ/UPKE7BHUsHoQAiEA/jpd40Fq2UGq+rwCoXBtHb/r+f94wMGgzE81/1uddFA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":177572,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj5iFoACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrNeA//eD8+UubY5EmgwwIMboOgfGDJE2I+AKeZwEDIp5WwAeBh3O4a\r\nrghbRDiQ9lH33zYhlCzr71s7rbjhQ4KnoQKNNZRoOylWDyA7icASm2QkxwSn\r\n0xwIyJ/UgA9lQ9uoBW6FX1sJNSB4L81lgtAjbEtfKCoBmI7lLAYkvfZ+ymDJ\r\nCneVzsx8BjS0e51/yBsZNtGNDSk7wLNMzv3hf8TU7ZVBdSAJGucnHG7MfJcj\r\nwjvBnTq7jDc9Mj8iwQkdXoR73b+ceYZKAyNdjr4wIs8KIwP5K91LF1dePVm8\r\nfSg0E7JLmpxoLjagS7MGOn85SmVgd0/rvh0LHxafWsxIiRQSICTqqD9LIbTC\r\njTUY6T8IalrkPCNa7Ip6Ql8YGzTcba2JHmDm2lcUGr0kdREZiU6JOC19iGtI\r\nlF6irNIrJdC5Tr234VIFc+qPllnrZcSH51psFcZ4w5d8pwKjfckfX24WKpK+\r\nHBvPpTezONqGgPNDzq4OnahNKEDAfgRdPFiUivFWl7BUS7NyMjj5pyRaQ6Vj\r\nJL7aMD6gazu6GILUuUJ9rjM6epGfGfNV5xvpfbHwk5wWSCbyotXlTFtklWr9\r\n2h+KJnU3tezwOI8WOHzIdW0bmns4JKpc5QbrAXNSr0kvC4inYqJV2TTKml5/\r\nz9Upk94ef+VDd58HXGhMMYUTpw7MrsOyaoI=\r\n=ociQ\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.23.0-alpha-20230210104946-b40ef0e7.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/730e94167978e83121eb99fac5c3e616/graphql-hive-client-0.23.0-alpha-20230210104946-b40ef0e7.tgz","_integrity":"sha512-inQFfP4Et8wZmizYVqDphoo3EzThnZixReNNkew/cs7280kFtMoznwgWfLgrnz45EBsCinZmywRIZ/lwXgMEPA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.3.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.14.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^3.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^9.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.23.0-alpha-20230210104946-b40ef0e7_1676026216025_0.5939190464059971","host":"s3://npm-registry-packages"}},"0.23.0-alpha-20230210105239-754fa2a9":{"name":"@graphql-hive/client","version":"0.23.0-alpha-20230210105239-754fa2a9","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.23.0-alpha-20230210105239-754fa2a9","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"c505e59520c5155edb9d01e3acedb4bdab463fbe","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.23.0-alpha-20230210105239-754fa2a9.tgz","fileCount":60,"integrity":"sha512-02xQnAsdK7KjASXHqIoatNZH9FkfditF8eppUwGxIlcsXbQCb4/9KcuaH+oe74IQ4pv38YW2ZTYLKi77+4qLNQ==","signatures":[{"sig":"MEUCIQDoVhtuce4AlHf8i7RB+FNRRZoS2hceMm8gFcTDNilUxgIgBOymacMFlFR4DkPpX03Op5dO5hisvoKSMo/KydY9AxY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":177572,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj5iIWACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmqh5BAAgDMzuza4zakUF8Xf5/MpmQWMfj6Lq7OA6EEWGnedyYQs176v\r\nGTtT4ULAugCCPWQmRhYPJHte/QF8OdTpnaRYdSu510cDNLQrC3INRbwjNWJ5\r\nF9REHGg6YC9T08HwsExplVVTr5gRmkHR9OdZ0+AY4bkNWoCw/r/h2JKgPr2K\r\nyYz6zdpNgtN4Pijni9QVrGbSDj15liH1cWfNIAwtU5YF8KJeDDzXHUJj5b0x\r\nyr19e6bfdzJx5U/xcAWNs2yTSyojqzSROBN82ixv1Dm0Aq5OeXPaAGqF/ZsO\r\nmcH35DUAsssttzvRPk6oWEMUkR9PqkiYFCXV7YLefDviu+gknDVn0JVuaskO\r\nIaZC5G8GNwt0Bra8nLkvGJz+R+g+rm668luUQhH9EaHXzH+wztOGAqNSQpND\r\ncTDMol01Epxk+hj5Y9urWFzS+w0qytoSvpLMDV3Rh+ODf0FL9Vtj4cVbft54\r\niPU7X6IQZl25C51jotq9QZt8FP3gujJ+bjUXnMlmwmV42eEmNFC81RZNG55Z\r\n4Bmej55Ocxv5Vfwo0yKmaONpEWo8SWsNWF8Wx/ElS3P5MF73k/ipBxuolWp5\r\nao0qeB7f2MokUUfwi5Ywyr5IYfoMmei4TSai5Jx65smRpI4gQi1jbh6zR9Y+\r\nMbOPAcThHpZzoxiih1/A9gBefBk24cDB3Ps=\r\n=4Tng\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.23.0-alpha-20230210105239-754fa2a9.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/a3c967ab856b73a12d271cbef46aa6a2/graphql-hive-client-0.23.0-alpha-20230210105239-754fa2a9.tgz","_integrity":"sha512-02xQnAsdK7KjASXHqIoatNZH9FkfditF8eppUwGxIlcsXbQCb4/9KcuaH+oe74IQ4pv38YW2ZTYLKi77+4qLNQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.3.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.14.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^3.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^9.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.23.0-alpha-20230210105239-754fa2a9_1676026390758_0.7308600771639027","host":"s3://npm-registry-packages"}},"0.23.0-alpha-20230210113705-0c669348":{"name":"@graphql-hive/client","version":"0.23.0-alpha-20230210113705-0c669348","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.23.0-alpha-20230210113705-0c669348","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"49b1d2e9224effd4110c048bddea848050f6bc06","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.23.0-alpha-20230210113705-0c669348.tgz","fileCount":60,"integrity":"sha512-8V5I5qo7tSddBDeh0YF950Mv+SHkn6XEUHAVwfnEQlEkj8DggN2A9it+cc1cW9Qrwk2rdzkgVKBXsLe7OVKEnw==","signatures":[{"sig":"MEUCIAr0CJHQ8mzGnuSc0YDloGRjTjmPsQotw9N0vOf4zFiXAiEA5zZgcrlxC9trCcHjWKX3oSsIacqtngOcWYAvkQBRCxs=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":177572,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj5ix/ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrIcw/9HwWVPR8XAHgIe4gPCJ9pv/11fMXK+7Q042AfbHW2L4d5LVpx\r\nBV6J1mnZ0Kc/VImSfWfWpMCJ3C6Ph58du1adjipNPoxuRQQSHNPtlhDNes6f\r\nM8MP61D/9naSunZiun/7yz5xTGoSjfCUS7qp31Ml5V87ZKaoYjjCG+GRjKl9\r\n5Ji9p7qBZyx9Zy0w8724kD0DT/oiKnrUjMl+EygDRSxoRQPU+6hTaZkZTwdQ\r\nYOG5MAXu4e3xh0WPynKo7mJf8XnDtw4jxew6TfE9+z63LV75E8i2/QGtn4lh\r\nv+FzpPaO3Lf+9XNgzouRVpeEFLPn3nV7xGg1iVJUdNg9KhZoFYasbCuBqGzy\r\n7y9q9Ei6J4hNMcNeOqr7Jm73Q3lzw5NPI28KX6BNvpyLpgvTQssJJeAjmhcS\r\nj1sRqplIykN2DUb7jqrzlr3rCDp8aWF2oR+WQIm3yY5+QU0guvl6wk2isAkN\r\nUgit7EsZLR/9BJij9uK46Y+et7ayAogdngAsCQydnEnSII0iV1/EFf1NIdcc\r\nts95u2STRmewOw+ApkX0v/+pmC9BoTGpkkYaPYvM2CXmw1Pca9GLnoiGS3MV\r\nggELwwWzVONb/Jc8ZbpB7ym92me5JIb6ftCScCAkvyYVx9leIg8tgVryS2Mc\r\nrttDjXBjuAj56H55TpLkOH6kDtVlPoZuUjE=\r\n=XtvB\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.23.0-alpha-20230210113705-0c669348.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/0cd4dd945366a1f8b3e260767aac8645/graphql-hive-client-0.23.0-alpha-20230210113705-0c669348.tgz","_integrity":"sha512-8V5I5qo7tSddBDeh0YF950Mv+SHkn6XEUHAVwfnEQlEkj8DggN2A9it+cc1cW9Qrwk2rdzkgVKBXsLe7OVKEnw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.3.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.14.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^3.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^9.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.23.0-alpha-20230210113705-0c669348_1676029055565_0.7122286982063502","host":"s3://npm-registry-packages"}},"0.23.0-alpha-20230210120031-f5b42d42":{"name":"@graphql-hive/client","version":"0.23.0-alpha-20230210120031-f5b42d42","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.23.0-alpha-20230210120031-f5b42d42","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"77213d80771b1139ad25adc0ea909ffb9d7d0505","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.23.0-alpha-20230210120031-f5b42d42.tgz","fileCount":60,"integrity":"sha512-RJDW8khYNB5G8nkAJmX025dsMOKVkUP76ueoF6zamS8W1tF91ZrRf2fSKREdyR5DlZq6sj379sp0hGXdNk48eQ==","signatures":[{"sig":"MEUCIQDabnjQPyFjcXYX0LF6Z887VMlP01ssoZVX3/SRmRHW1gIgJ8bSGGmikUf2VH7bTV5W19EMNd1CEtRAGEwYOZ+IiwI=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":177826,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj5jH/ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoVvA//RCk7aPZd/jNwucVudIm+F0Qq6HNI7xHnnyES6xHPf+wvdjbM\r\ngZBNfEbngJyb5fiUiqlXppSXvlQj2r3uF2bJNIdO8jXjUssiOGZ/GHmqJLvO\r\nP4m4CheLSSGdzLouVX3efx00gwdmEucWCY1M7k0FnmhCwoOsSINgWqF6bzr1\r\nDO1pK/DP6D+DO/+6qp6fxhRr5JwoLHrLKE9W90uVo7uy2K0sHYYZd4rfgGhd\r\nEHPRsoaisvIG+EhVI4Q0F9LAbQHhePDrPMTLRS18eMMRjgfL084R3/oNExWE\r\nxrfo8sbKjmJ5I3LuIY2/u2u42UCO0a35rPSRlfcD13KJlnadd71UEjPxKXbI\r\njU8Dw4vwvUKiBgNRNgNbQEQlmDgxw9vmbxUI58yFH0pdfQOWtSLVzQhiogpm\r\n3ZGDGvVSVrKbXKY+vEq5PCNegJfahLnbYzm72LEpceqXyiKKTaJfS8VwWTDf\r\n+iRsiIhzNAz62EmSQcfHubVyD9SktmFsLW+/TT1onnkJ8W/rMzdTnbOGY+Xv\r\nn6w4oiDvvU8CH+vvjOdxnSDoRucaqyismjykzTujrsElPl82vpGN2SAGKSZh\r\nJPCvDTrLibmjdaYzXgjgixQv1OWufePs4oj3P7enjIpoPkFix4Hk/C0/rET3\r\n8SZXolitk/KKPtqL2XMdEESaF4/Te7sqYTw=\r\n=2rUj\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.23.0-alpha-20230210120031-f5b42d42.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/0f61ff197ec6b1d8daa1ead7063161a2/graphql-hive-client-0.23.0-alpha-20230210120031-f5b42d42.tgz","_integrity":"sha512-RJDW8khYNB5G8nkAJmX025dsMOKVkUP76ueoF6zamS8W1tF91ZrRf2fSKREdyR5DlZq6sj379sp0hGXdNk48eQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.3.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.14.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^3.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^9.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.23.0-alpha-20230210120031-f5b42d42_1676030463261_0.8768991560281276","host":"s3://npm-registry-packages"}},"0.23.0-alpha-20230210120311-b348cbff":{"name":"@graphql-hive/client","version":"0.23.0-alpha-20230210120311-b348cbff","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.23.0-alpha-20230210120311-b348cbff","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"9515e6d7ab992035f24f48f46c327418c75c7f1b","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.23.0-alpha-20230210120311-b348cbff.tgz","fileCount":60,"integrity":"sha512-YsygSGPs6wbaZBw4pBVX7YqfjOnlnnrDaqlb7y17X1d2qRQDcN9Mr5XW3kg0mPwA0+5GHNxjNfWB42p/fgDEjQ==","signatures":[{"sig":"MEUCIQCqIRAt3235I8J+y2F8jNWtXolBfPQYE9dI+wBSHP8e1gIgAufi967sIDnmWRwM/As6WvYh6RGZ7z9L+Ci3kP7S7fI=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":177826,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj5jKdACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrW0w/+OzyByf8042GZ4uZ4atMzqxxbSoXM6K69rBm8bhrRFcMsqavp\r\n/cHNz4uqvHvuUp4rvOiAIqi1P+A4dyoMNMSXjnAV0ensSktRNkFTzQKKHYPt\r\ndiRbbvmvltGr2jUBUj1mYH86Emd3UBfq6FmZzYXVPOSW6jtY5IeEsvLIXeFs\r\nF4Nojqy9CHSvaejaFNO6tTbQqVSXhvpIJgjK52k+Atlq8JgecAsxu0YqLX9h\r\nnUmbS3GaB1Hiuz/OVTLA4vpya0Tgz/5LI/vs8M9XJGJ0QHwuIarPnWhsOsck\r\n1QRpd/9S38Q+EC7e6+jxcIrxr5qxaAYpPkPNenRVqH8n2WIWU/s3CzN6+UCB\r\nbtB4xF+mIXJo5SwZ+zgeA6j6/z4scE46YsTkGOZXS5wWxnwYEna6ujWgfbHg\r\ndgqLPLyJTfIXOSun3yzkSDgRKkcqTiF+SyyfnsY6i9BsY3wCN/gUPLy39uyS\r\nqSgsSAGsjNceT93/eBSjNI4bc3mGkV5IYM2QnKtwGphYdA44fNud5T2k7/p5\r\nUoTRWPSFuQAr+z0IQ5TwoWrSc5p3aR61yj5JHpjKF4AH8awxl6c2OZC1uVLl\r\nLWGYzDavhfVeBUImlsroUzJX8BYKDU7n138X6DeS+ZwUXplJtrR8IyO2JUH0\r\ndycfcrgBH9wpjPgm07OkTdPV0G09GsvjYZM=\r\n=mKXX\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.23.0-alpha-20230210120311-b348cbff.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/dc169054e3e78fb0dce7832c548d2bd9/graphql-hive-client-0.23.0-alpha-20230210120311-b348cbff.tgz","_integrity":"sha512-YsygSGPs6wbaZBw4pBVX7YqfjOnlnnrDaqlb7y17X1d2qRQDcN9Mr5XW3kg0mPwA0+5GHNxjNfWB42p/fgDEjQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.3.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.14.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^3.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^9.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.23.0-alpha-20230210120311-b348cbff_1676030621395_0.7623388391057777","host":"s3://npm-registry-packages"}},"0.23.0-alpha-20230210121420-da538854":{"name":"@graphql-hive/client","version":"0.23.0-alpha-20230210121420-da538854","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.23.0-alpha-20230210121420-da538854","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"9e69b16aaa94eb3b9e384c0138e4c101dcf62498","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.23.0-alpha-20230210121420-da538854.tgz","fileCount":60,"integrity":"sha512-mQMzgSLS96ORcXmZSOuuPjWPIo5LnO2ZfxWXUp1t9vJKsoxSBfOecN8NqB1za93zhs8zmcDgYwzRfmUu5v2/YA==","signatures":[{"sig":"MEQCIEIWpEsVGzpFH6O9+HeVea8bEd6at+cGnyHhaaEX9b+PAiACumNSXlBMVW6JZBAP3ODvxfGRbPV15vMi9yKFTSSPvw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":177826,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj5jU6ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmowPw//RmU5vCyFH/dDT0Hu+PWujaLX2p7ffOLE64h8aGBXro7D3q3K\r\nmjCs1lIsx8gI2OmO/y9LVXD7bQZ+vIGjBSrC6rQ/jZ+ZXRGKV2q8lRBs0m/M\r\nP9m3ds+WypLv6QJJ1QJryWMErN0N4zho1FhZw3bCIf5j9XkvfDcLHF/XiYTY\r\nD8DoXfItfVJxLDa5pAUVQebHaJ9C5eqtupWaSbSuXjDCVom0gXzN0hQOPIf9\r\ndqAiczBYI73hxX7owvFZyayJeykFe6wlHhFPYfUkQ2sTgRgKJar2DreKI7QF\r\nZL1yNJOOEYZ/WMeD3Oisua6jLZWmMWke/wexsIjWNX8JXC/lZtw4te+sl9EN\r\nmdfYtjEiDUaXuM1SEKmf1IlvKtJKaq9IB26WgkPTkgGueO48vqB2xqypyHlp\r\nkty+MVUgAaLsPknkxFCYI7U+Q8X7w9Ih+GfBxmbP/x2gopJnjz3pwBfeLNrl\r\nJ+BQwumnzGso7lzjz0z5b2LDnW1VfHu7obABwbZJP82HFctjNNAAcNLJCEqI\r\nC7IgiTkOgZ/TfRVjJhev4ESg5gdrFdnLpaHOn+ZQtYot6ZztCwXRjxnCktAk\r\nkKxuIEjyiJTAHTy4yOuFfdIb6s9WbsGdRxTtsQCfXMUO0dpMiB1TwQgXl9Rd\r\nIo/7rQHZiTKT5gUS8rA9Ty5EUHt7GUdI7jc=\r\n=oK9B\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.23.0-alpha-20230210121420-da538854.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/f05c058ab232fbf624563d0c3b450d4d/graphql-hive-client-0.23.0-alpha-20230210121420-da538854.tgz","_integrity":"sha512-mQMzgSLS96ORcXmZSOuuPjWPIo5LnO2ZfxWXUp1t9vJKsoxSBfOecN8NqB1za93zhs8zmcDgYwzRfmUu5v2/YA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.3.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.14.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^3.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^9.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.23.0-alpha-20230210121420-da538854_1676031290253_0.7627363662446498","host":"s3://npm-registry-packages"}},"0.23.0-alpha-20230210122411-2fda1580":{"name":"@graphql-hive/client","version":"0.23.0-alpha-20230210122411-2fda1580","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.23.0-alpha-20230210122411-2fda1580","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"81521702149b56078e6530e076918b06c7069e9d","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.23.0-alpha-20230210122411-2fda1580.tgz","fileCount":60,"integrity":"sha512-qpKdyzZGOCsRVYX3ZEeD6hmLsUfMxmoP5F4eZzUE2T+jTYrB3eqgV04fOaZymNUvTqbz1OV7Qo+Rkbl5T8TFZw==","signatures":[{"sig":"MEYCIQCJQ1KsH5NBl6AcC5KYlj9s2IzMAZOS8R0rTqr346r3MAIhAORHJymxi1fMFLxNx4shdZc8xJOPf6ZDQEUwBD+fK1Ut","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":177826,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj5jeKACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmq4aRAAmXQ0wlcA5DM9NuS4iizZVwjekxq6q3WTi4LmJG+W+CvDYx3h\r\nOh20sJ+i1TrrXMx9HbplZCuxjKEDbxSfEi146svjIh6+DI7UMMFYr3AcODFV\r\n3KjGkFXR6yqj4Kcm3/Hx4zeVQHYsmraGtMCNjGh5qatGU3T38S3oaWA1YCwf\r\nXG00rY4bCfx1iUDVFoH6psc31zVZP7Ql/jRGjRV2yy6Lsm/mwsC4r2azKBi+\r\n7mj+jwAwXRtmxyLemE4DDVnaxyQhB06FmV+ZIey+duRBJ66kctvXcyZWayq5\r\nSn/+OVGLYVRZqU8ix3SmYiQGSVQbYHuA5V3isYk47KCSoETRYxyCpdUM6OLs\r\nILcpme3wEuRa58hLID0pDTzZuKUyKTmC4fdrHKjak5xLMHno7BVyWznrneVv\r\nielNrvU9Z1MAQAKBmCY9hs0GAZcPsL+bm/+NoNYExUCLax2Z5SeIG3wG/uKq\r\nkOfwJJhpLp9jyHMU9AsgTlwTGL7gxBxDPj9LZ7FHv+etEJAWU3LBrxoVkQa4\r\nIZhEyFjFa8P/MG1HDack7WwkYJ2Gv0rvZTWPZ9KHmQtl0JERZTDYlDVPTJZf\r\nHMuXQYfHkR/P/pECxSFl5DDVj+BZ4IOTbD4SClFxqAyfDGLrAdL6hmjiPL1Y\r\nRspXEZzPr3Ux2HLVpuTfZBMykHwwhyg0X6c=\r\n=n2h7\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.23.0-alpha-20230210122411-2fda1580.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/d5aff7f45671bae1683b8b396f40a608/graphql-hive-client-0.23.0-alpha-20230210122411-2fda1580.tgz","_integrity":"sha512-qpKdyzZGOCsRVYX3ZEeD6hmLsUfMxmoP5F4eZzUE2T+jTYrB3eqgV04fOaZymNUvTqbz1OV7Qo+Rkbl5T8TFZw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.3.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.14.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^3.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^9.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.23.0-alpha-20230210122411-2fda1580_1676031881635_0.41054141630232266","host":"s3://npm-registry-packages"}},"0.23.0-alpha-20230210123050-13e6898c":{"name":"@graphql-hive/client","version":"0.23.0-alpha-20230210123050-13e6898c","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.23.0-alpha-20230210123050-13e6898c","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"63ec8062a7d9e4152e7b805f9d96e6d324c3c5c6","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.23.0-alpha-20230210123050-13e6898c.tgz","fileCount":60,"integrity":"sha512-RS8jnA/aW8rZvJay2JGXLHaFVQGzO19CylORCZd/LN3Qfy0LeYh5aZVo/z9jhZklnIay+HxwQGMRJ9amO6CEwQ==","signatures":[{"sig":"MEUCIQCYtIdE5ZmXfaFcaklLUdKYFam1FgfP7stggWbBYDBTAgIgMTjhyEm18F6uetQ+iySNiq5tWsudOFxb5/mVkdYmcRY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":177826,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj5jkcACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqUnA//Q2l0urB6KeF1IGDdLfi1s3GGNoLKwdoqapFjgnRGAndyPsbe\r\nPSUnTfUSBfiiL0q/zDPAjSsgSS+uQ7H+ZlqTeSQ63huHP4T7tIgOr/MRMSf6\r\ncKWJiRW/+b9AYw7MDOc6DBsVvfqWZShUFEMPTLVb0Sb27DKTdaMyn0CbxUx7\r\nAghZ/ea/W/sT36PPsX9LnuR3aWpymks/i3z9WoZlrM6sf6qQxFA1uNb9scml\r\noOlDnlx6VedDVeFg9CPq9LKce2RjxKsa0nnC3BnWRwxErkGyp2Humipuf9nq\r\nZh3/c561xAGmLUM8PUAdqqdUuUuIah5UWR+61/GiciXzkXDkE6gAyXg9E1R7\r\n87Z6RaoL5twT0oYs680jUjUz2TeEHGEM5B6qwMuos330mhBFd0EyoO/pwxCO\r\n01GP6GP3xmqeYXbrFjhS6bkLzQr2DLRXqWc7gPNRgZVU67n9A6CuH/REQAhs\r\n1adwslAnYpBR6kLOKTRtu6s4fdmbct1cYelJl/ffpnfofSxW4t9TOChcO2p0\r\n7Iq1nsGjcxFmwr9BXg7KAVIhzXxLrqnTR3OTe5cKiBUSwXy+NMco6DAOd5/G\r\nCY/fJHtesOvJwsJH8K8Za4wtCrfiZSE8T25b2ANhpAx4ZEC2WgjQGyGWz2AK\r\ntlDPPhPA+TQ8FeA23WpVnVcY9cK9Mh/KLZQ=\r\n=iAaE\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.23.0-alpha-20230210123050-13e6898c.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/7e40c17281d6d2ba8dfa8be2924f755c/graphql-hive-client-0.23.0-alpha-20230210123050-13e6898c.tgz","_integrity":"sha512-RS8jnA/aW8rZvJay2JGXLHaFVQGzO19CylORCZd/LN3Qfy0LeYh5aZVo/z9jhZklnIay+HxwQGMRJ9amO6CEwQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.3.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.14.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^3.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^9.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.23.0-alpha-20230210123050-13e6898c_1676032284011_0.17896238143642806","host":"s3://npm-registry-packages"}},"0.23.0-alpha-20230210123427-deb31f7b":{"name":"@graphql-hive/client","version":"0.23.0-alpha-20230210123427-deb31f7b","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.23.0-alpha-20230210123427-deb31f7b","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"024bc3dc5f624fdad18a7ea1c121b5eee1703bbd","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.23.0-alpha-20230210123427-deb31f7b.tgz","fileCount":60,"integrity":"sha512-dF7tzLDx34In1DcVbLJ6ZOxuslFCM0MZH9b+usjuFpVu59hPBMAfbZvI0we63OZYcQEudMSP9mbHRmxIWkZ54g==","signatures":[{"sig":"MEUCICjLXk/K891zkZr3od3a6lX0ydRFATPHYRKdAFZnjNUMAiEArHopt1BpxdPu3GU9JvTwFebI5TcU6T9SJ9cZ2JrDHiY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":177826,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj5jnxACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrfEQ//S0hYrPCS8PkdK8M0xEZfW3Vgubps04HIh/GJgUkWqUG03RLT\r\nD+s4K94S9Qusvxwhs1CZXxZ6Y2sWE+4/LnpdicVWovrPR9rWCsfQ0f9O0q5h\r\nFkECr+Yp+g+Przr53I8m7BueBKWDuTOTK++qzgdHix969j6ZyfTJ9bLpbrk0\r\nfF5CCN/Y/PN7hCWCJdkWeyz7StCb/cu7GsikyYgCMkdZ1yR4iLa+B1qQFVHl\r\nl9kgjOWljw73/YKzlYgFXO8NNho3mhkzmZrv/y4AtgfM6nNIkB28bOJSQLyx\r\nGsvA+hy8OWK2Hvb+sg70W+kJDs7LUTVggKqou87eJuN2yf5cVPqLmx4fD4s+\r\ntS/3lFITG0CAtJ77SMlkTvBLhGISgl3pklWDuW2g0LPHVMjL/xNiNvCtt8uM\r\nwUvsiwORnpDRCtGVwUOqKHMBbAiw+l5xOG8oe1JKM6Do2HlyuH0M5Qm+iujZ\r\nkVt/iWTAIGbsPy+V8xmZJTfFptFEd5DzquoFw2wIbcNbQiv+/HkRsL/n4BjK\r\nAB/6gFEgEGHpA1wDA3S/0hLmaQ6vvRxi3ia16gUG00iRCLQ57xq6NnAGrTNT\r\nrBcPKlNv9ufjRrr+RQvSyu1NHmaO5s7oxPs5qvX7ttAVE6zevF4XiqfsryJC\r\n1HPx7XELl0INfrQNfc/yr2mxgaOjxgRkuFQ=\r\n=nmtI\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.23.0-alpha-20230210123427-deb31f7b.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/b1146e6dcd093f8a7632fcc68e8bc890/graphql-hive-client-0.23.0-alpha-20230210123427-deb31f7b.tgz","_integrity":"sha512-dF7tzLDx34In1DcVbLJ6ZOxuslFCM0MZH9b+usjuFpVu59hPBMAfbZvI0we63OZYcQEudMSP9mbHRmxIWkZ54g==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.3.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.14.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^3.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^9.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.23.0-alpha-20230210123427-deb31f7b_1676032497695_0.6386113658680357","host":"s3://npm-registry-packages"}},"0.23.0-alpha-20230210124512-01d8a07f":{"name":"@graphql-hive/client","version":"0.23.0-alpha-20230210124512-01d8a07f","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.23.0-alpha-20230210124512-01d8a07f","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"35d689e5b461e1ff6eff7f9f841aa2a2a535e5d3","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.23.0-alpha-20230210124512-01d8a07f.tgz","fileCount":60,"integrity":"sha512-WBs2CYZIWpRJmi+bR0OaSCETTd+ppS+7JoGFu9uhDfUd/MeF8QO6sSCq+RVmXkNFiUobfJWNAOWQOavEBExXBQ==","signatures":[{"sig":"MEUCIQCnyxMT1gASHpO3lp4bfoZP3hnGLJ0ZgnnkVn15TVhDKwIgTasS3aKnHuCtc9x5vC28zpsIFAz0DWBlsPnL2c9+I/o=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":177826,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj5jx2ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmq80hAAmeddHfCmp6uoXykuIl+kj5NDy6lswTYsIQ3qOvIuOHNrBboX\r\nkAhtixCWXXAL/JRV8pImjWiMQbWhTGvAgU0L58d0r771pz5p9TK/Sxna/LmS\r\nkV+OCSqHdObT9xBW0qh5fTW2e0OAFNgsNf9NU+88/lQ0HK1qqHtMFnGw7lXi\r\nz6Bnm9NuKawPhfacIvv3t+7wGuoPubPuFtthMpMzN7PBISTmO842o/3bG7v/\r\nUfX/h7KEZPWkB3A5dNs1eSP4TGKFFiLPfg5sYflsaWOZ4g21maXg/ZL1UbJp\r\nvdj1ebVv4Gqc0fKZzJAvs8eq5XP9C3xLUq/cHYwYOKZLazFsSeCbC9o1/ziZ\r\nsQ0d8qV4EMxJPdAkLxEtWaRClN0V1h/S3nVlc6fDAZcoo7mZi90Y7fO6hQUG\r\n0bjXiNCkyU3iosLY4J7pE0oXped4nvERxw7/AO/VdGkrsKvdP6U+63og9+Ib\r\nXK8bLnQ2Wm2Iq95aH/ReU5qUR/SJvV4Tl+lz6FSzNbyVQl9jr//FlU57yUN+\r\n1iqgJ9quKRU5iCHKMs8f/l2Sbl5x7uB0B/AB5aNsia9Zyacwh29fAynv7keV\r\nvlTZipWZMaliuIKmA6zdvW3uOwJmzhhv4BCCvCO64/gtiPzmGEcCxv6/ntBC\r\nn7l91L5fr21H3qYRrNAYBHdlDX27JON67uU=\r\n=UQTD\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.23.0-alpha-20230210124512-01d8a07f.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/50d492bee5e8414d1221c8622f8c49ac/graphql-hive-client-0.23.0-alpha-20230210124512-01d8a07f.tgz","_integrity":"sha512-WBs2CYZIWpRJmi+bR0OaSCETTd+ppS+7JoGFu9uhDfUd/MeF8QO6sSCq+RVmXkNFiUobfJWNAOWQOavEBExXBQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.3.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.14.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^3.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^9.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.23.0-alpha-20230210124512-01d8a07f_1676033142384_0.29931382968230213","host":"s3://npm-registry-packages"}},"0.23.0-alpha-20230210125042-9ac57089":{"name":"@graphql-hive/client","version":"0.23.0-alpha-20230210125042-9ac57089","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.23.0-alpha-20230210125042-9ac57089","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"0cd43f486343ed9e719b2cb9badb8b34d383134c","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.23.0-alpha-20230210125042-9ac57089.tgz","fileCount":60,"integrity":"sha512-u5kS0n+Eb16aomOrcrazHWHcsaDR8Rx/p34QPN6Kghme2pJq5jRbLq5sWdGMppUS/pGRNH6ZVVzpKj38xTXwEw==","signatures":[{"sig":"MEUCIDcWyN95zih7VPJXXf5wH6YIuUeLyIpeYgKYsjgUaDAnAiEAopo/qxztEJGqHKlgqxe6yn55L5Or2u0vY6Wwt3hqcBw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":177826,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj5j3AACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrZQw//Q74almPHw8Hl+nlgmC9M66Ss8b7ahyFiEei5TVxA70O7ssft\r\ncENzEz7o2gZv5N6laHKqkKeTlxVcZqCbU7KG/FndI+YC70gbVgx5RXiW3p+i\r\nNEI0MIzw7L2cScBa2rMWSK2BZRtEebd/u9GFCd71+z3gImpHclOoeuA2oDrK\r\ngFIm0W4JNrJPkKcVR48GaNVein+JtNB7SFF9NJKkrzsRZ7PDjtRR5L2qtWNb\r\n1clR1U7U02IHYaShWhZwvXpwgEKEQCaCiBuiygYHeki9MabR13pIS7ABDy7W\r\nZdDQ1oJLjZjta1UjFYj9pIE9OxlZzU4rIMs5fSDIwdvV01XF2cmjYkSr80Rt\r\nROa/9mcq2YYy8LLztpBv07wl1IKCLfx4Xx0kCaGZXcw4834701IH0VJuPxtK\r\njSzNTr+DBCMwA9y4wb+GbhGaArZXXg1RLtXOmkAMn5Z1HFeeVRrFx0Jw9BVK\r\nyoT2gx+hVQIFgNq1/lYMXD2ILQyOnBpR+CAzRacneLEAvo0/yQo+77jF+K/I\r\nqfOT+BmNP2ld2UhajLFj7PfS5zhRqsMHyTK8i16KvUqEwGk924j/W95hBq4g\r\nC3jhv/uj4vXA1XbuM23aB+S26ZqIvVnQN3PD0YbHAQCP3Yr+ghinwdXPucEX\r\n8ebL/AYkoe6jP2jMaGZ6TTqMuCCDvsm/n6o=\r\n=v0Xn\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.23.0-alpha-20230210125042-9ac57089.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/c127319259865e8b243b2e084a6f6174/graphql-hive-client-0.23.0-alpha-20230210125042-9ac57089.tgz","_integrity":"sha512-u5kS0n+Eb16aomOrcrazHWHcsaDR8Rx/p34QPN6Kghme2pJq5jRbLq5sWdGMppUS/pGRNH6ZVVzpKj38xTXwEw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.3.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.14.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^3.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^9.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.23.0-alpha-20230210125042-9ac57089_1676033472378_0.3963579573425764","host":"s3://npm-registry-packages"}},"0.23.0-alpha-20230210133000-96f00a02":{"name":"@graphql-hive/client","version":"0.23.0-alpha-20230210133000-96f00a02","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.23.0-alpha-20230210133000-96f00a02","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"c80ee5edbccfc57bd173497ef9ff3ccc2d816676","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.23.0-alpha-20230210133000-96f00a02.tgz","fileCount":60,"integrity":"sha512-M2iTmyPwRP2H6IeTTUdUAGEOVeNqvS7Q8sE/+ceQ9xMmGj6exUttJGz+rgTupOQsQprva4wleE58GGrLt5EtCQ==","signatures":[{"sig":"MEUCIDMr29fMnrZQJeiaCp/4gAheLEUjkNll4bUy2A0g4Sd0AiEAs6dU54eQXKZ1KRehvM8+1cJZcISDNoG2jq2btUA3J9k=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":177826,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj5kcBACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqFgQ//SXr1O9f7TwKCEB33HF5lcNb+Qb2TMzaZCcZJIaf5H9oiruZQ\r\nAICnC4y5pMFMn08iCdc1UNDhkd2fBbxZB3/QRwc1fiazlFUzhyGkI7+PgnaW\r\nC89szy3uCmD5Ekama9LN/VuZnwfxs5/GE53cHTMKACS3rU8if8jWjy7tyzIH\r\nU8qW3zjeX2QqbbgVKxWmm8mtlZYYUchBZ53Aes/+2OvIAFA1euUJgtlm+TEn\r\ntl/EtNglai8f+v0KKnemi42+//HTZooZEuFtbpGe+GR4cl/9flcQW2kMljGq\r\n+W25YZKqWcmTuKGXA+wMmUADOkz4f8GJHB3T+wHIzb6UJBtLx8pbL9f6XmYb\r\neRn0MoTI+L9hFQu/Xo2eIZlEJ3Mw29L/DMQCxwjwdQKfSRBLvy3sDxwHpyoG\r\nHYkPqZv8lPWcP8TAGEMq7NcoZPGZWT9iWZrmWsPt4uImqRMqgr7oC0kd4ltv\r\nV/9lQtsMPX6TRq2Bx2B+SkDCAFSE8LFDQYPPgefPGb8XyMPpriVEL76hIPOe\r\nzg6Qm3QfqJzjdJnMF0ZfR8IuvTdiBsLw+mr4imREKaopfs5s+Q91jC/ApqNp\r\nf2VOKD+vE6wNsUIa0UmikU6cxgBhRb5qv1rFk//16bW9REvtyV/A8gVv7Azs\r\nRKkDHl5hlHc78uGg49scqOIYObVE32RDj5A=\r\n=Ubbo\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.23.0-alpha-20230210133000-96f00a02.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/33957eba84c6a858b9252d9035651c5b/graphql-hive-client-0.23.0-alpha-20230210133000-96f00a02.tgz","_integrity":"sha512-M2iTmyPwRP2H6IeTTUdUAGEOVeNqvS7Q8sE/+ceQ9xMmGj6exUttJGz+rgTupOQsQprva4wleE58GGrLt5EtCQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.3.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.14.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^3.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^9.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.23.0-alpha-20230210133000-96f00a02_1676035840965_0.533280015630262","host":"s3://npm-registry-packages"}},"0.23.0-alpha-20230210133412-31beb219":{"name":"@graphql-hive/client","version":"0.23.0-alpha-20230210133412-31beb219","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.23.0-alpha-20230210133412-31beb219","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"85961e605bbc208151ad11e3193291eaedf5b029","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.23.0-alpha-20230210133412-31beb219.tgz","fileCount":60,"integrity":"sha512-UJZiP8y+T86/pT1i8poxocnZRsAn3Dy/uYp5YtPBxwgF+wT4po3B0z/fjBgDZHor0mQqXXl+L8mNU7prmCB5aA==","signatures":[{"sig":"MEYCIQDK7Nt86RmndUCOPONT4do4JQVhq7uF6y2YUofTG6VPkAIhAPWcuExrTHQOIDKsbEmLFUO1GNIj8N154dtgM96ZNDpu","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":177826,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj5kf0ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpqMg/9H/FzUidDUeEfEg6G5G6Blw8+lPundVzi/EDQBcJLafSzcmWu\r\nHnZKcKMWfX+5v90rgvv5mB8cuf4RVo5rUN0cN7Zm/gpcNFJg/6yxne/Vp3kh\r\nFwI+adQy4Wm4TPlyIfrktTQmkFQKnjNZRou1rPGQ+stiNk/5085khM20qoEp\r\nj7TKY21CdUSzyMvl4+IxVg0jvIeR0X5hWpsDlOWJOWjToZ4Tgl/N2LBwKKvr\r\nl111XJ/ISDjw4/qEYiBNDoT6hcagHi8sXEauBvTrKLyLZWVHVoeZQDJpqz0Q\r\nvHrU/yL+JrMFIPS4M7T/ODAYvl/ohyGM/jZEg55v+pLVwjSrgu9V35RPlonb\r\ns996yx+lRe48dDRlX0Jo4UgKkm4AJmpSxGk+9ofD200UeiXz8N7RDRHOkIRr\r\nH51qmTRi1IqChlgpRUED2q8PgLV8w3Ugkvk+IWFkjPRlSKxOuS+Q3GpAmnE7\r\nuqaFNovLa5sB8hllOH2YYgJ9JkvdQM3GlDNut3Q7msYEmhRrCFafqz83WJzH\r\nNWLz1zSJ7D2gLNQWpcaIjvL1P9U+5V6hCDyKpCFxHgju3Cr+Zk9BgxMvQXn8\r\n5l+R1BTObrCw+blDBd0MUCdA7EjYnZeCO2EZYFgjOmWoZlQVKtVGS1s6k1iZ\r\nfKu7xCem8066wrVRkPsoK6Ue4Z/FnspzDkE=\r\n=zA/q\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.23.0-alpha-20230210133412-31beb219.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/082d0ef17748ce1e3e069bf44b065b04/graphql-hive-client-0.23.0-alpha-20230210133412-31beb219.tgz","_integrity":"sha512-UJZiP8y+T86/pT1i8poxocnZRsAn3Dy/uYp5YtPBxwgF+wT4po3B0z/fjBgDZHor0mQqXXl+L8mNU7prmCB5aA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.3.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.14.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^3.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^9.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.23.0-alpha-20230210133412-31beb219_1676036084581_0.19391782094964838","host":"s3://npm-registry-packages"}},"0.23.0-alpha-20230210133921-b7f005a2":{"name":"@graphql-hive/client","version":"0.23.0-alpha-20230210133921-b7f005a2","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.23.0-alpha-20230210133921-b7f005a2","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"3670603fa320ab5e26694eab34f9ef1fda514922","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.23.0-alpha-20230210133921-b7f005a2.tgz","fileCount":60,"integrity":"sha512-C43BIG08KtD00LhhjLGlbjyl8+lQNLWWb73M2cSvuGW8rN62+3BnVwMAE7nLO1mACgIdT/flgEJLI5AXo+fvgw==","signatures":[{"sig":"MEYCIQCFsoTkyo8RfBEsaAVGHtQTdKmVgvkTaWTYwOJJekCh+wIhAOzsd2P0hB6/RmlXXqzvQ7s5342suNHYJ8FOBV7k36OT","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":177826,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj5kkoACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmrstg//VxKqZyh605oYd3ORot3o5vZnJjdEI2a4NMJb9wEdqh2Zdz5N\r\n2e6yCu1pyHfYI70BAiaiF1wiTCHty2543pYEKZOdVsjGo9oZHuf+j6dagIMj\r\nRDXUJkFnhFxchiNPNvL4YoLrv8iOG1wvVPG8NH3UHR/j2wotOMT+d3hscrEs\r\nBcyrAUxww6DamuFo3rJqd/E9xfK1SqQI0S4KyjydXKeI3L4hhV1eBHGxzHH7\r\n5b3II1+SRPi+DAR1imSu+JywPKy5oneny197jgkIcjKqeeU/U/TRp3tgTAeX\r\nRfzW3HAZSx6znZAp7+ljbok2+nlOyvAtFzYbDoFbkWrIb2qoNV86qB6XZpel\r\nqniyfjlBXdyI+bEm6KVSceQ2+Pjx/bAwHdgmorp01+KmSMcn9xiMvUvwEDbT\r\nF+IXJR3o8X+QAi22T6pO/Y3ouFvnrnlQ7dH3fZKoK+qVB697dXeKuGosAfqh\r\nuaE2UB/ZLX8D6MZDJyWqFGc8sDckE+cMLLNe0eCcoFVQxtv5gfLiKYZOvLZT\r\naw6HnMVWA7deZ4E51fc1Uqcc2fWE1+ktjU1Fs4VPe2/+ZXq//Y75FWhZN0Mg\r\n6CR8wXkENxJWil81iVDjsxYyQZAsTab9IYBiSXOR099OterQ+4rdS0/TWBzs\r\n496Bi8ZYOQk3k6sZnn3bGCH/nffXISoO1TM=\r\n=gyXa\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.23.0-alpha-20230210133921-b7f005a2.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/23d367fdb989c95daf45c744dfc7da43/graphql-hive-client-0.23.0-alpha-20230210133921-b7f005a2.tgz","_integrity":"sha512-C43BIG08KtD00LhhjLGlbjyl8+lQNLWWb73M2cSvuGW8rN62+3BnVwMAE7nLO1mACgIdT/flgEJLI5AXo+fvgw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.3.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.14.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^3.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^9.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.23.0-alpha-20230210133921-b7f005a2_1676036392237_0.7236100038014579","host":"s3://npm-registry-packages"}},"0.23.0-alpha-20230210151627-4a8aa897":{"name":"@graphql-hive/client","version":"0.23.0-alpha-20230210151627-4a8aa897","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.23.0-alpha-20230210151627-4a8aa897","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"1781969113f6e822abd34bc364a4cd027a8e90c9","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.23.0-alpha-20230210151627-4a8aa897.tgz","fileCount":60,"integrity":"sha512-WpCiMsx1BgQ+6rxsVw1MjkAHHh489l6MnmANzmc2CcRaGzQMVKNLKVXVuZJbUdD4+9Y9j2fQ8zZmGj3q2hgB7w==","signatures":[{"sig":"MEUCIQCD3JlHf+uEGxazels8XgYRn9NDkTgj906nEz/s8W7idgIgKfmV+g6mj27zhwuZK54jF8ITbq/PopzIQ9gdmAVE2II=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":177826,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj5l/qACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqVAA/+MdEmzK1xjZVc6eoRKoC1FYMjcP8Qkc7mf9mn/mGQTnwFN8w2\r\nX++lun4dhvM5dNldbLNngz0q2hvffUBrjXNWCazN7Sg4cO79qX4yIdGaHt/X\r\nUHBrq4U+cXg8U/9njnT8WHlt5D6YyCQ3E7U4T5C2RMJ0uMETFM1c4DdwqAQa\r\nc9oLe9cYoKgGturIIznH6qamEXUlXbOM/q/RYLZftoW6SHzcNoKntPLrEQYq\r\nlh70ubVD7iobOcioqRY7Obt2IZkmycq8NvsGCGOZl3J58m54erniAHeisM8t\r\nQHREZfzcbBn+0p5ivgTrjuPokXQ2qGWvdfdKogGnUUKOoDPBlSnJGXAZhpbY\r\nHJ06ZgEwmZFumgNnKKV/TLmMIeZeBFki3zNOGyv/wtof2DJ6PmiCAP3h4YPc\r\nXoySniR5P0ze+JjtAlteDjFpPQqtIWOu2qY1JJvALuhPyv0fIMGHxGxyGPWt\r\nx1GDuAjf5tK/v/W30y3AusE76DC7HjxH7JmGaX51CbsrTChlnTb3bMVrVd6n\r\nCASZ6f2K3Kh/j4P2jxotZm1JkekgemMnqCrCyngbEm/OOpWyevEOqHQJhnc1\r\nyYS8T6BfaIMdGxLUEkh1Pf87F6HQFhpgQf7UWuOTZh5rXC7k8alnKn6x2Wws\r\n9ZjDxuGjX5fe1UHFsBDm1JQSOZ92ihgzDUc=\r\n=C9Nr\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.23.0-alpha-20230210151627-4a8aa897.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/7629edb328d1736cbadab6e2b9042e8a/graphql-hive-client-0.23.0-alpha-20230210151627-4a8aa897.tgz","_integrity":"sha512-WpCiMsx1BgQ+6rxsVw1MjkAHHh489l6MnmANzmc2CcRaGzQMVKNLKVXVuZJbUdD4+9Y9j2fQ8zZmGj3q2hgB7w==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.3.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.14.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^3.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^9.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.23.0-alpha-20230210151627-4a8aa897_1676042218482_0.02506305346217519","host":"s3://npm-registry-packages"}},"0.23.0-alpha-20230210155439-19481707":{"name":"@graphql-hive/client","version":"0.23.0-alpha-20230210155439-19481707","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.23.0-alpha-20230210155439-19481707","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"021ac657656baa7adb9a2f2c5ffe8f54a14c7cd5","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.23.0-alpha-20230210155439-19481707.tgz","fileCount":60,"integrity":"sha512-Ox1ZW+PMVNiXi0e38DJ0vvmWXyk+xXXQWv3bQ0W9Fh6SWhCmQPgEoINOhchwHZ4e7sYLVvMk55PLBN/roXcSXg==","signatures":[{"sig":"MEUCIC2FHrIl3EdYV+W683pfB+kxHv98iHPDvfEs26l8ZuSMAiEAhuoWOCsC1Youxu2f47La2QGhEnuZHopfrn6uMekYASE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":177826,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj5mjkACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrOPg/9GHwP90Vn9gHUnQZMp1VYszXfCB+QNIhlmE+N3NwSm/G4Ye25\r\n324PBwhXnmojM6yQy0kCgkYuwNP3PgL84zOcDilHstLxqz4Or6o8etATAlTd\r\nquH+NQo2DIwYVUQPmVQGouPRTUeI8MTHE1lEmx6fl6QKAm8pIzCobIxPD6j3\r\ns75mt1VbGvbROa2sVxXnrk2iEo6oH05a5TrFT6qQYPtuHGaS0KLv0GcEyBlj\r\n/OjcKAA7Xw8R/l0MjjlyxkmLvjd/aibc8uXYaWxWwWtfHKoBa5a3YKx+FV5U\r\ngdwBFiLJok7hDtzTXzyQ7d1g3BOAeUr1TeQdRXZltfcttaHpjRvLInYWcUb7\r\nlcEEkZDuP0cBDOiEc3aqZFUJhnTdK2iB7tP86jPKovlOIEOR+VRz4DVmSwMW\r\nFQWptA2mH9fwt37pGTMA8wz85l6DPo8WX369/5Z/3Efo7Qj+vn0IXtUNg8jS\r\nUYU0n7KFTWN32BxaOGcOLDqG0Vm7snfQqau9AguyhPK+hvVl8eQLSTgDsTCG\r\nBWXBAlCdqCIjujdp84qeXxqSUswoQ2KCFFF2SuGI7rBWzhzcM5aMm0Rqwd5B\r\nsMMZsaFEBcx55L5jRZEdhhHNeVWFr/320Xakp8eSfSzPhc3/2wmTtzHo3qqF\r\nPPcjRfgfjpI4E4n0aWtVU2i0+uL2hRvwM6Y=\r\n=GcKj\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.23.0-alpha-20230210155439-19481707.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/07958a6caab3c2d771d2c94302071657/graphql-hive-client-0.23.0-alpha-20230210155439-19481707.tgz","_integrity":"sha512-Ox1ZW+PMVNiXi0e38DJ0vvmWXyk+xXXQWv3bQ0W9Fh6SWhCmQPgEoINOhchwHZ4e7sYLVvMk55PLBN/roXcSXg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.3.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.14.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^3.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^9.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.23.0-alpha-20230210155439-19481707_1676044516025_0.45268009391875674","host":"s3://npm-registry-packages"}},"0.23.0":{"name":"@graphql-hive/client","version":"0.23.0","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.23.0","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"85a09bea344adbb9725018e8e795c92bd1bcdf10","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.23.0.tgz","fileCount":60,"integrity":"sha512-D2H/t+vA3Jvg1cDKMIt6z3ZeXhGSP8r7zca5luIj6ENRBwVoI5eRDRkTsmnsI6UqA4Z9RO5VccrYiJw2VVvXZw==","signatures":[{"sig":"MEUCIQDzuwdBJMb5ylkGt2Xs9nCPcmKwSLFUsfEKbKFiWF+xdAIgNEtCKK0SMXXVkL3jbg2Uo8onIVXYLMjpsKYxwaVqwbA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":177676,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj5nAGACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqroA/7BYdzgtPdOcdN8zUfvimngKBltDOihj8Q4+cTexzGKSXilc3M\r\n2QO/aM76xc7ckZf96383vtVFYvSLkr8MmzAN+qc4h1ZgyRnPhYsz+Zr27JBJ\r\nyK8mufEKSvUkFh0FkCEtUVEp/TDue6APkaMrUbI7s7POWPTVT6e8PBtqKDUQ\r\nkDPQMiUdmiH5dVBdShGxwuUoBAw1u9kwmA8rVk/PRN75nE3JmZsy1wrvbptp\r\n7kV+nmQrC5a9HdM/0DhAR/KJo8AT/swyNjpAjtYr+MJ+1dcTAW16feGOyGWe\r\nv3j5yYUIpVNMA5WH4w9kLWDzxcu19lBV3uCPJk7Sv8yIsEjvT9wL+yGaPvHQ\r\nY51a3tQnkGl3Uj1NS9BMPK8zn1Erk1OkW82qcI0CF8/JRiELEm6etj9p87pe\r\ne7lYuKeeT6BqRFQF45jRhPPwSuYoMwfUFTuU8SnjtFwSC34V4MKFhwGnKYVj\r\nxLQVHI5F1Xv2ztYQRF37jRkXaKHicItd3idUVDHJTZj96duik7KM6BTTABfA\r\nX91Qu6qnSoth4uRvotoU+AmFUlpw4UuLrobgfi6P7wErrksUqxJB0fvAAk8L\r\ny1D/PBfzSvm9Eq8k3I6efKrhc66FxYI1BVDWOwq9jUDLvfu7t1bRMzZ/AUsL\r\nKZFVZsgDrHiWK5n2MnLaexnlqzu8Q2L/91E=\r\n=Ynrb\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.23.0.tgz","module":"esm/index.js","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/366a5d2accf1e63538037f291b3a976f/graphql-hive-client-0.23.0.tgz","_integrity":"sha512-D2H/t+vA3Jvg1cDKMIt6z3ZeXhGSP8r7zca5luIj6ENRBwVoI5eRDRkTsmnsI6UqA4Z9RO5VccrYiJw2VVvXZw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.3.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.14.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^3.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^9.0.0"},"_hasShrinkwrap":false,"peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.23.0_1676046342776_0.20176516207400264","host":"s3://npm-registry-packages"}},"0.23.0-alpha-20230210162531-7fb44d1e":{"name":"@graphql-hive/client","version":"0.23.0-alpha-20230210162531-7fb44d1e","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.23.0-alpha-20230210162531-7fb44d1e","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"fe32fb5556d422558a409938561a7ba37264143c","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.23.0-alpha-20230210162531-7fb44d1e.tgz","fileCount":60,"integrity":"sha512-/BMd+tZnl6hY/3YyjRoQT+qFrRr9V7oRg56p0hQ/5tWip2WU2+sDpikXIe/0kpLE+nhnhFZlBsk6kNpboZQHRQ==","signatures":[{"sig":"MEUCIE+bghens/iyY19DvkCGgLyTPHDp5Kd/sbfjdOGVfNsFAiEAxhSZzsbHHHN9BjVBWRVG2fwpAtaHUuEcgbFjyB9lO3s=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":177826,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj5nAjACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp+NA/5AI1VsmpEt52NCg1LPTQmYnI4PbU6DKEMwEuKXY6mYpVSDDau\r\nKpo3d+bC1bg7m1a7yFP6mHjd4sj/C/cnL2ozMCccxsYlo7LIPyCZyTm8jfQ/\r\nxD95wAmvM2V53KhbeajInaM2ANShwewC5TID9r4U20TJtkkrZSGdSoGUjnk2\r\nZv7+xHGKX7g77iqZYK3PCd7NAgoLRHt/fnSqsZt6sGON4HIWX9pA7pRdJ25t\r\n+BEu9P9d+V3CenQGVotCO9w+LdYlP+3IrSx7BCiDlWuOH657QDYH0Od5y/DV\r\nqbAEAPhZzdFBi5piRM/47MHaWlqiNLW+9guCHy/6bC0sK8VWfCUlEgaK5TYK\r\nZEzhW9a+vPcUbrlRmjE5d7yn3Ydq5s1Ssc3U8t6/sNdnrWxoeWmXD7dx/k+4\r\nGOYNVHiDwOPqv395Gqyvh24C1bDhFWMm0QJpL82m5nVNcVPvLzmLPrJyzcsc\r\nXZunnpGV8f/k/JXdwsk8nECTcgQGGc8VtbHQz+8oXkS3ARlaB6DScQxWZq6A\r\nQo8KNxjU90RcO9RZUnvXxCoxNwq/z7NsgMf3fj2nngVOmEB2x6HxyBnEF63z\r\npLJPMSHkEeah6fLfFFz2GH3lJKOjl274Q+fUoOVhcYlEFpHy7XF09SqohUgT\r\n5WcnGAE2oTM6mWI0suREz6gqmjnrYTAHhXE=\r\n=SXQK\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.23.0-alpha-20230210162531-7fb44d1e.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/489388475feae4aea44bb8b3d0496895/graphql-hive-client-0.23.0-alpha-20230210162531-7fb44d1e.tgz","_integrity":"sha512-/BMd+tZnl6hY/3YyjRoQT+qFrRr9V7oRg56p0hQ/5tWip2WU2+sDpikXIe/0kpLE+nhnhFZlBsk6kNpboZQHRQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.3.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.14.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^3.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^9.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.23.0-alpha-20230210162531-7fb44d1e_1676046371180_0.6490677722965732","host":"s3://npm-registry-packages"}},"0.23.1-alpha-20230213090810-b98936ac":{"name":"@graphql-hive/client","version":"0.23.1-alpha-20230213090810-b98936ac","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.23.1-alpha-20230213090810-b98936ac","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"9e56a24ad3f0021fabd516d49ecd1e581db4dafc","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.23.1-alpha-20230213090810-b98936ac.tgz","fileCount":60,"integrity":"sha512-btWLuWSXGHtr4WJZeMFrDH9VaLrzXPz6x3u/lf3fd7CbcyCkTX3gVuY1ej6V5aJKWIlZQLFn4bh+g6BEHgwQjg==","signatures":[{"sig":"MEUCIQCbmCGM+1dvtxp10RqhsVK2crl+Cuwf1pyI5p/KqesUGwIgQ4HrpAxzm9Gx+zBjDzq3aSY8QCWv4yoEX83w2WGGLJ4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":177852,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj6f4cACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr0UQ//Q88Rs+MLPvC6N9fMB/dOwy/jnsBnaB4NFECOKnG/yfobbpaj\r\nl2ztVCpP5e0j6+JuQz13qH5XcWONRtYbeTVhQqG8gkq6saWkbu22xzF+SeYq\r\nr7Orve73ZXRt879prC3Y37GL5hyamSKX9aLgaWK3PBdx4DtAeYQu/tyP3LnO\r\nexTiXQLimGv9lPrjtay+WacQSwNG1srBdDzW4dnyoAyLN7LHj8MLwaw3iYYf\r\nG60BqcVpjOCC6lB//UVIA8Fbq3gNt9yMhiYJD4ig68geuPYVbbM+MzEpDk62\r\nLHvj3a3zUbO5Pp7DPW2SbAKcF4QHvRoHjkiSGWSnJJaG0AS9Tuqfb62RJ8ou\r\nOZ15YJLzOXGGFhMba2xe0vh9ngcOx06+5grnLHC9me/BgwuKBTYfPQe355NW\r\nsHR4jn5qe6pCdRjwKhJVPwNbYvBnE154uC+/sarU+ndDl9fcWuWHsKmD0VMI\r\nBcBQkD5GyXd1g/g5YhC6Aj5Whe3KPyBYs0MhBCM0/zBoWvvjiHuZE28tQrEf\r\ngaAcZEDL4zk2HvIRcKZpSLQ3bPZbyT/PD8wls9Qs1K2Fr9k8yKpNMkiS7Jvc\r\nuLG1uW4jLMJawy0+2sVOPM+4ci/kFbkcRKCHGUqdgDcWn5ttCG6wdP7+ck9V\r\nAH6dXvZ3fVbf3YSck3fjOJHR1M3hsBzaRv0=\r\n=ZS3n\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.23.1-alpha-20230213090810-b98936ac.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/2384f7daa6a27e95164794c675a4a264/graphql-hive-client-0.23.1-alpha-20230213090810-b98936ac.tgz","_integrity":"sha512-btWLuWSXGHtr4WJZeMFrDH9VaLrzXPz6x3u/lf3fd7CbcyCkTX3gVuY1ej6V5aJKWIlZQLFn4bh+g6BEHgwQjg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.3.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.14.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^3.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^9.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.23.1-alpha-20230213090810-b98936ac_1676279324235_0.6672014810159801","host":"s3://npm-registry-packages"}},"0.23.1":{"name":"@graphql-hive/client","version":"0.23.1","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.23.1","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"11f114540545fbe5f466e1f872e7a064e0817c3b","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.23.1.tgz","fileCount":60,"integrity":"sha512-Nb4b4AIaEf0+w2VaOitgPCwoerzc62rAX/T7+UiR6DFL42xR78wX8HNNufBC4SAUTvLgYJLFjvXDQ+LoTthqMg==","signatures":[{"sig":"MEYCIQD/WIrqKzkjbpYEiiiTr3NV4N+rLS6TZ7GekNDKiQTwWQIhAOxgpx07vzeRMqfGkA8t2TpQmQ/19WakYYvABK6Fuqcv","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":177702,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj6gLGACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmq+KBAAj1cvf+bRTb1iE0PNAKfBuzIRyLIDe8LyqJSQSdITkkdAwNNZ\r\nywY2Qo611Gy0bgSStFBz2mOxJK+T5kbyG06EWA99XkQIW+Z7dk58RVaPEifA\r\npgpzlNY2o+gXPs3AmR9lMkmO2D3Lk+ydsl7APqj9D1KZqCvMpoiUkgxDTKdY\r\n64nlcsigs43NDJ0zJfIYUw+rIJVFUw5FeIZzJKH347VOIoZrk69ZDJDJeWaW\r\nYkFAK6rqHDI7aGVWMUBJo7sIpOrUuv1ikuZTGwyeemULoHE+AcOla0WxCXVM\r\nho7TzGhdN+hWAwVx+BaTD5MFNuk0VfqbLr3EIPqotYCj/rAPw9UFCnfhjr0q\r\n0oWhaEsneNOLCW5XeV6NL13bGiSi5JvbcQuwQAMnK4z3NPnLTSnz0QA5abXg\r\nskv28J35y0gUfsyY9t5v7JfQ1xm8+XsMDCrSIKUUIBoM5iq24Yb6fmcoUOpR\r\nv692zKBtwE+7f04+ZOk2aMKuruPdZ6T8d2UTB4MVzWynAdc2xP/spMxqfNuG\r\niTo+nash874HALXZipxxVLssyq5VBlY3G3Dmj9fpJhgzsUmuroRRHVeFLnEu\r\nK185XT4E5xEmSOFpmhqznvgDLXIOGrdfT1+Vdo4iQL4w8Fr/nTr3HbTc5R4s\r\n+jg0QCJyqiVuqBBDtwLf8khYLRyZF2rnfJs=\r\n=gryn\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.23.1.tgz","module":"esm/index.js","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/abef4eb247bc5275da7ef6cc49ce94b9/graphql-hive-client-0.23.1.tgz","_integrity":"sha512-Nb4b4AIaEf0+w2VaOitgPCwoerzc62rAX/T7+UiR6DFL42xR78wX8HNNufBC4SAUTvLgYJLFjvXDQ+LoTthqMg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.3.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.14.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^3.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^9.0.0"},"_hasShrinkwrap":false,"peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.23.1_1676280518155_0.924861789319132","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230615091436-e7c527b8":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230615091436-e7c527b8","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230615091436-e7c527b8","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"520b912582e7b28042b699a4ae1420d5b4544ad2","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230615091436-e7c527b8.tgz","fileCount":64,"integrity":"sha512-9yL8UYJ8z4G+GywuuLGvmxeafKZg6q3SLrESPvgonkxJDPgWrfdl9cEfBsC0Zhbe5of0qOXsRrTzlXqLFZ0a6Q==","signatures":[{"sig":"MEUCIAxRoyUZ7jhLVBwHkDvRbDApBWAI85Aro47FixKh7vI6AiEAsULygzzSAYQ7TWEPc7cGfTn1i1sfFq0dMs+de+mHTnE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":188091},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230615091436-e7c527b8.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/3cbc7c040e097576dc8b6cb98d74e226/graphql-hive-client-0.24.0-alpha-20230615091436-e7c527b8.tgz","_integrity":"sha512-9yL8UYJ8z4G+GywuuLGvmxeafKZg6q3SLrESPvgonkxJDPgWrfdl9cEfBsC0Zhbe5of0qOXsRrTzlXqLFZ0a6Q==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230615091436-e7c527b8_1686820522175_0.7510857770418813","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230615100127-4472d65b":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230615100127-4472d65b","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230615100127-4472d65b","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"699719163566e814f773ee91c093782baed5d0b0","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230615100127-4472d65b.tgz","fileCount":64,"integrity":"sha512-gnQNojyILAs72hcHGBX8xaKxzHwzduS7+gc/hP++kZcGZ57pCCn7MdC53ZzFP8fuH9FftvnKbVDl0hs/uzEfpA==","signatures":[{"sig":"MEUCICojSvl0UhR4rN85sEHRUFOul9+EJEP6atSLMYwe2vcVAiEAu2+LRHtQ7gdf/i2WMgwHE/N9dZZo/0P0uPNU4ddWWxA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":188091},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230615100127-4472d65b.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/c3a5724a90d9497a3d6d7dd94592fb94/graphql-hive-client-0.24.0-alpha-20230615100127-4472d65b.tgz","_integrity":"sha512-gnQNojyILAs72hcHGBX8xaKxzHwzduS7+gc/hP++kZcGZ57pCCn7MdC53ZzFP8fuH9FftvnKbVDl0hs/uzEfpA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230615100127-4472d65b_1686823322264_0.013032275746462041","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230615100945-0ce2709c":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230615100945-0ce2709c","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230615100945-0ce2709c","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"2cabd84f24b4cb348d76498355c79bac7dac4473","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230615100945-0ce2709c.tgz","fileCount":64,"integrity":"sha512-ygv1X7YQr+gdJoqgEbvHspsCjhEWrIVT5MJ1YyVpIZ6GmAlgFjmoZmJPns0sSd1nIFhDRiu61pyPGnr+6V4Gcw==","signatures":[{"sig":"MEUCIFFqZYCncpna2adlRVs2tH2kXh7YQHOsccX4DfQjmza6AiEAktnrC+c2Jmt+vZbAVF/WGQrM2rRHDL7tYiPGM3q1fbU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":188869},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230615100945-0ce2709c.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/c5b26448d64cd2b0de3563762734ed7b/graphql-hive-client-0.24.0-alpha-20230615100945-0ce2709c.tgz","_integrity":"sha512-ygv1X7YQr+gdJoqgEbvHspsCjhEWrIVT5MJ1YyVpIZ6GmAlgFjmoZmJPns0sSd1nIFhDRiu61pyPGnr+6V4Gcw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230615100945-0ce2709c_1686823820192_0.3583069199905151","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230615112327-6f00eae5":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230615112327-6f00eae5","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230615112327-6f00eae5","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"6c3e1b0f9d4d960bebb85d46d718795ff4713fe9","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230615112327-6f00eae5.tgz","fileCount":64,"integrity":"sha512-ylnAWAFVOzv45Y+SNgS4h4h7rRUsCClXN9OgzaxlYGIm24suo9OE7s4hy1+DzvRbW7L2Kou05WWrodIazGavFA==","signatures":[{"sig":"MEYCIQDhATbtrsa9R7cc6/MV7/VY3wdfir3KODx6bmYjCqFNaAIhAPUoTZgYWJLnfjg616X+UQ+21VEWuvlueFN58unj2bA1","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":190741},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230615112327-6f00eae5.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/8dc95653cc9e801ae19b4b68c2fabd0f/graphql-hive-client-0.24.0-alpha-20230615112327-6f00eae5.tgz","_integrity":"sha512-ylnAWAFVOzv45Y+SNgS4h4h7rRUsCClXN9OgzaxlYGIm24suo9OE7s4hy1+DzvRbW7L2Kou05WWrodIazGavFA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230615112327-6f00eae5_1686828240630_0.5551207093035173","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230616074730-dc6f93bd":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230616074730-dc6f93bd","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230616074730-dc6f93bd","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"102c82ff13ed50ef25298556153dabd4fd9a45b9","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230616074730-dc6f93bd.tgz","fileCount":64,"integrity":"sha512-4GPA+qlGXtzDKMeLdiWNw58YEb3Bv0QwH7REHPtQdPIf5TAOL5cbrWo7Ofv7gU3T8JM34rAyzKU8QfMPt+udjA==","signatures":[{"sig":"MEUCIHX7R1TpXwjC+rDGAGckxS0fqsrqbTJq1K2Phm31GQV4AiEApz3DcXlrvrqBalOPbBzAVmbAGV2Jfz4pG7gM3lhDqp0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":190741},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230616074730-dc6f93bd.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/4c01128229b21ec3639080abe796fc3c/graphql-hive-client-0.24.0-alpha-20230616074730-dc6f93bd.tgz","_integrity":"sha512-4GPA+qlGXtzDKMeLdiWNw58YEb3Bv0QwH7REHPtQdPIf5TAOL5cbrWo7Ofv7gU3T8JM34rAyzKU8QfMPt+udjA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230616074730-dc6f93bd_1686901689726_0.8581243317951146","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230620130030-39261598":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230620130030-39261598","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230620130030-39261598","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"c860d8154cbcfdc09f1f108fea52bc41d1c65548","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230620130030-39261598.tgz","fileCount":64,"integrity":"sha512-AjygzLX1TVr/mi+G+UkVwkmx7sYI75CDPGd2u84Ch7ZwP4UJund1Wo3jRKWz5o0rF9r9K82UtbLaR2gujLdwmQ==","signatures":[{"sig":"MEQCIEetGHYVHFZQJrTui6wAWOxIN+9e8Xw7tfDxlS07iy5AAiAYal5+0dOX/5GZ80LdePRnnC4yFuJ/k/GtmabBHomy6Q==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195823},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230620130030-39261598.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/30d4ad21567086cdf6a7ddbdd8e672a7/graphql-hive-client-0.24.0-alpha-20230620130030-39261598.tgz","_integrity":"sha512-AjygzLX1TVr/mi+G+UkVwkmx7sYI75CDPGd2u84Ch7ZwP4UJund1Wo3jRKWz5o0rF9r9K82UtbLaR2gujLdwmQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230620130030-39261598_1687266070427_0.21594034886422042","host":"s3://npm-registry-packages"}},"0.24.0-rc-20230620134529-c38690af":{"name":"@graphql-hive/client","version":"0.24.0-rc-20230620134529-c38690af","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-rc-20230620134529-c38690af","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"454396ef31af28eccf7eceb53e21883568f7dc33","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-rc-20230620134529-c38690af.tgz","fileCount":64,"integrity":"sha512-GuvbmAPihMKF5rQFx1A0puDyockdVeCfQdpYKvOXb60IZzdKzsF+rDmhvOXJUfc94tfjpKP+fiKoz3kTz6BrIQ==","signatures":[{"sig":"MEYCIQDNI7Zyw+JTQabiq5gTcqImFBXp3ZUaYR6w81VzY3oJ7QIhALGWMCpioQeGhkF70RAh+LMAZBNBK+M4ju6Oi68enguE","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195808},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-rc-20230620134529-c38690af.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/c145e92b28ae4fe224ce9a8ef21360ca/graphql-hive-client-0.24.0-rc-20230620134529-c38690af.tgz","_integrity":"sha512-GuvbmAPihMKF5rQFx1A0puDyockdVeCfQdpYKvOXb60IZzdKzsF+rDmhvOXJUfc94tfjpKP+fiKoz3kTz6BrIQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-rc-20230620134529-c38690af_1687268763954_0.7597363286220193","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230620134629-3768bb62":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230620134629-3768bb62","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230620134629-3768bb62","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"728ab9c08b74990927f6ad133f563ea1d16a4d2b","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230620134629-3768bb62.tgz","fileCount":64,"integrity":"sha512-hN9RZYo1l6R5LkYcLPb6FcxfXGnY4AMf6+pNOHpq6Sp/OG+AROsRPaORhRMoIT39glutsQyG3f2SkzxrpmEB8w==","signatures":[{"sig":"MEQCIA5BOPPHO2BAbLltW47sRyfwNLtLYR6dLhjKI6rmf3oBAiBq83Ffzve8mF+q9IDI9x7+4ePbBc2lFOnKte9iDBMH8Q==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195823},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230620134629-3768bb62.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/0f72118498e97caf744929ddc6dd13ed/graphql-hive-client-0.24.0-alpha-20230620134629-3768bb62.tgz","_integrity":"sha512-hN9RZYo1l6R5LkYcLPb6FcxfXGnY4AMf6+pNOHpq6Sp/OG+AROsRPaORhRMoIT39glutsQyG3f2SkzxrpmEB8w==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230620134629-3768bb62_1687268822679_0.5978579453166497","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230620141319-94512794":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230620141319-94512794","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230620141319-94512794","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"a396d5f325df8f62b0518da28082301aca9f12dc","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230620141319-94512794.tgz","fileCount":64,"integrity":"sha512-BmPYUjbUZk4XUlqeYAHKg6a6VAEcyXs2AH8P6XKlG7oTPTPDT7l7IAM4k70dkoZrZSyCO+4yJ/1M34VJDEH93A==","signatures":[{"sig":"MEQCIEqrzKqNXyMx9dKIZTpy2NHqSYahvXX7J6ZkmoELBTeYAiAqOOjGgF21c0ppTQAXDkrB2+4rTtDI/oD7L7muFcgEGQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195823},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230620141319-94512794.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/df6427c02ce5805840dff64eb7b166fb/graphql-hive-client-0.24.0-alpha-20230620141319-94512794.tgz","_integrity":"sha512-BmPYUjbUZk4XUlqeYAHKg6a6VAEcyXs2AH8P6XKlG7oTPTPDT7l7IAM4k70dkoZrZSyCO+4yJ/1M34VJDEH93A==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230620141319-94512794_1687270435029_0.37899765360367765","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230620141446-8947c43d":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230620141446-8947c43d","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230620141446-8947c43d","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"42e3a26c7652e34d3ca1a2aaf672905efed54446","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230620141446-8947c43d.tgz","fileCount":64,"integrity":"sha512-7t/ZeFEtE1XOs+8zBck3wRtzN93tCIfFnMkumK5WMKReF2ffEP11G+oernT2oVdeiTW2rpCFM1g81Gui9rgwZw==","signatures":[{"sig":"MEYCIQD2zL5SbJ3WFZO1y5AyAixkFHtgr+5IlaEkgMRTiFaYJwIhANpSeYkj12lw4T1rTyx8UJzsr8IB9SjnArwY5ZYp0sPO","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195823},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230620141446-8947c43d.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/58abe07702faaf9f78dfaa0179d8c24d/graphql-hive-client-0.24.0-alpha-20230620141446-8947c43d.tgz","_integrity":"sha512-7t/ZeFEtE1XOs+8zBck3wRtzN93tCIfFnMkumK5WMKReF2ffEP11G+oernT2oVdeiTW2rpCFM1g81Gui9rgwZw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230620141446-8947c43d_1687270533129_0.5966220437954299","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230620141614-53ebda22":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230620141614-53ebda22","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230620141614-53ebda22","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"f8753a90baa15e4cd9b8aeb1215bdd76ca9c20c9","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230620141614-53ebda22.tgz","fileCount":64,"integrity":"sha512-bTCOrVD2i974DsLvZetSEm15f2UOR5ySy4LTDiwpdqZjlqm6JN2Z9Q0dWfRMtEfOzogDJ3el0ILzDfsNJUmkRQ==","signatures":[{"sig":"MEUCIA2mNBn4yQSSrbj1PC7kKWbPpNRptmh0G4VXPO/gm0mWAiEAv9+5WTI3Z+bBkYuyQMeXuL/0RSuMpdaSDN7GKYmJR0I=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195805},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230620141614-53ebda22.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/430f1a00833bacea5503aa3660a5fbea/graphql-hive-client-0.24.0-alpha-20230620141614-53ebda22.tgz","_integrity":"sha512-bTCOrVD2i974DsLvZetSEm15f2UOR5ySy4LTDiwpdqZjlqm6JN2Z9Q0dWfRMtEfOzogDJ3el0ILzDfsNJUmkRQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230620141614-53ebda22_1687270620948_0.8681273200356527","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230620141743-f06c56b2":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230620141743-f06c56b2","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230620141743-f06c56b2","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"32a3b51d951df442731752cdcbacf732afe67c7e","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230620141743-f06c56b2.tgz","fileCount":64,"integrity":"sha512-ykk2tBQ86xt+RealejRLwXxapvSSe8g8J1zipvpdRsEp7WgsSp7cCoRixqFDEMOa/J7xrVzPPYs7O32XvvIjpw==","signatures":[{"sig":"MEYCIQCxwUVOiQQ0tjlTbd8hQR6dPaPPUmEMPyWZPwf3vy49lgIhAJPplRI1D8fe6dLx8yHcT3RvxNIh2LGz37BlObe021x9","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195823},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230620141743-f06c56b2.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/aed58b3fe2f8759517f3041e11cab278/graphql-hive-client-0.24.0-alpha-20230620141743-f06c56b2.tgz","_integrity":"sha512-ykk2tBQ86xt+RealejRLwXxapvSSe8g8J1zipvpdRsEp7WgsSp7cCoRixqFDEMOa/J7xrVzPPYs7O32XvvIjpw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230620141743-f06c56b2_1687270698370_0.1685216309309434","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230620150457-3ee886b6":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230620150457-3ee886b6","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230620150457-3ee886b6","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"9eba68b7212e133d1db6141f9192fec76847011e","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230620150457-3ee886b6.tgz","fileCount":64,"integrity":"sha512-B5hG5WIYyC8gkPvjPe3fYsgx79yfjcAL0kRCm37IBTty1XIw6mWG9EeMDN1e2auA8rbstLEIdlsfGooXR8i4Rw==","signatures":[{"sig":"MEUCIAU9kayCPqhfAME90ptmRJZyMcXY0GwsVrmO67BjXx7dAiEAn3250Qv3kTZtRvueePsSsnwpl9ruenclWMci/x2ybrA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195805},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230620150457-3ee886b6.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/3c0a97b1f72099728446317147ccb74a/graphql-hive-client-0.24.0-alpha-20230620150457-3ee886b6.tgz","_integrity":"sha512-B5hG5WIYyC8gkPvjPe3fYsgx79yfjcAL0kRCm37IBTty1XIw6mWG9EeMDN1e2auA8rbstLEIdlsfGooXR8i4Rw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230620150457-3ee886b6_1687273534266_0.12348426839682314","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230620151917-24f1a885":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230620151917-24f1a885","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230620151917-24f1a885","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"e5cdeabf751413f1221671c40277d047134784e3","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230620151917-24f1a885.tgz","fileCount":64,"integrity":"sha512-qAUNWslbHmEZesucDUfDgq5DzAlkyHPcHgqphI20X01ivVdt0xcUMzK4m0LX9dAADRtDrOxX4UpWm1uF7ATq2g==","signatures":[{"sig":"MEUCIHM7YzbKNUa+hGJDBmymKkrvaIS5wuouhkaUD/4DWjBCAiEAsbIGp48NQ6nl1LZ3HYANXCEpPXGJ+unUBqQjPiB2Op8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195805},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230620151917-24f1a885.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/5b0d4e549abb9dbfb35d38d517e90935/graphql-hive-client-0.24.0-alpha-20230620151917-24f1a885.tgz","_integrity":"sha512-qAUNWslbHmEZesucDUfDgq5DzAlkyHPcHgqphI20X01ivVdt0xcUMzK4m0LX9dAADRtDrOxX4UpWm1uF7ATq2g==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230620151917-24f1a885_1687274400924_0.7232602760956723","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230620193531-c83abff6":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230620193531-c83abff6","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230620193531-c83abff6","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"3f601e8c77e793a1a536ba1f2f9d65192dc954e1","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230620193531-c83abff6.tgz","fileCount":64,"integrity":"sha512-F9gKZWLwyysjc842BFsE8XmZ9MNH65deaUfn5YUT5+NGacfM32FXGxVKeEBcYgDpz/f2tQeOYaAmuEcDDeYPXw==","signatures":[{"sig":"MEUCIQDWOoc3S3VSArYq1bXHkdlQvtTVCqPL2SXUsu+tPK3QaQIgRDRWIg4JzDo6bL4GBCN0pYwll8SJwdmti4W26uc9t1s=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195805},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230620193531-c83abff6.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/5eee388055e8a8addcbe53b1cf80d4ab/graphql-hive-client-0.24.0-alpha-20230620193531-c83abff6.tgz","_integrity":"sha512-F9gKZWLwyysjc842BFsE8XmZ9MNH65deaUfn5YUT5+NGacfM32FXGxVKeEBcYgDpz/f2tQeOYaAmuEcDDeYPXw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230620193531-c83abff6_1687289765723_0.6201479299594732","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230621024050-a406dcea":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230621024050-a406dcea","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230621024050-a406dcea","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"59da522d41ea5ff69bd1b1d63fa8ca856fa3af61","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230621024050-a406dcea.tgz","fileCount":64,"integrity":"sha512-Sa33hb0r0I0RAdI36Ea7haBDFEsKIcCzOax3JbO7qiH4G7y126oFhP1po3DFBmL+BHH5Era25zIR5FW7PD8XHw==","signatures":[{"sig":"MEQCIAX8pSp/ESQ5d90ZqQUS5VtR9Ut5WOp2S5w1Z+bW3Is4AiBIsb7LvOu+SryQ0EuEZ2O3XQibWTKw7r3smdXwPAGzQA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195805},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230621024050-a406dcea.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/a97c5228814627ba1120645e5392cce5/graphql-hive-client-0.24.0-alpha-20230621024050-a406dcea.tgz","_integrity":"sha512-Sa33hb0r0I0RAdI36Ea7haBDFEsKIcCzOax3JbO7qiH4G7y126oFhP1po3DFBmL+BHH5Era25zIR5FW7PD8XHw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230621024050-a406dcea_1687315284314_0.027585899383152146","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230621024105-a406dcea":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230621024105-a406dcea","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230621024105-a406dcea","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"ca0dc61985ad361dc52b14f805f62dd7ece75848","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230621024105-a406dcea.tgz","fileCount":64,"integrity":"sha512-cRPFiyGhkzk+julOdqA8z1zhVB6jMdgirjpQkiofWMJkIiQJPVbist+/v4rzp0AzuLsqIZRu1YCv0weU/8/I2A==","signatures":[{"sig":"MEYCIQCrp+cwIgODZNo0W5ed6xPfXtPV18UpqzRbstNrJA3ETgIhAMh9PwY84oQUdStKjyKksdI8z60ll2c5nehZW2OR2U7H","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195805},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230621024105-a406dcea.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/fd542637c59ece03db14cb79a0974f49/graphql-hive-client-0.24.0-alpha-20230621024105-a406dcea.tgz","_integrity":"sha512-cRPFiyGhkzk+julOdqA8z1zhVB6jMdgirjpQkiofWMJkIiQJPVbist+/v4rzp0AzuLsqIZRu1YCv0weU/8/I2A==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230621024105-a406dcea_1687315302128_0.5617591413184573","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230621081140-9e44d151":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230621081140-9e44d151","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230621081140-9e44d151","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"fe2e0bb2e3be59cfca78ec48838954bd63d4d633","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230621081140-9e44d151.tgz","fileCount":64,"integrity":"sha512-Q63/UiMlAVO3XCXuuFRtWtWlTsjNTxwf/A0jmuLRbivHCvHpByYkXCmkvVKxyOPwiRCpJ0UGhfbiYybN4+ORgw==","signatures":[{"sig":"MEQCIBCgcImBdcvZB1py9dcxqkdj52Y/ZVxlUonP8lZ2ooTMAiBEb8oMDp9Tu8r1Wp66C8UYq0XIVMSkr+KCL3n2nkO7Lw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195805},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230621081140-9e44d151.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/3a74b04be50b9eddaaa0447f283020d2/graphql-hive-client-0.24.0-alpha-20230621081140-9e44d151.tgz","_integrity":"sha512-Q63/UiMlAVO3XCXuuFRtWtWlTsjNTxwf/A0jmuLRbivHCvHpByYkXCmkvVKxyOPwiRCpJ0UGhfbiYybN4+ORgw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230621081140-9e44d151_1687335134875_0.9886781711054653","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230621081204-9e44d151":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230621081204-9e44d151","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230621081204-9e44d151","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"3a81f0c8a2dc90d540cd05c9ec1a0188d92f9657","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230621081204-9e44d151.tgz","fileCount":64,"integrity":"sha512-bdIgGH2c6OJ9qyB2Cr3NwMeZmkTRp1UTIquQEQPVQggRQ3TqfgCoCkkN0ncI3uNxBJBOj5NWn095NiQhg7n9eg==","signatures":[{"sig":"MEUCIF3ceH5r3PTqRfrW3HdaGPbahwSsMz5aR4aaxCl3ezwSAiEA6aQtKokb3yM/UtlbCsWdlUponXksLI1Hs/B8bsryMrU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195805},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230621081204-9e44d151.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/c82072be9363392bc8457cf498615e92/graphql-hive-client-0.24.0-alpha-20230621081204-9e44d151.tgz","_integrity":"sha512-bdIgGH2c6OJ9qyB2Cr3NwMeZmkTRp1UTIquQEQPVQggRQ3TqfgCoCkkN0ncI3uNxBJBOj5NWn095NiQhg7n9eg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230621081204-9e44d151_1687335166245_0.2302046236397577","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230621084952-e2fe8713":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230621084952-e2fe8713","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230621084952-e2fe8713","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"4fc795849a247cd7e8603503728bef778111c538","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230621084952-e2fe8713.tgz","fileCount":64,"integrity":"sha512-k0823O0wXheTpuL9ZLljVQace9PqU8rtUghO1UG943ESOa6hD4aght8G6m3h7gV31ppsk6USE2k4RplST+RsCA==","signatures":[{"sig":"MEUCIQDxv3ttlQj/HFJ0ddnOQUH1J/SNdqqQJgH+aVVkIthq+QIgSQBrsNCJDv0TVL3VYBZMLNNFGmHH8mvzGKZXFyQH5LI=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195805},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230621084952-e2fe8713.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/5062183dc5bb5bce5d3cbeba62fbcdae/graphql-hive-client-0.24.0-alpha-20230621084952-e2fe8713.tgz","_integrity":"sha512-k0823O0wXheTpuL9ZLljVQace9PqU8rtUghO1UG943ESOa6hD4aght8G6m3h7gV31ppsk6USE2k4RplST+RsCA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230621084952-e2fe8713_1687337428255_0.45376760997374244","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230621085024-89c9cee5":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230621085024-89c9cee5","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230621085024-89c9cee5","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"7e48f61e0d4160551506096aae7d1a41bf959225","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230621085024-89c9cee5.tgz","fileCount":64,"integrity":"sha512-WmY+vYCqRHblpktd1vxaLhQ7gryZKfZPVYT2+98+uFnKqkO6DdthfSHqxUomkxyNBJMTKWbH7oEESCGsevbIwA==","signatures":[{"sig":"MEUCIC2wgPC/bzDIQthFSFhBtWEvMz4UZKX8V+05ceSfFU8CAiEAktOjUAg3GfQDhjd+FaRTp9IlXouNLopztpTPO1Cqmp4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195805},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230621085024-89c9cee5.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/ccda03ac7aa2300f87fddd72183ed4f7/graphql-hive-client-0.24.0-alpha-20230621085024-89c9cee5.tgz","_integrity":"sha512-WmY+vYCqRHblpktd1vxaLhQ7gryZKfZPVYT2+98+uFnKqkO6DdthfSHqxUomkxyNBJMTKWbH7oEESCGsevbIwA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230621085024-89c9cee5_1687337472964_0.6995279222826929","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230621085251-e9c0c710":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230621085251-e9c0c710","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230621085251-e9c0c710","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"98e0bcdbd493d3050b079f4af8882622fed25619","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230621085251-e9c0c710.tgz","fileCount":64,"integrity":"sha512-Y9qmcOZZGh140+7xpSIpaPUSab7lzTJuK2WjOMB7BGw+t6RO3sSP0Ps+tB1gipPC9yYngsZIZngpodvcS8PNHQ==","signatures":[{"sig":"MEYCIQDeGZ1tWe4NKCoK3QT2vOqtaQ1Z86z7ekCdpx+JiNNfUAIhAIR7K81sDHY6ZDO/QYMze1ncNdPmjOP4kGlJjXEgQRMq","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195805},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230621085251-e9c0c710.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/d0ed7c531d9b2c0fe9be7a5af69c8abd/graphql-hive-client-0.24.0-alpha-20230621085251-e9c0c710.tgz","_integrity":"sha512-Y9qmcOZZGh140+7xpSIpaPUSab7lzTJuK2WjOMB7BGw+t6RO3sSP0Ps+tB1gipPC9yYngsZIZngpodvcS8PNHQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230621085251-e9c0c710_1687337612886_0.6435057590295148","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230621085919-fb8a8abb":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230621085919-fb8a8abb","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230621085919-fb8a8abb","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"ca5ec6f97d23460bd1dcdb7b32764b5a9d114a0d","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230621085919-fb8a8abb.tgz","fileCount":64,"integrity":"sha512-VJ7P18gh0ZtBauVxnZsihflWQvynUCcpLFoDCWoSrRNmUcyoSpKYq6OaGSHP7n0jgkiJD5pDNi3ehN/YUUxwPg==","signatures":[{"sig":"MEQCIFFoFuQSmVwhNcBddxa3627Slw6qDVe2lJGgLsvPOOwlAiArKdB1LPf621utxgyKh/HkwXlLv6Eu8bOUZ4gRwO4eKQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195805},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230621085919-fb8a8abb.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/7a3dcffff9b2f1c8b93199ec67de76e6/graphql-hive-client-0.24.0-alpha-20230621085919-fb8a8abb.tgz","_integrity":"sha512-VJ7P18gh0ZtBauVxnZsihflWQvynUCcpLFoDCWoSrRNmUcyoSpKYq6OaGSHP7n0jgkiJD5pDNi3ehN/YUUxwPg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230621085919-fb8a8abb_1687337995426_0.2580384362071808","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230621092700-2217178f":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230621092700-2217178f","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230621092700-2217178f","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"3f64d0bbaf2cf750aeb143eb816c4790241dc101","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230621092700-2217178f.tgz","fileCount":64,"integrity":"sha512-AulHSlAMi2PqW1MEoi//cnQKnVuJty399Fy4kzOJzKQeeuzwgb5X9gNzTf38gieojdc0GILd4VOWtTqHRBXazQ==","signatures":[{"sig":"MEUCIDwZ+QM/05qGEAFMF75wnfewe0yyAb21+ZUFeGb5n80YAiEAvbB0Ok/PT7px79bEjyCHj0AQUX3kJa2ili40a9ZEHHI=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195805},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230621092700-2217178f.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/77b9bafbb19fe4b3c3471b7e7914c471/graphql-hive-client-0.24.0-alpha-20230621092700-2217178f.tgz","_integrity":"sha512-AulHSlAMi2PqW1MEoi//cnQKnVuJty399Fy4kzOJzKQeeuzwgb5X9gNzTf38gieojdc0GILd4VOWtTqHRBXazQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230621092700-2217178f_1687339654173_0.6305590028300476","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230621092815-e84b6921":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230621092815-e84b6921","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230621092815-e84b6921","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"16f26d3f28a5bad58b8fcbcd84f5d6e114de0619","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230621092815-e84b6921.tgz","fileCount":64,"integrity":"sha512-gd5YK1mbD3eEWf+m8OT/gYA5cCEGZJ35kvGdGKTbag+mrBGUIYuQmlY3Q898u+0EQULfKzKTCx5RzKa8Uvqfzw==","signatures":[{"sig":"MEUCIBBbSKkpFnBHrF2gyGwqHU/jql5YiwUoiBV+KbL57Gt9AiEA6TPWxV/6byfij1F1ffi8qHxNYHpWHPKHhOMvrhIFxnY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195805},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230621092815-e84b6921.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/8e16b2c09c3d44126f9e1c29114587da/graphql-hive-client-0.24.0-alpha-20230621092815-e84b6921.tgz","_integrity":"sha512-gd5YK1mbD3eEWf+m8OT/gYA5cCEGZJ35kvGdGKTbag+mrBGUIYuQmlY3Q898u+0EQULfKzKTCx5RzKa8Uvqfzw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230621092815-e84b6921_1687339728681_0.8312072185091706","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230621093055-122f652b":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230621093055-122f652b","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230621093055-122f652b","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"1d8b242588057916ea5be4ecbb7123630c2f6bc4","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230621093055-122f652b.tgz","fileCount":64,"integrity":"sha512-07bh/wSM0TUedh6BNVITUrTp2iT5411pLZQ0B3oI6UTNTIe6O7LQOOaCRdXksb4lYTXJmwM0ZNUBgj50FHHT5A==","signatures":[{"sig":"MEQCIGZx82/DapayH6TM23SrwvSKmgxYeKH4b00rCLbWBkNHAiBA91pNSQShwUGW252ejAw0lUGXnCrI20FFmuH1RRa4sw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195805},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230621093055-122f652b.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/81e7a35927c08239440f465abbdc72ff/graphql-hive-client-0.24.0-alpha-20230621093055-122f652b.tgz","_integrity":"sha512-07bh/wSM0TUedh6BNVITUrTp2iT5411pLZQ0B3oI6UTNTIe6O7LQOOaCRdXksb4lYTXJmwM0ZNUBgj50FHHT5A==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230621093055-122f652b_1687339890967_0.4267759157921953","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230621093252-87ab461b":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230621093252-87ab461b","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230621093252-87ab461b","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"f224cfb7f34ef287ee292e76867b5cbc04e9f788","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230621093252-87ab461b.tgz","fileCount":64,"integrity":"sha512-KxxCwYjqlS8kaN1BUi4HSPiiYqDg6KxvkMYyNHkClsRzE+FoS72psuvfYdeHy77r8wYN3LsYjovIRk7NFaZbcw==","signatures":[{"sig":"MEYCIQDXXGNjz7/dMeE+dOaBGiNm8tPEEd2/rDGq5LWO6B8F4wIhAN61tb0CWnNi74KHyvAuxhIxExsYBH89Wpdas0BaBm2k","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195805},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230621093252-87ab461b.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/3751ec086293a2bc142f6a288ca63baa/graphql-hive-client-0.24.0-alpha-20230621093252-87ab461b.tgz","_integrity":"sha512-KxxCwYjqlS8kaN1BUi4HSPiiYqDg6KxvkMYyNHkClsRzE+FoS72psuvfYdeHy77r8wYN3LsYjovIRk7NFaZbcw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230621093252-87ab461b_1687340006706_0.16407848645760925","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230621093433-1f918bba":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230621093433-1f918bba","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230621093433-1f918bba","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"58261c4ecdc784e5a8075148de286bb3efddeca5","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230621093433-1f918bba.tgz","fileCount":64,"integrity":"sha512-mJfNA9E6l61DOoLO0vPhiG3LbTRVD2f8NcXZeR3Su/wPBmqBv/Vue8JxdJg5ZqM5qPafKBWotI6XRexiNpktdA==","signatures":[{"sig":"MEQCIDUK0Sr2jXvusmnAdYsklHFmbaTRhkiuFiI0gdnUQnKLAiBOknk0fbgslwPh+VQa5cWi1oFpVUXL0Ya+paFJZ9o6DQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195805},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230621093433-1f918bba.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/7cc8d607f0958e416f5c697661b0bc8a/graphql-hive-client-0.24.0-alpha-20230621093433-1f918bba.tgz","_integrity":"sha512-mJfNA9E6l61DOoLO0vPhiG3LbTRVD2f8NcXZeR3Su/wPBmqBv/Vue8JxdJg5ZqM5qPafKBWotI6XRexiNpktdA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230621093433-1f918bba_1687340107038_0.46631355724873114","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230621093637-1f918bba":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230621093637-1f918bba","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230621093637-1f918bba","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"fe06e6d1caf61fa5a6656eb69fe8656e3d72aeb1","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230621093637-1f918bba.tgz","fileCount":64,"integrity":"sha512-SaIM7MOtjVhFSAWKQz5DixI3H3vvnCVQjvw7QtNYVaU2Du8hOT9SIF11BTc6Q6NMyzK7Ya3hvlSvqY902pHMYQ==","signatures":[{"sig":"MEUCIALe0+jiH7jaufSOZY3tiGLJ8K0UIzjqLl72sFk0gZ2eAiEAyPyOBaFIKGULCwHvyvepXLd6mrc4Q0c+aMCV9bg2GF0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195805},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230621093637-1f918bba.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/7bddee3ae33047c31b2dc10c4feb869a/graphql-hive-client-0.24.0-alpha-20230621093637-1f918bba.tgz","_integrity":"sha512-SaIM7MOtjVhFSAWKQz5DixI3H3vvnCVQjvw7QtNYVaU2Du8hOT9SIF11BTc6Q6NMyzK7Ya3hvlSvqY902pHMYQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230621093637-1f918bba_1687340246310_0.5343337921303137","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230621110607-58068982":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230621110607-58068982","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230621110607-58068982","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"daeaf2a82268806d2ca7f783816bea52a5d04f99","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230621110607-58068982.tgz","fileCount":64,"integrity":"sha512-5UTAn1c8usvIj0yrivKRls4YaP7U+A+4GKXltWwhy9qi4qX+VFSbcG/L8pInTfwQmBdsTfypN0qXF37XTS+u5A==","signatures":[{"sig":"MEUCIAOiLLxMA9VyBMomVJLCbIqFdcCT2sDcgnbAvOtVvFigAiEArYSqw4u3mMIWT5uxLsaMDTT9OOrgAffd0sV76bzPfvk=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195805},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230621110607-58068982.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/fc3ef6f452ff6b53e6f199355e12d62b/graphql-hive-client-0.24.0-alpha-20230621110607-58068982.tgz","_integrity":"sha512-5UTAn1c8usvIj0yrivKRls4YaP7U+A+4GKXltWwhy9qi4qX+VFSbcG/L8pInTfwQmBdsTfypN0qXF37XTS+u5A==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230621110607-58068982_1687345608183_0.9799386284194156","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230621110659-d9d43271":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230621110659-d9d43271","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230621110659-d9d43271","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"c5b6ca8eb1fc1aba43b844eb2624cd46d47fa6d6","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230621110659-d9d43271.tgz","fileCount":64,"integrity":"sha512-mmALeOUXqFZxhl0d6/Gej+f1ua3tW/PQ63MPEGCO4bsiIoeEgEF6/5Lc3UAzbQUcIFknRLVHabOhkrxNLls4Qg==","signatures":[{"sig":"MEUCIQDejMSCA+EMMTH4lm5rVQQwQNVROGBrD8NC2Mh82XO86AIgZri4V5xbZfNxMmgPZJfEkTUMXtUQdTjj2mG7881KPtw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195805},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230621110659-d9d43271.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/200e72a4c184d7118727679816abc019/graphql-hive-client-0.24.0-alpha-20230621110659-d9d43271.tgz","_integrity":"sha512-mmALeOUXqFZxhl0d6/Gej+f1ua3tW/PQ63MPEGCO4bsiIoeEgEF6/5Lc3UAzbQUcIFknRLVHabOhkrxNLls4Qg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230621110659-d9d43271_1687345653684_0.2559697792419129","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230621112008-62a31a8d":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230621112008-62a31a8d","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230621112008-62a31a8d","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"75b0c2784ded129cba590c4e3c72378f42afc6b7","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230621112008-62a31a8d.tgz","fileCount":64,"integrity":"sha512-1MUfB2jQI2nV021BVSzK2vb3CvWUNmrER75H45PTZibD7Tce6+o0qI+HqNUVoJakJbSyebwACVsgZaft92wzGg==","signatures":[{"sig":"MEYCIQCFpUqtd3CGq37sP/05KhWkx6Nsn60rYU4qOG5O2bUFzgIhAIZe7YsyV0Kk+0IsOcQ7PE/XG5wZzxBvT7scWmo/ylES","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195805},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230621112008-62a31a8d.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/2ff7b3a306cde5a4ba7f1ab440c6d3ea/graphql-hive-client-0.24.0-alpha-20230621112008-62a31a8d.tgz","_integrity":"sha512-1MUfB2jQI2nV021BVSzK2vb3CvWUNmrER75H45PTZibD7Tce6+o0qI+HqNUVoJakJbSyebwACVsgZaft92wzGg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230621112008-62a31a8d_1687346460717_0.8234984596389738","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230621112823-59232682":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230621112823-59232682","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230621112823-59232682","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"58ee15b5120b2e4616b974c434849359d99c09c4","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230621112823-59232682.tgz","fileCount":64,"integrity":"sha512-tHdkgrVbAB8ysDVHPLAfrNyfTGhZWFBKjGKKWRAENHftJUmOg5R7lq5NO2SOxS4rB6ZluTXfT3bWQmKD4ujdbw==","signatures":[{"sig":"MEQCIDqk5a2R43Q63g6FXfiFFatAt2Uk5oUirts7D0ByITgQAiBMX3ZgrvQ4uFtjoSsSCmDEoq3rqJjNlG6qjWW42KUfGA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195805},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230621112823-59232682.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/b6d87f3649160c71605705f6bcf6a6f6/graphql-hive-client-0.24.0-alpha-20230621112823-59232682.tgz","_integrity":"sha512-tHdkgrVbAB8ysDVHPLAfrNyfTGhZWFBKjGKKWRAENHftJUmOg5R7lq5NO2SOxS4rB6ZluTXfT3bWQmKD4ujdbw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230621112823-59232682_1687346944558_0.8817453514728169","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230621114549-bac18fda":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230621114549-bac18fda","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230621114549-bac18fda","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"01d9232ffa6f72dd880b8b5c2a38b02157f463da","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230621114549-bac18fda.tgz","fileCount":64,"integrity":"sha512-ztd+B7151JkXJ/OHW1dpxlJW+RM8cYDEshrb/7wpD51xOu/WeEf1AlUomO0OWW80mOAMAt+aoEgr9a0+vI1j3w==","signatures":[{"sig":"MEUCIQD6iLR8yaf04Le52O/yDyqpU4nWPOeD0efXgleqEmSRlQIgC6SXk14Rb7FX5ue0aLig5oTik9saaN6nspNRVzfC7eQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195805},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230621114549-bac18fda.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/d8c1c8d73f205a124becd1e15e998b2f/graphql-hive-client-0.24.0-alpha-20230621114549-bac18fda.tgz","_integrity":"sha512-ztd+B7151JkXJ/OHW1dpxlJW+RM8cYDEshrb/7wpD51xOu/WeEf1AlUomO0OWW80mOAMAt+aoEgr9a0+vI1j3w==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230621114549-bac18fda_1687347995438_0.41153926381215933","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230621125127-6940197a":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230621125127-6940197a","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230621125127-6940197a","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"9564501ee70b104f837c7b22b3df5a15b9ab988e","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230621125127-6940197a.tgz","fileCount":64,"integrity":"sha512-iSE1QADWBd7G4BL/1Nb6Ypzk2EN4vGhkfjd0Q5/d9htvJX2KkvhqV3+88I0rQVaWInOmIWH/gmmI0itjSX9y4g==","signatures":[{"sig":"MEYCIQCGDoPXRCoAOlmP2aI/Xyex0O0dmIH1/uR2vTVaBiJfPQIhAM0mW6avCTbHeT/OVSYrJIDzmaPHfn+BvVlanbAgGbjs","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195805},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230621125127-6940197a.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/426ccab64b649e44715c3f3f49399936/graphql-hive-client-0.24.0-alpha-20230621125127-6940197a.tgz","_integrity":"sha512-iSE1QADWBd7G4BL/1Nb6Ypzk2EN4vGhkfjd0Q5/d9htvJX2KkvhqV3+88I0rQVaWInOmIWH/gmmI0itjSX9y4g==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230621125127-6940197a_1687351922930_0.5814193916002233","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230621125252-2afbca6f":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230621125252-2afbca6f","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230621125252-2afbca6f","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"7fe3d2f883864a01e8a2663db83d79392fe50ed2","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230621125252-2afbca6f.tgz","fileCount":64,"integrity":"sha512-kRFK+FGheb5n2pzQa0xaIg+J+xXyB6cZuUkQyO+84ER8kq81+DO6NLjNnnSvwpOw4XKseYeMfFIOd/df1Q8i7w==","signatures":[{"sig":"MEQCICjsnozCsXnHXm6zSHn/npEYrbcDxSumd3uaRbGcAg3QAiAF5T4cSfQtfO0pkYmF01n7v5VlK9mtuR+QEw4p1zYlNQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195805},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230621125252-2afbca6f.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/b7e7f471d5b5dec176e6b14412c7c045/graphql-hive-client-0.24.0-alpha-20230621125252-2afbca6f.tgz","_integrity":"sha512-kRFK+FGheb5n2pzQa0xaIg+J+xXyB6cZuUkQyO+84ER8kq81+DO6NLjNnnSvwpOw4XKseYeMfFIOd/df1Q8i7w==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230621125252-2afbca6f_1687352009232_0.9270380820158628","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230621125410-435aee48":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230621125410-435aee48","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230621125410-435aee48","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"72dfa101bffc1aad5eaa58ae80f03b57579a7dc9","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230621125410-435aee48.tgz","fileCount":64,"integrity":"sha512-jM1FyKtjBGf5amdQLCnfIRy6oPXUXVkHYZuM3LO046d/F1Xi/bN+jGaQZGQGt0a7rbFxlFUPyWftgIA0p7rpVw==","signatures":[{"sig":"MEUCIB9uQ107Qh3IB7+nwFzujUfDilxvvTh3qtb90DpJpDqaAiEA1sPp9/qd4Y6BocjvNqh6GJy7yyqpzCjiPtzF/5+6iEU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195805},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230621125410-435aee48.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/137b7e7f1254edd7436213c38e4f8cd2/graphql-hive-client-0.24.0-alpha-20230621125410-435aee48.tgz","_integrity":"sha512-jM1FyKtjBGf5amdQLCnfIRy6oPXUXVkHYZuM3LO046d/F1Xi/bN+jGaQZGQGt0a7rbFxlFUPyWftgIA0p7rpVw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230621125410-435aee48_1687352085135_0.8221453600238078","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230621125547-1c13a0e6":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230621125547-1c13a0e6","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230621125547-1c13a0e6","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"29be7df83a2eeb7af976e575285f55bafb93b53c","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230621125547-1c13a0e6.tgz","fileCount":64,"integrity":"sha512-XUBYDrRNpMJaX2BoJLpZ9+2lef+HcYF1luh1F4AD59+cDf3duP77679ugoi7/lTSmVQoG0dq0/24/RjktJNwqA==","signatures":[{"sig":"MEYCIQDsh9ZanCV03FJq09MHImf+bj+ckKUFcmZ5wIBvPOt/CgIhAKH84hWLJukcpOpEhCw0UoZOjhgnyJXLS/VLZosNjhga","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195805},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230621125547-1c13a0e6.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/fbd94123658a5e1e1e02f10d972fd126/graphql-hive-client-0.24.0-alpha-20230621125547-1c13a0e6.tgz","_integrity":"sha512-XUBYDrRNpMJaX2BoJLpZ9+2lef+HcYF1luh1F4AD59+cDf3duP77679ugoi7/lTSmVQoG0dq0/24/RjktJNwqA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230621125547-1c13a0e6_1687352181599_0.01761740835333847","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230621125702-1c13a0e6":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230621125702-1c13a0e6","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230621125702-1c13a0e6","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"1e382cd18424a8eb6f0191ada552b414f3a06042","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230621125702-1c13a0e6.tgz","fileCount":64,"integrity":"sha512-zEoKDbCmz4WFFmeo3mn4AVv8Ap4E85ouSsCmJkEOv308Vy0EB18CjNQbdizNdwCxHxXpXiFxfgk0LNKbShrsdg==","signatures":[{"sig":"MEYCIQCKwUUEl4rK3CtkxZFB2SvEh9cFjb/fccWugDcAmIq5hAIhAPvjyfy7m06VbdfS/6j01GPq+Q5UwL/fA769FjIq7BfP","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195805},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230621125702-1c13a0e6.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/f13a40e6dcdd8843c3592cc6ff252d54/graphql-hive-client-0.24.0-alpha-20230621125702-1c13a0e6.tgz","_integrity":"sha512-zEoKDbCmz4WFFmeo3mn4AVv8Ap4E85ouSsCmJkEOv308Vy0EB18CjNQbdizNdwCxHxXpXiFxfgk0LNKbShrsdg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230621125702-1c13a0e6_1687352256445_0.9605467836253871","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230621134430-10052ec4":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230621134430-10052ec4","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230621134430-10052ec4","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"bff8501db9cb880e91d7dedd8f63053518ebe9ec","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230621134430-10052ec4.tgz","fileCount":64,"integrity":"sha512-TeKTZ7NLYEORczf5XMZAC91FhE3UUmuudliUvHRaCglsqRZsmL9hzvUZUHgo0bJFQmAB9XYP9RygsjMYjCG8dA==","signatures":[{"sig":"MEYCIQDPTAUhh3llfP3UDaUiopSLlS0Jdjk8dt02zK9GhMHbQgIhAPuOt+fId8jtJFv1jFxaAAmel1jhakEW85DybRq02DjT","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195805},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230621134430-10052ec4.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/cd36c85eec4aae155b4800d1b839e668/graphql-hive-client-0.24.0-alpha-20230621134430-10052ec4.tgz","_integrity":"sha512-TeKTZ7NLYEORczf5XMZAC91FhE3UUmuudliUvHRaCglsqRZsmL9hzvUZUHgo0bJFQmAB9XYP9RygsjMYjCG8dA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230621134430-10052ec4_1687355103618_0.6602603174902106","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230621134621-e1ffaed8":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230621134621-e1ffaed8","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230621134621-e1ffaed8","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"03b1be93abbf47a33d822ff7a987bcf3bd22784e","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230621134621-e1ffaed8.tgz","fileCount":64,"integrity":"sha512-BJi5BW+m8+XNWt4UZCBnlFw93FylNZx8LeQdUOHWVcbeTwGPQwDR9P9bmtY4UT5Z2swBOYjGy5jqbQzxKgTSaw==","signatures":[{"sig":"MEUCICS370OZFpSiYey9lUdYCGht9Q3hprEFy5B2CampFGYrAiEAt78iQtzdIc10CaHS6uv5t74zkUKSjoCrxUMeAczSaAg=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195805},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230621134621-e1ffaed8.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/fb70ddf3944e243835f86672105469e0/graphql-hive-client-0.24.0-alpha-20230621134621-e1ffaed8.tgz","_integrity":"sha512-BJi5BW+m8+XNWt4UZCBnlFw93FylNZx8LeQdUOHWVcbeTwGPQwDR9P9bmtY4UT5Z2swBOYjGy5jqbQzxKgTSaw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230621134621-e1ffaed8_1687355215149_0.911252222054153","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230621134642-c2233c1c":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230621134642-c2233c1c","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230621134642-c2233c1c","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"5684db377a75f5695f692bd7019a15e9ed800ca7","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230621134642-c2233c1c.tgz","fileCount":64,"integrity":"sha512-m919ARBJsp6kz6SfDidOG9B5xkNTAbpBkJLW0ABX2YFG3K7njwb8zdhBHslh9BeL1KYurJKC5S8CF0xxTF9aag==","signatures":[{"sig":"MEUCIQC9EfYPn3mvcLqjCmf60fvE8TBp6U4Yg5avKNigwWr1wQIgMCN4n/jbLOmft8PVELqHqn8bDX7UP0drFq693OPcZDM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195805},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230621134642-c2233c1c.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/2ada2b9e99e1ed2a26b0367eb52dbb78/graphql-hive-client-0.24.0-alpha-20230621134642-c2233c1c.tgz","_integrity":"sha512-m919ARBJsp6kz6SfDidOG9B5xkNTAbpBkJLW0ABX2YFG3K7njwb8zdhBHslh9BeL1KYurJKC5S8CF0xxTF9aag==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230621134642-c2233c1c_1687355237341_0.17571777140865796","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230621140122-3ed05dbf":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230621140122-3ed05dbf","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230621140122-3ed05dbf","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"27864eed2a8a16d931c9ad2f6c35e2a739b76e8a","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230621140122-3ed05dbf.tgz","fileCount":64,"integrity":"sha512-yEP/t/iEzIVeCiQuvjiW1GCVXEwNy0QyDyQ9K7MAvZfjHhag0J+MNubzjuxYnEU0a5ULBB3/r7lAYv7vhFHsCg==","signatures":[{"sig":"MEQCIDsh41kG8dJahyQEdeoBx1fpHGuxjjEYyL5pGkX2w2DvAiANraY5qFS7V02OzlKu27nqUquOPsSgyuPO8WtqMNZFPQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195805},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230621140122-3ed05dbf.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/caad3e6426f8b3707d06f5f6293943a4/graphql-hive-client-0.24.0-alpha-20230621140122-3ed05dbf.tgz","_integrity":"sha512-yEP/t/iEzIVeCiQuvjiW1GCVXEwNy0QyDyQ9K7MAvZfjHhag0J+MNubzjuxYnEU0a5ULBB3/r7lAYv7vhFHsCg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230621140122-3ed05dbf_1687356115906_0.7296423302601902","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230621140150-1fdc4c7c":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230621140150-1fdc4c7c","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230621140150-1fdc4c7c","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"cc3e813c7d34193cc06fce45e2ee089e0e195e68","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230621140150-1fdc4c7c.tgz","fileCount":64,"integrity":"sha512-SF1D9o/6kuER9f4JKqJRRNoiuGDqdguKiHflUV3nnGJNclnFpjqgYZQrqnd/OEf7f3XES9aE3pg5hZAUW4h6tg==","signatures":[{"sig":"MEQCIGjoQ3OYY1VJtabvqY/l6PCVphnWf/aYIGa2/gMdrVbmAiAM+4YWJCT/tH3G+ZxeSleXmRYK6E1IyzqMNLzFZF6KIQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195805},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230621140150-1fdc4c7c.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/88090b3c52054ad28316b4641d79b405/graphql-hive-client-0.24.0-alpha-20230621140150-1fdc4c7c.tgz","_integrity":"sha512-SF1D9o/6kuER9f4JKqJRRNoiuGDqdguKiHflUV3nnGJNclnFpjqgYZQrqnd/OEf7f3XES9aE3pg5hZAUW4h6tg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230621140150-1fdc4c7c_1687356145300_0.10285260407623364","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230621142140-62ea6117":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230621142140-62ea6117","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230621142140-62ea6117","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"51ceaea86e7008a0a3b40e3201efee722c08ebf5","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230621142140-62ea6117.tgz","fileCount":64,"integrity":"sha512-LzFjADEVRrcRRAQLFI/SB9LAtEIA5eSzy1Ytf114fIhjLzG6JzdHZ3O9ZJSqxFbM4s6pBwZoCGNzbQl88Y462g==","signatures":[{"sig":"MEQCIBsRbs5fyghUCs3+el8/k8y1zJdIe+XvJfk1gfqlaX+tAiA0pWNtblWlz3WMGn+Tp+FcSCKGbPP8ElCVg3ppQqVqAw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195805},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230621142140-62ea6117.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/a4267eb583a5ee87824aeb46127b41ee/graphql-hive-client-0.24.0-alpha-20230621142140-62ea6117.tgz","_integrity":"sha512-LzFjADEVRrcRRAQLFI/SB9LAtEIA5eSzy1Ytf114fIhjLzG6JzdHZ3O9ZJSqxFbM4s6pBwZoCGNzbQl88Y462g==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230621142140-62ea6117_1687357334262_0.6822129091535978","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230621142836-770170f1":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230621142836-770170f1","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230621142836-770170f1","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"9dffa047221eefb9018b1dee331d1190a579128e","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230621142836-770170f1.tgz","fileCount":64,"integrity":"sha512-EJq/xxCrUMyJzeAX/N07IG0DSZRw0yMe+9ZQJV8rM8yn3FvSzEUkYFMFWnu0AKZgUvkWJtO/7Qo2Flxa0d5DMA==","signatures":[{"sig":"MEQCIALQySQT2SlbSgZVe8+nhBdYvtj4DVNu73cO6RomgZi/AiAlcp9VI9aAm0lWFxuaZkeZFY4hfhYeAs/VklD0PWdZYQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195805},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230621142836-770170f1.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/241b8ebea05baf1ac0128a95efbddccd/graphql-hive-client-0.24.0-alpha-20230621142836-770170f1.tgz","_integrity":"sha512-EJq/xxCrUMyJzeAX/N07IG0DSZRw0yMe+9ZQJV8rM8yn3FvSzEUkYFMFWnu0AKZgUvkWJtO/7Qo2Flxa0d5DMA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230621142836-770170f1_1687357761085_0.5344965971796127","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230621151433-c3f04bdc":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230621151433-c3f04bdc","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230621151433-c3f04bdc","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"dd20804e8fb12007fc2b8221428d3b0e37fc85b6","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230621151433-c3f04bdc.tgz","fileCount":64,"integrity":"sha512-dI/xfPoMXMat8vaeGE5LqKtZbM8xT6cgEHQv5OYrIzFsgeEB/b+ulnG4vZ/1SDsUmguezvkku3jdJ8pjKW/WLg==","signatures":[{"sig":"MEQCIFQzLCaklnuioO98YTjqaMjMn0fyxqX5eU8qXjSWeqYcAiBb0Ks5CQJFrhyjiifOis7UjDzTmDsorau18Xv6ffpUQA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195805},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230621151433-c3f04bdc.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/1ba3e7420516979444443b9847117b13/graphql-hive-client-0.24.0-alpha-20230621151433-c3f04bdc.tgz","_integrity":"sha512-dI/xfPoMXMat8vaeGE5LqKtZbM8xT6cgEHQv5OYrIzFsgeEB/b+ulnG4vZ/1SDsUmguezvkku3jdJ8pjKW/WLg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230621151433-c3f04bdc_1687360506859_0.6198441104935275","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230621151846-a5bae3c5":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230621151846-a5bae3c5","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230621151846-a5bae3c5","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"4452a548b850005a591ebebb288eea1130c7bf39","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230621151846-a5bae3c5.tgz","fileCount":64,"integrity":"sha512-HBMsS7b2hr/HEZ212eG8UoNLwKWS+nnijXXwsqOweWtmbi6S66dKZv7EydGrTkgPSDhPFeWzj38ePOkuX4KK2g==","signatures":[{"sig":"MEQCICBihsjIaOLColgpB1mtCQb+HwTySdr1znYAUtaoALMyAiBNteIgeyU9GCC1iI8ibZsgVBjo6QyVF7yhil6HjgWODw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195805},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230621151846-a5bae3c5.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/a2e5504867db6432c93485effc6400f6/graphql-hive-client-0.24.0-alpha-20230621151846-a5bae3c5.tgz","_integrity":"sha512-HBMsS7b2hr/HEZ212eG8UoNLwKWS+nnijXXwsqOweWtmbi6S66dKZv7EydGrTkgPSDhPFeWzj38ePOkuX4KK2g==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230621151846-a5bae3c5_1687360768838_0.6537845774346716","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230621201935-65bbf891":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230621201935-65bbf891","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230621201935-65bbf891","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"a9f4681736dbea7b9ce3023fe2eeae0c75395d76","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230621201935-65bbf891.tgz","fileCount":64,"integrity":"sha512-QG53f95smmqQtV76Nl5Ivv10sc6j4vbEQpRKhz2jX+QVwzpoz1iu+Lqb9lgH1+kKGTcKI12AUTAyqHD7OMypUg==","signatures":[{"sig":"MEUCIA5UU145Z1fchGS6fUAjaEsIZnMA8uxe02xehACADD9NAiEA6nIWPy3tha4DX5QKVU5c/QZpRQap3t6n/wMMorLT2Gk=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195805},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230621201935-65bbf891.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/9a13c43d6714b360dba0a56364de7194/graphql-hive-client-0.24.0-alpha-20230621201935-65bbf891.tgz","_integrity":"sha512-QG53f95smmqQtV76Nl5Ivv10sc6j4vbEQpRKhz2jX+QVwzpoz1iu+Lqb9lgH1+kKGTcKI12AUTAyqHD7OMypUg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230621201935-65bbf891_1687378810035_0.47120715305667704","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230621213718-37ba4541":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230621213718-37ba4541","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230621213718-37ba4541","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"7c16c146e83fd43f0eb9f9ba6edca0c372b88b71","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230621213718-37ba4541.tgz","fileCount":64,"integrity":"sha512-0HQsdInzCFVfCrozUXfEf+92l0UYq6mLTDEp8paPJApphVV8aH6FRM8GewNArsjWoTSfuH47fKVBlFWeyQ5qcg==","signatures":[{"sig":"MEYCIQDRe4NT9r9J6ZVUHsKdzwNinnzhNObP23tOR76/PWzbnwIhAMTVk9pvG24mPfzbmyU8gnFxKQDBqFxKjOyCRGK/aw5g","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195805},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230621213718-37ba4541.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/f50e2414ad8b774b868fe1b969c5aed1/graphql-hive-client-0.24.0-alpha-20230621213718-37ba4541.tgz","_integrity":"sha512-0HQsdInzCFVfCrozUXfEf+92l0UYq6mLTDEp8paPJApphVV8aH6FRM8GewNArsjWoTSfuH47fKVBlFWeyQ5qcg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230621213718-37ba4541_1687383471973_0.8677536934992267","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230622023451-f80db8aa":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230622023451-f80db8aa","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230622023451-f80db8aa","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"b27773c6100c1ca4b6e315713f7e289569596230","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230622023451-f80db8aa.tgz","fileCount":64,"integrity":"sha512-LSH17RCY63ZX1qrBADk0vHZYOUJP/GVCliTREFI/dK/DDr5ti4jtLCdzou21avyLJGt8gN81eWbQAWEHVR+rDg==","signatures":[{"sig":"MEUCIQDM/cRr5v7/C4Dp1JGW1JajClX66VtcFKkwjtAA2iA4WwIgbAKIy8fnF1QRMJ8x0wq3WlQVNlGSM7G5xkCepC3yIr4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195805},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230622023451-f80db8aa.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/9afbf1ed32bd6aa1d96c411b1073ebe7/graphql-hive-client-0.24.0-alpha-20230622023451-f80db8aa.tgz","_integrity":"sha512-LSH17RCY63ZX1qrBADk0vHZYOUJP/GVCliTREFI/dK/DDr5ti4jtLCdzou21avyLJGt8gN81eWbQAWEHVR+rDg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230622023451-f80db8aa_1687401332549_0.6336722283527894","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230622023508-f80db8aa":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230622023508-f80db8aa","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230622023508-f80db8aa","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"530d124ceb64f31131038396d19d993ac0813f38","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230622023508-f80db8aa.tgz","fileCount":64,"integrity":"sha512-JEBRj16rWU3dtyUizlljiNwmSgnLC9dRUhx1VgM/vo1+otIUyLQLycMoMRL5gWk/HRky3LBk4rKrzB6Lz+8IXA==","signatures":[{"sig":"MEUCIFE2pzmldHfnYRE3n01KwppJAcPwuM5aTEfKu78hTapaAiEAlY+e6lMhxTBl3i0EtY1YObCRuqPot35ukm1cisNlfDY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195805},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230622023508-f80db8aa.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/9a5b434e75e4167c532e45306cf88b41/graphql-hive-client-0.24.0-alpha-20230622023508-f80db8aa.tgz","_integrity":"sha512-JEBRj16rWU3dtyUizlljiNwmSgnLC9dRUhx1VgM/vo1+otIUyLQLycMoMRL5gWk/HRky3LBk4rKrzB6Lz+8IXA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230622023508-f80db8aa_1687401354384_0.29432670087730384","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230622062017-e6a21282":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230622062017-e6a21282","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230622062017-e6a21282","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"306627dd79df82314501087bea0328b6c8bd62b2","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230622062017-e6a21282.tgz","fileCount":64,"integrity":"sha512-18nkSnkgRk+zm3KYjSN8Oij6fslB5LveQpuJmlhzk2aQNgtn2cMIm99r4WUPwn4JKfDrARjAI/dBQRrL2lgF1A==","signatures":[{"sig":"MEUCIQDyvCNBF33wIYBpoxfSaIfnaYqvnCKg0G0RuzwT2Fx9yQIgcxAjbXNbiqflYoln8KXf7/T8N6lxjOAi7c36t+0zpzU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195805},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230622062017-e6a21282.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/e92a87c6599b69494dc1712d82c4540a/graphql-hive-client-0.24.0-alpha-20230622062017-e6a21282.tgz","_integrity":"sha512-18nkSnkgRk+zm3KYjSN8Oij6fslB5LveQpuJmlhzk2aQNgtn2cMIm99r4WUPwn4JKfDrARjAI/dBQRrL2lgF1A==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230622062017-e6a21282_1687414852216_0.009920614410148687","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230622062049-3f3d0265":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230622062049-3f3d0265","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230622062049-3f3d0265","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"f38eb4b26b0350d281c1c33a2952f9a4ad50d857","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230622062049-3f3d0265.tgz","fileCount":64,"integrity":"sha512-c8DMjtzKhFk71s8JRK3WjAf1veAfKbINzwVfJslz/rXjD3eYIdr4FS+5YSHr3tWOoYKgc8iTDGgWt7utr/tRLQ==","signatures":[{"sig":"MEUCIDZztv6v981ehgrH6niTTWdfp4IoiKL1MYhLWksxHdaFAiEAg9oBZ0+oKXSQH0hJN3EQObPNhqiNcyvjvtun1Vpemhc=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195805},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230622062049-3f3d0265.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/23ce34cf2ede9b1fae7c01f4d7d710b7/graphql-hive-client-0.24.0-alpha-20230622062049-3f3d0265.tgz","_integrity":"sha512-c8DMjtzKhFk71s8JRK3WjAf1veAfKbINzwVfJslz/rXjD3eYIdr4FS+5YSHr3tWOoYKgc8iTDGgWt7utr/tRLQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230622062049-3f3d0265_1687414896883_0.048362218197234075","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230622062159-6f944eab":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230622062159-6f944eab","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230622062159-6f944eab","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"46a7260fcacb15a95ec9465b12f6630f0b26717c","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230622062159-6f944eab.tgz","fileCount":64,"integrity":"sha512-FqzK8E0YwB/TLup5eovG0fDGzleGx/cz4fimMfQYZybx4Oh8LbzXO5/aFZBF+0E9GGBcDHUFI1U+PUnhUo5Zjg==","signatures":[{"sig":"MEUCICklq0vJULxWeXdbSlQoxPFUsZbsMF6qwXiD1Q0QwxpSAiEAgWwzfZqLoULStStxklM8Sej6HcVSYinAQaemocXCMoc=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195805},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230622062159-6f944eab.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/9bdebb46e6935f740787f938408e9b1a/graphql-hive-client-0.24.0-alpha-20230622062159-6f944eab.tgz","_integrity":"sha512-FqzK8E0YwB/TLup5eovG0fDGzleGx/cz4fimMfQYZybx4Oh8LbzXO5/aFZBF+0E9GGBcDHUFI1U+PUnhUo5Zjg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230622062159-6f944eab_1687414954490_0.6129980758775375","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230622065502-1db4d321":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230622065502-1db4d321","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230622065502-1db4d321","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"d3ecebe3081095f0cbf39979d01361e375372f57","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230622065502-1db4d321.tgz","fileCount":64,"integrity":"sha512-y5dPFTeShBCrfh7GFzZKC+jVb4tjzaCyHxUMPmdQij3XW9REnoseDumZE9wtQ8Gh4INjiczfL+nhhzEpsQQxhA==","signatures":[{"sig":"MEUCIQDoqcV90/TxDmppmSFhrgH0Dae1Jnk99o7OHdFtrDO9VgIgOycu/xc5Og+mCMFgRlQZ+VN/npIWvrt3h+toXOHqTAY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195805},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230622065502-1db4d321.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/792c9c476f913d7778d24ba27cefb86c/graphql-hive-client-0.24.0-alpha-20230622065502-1db4d321.tgz","_integrity":"sha512-y5dPFTeShBCrfh7GFzZKC+jVb4tjzaCyHxUMPmdQij3XW9REnoseDumZE9wtQ8Gh4INjiczfL+nhhzEpsQQxhA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230622065502-1db4d321_1687416938606_0.10519527533883033","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230622065955-4f4b0e88":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230622065955-4f4b0e88","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230622065955-4f4b0e88","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"568dcfe3dcd4d8f0a2291b121c45d7ec3b15d8f2","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230622065955-4f4b0e88.tgz","fileCount":64,"integrity":"sha512-1rtK8LFGWY9Z9x4M5ZxsDqiHLMbVAraqtVbJUdZvTwL+WRDMNzYIjNzEw5g/EdMbzCNH+ttVnWpoHrlBb/DEUA==","signatures":[{"sig":"MEQCICPmxrUvluFI/tbdqMtg1rPXWTytDunRuxAdSaITVV4GAiBs2D7Fwv9oxJ2Cxik93GAsLzmyjBIIn9NooxBZbe1szA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195805},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230622065955-4f4b0e88.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/439b5485cd97da0c146a013022ea1366/graphql-hive-client-0.24.0-alpha-20230622065955-4f4b0e88.tgz","_integrity":"sha512-1rtK8LFGWY9Z9x4M5ZxsDqiHLMbVAraqtVbJUdZvTwL+WRDMNzYIjNzEw5g/EdMbzCNH+ttVnWpoHrlBb/DEUA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230622065955-4f4b0e88_1687417234780_0.8202441382056722","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230622070443-fad9e29c":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230622070443-fad9e29c","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230622070443-fad9e29c","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"8e09b8f91048b9c63bd45d77351697d33c1f1247","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230622070443-fad9e29c.tgz","fileCount":64,"integrity":"sha512-BYkLGFBgyGZk2ZjPNfpjdkLIF4iZDYfWFK8UZYSmuxGIHXErVXP4rYKBYhxIHXoGoKJ+mQ4cTes+8TvMvljOZw==","signatures":[{"sig":"MEYCIQDEYnX6COhMt2I6kpKDkfFfIy4SnsPKzaURsk7dXSSjwAIhAK6knyH75C++EbhJxWScxyKzPHlildPE1wttSSfYBC7+","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195805},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230622070443-fad9e29c.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/436e2feb7a7826e407b38121096884d7/graphql-hive-client-0.24.0-alpha-20230622070443-fad9e29c.tgz","_integrity":"sha512-BYkLGFBgyGZk2ZjPNfpjdkLIF4iZDYfWFK8UZYSmuxGIHXErVXP4rYKBYhxIHXoGoKJ+mQ4cTes+8TvMvljOZw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230622070443-fad9e29c_1687417517154_0.35026106986258454","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230622081632-00a7835b":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230622081632-00a7835b","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230622081632-00a7835b","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"e5ffe67fc0a217ee051dba0e8a06be84e3a30fa5","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230622081632-00a7835b.tgz","fileCount":64,"integrity":"sha512-COszcTsGd+oZIY77pGrRO9mQR8Va+dyBboOZLOSFelNBHq/xqbBktyyMjYSOfPXuy8ly8GW+f5C5U0b8/uB46Q==","signatures":[{"sig":"MEQCIGNBoZvoGIa5cc4YNhT20M5SsJqa3+K5x0NYQdBr8aHKAiBQ3w+cHRKH7ZcBdylMXY9P/amwPPBnQ+LAD9JMQxPM+A==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195805},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230622081632-00a7835b.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/e90c82d7a02d6c4410306a5e4193bdfe/graphql-hive-client-0.24.0-alpha-20230622081632-00a7835b.tgz","_integrity":"sha512-COszcTsGd+oZIY77pGrRO9mQR8Va+dyBboOZLOSFelNBHq/xqbBktyyMjYSOfPXuy8ly8GW+f5C5U0b8/uB46Q==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230622081632-00a7835b_1687421836687_0.2297112650048434","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230622082730-6da74f68":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230622082730-6da74f68","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230622082730-6da74f68","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"3330dfcc2ee3cacc16259b9a42f5439ae0da6832","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230622082730-6da74f68.tgz","fileCount":64,"integrity":"sha512-ySZAzXMLDI2LlRUdA9A37LbtyUx51b0j7eoDUwrdIUHUEI7AkR9XSIQe2IxMxBdyjfG9WnylS2gpbVS5EzWrog==","signatures":[{"sig":"MEQCIHes83HuguwQ+N1yjeQAZxQODjk+MC2rAbnrShtKgWeYAiAR7Upz01Kqvhm03E2GSpw7dwpmgn8Aujasr6j9NXdc8g==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195805},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230622082730-6da74f68.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/41b11f0dfcaeec56b6d92f0267091733/graphql-hive-client-0.24.0-alpha-20230622082730-6da74f68.tgz","_integrity":"sha512-ySZAzXMLDI2LlRUdA9A37LbtyUx51b0j7eoDUwrdIUHUEI7AkR9XSIQe2IxMxBdyjfG9WnylS2gpbVS5EzWrog==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230622082730-6da74f68_1687422486571_0.6925370292967632","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230622110147-3830766e":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230622110147-3830766e","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230622110147-3830766e","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"898faf85f76f322489c1318de283978901e2cc8b","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230622110147-3830766e.tgz","fileCount":64,"integrity":"sha512-Qbr8G/ti0dXKY0VZDlCRNgCNfSk70yiZjF3m6blPWdqH0GY1OnY63zEajjudq+IFyYctFqXSOjvE8Mq/MMiVdw==","signatures":[{"sig":"MEUCIAzIWdq2zRrfWg91VDfBfc6m2h+ro+WxuPRo/idSjKFfAiEA94/R+RjB6V02nEvHqwa4U4McJlI0eZfGNNUlM//qEwY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195805},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230622110147-3830766e.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/e817da49534dc914632a465af6bdd498/graphql-hive-client-0.24.0-alpha-20230622110147-3830766e.tgz","_integrity":"sha512-Qbr8G/ti0dXKY0VZDlCRNgCNfSk70yiZjF3m6blPWdqH0GY1OnY63zEajjudq+IFyYctFqXSOjvE8Mq/MMiVdw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230622110147-3830766e_1687431748219_0.9784348309893494","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230622150559-5e3d3233":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230622150559-5e3d3233","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230622150559-5e3d3233","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"5cbf04ec2c4dbb4a6b44c82799ea1bbc9a31bcb2","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230622150559-5e3d3233.tgz","fileCount":64,"integrity":"sha512-TDQo7kKNn1JPmia5Nm09dbl35syCvt3FWyzAUwgXPyDbuxT0mOfrN94NtWbW69Snlzrlwf+IIAt9olVUG6d4cA==","signatures":[{"sig":"MEUCIEh0dTPXy7MRv8Q8p7f+roZTL3gLzFoXUo/gW5ySk6GjAiEAiKLs66HPksUeJi33zL0enCi1dpX+aYmO/6DX2Mdin4g=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195805},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230622150559-5e3d3233.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/493f62fd5dc5bf428d2e04c23f4a3941/graphql-hive-client-0.24.0-alpha-20230622150559-5e3d3233.tgz","_integrity":"sha512-TDQo7kKNn1JPmia5Nm09dbl35syCvt3FWyzAUwgXPyDbuxT0mOfrN94NtWbW69Snlzrlwf+IIAt9olVUG6d4cA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230622150559-5e3d3233_1687446395802_0.8140910604016174","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230622151154-b33d5643":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230622151154-b33d5643","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230622151154-b33d5643","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"bc6c334a8b2210ba53f9b01e474d84247c1d6399","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230622151154-b33d5643.tgz","fileCount":64,"integrity":"sha512-N6Z0libVhOMNav01LDSJcoxkOen/ymvOhwJpMFiaAYthqrv1TJr1H7s6dbGH+jOfN5XUTzRifyRMQpQIF37cyA==","signatures":[{"sig":"MEQCIHQrCVR7ruhKiFQfgIHfM/QaS5GPv6cnteL6h6hjnBlUAiBUxK50e7ejgPHMrgw/zbmc0/xQQxtLWbk7G2xP/5Y3Tw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":196103},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230622151154-b33d5643.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/c32a8c0dfdd4cf595fde6cf556da4aad/graphql-hive-client-0.24.0-alpha-20230622151154-b33d5643.tgz","_integrity":"sha512-N6Z0libVhOMNav01LDSJcoxkOen/ymvOhwJpMFiaAYthqrv1TJr1H7s6dbGH+jOfN5XUTzRifyRMQpQIF37cyA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230622151154-b33d5643_1687446757022_0.03146473904367375","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230622192126-8ea6ea4e":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230622192126-8ea6ea4e","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230622192126-8ea6ea4e","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"dae9d3662b8dadb3ce324c90b7c27db250d83504","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230622192126-8ea6ea4e.tgz","fileCount":64,"integrity":"sha512-YjNhp/BQjKUq79sP5GUym2C9rXDQwmocGQYpYpoQ8w7d+wM0LORG/7tzt2tZZT5oTeJuP+D17yXIYUjnPWj0pQ==","signatures":[{"sig":"MEUCIHDINo1KnxKIh5+ndr+ginFKCts9CCvGtSvHNxvtOfniAiEAiOghuQ9sKOTzILsTgO7ALNW6wQ9CKSJn3PnS+opWFfg=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195805},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230622192126-8ea6ea4e.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/c4739b77f3f0ee98c354bec428ee6fc0/graphql-hive-client-0.24.0-alpha-20230622192126-8ea6ea4e.tgz","_integrity":"sha512-YjNhp/BQjKUq79sP5GUym2C9rXDQwmocGQYpYpoQ8w7d+wM0LORG/7tzt2tZZT5oTeJuP+D17yXIYUjnPWj0pQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230622192126-8ea6ea4e_1687461721527_0.1594114171598482","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230623045708-d3b09848":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230623045708-d3b09848","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230623045708-d3b09848","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"fc949c354553f815811e0a6be2b7eadfd76c7756","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230623045708-d3b09848.tgz","fileCount":64,"integrity":"sha512-GcZ+pNZdBW1pwmE4xfhXEgJ5wX8QlcBJVATPv8xAfRD9n52yfgED5C+5jJyv3W74f4M3CBYSkZwApT2dkgxEcw==","signatures":[{"sig":"MEYCIQDlACYCerV4tJT1155G/NdImfXkP0491AgST4dZen+NjgIhAO8xg5VcF2gYdNCu9pkrewCMBGqvHChEruoayL5KITV4","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195805},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230623045708-d3b09848.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/e21041b63d9eb228cf23d04d0da057af/graphql-hive-client-0.24.0-alpha-20230623045708-d3b09848.tgz","_integrity":"sha512-GcZ+pNZdBW1pwmE4xfhXEgJ5wX8QlcBJVATPv8xAfRD9n52yfgED5C+5jJyv3W74f4M3CBYSkZwApT2dkgxEcw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230623045708-d3b09848_1687496274806_0.6156349719023213","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230623075243-0b1cd923":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230623075243-0b1cd923","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230623075243-0b1cd923","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"8ccd2bc346c04823fbea84790c86fd0584450450","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230623075243-0b1cd923.tgz","fileCount":64,"integrity":"sha512-1v2JW2DkxDry7hM0aKM7YBqDq8jtUCn6LCLkz/qMeLYV4j9ktToQ/t8RU5yZ7ohb2oGCOwbJFAofWM2waXBVfg==","signatures":[{"sig":"MEUCIQDgfXQD6pAd7pbYFUQRq9fTu6J+Jxw3oxjpzoDCZQxxSAIgYQ+s2I9xMWHUyy8NblPJcWrkCp2vgO9iRxKYFI8ltmA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195805},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230623075243-0b1cd923.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/953e58cae8049c1249adfcacc2055bd6/graphql-hive-client-0.24.0-alpha-20230623075243-0b1cd923.tgz","_integrity":"sha512-1v2JW2DkxDry7hM0aKM7YBqDq8jtUCn6LCLkz/qMeLYV4j9ktToQ/t8RU5yZ7ohb2oGCOwbJFAofWM2waXBVfg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230623075243-0b1cd923_1687506803832_0.947308249411835","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230623075332-81646edc":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230623075332-81646edc","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230623075332-81646edc","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"f8d702e408152629a78193b9ee06f702d2bf2710","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230623075332-81646edc.tgz","fileCount":64,"integrity":"sha512-A1H2PPTTno4a2OkJesU/fOAMSqP4PiN73LXJwthi4ZabzSbnACM9Qig5aabWRj0tbL//e1KKeKX2YH78TLItbg==","signatures":[{"sig":"MEYCIQDZEouYDhsT4QoWIPQgD4RCpNFX2vnIURLwuUQOObinKgIhAMjoCqP9Arl93D+dEfUIhRTNj81PUyk53IfOEqrT8irf","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195805},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230623075332-81646edc.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/01696c45a132cfdf6eca224f601d2c17/graphql-hive-client-0.24.0-alpha-20230623075332-81646edc.tgz","_integrity":"sha512-A1H2PPTTno4a2OkJesU/fOAMSqP4PiN73LXJwthi4ZabzSbnACM9Qig5aabWRj0tbL//e1KKeKX2YH78TLItbg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230623075332-81646edc_1687506845982_0.13177642851570703","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230623075455-26b57a36":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230623075455-26b57a36","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230623075455-26b57a36","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"5f31f7c100052c17f1fc5d41e2a0cddfec1df0f6","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230623075455-26b57a36.tgz","fileCount":64,"integrity":"sha512-ujfSXeUZ9SpknOoPtwwRDVF/zK6lptUvDtnsZYnkiRMgAlKkuFJqFl/DHeKrA7pQ156rMF0+6CgGQSm1bJiCqA==","signatures":[{"sig":"MEYCIQCmhGQwLjdeL86KCq9tcCCvRHVfNQP9RCQRCwDnJQQvpwIhAMGniH6ANWoAceg3B9fBXXaifF7lpu3VDBju3KGjqZw4","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195805},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230623075455-26b57a36.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/1baafe34c335a8444d7f85ab7ec1eb6e/graphql-hive-client-0.24.0-alpha-20230623075455-26b57a36.tgz","_integrity":"sha512-ujfSXeUZ9SpknOoPtwwRDVF/zK6lptUvDtnsZYnkiRMgAlKkuFJqFl/DHeKrA7pQ156rMF0+6CgGQSm1bJiCqA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230623075455-26b57a36_1687506929905_0.751617049722205","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230623075719-b9db8a7c":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230623075719-b9db8a7c","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230623075719-b9db8a7c","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"670c8d70dce6a154533f62706969db9565b75e1c","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230623075719-b9db8a7c.tgz","fileCount":64,"integrity":"sha512-VymFRYqF8Y8c/NoaRY68avNIEqnIgkJ7HpF9ZVpE2Fp0IK0ol+o8KFLDaGuygKf09Ad8Wm+jlzn93a2+oK0fkg==","signatures":[{"sig":"MEQCIFr8uuCutaxUOhk1G6JrYc0dMCF4Fh+llxirCOZ4Quu6AiAcDgnEuKP9WEvCEA0qkvlxIdIjdzQ0xHXx1yaI+gTH9w==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195805},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230623075719-b9db8a7c.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/3bf3adb9cc99f2aca2553eb20488f38e/graphql-hive-client-0.24.0-alpha-20230623075719-b9db8a7c.tgz","_integrity":"sha512-VymFRYqF8Y8c/NoaRY68avNIEqnIgkJ7HpF9ZVpE2Fp0IK0ol+o8KFLDaGuygKf09Ad8Wm+jlzn93a2+oK0fkg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230623075719-b9db8a7c_1687507081693_0.5245654358894876","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230623075747-b9db8a7c":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230623075747-b9db8a7c","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230623075747-b9db8a7c","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"253fa5322683d33e7c01380f2be54496896b0158","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230623075747-b9db8a7c.tgz","fileCount":64,"integrity":"sha512-eKCNFvrl9DJQ+6WOlRbYwmY7ILpAO6NOaVDpWI4uyBA3LPdlTtZxOSerSmpdX7rgRrtreY4finqmIrUCQZoJNQ==","signatures":[{"sig":"MEQCIBeHOgwC4uGaQf1NSQ6Ghe8Dk/mBPmhxZjXlX3j51qBIAiBGHSN7PKVYES3hZDXp4Yg/7vW9h6CZI6RrPtKiTSC5vQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195805},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230623075747-b9db8a7c.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/4a117276271b968a9f8e00a3621b2e64/graphql-hive-client-0.24.0-alpha-20230623075747-b9db8a7c.tgz","_integrity":"sha512-eKCNFvrl9DJQ+6WOlRbYwmY7ILpAO6NOaVDpWI4uyBA3LPdlTtZxOSerSmpdX7rgRrtreY4finqmIrUCQZoJNQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230623075747-b9db8a7c_1687507100580_0.6457909258220713","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230623082758-98c0ec20":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230623082758-98c0ec20","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230623082758-98c0ec20","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"ce398d1129c161b55b09f1fdf31e12be75ceff06","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230623082758-98c0ec20.tgz","fileCount":64,"integrity":"sha512-BaaMARIEpXyKChZhrEqX/olnaGaDNC9vU/ij4hBfCrQZCpmzkoj4Q1F2NmnKFNZHVeqtWyAvcj2D5CH0cVCiZQ==","signatures":[{"sig":"MEUCIDWvhPgboFiDQU/JWqaO5B1xzeTRSiMSZvGF/FXc5BX7AiEA2cNcDasC62Y0U0I1sDM29GCP17TExaP7Y8NHut3NEJ4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195805},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230623082758-98c0ec20.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/24081bdd8128f2024e9a1a477ccf2e91/graphql-hive-client-0.24.0-alpha-20230623082758-98c0ec20.tgz","_integrity":"sha512-BaaMARIEpXyKChZhrEqX/olnaGaDNC9vU/ij4hBfCrQZCpmzkoj4Q1F2NmnKFNZHVeqtWyAvcj2D5CH0cVCiZQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230623082758-98c0ec20_1687508911870_0.49063654383732747","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230623083017-7ffa1935":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230623083017-7ffa1935","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230623083017-7ffa1935","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"9f456515f4a4cc21dd3b4576d01beac4ac332f9e","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230623083017-7ffa1935.tgz","fileCount":64,"integrity":"sha512-/w2X2JiwWqq5AHLLte6vjEIT7cFMe9fYo/mJNgWOhZI2c4Uhi7ZlE6Wu5/MIMdMygr9p1NMJuQPGqOyYsX/Fqg==","signatures":[{"sig":"MEQCIEV3NnIgKjsQJKAZ08t5AIqEtrNiOoD+lFE7mfrQes2BAiA5RfGsrX7/CzqR+y5BRqwqUSJqgllRiWOaTGwpiEGRAw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195805},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230623083017-7ffa1935.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/63dc58895a8fb6cee0c1c85a3569aa7b/graphql-hive-client-0.24.0-alpha-20230623083017-7ffa1935.tgz","_integrity":"sha512-/w2X2JiwWqq5AHLLte6vjEIT7cFMe9fYo/mJNgWOhZI2c4Uhi7ZlE6Wu5/MIMdMygr9p1NMJuQPGqOyYsX/Fqg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230623083017-7ffa1935_1687509064115_0.028107449491741043","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230623083944-93a24c24":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230623083944-93a24c24","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230623083944-93a24c24","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"05aef8461f63486a737608fbbffb9abf2a0cbf34","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230623083944-93a24c24.tgz","fileCount":64,"integrity":"sha512-gxqebWbEaUMNv9WAGS7SjwFJ6QavHyWp2UO8ERPs6na0su/PpqWjfYYemuXT1JPyUAwGkuGOEi5+x7DsB0HXcA==","signatures":[{"sig":"MEQCIBTvWWyVPa+ALLy04pvVc28skn66RF7jTgOh5Z4A1lKBAiA1TRwhb8h1LdGWbePzxhz6BMtDCXFFosNOUN2Gv7s1rg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195935},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230623083944-93a24c24.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/c3e9c29b57cd91cde1bbf7282b490b13/graphql-hive-client-0.24.0-alpha-20230623083944-93a24c24.tgz","_integrity":"sha512-gxqebWbEaUMNv9WAGS7SjwFJ6QavHyWp2UO8ERPs6na0su/PpqWjfYYemuXT1JPyUAwGkuGOEi5+x7DsB0HXcA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230623083944-93a24c24_1687509619582_0.6731949925009866","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230623084247-f85af85c":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230623084247-f85af85c","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230623084247-f85af85c","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"d670c3ac33f0ffa50ab7f2de6c79df44fa4ce9f1","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230623084247-f85af85c.tgz","fileCount":64,"integrity":"sha512-jIW13vwg06P0Q+nFoDryI+O0n9HNRpB8Zk9kmSytMx+00gGGxndr+SsNLgm7AmU1W1Lg2lmhG+LQnHCUfVQGog==","signatures":[{"sig":"MEQCIBy1I4KDydD7YN9GiYWkW79S9T/WCj6WK7x1PN74nr0EAiBivd4qdg8HUwM7RfyjJ6t45pG8p36e48q7flG63RQfQQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195805},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230623084247-f85af85c.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/bfe0a57221e6d3b98ccfcacb241c1764/graphql-hive-client-0.24.0-alpha-20230623084247-f85af85c.tgz","_integrity":"sha512-jIW13vwg06P0Q+nFoDryI+O0n9HNRpB8Zk9kmSytMx+00gGGxndr+SsNLgm7AmU1W1Lg2lmhG+LQnHCUfVQGog==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230623084247-f85af85c_1687509801067_0.7066080267305823","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230623084523-6dcefd7d":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230623084523-6dcefd7d","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230623084523-6dcefd7d","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"d8a414d706f9f23e782ae9f7cac56f661ef3c75d","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230623084523-6dcefd7d.tgz","fileCount":64,"integrity":"sha512-vXoMzDGqi2JL1OMtE4xsonZhU3GNRx9pMYAKPTm2CCEmDWTgerj0W5zvnUpeKAiv7Cyu5jK+aiuO6E6PtZbpQw==","signatures":[{"sig":"MEUCIH+VYEJ3sYJrMqufDJU7jEsFKtYi/Zoo0To9qIAXNehGAiEAod84ZA07gTZfIxgSzNt7mpEekx6kwz3bquM+0CrukyU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195935},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230623084523-6dcefd7d.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/52a03b243176af48fa799c485e13d9e5/graphql-hive-client-0.24.0-alpha-20230623084523-6dcefd7d.tgz","_integrity":"sha512-vXoMzDGqi2JL1OMtE4xsonZhU3GNRx9pMYAKPTm2CCEmDWTgerj0W5zvnUpeKAiv7Cyu5jK+aiuO6E6PtZbpQw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230623084523-6dcefd7d_1687509964580_0.9870371401019893","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230623085220-6c457b93":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230623085220-6c457b93","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230623085220-6c457b93","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"511c75b2ebcc4fec79d816cb0b0b018286d49c52","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230623085220-6c457b93.tgz","fileCount":64,"integrity":"sha512-UjCchRG1r1Idb1Ve+tRSmLfTVJNCHJglAeEgi8aXO33BlKd+Amf+j2sMkSpjeOw6DXY/jr8n1BE1Us5DjSc6Pg==","signatures":[{"sig":"MEUCIQDF1FoGoATx8pHohHYlcp27Vy7X21G2zQtj/4GPBZcTVAIgP3/AsWcOFlit1vnGYrxPFDYqxIHrottELsI+f8lXnxU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195805},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230623085220-6c457b93.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/4dcd1dc10e9efdadbbb1c1ea0a89c8f7/graphql-hive-client-0.24.0-alpha-20230623085220-6c457b93.tgz","_integrity":"sha512-UjCchRG1r1Idb1Ve+tRSmLfTVJNCHJglAeEgi8aXO33BlKd+Amf+j2sMkSpjeOw6DXY/jr8n1BE1Us5DjSc6Pg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230623085220-6c457b93_1687510373986_0.23781285783173023","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230623093018-bba228a8":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230623093018-bba228a8","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230623093018-bba228a8","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"d4df51724a41e8c800021a01112bf3c0f26f5d68","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230623093018-bba228a8.tgz","fileCount":64,"integrity":"sha512-K2pfLmg/Ev7MhaSlZ1ewBvI60xcrGuUDX3jUiDS9t+f321Q/FMzkb8PBM0tQe/nrlz7WXPhITxCOV29Ym2ie5w==","signatures":[{"sig":"MEYCIQCZoUU0piy9LQn8xo5n+RNUMufIGec4wiFFHJlcHB3l0QIhAOu6jFrO58tXjX9GwSY9tIVp2hvqwIfMXU96Gmx+mx2x","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195805},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230623093018-bba228a8.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/25fded192432bdbdbfe6c606a334bea8/graphql-hive-client-0.24.0-alpha-20230623093018-bba228a8.tgz","_integrity":"sha512-K2pfLmg/Ev7MhaSlZ1ewBvI60xcrGuUDX3jUiDS9t+f321Q/FMzkb8PBM0tQe/nrlz7WXPhITxCOV29Ym2ie5w==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230623093018-bba228a8_1687512663517_0.06484716849716166","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230623223345-29405af2":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230623223345-29405af2","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230623223345-29405af2","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"b4cf12ceba4d1e79b5fc3d398a240d89900ed4ec","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230623223345-29405af2.tgz","fileCount":64,"integrity":"sha512-71v2+D/vI1JP4+Une1FkJVz92lTYDK5N+YHEJb2zmnyvzAKC9UyqBC+GHLvfFqX9M7lGQoQtt5TbGXT9xWJNlg==","signatures":[{"sig":"MEYCIQC8a9+F6Rc+xut8VVFH3aUqkuBJ1JIAx8gfxlmjCNC81wIhANpMKSKJlHJs92zXSG6GIfPyTJ4QBgrPWxLddAzyLwXl","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195805},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230623223345-29405af2.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/fd94af7fb3e3076576310008891545b9/graphql-hive-client-0.24.0-alpha-20230623223345-29405af2.tgz","_integrity":"sha512-71v2+D/vI1JP4+Une1FkJVz92lTYDK5N+YHEJb2zmnyvzAKC9UyqBC+GHLvfFqX9M7lGQoQtt5TbGXT9xWJNlg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230623223345-29405af2_1687559660187_0.12403817386997096","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230623223506-29405af2":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230623223506-29405af2","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230623223506-29405af2","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"54177750b6a23210e52718ea9b72e8c478c45dcf","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230623223506-29405af2.tgz","fileCount":64,"integrity":"sha512-dNURk+SMOwJubMGFcETQhOCn0k+6rA7HjS6B+lOS6lG2dXuQQKtmBqA/WxseAOY8QUoqTy9dj7whqQAT2vWFug==","signatures":[{"sig":"MEYCIQDTbsfcapF19Ad6cc/u453975HPCnuOpgOcAtuVt1zn3gIhAMO9n0GZBmyf3AUlZRHaeFH7RUczm7XDjtRlkmzDTRF8","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195805},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230623223506-29405af2.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/36b7de9aed96fd91cd48ef68ba36346c/graphql-hive-client-0.24.0-alpha-20230623223506-29405af2.tgz","_integrity":"sha512-dNURk+SMOwJubMGFcETQhOCn0k+6rA7HjS6B+lOS6lG2dXuQQKtmBqA/WxseAOY8QUoqTy9dj7whqQAT2vWFug==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230623223506-29405af2_1687559741563_0.0503856831383116","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230623223525-3d54c06f":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230623223525-3d54c06f","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230623223525-3d54c06f","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"c4747d3918f5059e5412e6e1dc244339d9fc1dce","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230623223525-3d54c06f.tgz","fileCount":64,"integrity":"sha512-G/6HYaNKYXsDClWq1FZcFC6jpSrGXpEfiXVd9z/ZYuaRFXq/YDjFsjYQIhtAIx0IXfCLhQ7CCO9T2vJgnDyGJw==","signatures":[{"sig":"MEQCIEzr0IGJjocFJXLaHAW9XOw/pETOiz0Pcd6AEfC7HWOfAiBVerJo3uHtpfTYvf3LNXCubib9vJxs2AXbnzIJy0ULlA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195805},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230623223525-3d54c06f.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/cc4caf5d3e2b51d932d83765ca80895f/graphql-hive-client-0.24.0-alpha-20230623223525-3d54c06f.tgz","_integrity":"sha512-G/6HYaNKYXsDClWq1FZcFC6jpSrGXpEfiXVd9z/ZYuaRFXq/YDjFsjYQIhtAIx0IXfCLhQ7CCO9T2vJgnDyGJw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230623223525-3d54c06f_1687559759139_0.6163233577969907","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230624032049-5e6bb3fc":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230624032049-5e6bb3fc","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230624032049-5e6bb3fc","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"1202abafb3a70c0bf6128d1951558fd4ff740965","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230624032049-5e6bb3fc.tgz","fileCount":64,"integrity":"sha512-KIuH0zrB8ikazjlmdGfSP756aewPhapCJSj1vI7VmwrNuaezgLXNzDwWvHrnfOnb/VIm8Qq+CSa03DLal/onNQ==","signatures":[{"sig":"MEYCIQC7EP8vDzoNBPsFP+68vSikwrJ+JmcuY9xZJy47D+CrfwIhAIO7kfBbedU9Zl3CGehpihP96uQscVT9o17TRwrshxwN","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195805},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230624032049-5e6bb3fc.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/027888dd24a23a838054b03205738f7e/graphql-hive-client-0.24.0-alpha-20230624032049-5e6bb3fc.tgz","_integrity":"sha512-KIuH0zrB8ikazjlmdGfSP756aewPhapCJSj1vI7VmwrNuaezgLXNzDwWvHrnfOnb/VIm8Qq+CSa03DLal/onNQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230624032049-5e6bb3fc_1687576883734_0.8357920117492696","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230624094001-7c901d43":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230624094001-7c901d43","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230624094001-7c901d43","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"0cf027e57b6764592f8f018ba9744954e3f2ef5e","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230624094001-7c901d43.tgz","fileCount":64,"integrity":"sha512-MI+DG7M1OtY0eP2rFQA+E4v8uzrfdcVZElyOBbt6xTpt6jSKozI6dMLUoi9NTbw0hEjBf0Wtc0VNDd+SP1tk3Q==","signatures":[{"sig":"MEYCIQDnOJj893rvXys6DbtzClSkOmdfpj6H0Lx5oju82vCwSQIhAI8q4rPnjiIcroto77nNAU5ysBl2llmIKE39q26qgN2L","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195805},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230624094001-7c901d43.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/1c3c15626226aec96bd7f2dc7448a786/graphql-hive-client-0.24.0-alpha-20230624094001-7c901d43.tgz","_integrity":"sha512-MI+DG7M1OtY0eP2rFQA+E4v8uzrfdcVZElyOBbt6xTpt6jSKozI6dMLUoi9NTbw0hEjBf0Wtc0VNDd+SP1tk3Q==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230624094001-7c901d43_1687599636874_0.9335558224339016","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230624094209-07c0afb2":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230624094209-07c0afb2","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230624094209-07c0afb2","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"ee0dad3afc6a0a5a8adf02337f6b027fb6a4d67e","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230624094209-07c0afb2.tgz","fileCount":64,"integrity":"sha512-4ecE24V2vXHWiHgEJak8GG2sGVhaNZt439iTzkjVSGYg/HU97Z3OUlWZwwAR5uX1rwFz5sgi9YFAjJjQux71fA==","signatures":[{"sig":"MEQCIA0qHIXbCU886nteEXUUEGB4d5+jtM5n43fZ+e8xl6bhAiACIXTqRNSc22c+qa6dbjyP+gCkhZfNLIIBVFMLdjKKkQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195805},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230624094209-07c0afb2.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/e24f1332d47d6458256a09927863fa64/graphql-hive-client-0.24.0-alpha-20230624094209-07c0afb2.tgz","_integrity":"sha512-4ecE24V2vXHWiHgEJak8GG2sGVhaNZt439iTzkjVSGYg/HU97Z3OUlWZwwAR5uX1rwFz5sgi9YFAjJjQux71fA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230624094209-07c0afb2_1687599767072_0.5395120469573997","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230625040408-6f0e23a7":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230625040408-6f0e23a7","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230625040408-6f0e23a7","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"caa32aabefd3e0b8b4699fd0264491f3f2baff7b","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230625040408-6f0e23a7.tgz","fileCount":64,"integrity":"sha512-ce12M2gTKKkbBJ7JUZ9WOELg7ZGSoFCb9IsbbDseGdXCdeVHFOC4lb06fscNu/p1H1JlSfvIS5w2kADYKr9xmA==","signatures":[{"sig":"MEYCIQCpEtS0ZX+IXo+sui+CKSyFH423MCl6zf3UmcvCfU58GQIhAPBrBTV9rcG/UZI6mIhU7XZfrgIRBva3hMBKX6gLjaea","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195805},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230625040408-6f0e23a7.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/d26f64900327aed1a1c7fe3be1a7c91d/graphql-hive-client-0.24.0-alpha-20230625040408-6f0e23a7.tgz","_integrity":"sha512-ce12M2gTKKkbBJ7JUZ9WOELg7ZGSoFCb9IsbbDseGdXCdeVHFOC4lb06fscNu/p1H1JlSfvIS5w2kADYKr9xmA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230625040408-6f0e23a7_1687665893753_0.33079978592107695","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230625103255-ef9fa5bf":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230625103255-ef9fa5bf","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230625103255-ef9fa5bf","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"f144681bb500205f5885d2bb2f65a16b0b3a5bff","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230625103255-ef9fa5bf.tgz","fileCount":64,"integrity":"sha512-Ht97VoL6uT3AG3+l+MzqK6ksDohtCd8LHf2OMDSAw73PMRzfh03EDuZFqX75FcuaTvhHV1syxi6GRdA0RINJQA==","signatures":[{"sig":"MEYCIQD5s6QoL7w+WMOSzN/D2lhFZqn0LdI3AQk4PYa+M+hZ5wIhAJ5pMS+sN7u4mZOko5nbUnKB5WJKxA+isoJf5ahaHEPC","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195805},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230625103255-ef9fa5bf.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/9f4db853e82a4e4427fbf8320a0b95a4/graphql-hive-client-0.24.0-alpha-20230625103255-ef9fa5bf.tgz","_integrity":"sha512-Ht97VoL6uT3AG3+l+MzqK6ksDohtCd8LHf2OMDSAw73PMRzfh03EDuZFqX75FcuaTvhHV1syxi6GRdA0RINJQA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230625103255-ef9fa5bf_1687689215642_0.2330262955859823","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230625103549-a5bfec1b":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230625103549-a5bfec1b","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230625103549-a5bfec1b","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"56cd3033b9f9ef0f1e5b191e09ebcc6431d76cea","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230625103549-a5bfec1b.tgz","fileCount":64,"integrity":"sha512-bM3BqkGd0PJvh1/oQfmwvegqzq+GydDdadN/UqlyF5d8nYOBb7ey5e3takje4LDstZZcuRFI7FrFkyKXnlnVzg==","signatures":[{"sig":"MEUCICbKfkRHHmpZ+SZtuIECyB79DLJNtAk/Gpj6yDE08o9lAiEA4HL9mYBcT0dbfwXYC/regSmd0UiKEO6k5qZesG4/hc4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195805},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230625103549-a5bfec1b.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/661a3909ca8dd863dc6230e37b42da4b/graphql-hive-client-0.24.0-alpha-20230625103549-a5bfec1b.tgz","_integrity":"sha512-bM3BqkGd0PJvh1/oQfmwvegqzq+GydDdadN/UqlyF5d8nYOBb7ey5e3takje4LDstZZcuRFI7FrFkyKXnlnVzg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230625103549-a5bfec1b_1687689392326_0.8659054909488162","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230625114520-43ffb90e":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230625114520-43ffb90e","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230625114520-43ffb90e","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"c8264065f960012bd6eca4105a7795469ea01ed9","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230625114520-43ffb90e.tgz","fileCount":64,"integrity":"sha512-7UtZ0dCdyBiYgAshVLc/2h/NJ2/pn7LDfxa5TElLHSD+9PMYyK4qWf0utig9PCwKCOTVQ8/DKAHMn3yV1RHQsg==","signatures":[{"sig":"MEUCIQCUgGBsLBMToL1WszX2HeDdBnAGZpcT6qM/XwREryCs1AIgJ9UuMDdFnNc5CMHLnsMDirO7kgS97EQV7K0eiOV0Ts0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195805},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230625114520-43ffb90e.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/a7c77bcec689885c2528b1cb53f2a312/graphql-hive-client-0.24.0-alpha-20230625114520-43ffb90e.tgz","_integrity":"sha512-7UtZ0dCdyBiYgAshVLc/2h/NJ2/pn7LDfxa5TElLHSD+9PMYyK4qWf0utig9PCwKCOTVQ8/DKAHMn3yV1RHQsg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230625114520-43ffb90e_1687693554547_0.6300243875956051","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230625114714-0bf7326b":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230625114714-0bf7326b","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230625114714-0bf7326b","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"65adebb95ba5f76cb5964ba55f664beaea44a3c2","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230625114714-0bf7326b.tgz","fileCount":64,"integrity":"sha512-/xjtZ61/ahpU5hILyAkLGuwL7pPKIP9FKb+0Co6HaDCaCWVT7G6xRXnqyXySUCejiJipPbx6uF11jAdjjb1p4w==","signatures":[{"sig":"MEQCIE6qGJ7WATy6DhGPqpK3EYtq5WLc/rkqX0X2uGkXZb4hAiAWnl5XR8UGlDeTuraiAGC+OZiOvkqVJThcs/jDvpZkLA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195805},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230625114714-0bf7326b.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/2dd2d4f5f598e2299c645d4ad5fd0033/graphql-hive-client-0.24.0-alpha-20230625114714-0bf7326b.tgz","_integrity":"sha512-/xjtZ61/ahpU5hILyAkLGuwL7pPKIP9FKb+0Co6HaDCaCWVT7G6xRXnqyXySUCejiJipPbx6uF11jAdjjb1p4w==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230625114714-0bf7326b_1687693673833_0.3348452323408371","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230625114825-9b1099b6":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230625114825-9b1099b6","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230625114825-9b1099b6","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"83809e6c93b3c6bc885576a39bfb7579cda323c6","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230625114825-9b1099b6.tgz","fileCount":64,"integrity":"sha512-on5nxYwgTdTkHY1hNBoHFSVFnSiZlFUv9q6PTPKBofSP7cfp114J7AvbS3v1xfyPibsWbnst3NcnnA2ch+yS/Q==","signatures":[{"sig":"MEUCIG+PXNeceRT5afcpwHfVDPJmPzhiJkiXJguaSXORfFiJAiEAp8+jgKntpaAELLmxwjyEsErAStFeh8edQerFlzfpWeE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195805},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230625114825-9b1099b6.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/83e0a174ace80b8d98db3e712c4d2620/graphql-hive-client-0.24.0-alpha-20230625114825-9b1099b6.tgz","_integrity":"sha512-on5nxYwgTdTkHY1hNBoHFSVFnSiZlFUv9q6PTPKBofSP7cfp114J7AvbS3v1xfyPibsWbnst3NcnnA2ch+yS/Q==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230625114825-9b1099b6_1687693744254_0.3204534451690255","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230625114924-efbd21d3":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230625114924-efbd21d3","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230625114924-efbd21d3","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"287c7e96349bbe224f4b7c160dbf38cbd285fa7a","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230625114924-efbd21d3.tgz","fileCount":64,"integrity":"sha512-aexv3VLFlGnMM0A+f6o3wEI2X+WfMt+TsT7PWTt0zYMPgsPLJ3MTY4r5JKAM/OKzFX8v2ati4Va6wGrBstjveg==","signatures":[{"sig":"MEYCIQDrMrRq2d/3xzmACi6ztNEbMSprGUfgfWMPsuWIAEddgwIhAOr3jkgxlRWd0xiXFZDynnddVKZixVdSII+MktgqXrwb","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195805},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230625114924-efbd21d3.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/84ea4562827d25710474dbacc3ce6486/graphql-hive-client-0.24.0-alpha-20230625114924-efbd21d3.tgz","_integrity":"sha512-aexv3VLFlGnMM0A+f6o3wEI2X+WfMt+TsT7PWTt0zYMPgsPLJ3MTY4r5JKAM/OKzFX8v2ati4Va6wGrBstjveg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230625114924-efbd21d3_1687693797664_0.5895020088079508","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230625115022-25473b9f":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230625115022-25473b9f","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230625115022-25473b9f","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"acc64279c6918bb9eacc909a1b8af1ed7bf411ae","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230625115022-25473b9f.tgz","fileCount":64,"integrity":"sha512-J2CgFKL97qJF2gYEnqnFICwQV5JI/4ZfVE3xFF8vrhySAkL0Ld/km1HiFwHE7Yiz8jAppxklRbVSE9TKcVpDwg==","signatures":[{"sig":"MEUCIQDXipMK3p9mCj6Hisv3JOvnx2loROc8yFty891ovW3rdAIgOom9pN+2c/rNysuerDsrIdPMIeBsN8faWRIEn3vjbGU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195805},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230625115022-25473b9f.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/7f0cde0430f29a289fc136c4108adaaa/graphql-hive-client-0.24.0-alpha-20230625115022-25473b9f.tgz","_integrity":"sha512-J2CgFKL97qJF2gYEnqnFICwQV5JI/4ZfVE3xFF8vrhySAkL0Ld/km1HiFwHE7Yiz8jAppxklRbVSE9TKcVpDwg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230625115022-25473b9f_1687693855660_0.8675236057289757","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230625115124-6bbc17c5":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230625115124-6bbc17c5","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230625115124-6bbc17c5","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"c1ef507c8cdaa5ec25500c27a04df0f5f7c0a4e4","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230625115124-6bbc17c5.tgz","fileCount":64,"integrity":"sha512-2r7zgnuM1HJyViQ5qY8Lu+tYXUU7w/nrPMlzQE9IovF1KwIhBWnodCfxqLn3MSbkGnKJY8W8SORDowsPeW0K2g==","signatures":[{"sig":"MEYCIQDkPSJ+m/zNOkQMr0Jt7NI2QnjteDWz/pk/w1gh1VpADgIhAPJe734UmBAzyW3q/++CJzBhV+V9iPO+BpH2ceb1WOkd","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195805},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230625115124-6bbc17c5.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/b6a0f0e16d4d4a31df944d51d08a16f0/graphql-hive-client-0.24.0-alpha-20230625115124-6bbc17c5.tgz","_integrity":"sha512-2r7zgnuM1HJyViQ5qY8Lu+tYXUU7w/nrPMlzQE9IovF1KwIhBWnodCfxqLn3MSbkGnKJY8W8SORDowsPeW0K2g==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230625115124-6bbc17c5_1687693917761_0.25978402838997083","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230625123657-117f1da3":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230625123657-117f1da3","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230625123657-117f1da3","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"4f408cf44da0f52f651371d0c725201b71ced6d5","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230625123657-117f1da3.tgz","fileCount":64,"integrity":"sha512-ixUcPcAFv9cFDdiziRV21yLzF+8A86Tw4tZ6prEdMV6327zTAUqYqSM9YwJcJ3TrQYYMjnBEpt/x7O4GP5JRuQ==","signatures":[{"sig":"MEUCIC6hrBhr+vjphAlWXLCQsB2Fh/oUKJBMBrtHD90kqQ8cAiEAl2ZM5rL4TnZCrgn2wa85jn40i8ugn6+bVuAlXXF2N6Q=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195805},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230625123657-117f1da3.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/536000c7610c833beac32b8176037dfc/graphql-hive-client-0.24.0-alpha-20230625123657-117f1da3.tgz","_integrity":"sha512-ixUcPcAFv9cFDdiziRV21yLzF+8A86Tw4tZ6prEdMV6327zTAUqYqSM9YwJcJ3TrQYYMjnBEpt/x7O4GP5JRuQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230625123657-117f1da3_1687696653402_0.8925289379563792","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230626083547-2ce7d70f":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230626083547-2ce7d70f","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230626083547-2ce7d70f","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"93ba5b66c28a771b4b287aa1afa75f46ae3ce472","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230626083547-2ce7d70f.tgz","fileCount":64,"integrity":"sha512-OCJgNX7TiKntPop3InqXcLpd2RFfW6sHnZNRD6PefZE9KXdLtbaUrIYTHpzb60M+i0Y0wzME0Umb5LPPJYwtRg==","signatures":[{"sig":"MEUCIQCyR5JwsVEks7cztUwmPtfnUKblKo7gEOdd9TcdWjJVsQIgViVAPx31QFGV8l4v6fdVyNdDAt1v82jrPOY8xT+hpBo=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195805},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230626083547-2ce7d70f.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/82c996848f15d826838ce6c114910add/graphql-hive-client-0.24.0-alpha-20230626083547-2ce7d70f.tgz","_integrity":"sha512-OCJgNX7TiKntPop3InqXcLpd2RFfW6sHnZNRD6PefZE9KXdLtbaUrIYTHpzb60M+i0Y0wzME0Umb5LPPJYwtRg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230626083547-2ce7d70f_1687768582907_0.9049551384483958","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230626083612-2ce7d70f":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230626083612-2ce7d70f","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230626083612-2ce7d70f","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"381bd87bf20d9a1c9e3e87fc73bb87d92bf4f6c7","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230626083612-2ce7d70f.tgz","fileCount":64,"integrity":"sha512-WZnF/ps/TiYbXMAEagNmpJwKpAV/DfTwHyDA28Wy5wrz82A/QN2Bin+eT5avWgfQ+e/d6UmbDlngmJhc15tyZg==","signatures":[{"sig":"MEUCIHFgu1Wt+eJlck6/z25eZsudP3jzCKJ+NtzpfTqgcBB9AiEAuBdvBW4eOMeWww2SnwOUb/5c0x22D2GvZwY/Za7F0wA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195805},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230626083612-2ce7d70f.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/798af8dd0dc51b5f675e710c6bf6cd9e/graphql-hive-client-0.24.0-alpha-20230626083612-2ce7d70f.tgz","_integrity":"sha512-WZnF/ps/TiYbXMAEagNmpJwKpAV/DfTwHyDA28Wy5wrz82A/QN2Bin+eT5avWgfQ+e/d6UmbDlngmJhc15tyZg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230626083612-2ce7d70f_1687768606716_0.7658705765975871","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230627002708-5b7a3da9":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230627002708-5b7a3da9","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230627002708-5b7a3da9","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"13aca872992028ae1ccfeb4503aceefb6f809797","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230627002708-5b7a3da9.tgz","fileCount":64,"integrity":"sha512-eqLwNLZ2KlZ/J6EvTwoYWVDN/yEtXj1KEAqjB3KC5cLodjqUAV8DqDdQdRHO0iEf1h97r/qNQnjjkYY87UcMCQ==","signatures":[{"sig":"MEQCIFjeBAT9a/vqu1yYcNYjfBatOdAV0vNZtbh4wDiNNWyOAiAZB4qfAnruxPA1DUoHVgJxrBZKp/3eGWPf+X5Tl33ouA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195805},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230627002708-5b7a3da9.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/078bb6c285bb0eee36f062977d56a347/graphql-hive-client-0.24.0-alpha-20230627002708-5b7a3da9.tgz","_integrity":"sha512-eqLwNLZ2KlZ/J6EvTwoYWVDN/yEtXj1KEAqjB3KC5cLodjqUAV8DqDdQdRHO0iEf1h97r/qNQnjjkYY87UcMCQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230627002708-5b7a3da9_1687825665437_0.23943691549721247","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230627002729-5b7a3da9":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230627002729-5b7a3da9","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230627002729-5b7a3da9","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"86e20a0c71e6c9eed45bc6e1d571387977ef189d","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230627002729-5b7a3da9.tgz","fileCount":64,"integrity":"sha512-Pok5N0Od8O/gIw4mmF4+f5ff8ZidnwLIwFiZc1JVyD1i+LKVIq6jFQRVlKoU/FqOI4wL5heSufPwFE5IO/pfrw==","signatures":[{"sig":"MEYCIQD3DtvKJ22pys8IKWOhbZ1sknWbsErcTRgelSG9QHyuPgIhAM76o9fIXkrNEKArUgT9gn6j7bHAznJBXdifK+w7sxx2","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195805},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230627002729-5b7a3da9.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/2f575ee8366b1a5be88a1c7a10f23413/graphql-hive-client-0.24.0-alpha-20230627002729-5b7a3da9.tgz","_integrity":"sha512-Pok5N0Od8O/gIw4mmF4+f5ff8ZidnwLIwFiZc1JVyD1i+LKVIq6jFQRVlKoU/FqOI4wL5heSufPwFE5IO/pfrw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230627002729-5b7a3da9_1687825684534_0.6775516095278258","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230627085251-f82ef5f3":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230627085251-f82ef5f3","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230627085251-f82ef5f3","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"cf49c8822d7b31a4fbcadbe3a00c0f8868be89cf","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230627085251-f82ef5f3.tgz","fileCount":64,"integrity":"sha512-teK2gnp7SUMqrgRFPZjSXnZpBoK1hEPTsApCTrh2TPnL6x1DqA1l7MNdgabOD8P0XOArep6mUQT0QkLA5/cIsA==","signatures":[{"sig":"MEUCIQCBwZSKaeb9fhp072Bl3REUmqkMo5XNc39eoHEkXMf3TwIgB5et9/Gv3oftssFH+ITSv17po8W7FfhylIzY6BcOJTA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195805},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230627085251-f82ef5f3.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/22226fa6b72523e4ec858cf811e00c00/graphql-hive-client-0.24.0-alpha-20230627085251-f82ef5f3.tgz","_integrity":"sha512-teK2gnp7SUMqrgRFPZjSXnZpBoK1hEPTsApCTrh2TPnL6x1DqA1l7MNdgabOD8P0XOArep6mUQT0QkLA5/cIsA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230627085251-f82ef5f3_1687856007307_0.00021872199071992782","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230627093336-3fe7ed15":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230627093336-3fe7ed15","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230627093336-3fe7ed15","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"9f595696fa2e9b96c1ad5b0015e7d5cfaf1192c1","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230627093336-3fe7ed15.tgz","fileCount":64,"integrity":"sha512-DMufpOgsv/kLfHXu9GJI85HX2OLeEwgXrMniTbxcA5tNRxdVIYijshoWAbLYDNQR3t7eEZzdyCwni7MU7awU/w==","signatures":[{"sig":"MEUCIQDMJ136bb4f5qlKNuTH1LTakVZaOLK1GVG1qieMgeYP0wIgMg4C0SB58sfxq+8tsS4TGoKhvltm0p+LIaLZP+g4Gx8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195935},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230627093336-3fe7ed15.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/54e71312097add756a84dd5bd5ee704f/graphql-hive-client-0.24.0-alpha-20230627093336-3fe7ed15.tgz","_integrity":"sha512-DMufpOgsv/kLfHXu9GJI85HX2OLeEwgXrMniTbxcA5tNRxdVIYijshoWAbLYDNQR3t7eEZzdyCwni7MU7awU/w==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230627093336-3fe7ed15_1687858460110_0.5708376854056179","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230627093818-a1c919f2":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230627093818-a1c919f2","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230627093818-a1c919f2","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"f39a94fdfcd090a60cfd2d0b963313f467bce842","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230627093818-a1c919f2.tgz","fileCount":64,"integrity":"sha512-oKtwBBHg9Pm/t38XOuw+DJ8WZFZHiItOUoNKywK/9nsoJoHjizTvq8IIHAMv9MF64FBf7Drg+OkccT3zJZuKAw==","signatures":[{"sig":"MEQCICroHZV3QeFj1uawO1OydfLoV9L/QBO2CJfC3piab81yAiBfVmgcNlIY9cu3wMNmcs5liWjSlqPYi6QW5IJIw9ARYw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195805},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230627093818-a1c919f2.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/1f8d1ed2c04c6423b77a0cafdd6bdaa7/graphql-hive-client-0.24.0-alpha-20230627093818-a1c919f2.tgz","_integrity":"sha512-oKtwBBHg9Pm/t38XOuw+DJ8WZFZHiItOUoNKywK/9nsoJoHjizTvq8IIHAMv9MF64FBf7Drg+OkccT3zJZuKAw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230627093818-a1c919f2_1687858737133_0.038330583318915146","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230627101822-31468b6b":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230627101822-31468b6b","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230627101822-31468b6b","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"c19e5c57bdfe86b116419db3009406f249e43250","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230627101822-31468b6b.tgz","fileCount":64,"integrity":"sha512-ohwceBxR3JRZGP8juPRZBna08SgmA3eptpc0JpohE5u/C74qABS8Zjy4kH+724dJQUCywFiasEbC0UbsTHJ89A==","signatures":[{"sig":"MEUCIQCXXw0ffmzIFL/vtbfgWIHwmE/VTU3Ojc03AlTMR79q1AIgU3HnwbDmG+L5+J2bb3xgog3WnaSw6D1CXe31ia3LHM4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195805},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230627101822-31468b6b.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/70a2c23838ffc0240d6dbb903b15844f/graphql-hive-client-0.24.0-alpha-20230627101822-31468b6b.tgz","_integrity":"sha512-ohwceBxR3JRZGP8juPRZBna08SgmA3eptpc0JpohE5u/C74qABS8Zjy4kH+724dJQUCywFiasEbC0UbsTHJ89A==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230627101822-31468b6b_1687861137274_0.783829275873984","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230627102906-f22e6c9f":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230627102906-f22e6c9f","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230627102906-f22e6c9f","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"49b0b4ccb536deeb55425d3e76462e816452855b","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230627102906-f22e6c9f.tgz","fileCount":64,"integrity":"sha512-QMFwep9/h+NlwsUmz+GDV464KWjVqhTyhpuE8yp0blAM0aT6EsyKVbp7KXw579tEHoeO+SuU11icfeuyaWUmIw==","signatures":[{"sig":"MEYCIQDD1cmK8d2VaJTUgncS+vRnCcNdfkD5VVY6uRjCBijyQwIhAJtInYanzTrV2SHwitzu/ttVRtkwKNIlYkqYo5rIqNEP","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195935},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230627102906-f22e6c9f.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/bb2f0b2504c826993125580916265534/graphql-hive-client-0.24.0-alpha-20230627102906-f22e6c9f.tgz","_integrity":"sha512-QMFwep9/h+NlwsUmz+GDV464KWjVqhTyhpuE8yp0blAM0aT6EsyKVbp7KXw579tEHoeO+SuU11icfeuyaWUmIw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230627102906-f22e6c9f_1687861783803_0.6997677919101424","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230627103019-641ecfee":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230627103019-641ecfee","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230627103019-641ecfee","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"53f51f96b7d8ad9bd9ad2db735714b3b149a7c7a","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230627103019-641ecfee.tgz","fileCount":64,"integrity":"sha512-Md1hz7XGE9QGGhQjTDAYTwTWxE9TA3VuFAsaaeF7mawpSs0msHMPxqg9Oo8lC5y6Wa5bITkqdiSiJGt/X4rlGQ==","signatures":[{"sig":"MEQCIBYSf9juG4P4+EGpKxhL1uCRYY3hfYFR4Icm/XMUx/azAiAZZ5ixtJmldm+75RVbwem6s2mbSkgpGl9HSBIBT3RNzA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195935},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230627103019-641ecfee.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/feac84a1f5f2cf6948f9c27b383c09f4/graphql-hive-client-0.24.0-alpha-20230627103019-641ecfee.tgz","_integrity":"sha512-Md1hz7XGE9QGGhQjTDAYTwTWxE9TA3VuFAsaaeF7mawpSs0msHMPxqg9Oo8lC5y6Wa5bITkqdiSiJGt/X4rlGQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230627103019-641ecfee_1687861852435_0.6496946373400712","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230627103136-7b3d2387":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230627103136-7b3d2387","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230627103136-7b3d2387","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"2b1a58bef75d6f11684b0d752066868050a546df","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230627103136-7b3d2387.tgz","fileCount":64,"integrity":"sha512-6MzeXVkeCSEncCay5TgoxerRiSmnyCcv1s6MWZrwCYQ9GcbnBoFCgHZspUXiqB7eeurSPGQix59VJwyby6R+JQ==","signatures":[{"sig":"MEQCIEL0/r3R/ejgjOJLtizOD2rVnsNP2ACxAP19wWarGlrGAiAoEdIqErEXD1sxNIXsuR1kHldr3XedDlhEP33F/iBMSw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195935},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230627103136-7b3d2387.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/e4a18447bdcb9c4cc5b4a237a8feb287/graphql-hive-client-0.24.0-alpha-20230627103136-7b3d2387.tgz","_integrity":"sha512-6MzeXVkeCSEncCay5TgoxerRiSmnyCcv1s6MWZrwCYQ9GcbnBoFCgHZspUXiqB7eeurSPGQix59VJwyby6R+JQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230627103136-7b3d2387_1687861928743_0.9284187704955564","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230627112304-c3e69392":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230627112304-c3e69392","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230627112304-c3e69392","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"ae1b86dd5e4ab6d7f3eeaa6033813619b7227271","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230627112304-c3e69392.tgz","fileCount":64,"integrity":"sha512-XRpSn3SPXeIiB+H8lEALR1j3iEE+kc9lBQ8UkwP374ADWmcNHkRUUzxqtxv+8PW8BbzBVC4oS7Bw9C3N2VJtHw==","signatures":[{"sig":"MEUCIQCn0VpbmrUAQ5vVwSmILwudE3l1o2IQDZdxvoY52iotxAIgYsYV6auhEPxBENGOgJICh1X9iYBZnmIaCxBvsB78r7c=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195935},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230627112304-c3e69392.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/03024424d045370366463489b1cd3aff/graphql-hive-client-0.24.0-alpha-20230627112304-c3e69392.tgz","_integrity":"sha512-XRpSn3SPXeIiB+H8lEALR1j3iEE+kc9lBQ8UkwP374ADWmcNHkRUUzxqtxv+8PW8BbzBVC4oS7Bw9C3N2VJtHw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230627112304-c3e69392_1687865018124_0.806825437393144","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230627161933-e782f03f":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230627161933-e782f03f","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230627161933-e782f03f","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"7cfbd00d3a60231e15aa28d2285ae3f975e7acfb","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230627161933-e782f03f.tgz","fileCount":64,"integrity":"sha512-4jwaU7dmqGG8TMv82r8M6rjxf6VvkwIPBT340KpfvM3jjWhWjtvLT6B1jTmE69b7eS993WxGB0IMV/PxGB5/RQ==","signatures":[{"sig":"MEUCIQC02mtjPMXn5Cf3hz5ubGkUu70Z/JZ6BnOiUlu6xwvOZAIgLapOpha2+cdNvoTRKh9D5VWcwgO0Ajdo0J8wKdzVE2c=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195935},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230627161933-e782f03f.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/eb3620cb8cb87aa228e3727c57a260d8/graphql-hive-client-0.24.0-alpha-20230627161933-e782f03f.tgz","_integrity":"sha512-4jwaU7dmqGG8TMv82r8M6rjxf6VvkwIPBT340KpfvM3jjWhWjtvLT6B1jTmE69b7eS993WxGB0IMV/PxGB5/RQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230627161933-e782f03f_1687882818873_0.7496894632123468","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230627183516-5f919da1":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230627183516-5f919da1","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230627183516-5f919da1","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"b7e85562d6c32fad7167e084fae5d68418ac25e1","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230627183516-5f919da1.tgz","fileCount":64,"integrity":"sha512-I2LGIXO4tXaJyMQvm0/XLYG8LJC/9h4IqP9AEVJa2azofx7kg0XoIbAlR5YDKsj/awhGNCHSpkzeKJGVE7W7TQ==","signatures":[{"sig":"MEUCIQCLz/yWcSPuEval64o/WuBhWIyc0GqtJvzMVg78XVOhlwIgCpoDlkYdetN/DFVIZFwmSjU2nUvJeScIbJlhjblcU6Q=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195935},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230627183516-5f919da1.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/bf9cf5279fcbd1c6738827f03ffb6637/graphql-hive-client-0.24.0-alpha-20230627183516-5f919da1.tgz","_integrity":"sha512-I2LGIXO4tXaJyMQvm0/XLYG8LJC/9h4IqP9AEVJa2azofx7kg0XoIbAlR5YDKsj/awhGNCHSpkzeKJGVE7W7TQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230627183516-5f919da1_1687890967019_0.032749346130461765","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230627183955-6698fbec":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230627183955-6698fbec","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230627183955-6698fbec","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"83f482c74ffa65715ff4fca741e44348caf48919","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230627183955-6698fbec.tgz","fileCount":64,"integrity":"sha512-tkts9mqNIKiEcXIrcGFi6HOjBDEYfCqcjc/f61XlPd3MZTQsvXxBlnOIxv7tbxWG+tCaRzbd5G9DB7vwI6JT4w==","signatures":[{"sig":"MEUCIHJVtlurdPyYNtkhV1DfnlCMLZNcAU4/2+18QFU9Ct/HAiEAmPcH6V68jj6O2XggED4oQx7xrS62EfsPij7JArrpiJg=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195935},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230627183955-6698fbec.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/d36fbff2a1d7e87f44b3a108f1e6b5eb/graphql-hive-client-0.24.0-alpha-20230627183955-6698fbec.tgz","_integrity":"sha512-tkts9mqNIKiEcXIrcGFi6HOjBDEYfCqcjc/f61XlPd3MZTQsvXxBlnOIxv7tbxWG+tCaRzbd5G9DB7vwI6JT4w==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230627183955-6698fbec_1687891228206_0.1681934422804099","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230627184656-4d75fe45":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230627184656-4d75fe45","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230627184656-4d75fe45","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"07755045c6903f9745f40f08bd58d413f82e8c6e","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230627184656-4d75fe45.tgz","fileCount":64,"integrity":"sha512-/YiWNcHG9YeEdOPjoXwubllTr8LxGG63N9R0KvRgDqNg/3E2Km3GFYy4ohgO/6T0NOWeWASbtZReOH9BSpxRhQ==","signatures":[{"sig":"MEQCIBYwGOSP3m+S/izv+G7kzizb+pJV2LEJpMIotA4fL1bCAiAW17A2HRLETb9QtxCuqUyhsjBuq9/8MNHy5/Z7kovg7g==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195935},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230627184656-4d75fe45.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/d5c2a6da8398faac5638390564e531d8/graphql-hive-client-0.24.0-alpha-20230627184656-4d75fe45.tgz","_integrity":"sha512-/YiWNcHG9YeEdOPjoXwubllTr8LxGG63N9R0KvRgDqNg/3E2Km3GFYy4ohgO/6T0NOWeWASbtZReOH9BSpxRhQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230627184656-4d75fe45_1687891658890_0.05123805465981479","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230627193122-9e0fd083":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230627193122-9e0fd083","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230627193122-9e0fd083","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"c753cd3020fb4a0dd2681fb36629f27ca4fdd086","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230627193122-9e0fd083.tgz","fileCount":64,"integrity":"sha512-iieccsNNcpIpLUx3VThcRacJgBMqx4doYPG+kxc8Gr/gKfDpfYf8oVr4lWSMmvVZW6SmltkaA/8QByGCOeQmHQ==","signatures":[{"sig":"MEQCIHU4rdeL0GVG2eAL/ShSk+62C3oCQUKQvLMS3vZWAyruAiBMIBEogeN5wpiykVZ5lm4aX6essGm/opsss69P+KUqlQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195935},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230627193122-9e0fd083.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/08b5bdf57e629d2c4f454132662a2043/graphql-hive-client-0.24.0-alpha-20230627193122-9e0fd083.tgz","_integrity":"sha512-iieccsNNcpIpLUx3VThcRacJgBMqx4doYPG+kxc8Gr/gKfDpfYf8oVr4lWSMmvVZW6SmltkaA/8QByGCOeQmHQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230627193122-9e0fd083_1687894316415_0.604340885657308","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230628082730-004728cd":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230628082730-004728cd","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230628082730-004728cd","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"c41d9213cc84c3001d97a88e0905160101c84e04","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230628082730-004728cd.tgz","fileCount":64,"integrity":"sha512-L5JHIdsCTlJ9oNG167YmmFm9cI+Ui6XdhkTgJsoINGhXOjrLWA+vcsCKW4f8LjTGhgz7PqvE1xVSxew6Jevajw==","signatures":[{"sig":"MEUCIGMumdhsFnt7GycrqYym2XOZpuzJgjNVlbVghVvSEx1dAiEA3a9zVyDS/jpgTWU96aiIjwOyxSOxgntTBDft4hR+Sz8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195805},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230628082730-004728cd.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/9f54cd012e68e3a72fdf898458eb1eaa/graphql-hive-client-0.24.0-alpha-20230628082730-004728cd.tgz","_integrity":"sha512-L5JHIdsCTlJ9oNG167YmmFm9cI+Ui6XdhkTgJsoINGhXOjrLWA+vcsCKW4f8LjTGhgz7PqvE1xVSxew6Jevajw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230628082730-004728cd_1687940890046_0.34708525055406625","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230628082832-06594691":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230628082832-06594691","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230628082832-06594691","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"39cd659fe9476682fe8db1296489b7f56942c2a6","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230628082832-06594691.tgz","fileCount":64,"integrity":"sha512-TQL21NFGoXnCbmpXbKDBLTHCF6HRPHrdvlTHpp8ZhkI3qx40KwHCF7RhORD6Qsz1swieJ/Kn5R/lLsPVCghboA==","signatures":[{"sig":"MEUCIQCkaUmTnS9wFsOWZl/tiRi0lurloV2hur0ZmctScfzskgIgGfF/bUWxXn7Q1woind6v4gU5VIge8D6/TPrmUfQ4jz0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195935},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230628082832-06594691.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/3fc94fdabf3526cbbce06a5b44efea33/graphql-hive-client-0.24.0-alpha-20230628082832-06594691.tgz","_integrity":"sha512-TQL21NFGoXnCbmpXbKDBLTHCF6HRPHrdvlTHpp8ZhkI3qx40KwHCF7RhORD6Qsz1swieJ/Kn5R/lLsPVCghboA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230628082832-06594691_1687940960685_0.03801228078531116","host":"s3://npm-registry-packages"}},"0.24.0-alpha-20230628083144-2eac5b3d":{"name":"@graphql-hive/client","version":"0.24.0-alpha-20230628083144-2eac5b3d","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0-alpha-20230628083144-2eac5b3d","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"179fb854af7210fdcd7fa845bb511209e46b6954","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0-alpha-20230628083144-2eac5b3d.tgz","fileCount":64,"integrity":"sha512-Y1QiXKlMUtFmd06sB3xIxw8FcJkgZqAc9u19iRQW6ib3YMFqd/QoRRHK1RMmKIEibcuVdR1M00ljB3Dvg0XznA==","signatures":[{"sig":"MEUCIQCF9uOu6EY+yocsMaJ/TLrDKgcIY3hFcX4lrbx/6OFf8wIgJ6IKqZ5Hwziw2F6LKswvZlxIfozAwNH1NTloo6VIUeo=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195550},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0-alpha-20230628083144-2eac5b3d.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/12aa134c196aaf5ecfba9922676fabab/graphql-hive-client-0.24.0-alpha-20230628083144-2eac5b3d.tgz","_integrity":"sha512-Y1QiXKlMUtFmd06sB3xIxw8FcJkgZqAc9u19iRQW6ib3YMFqd/QoRRHK1RMmKIEibcuVdR1M00ljB3Dvg0XznA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0-alpha-20230628083144-2eac5b3d_1687941138969_0.21073230517583852","host":"s3://npm-registry-packages"}},"0.24.0":{"name":"@graphql-hive/client","version":"0.24.0","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.0","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"02189bcc693851a6a9ec1e52a4ae0bef70bc3964","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.0.tgz","fileCount":64,"integrity":"sha512-9SbqkVTUwgIjorX0yCvGKz/RHnx1KtXYiFvZIXIx6vTY6ICk9qBqw13AJihDxiaESUlVyCcYikVc4htmjpLYQA==","signatures":[{"sig":"MEUCIFFIb5cAGO7ILQvuq77dxYXMff947bnAvpY2WMHXcg4PAiEA41H/ecUNODMdC5WA4JLtS+tY3HONMrPF7bvLX9KtvfE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195785},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.0.tgz","module":"esm/index.js","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/85560929f7ba81884d65c964a6b55cfc/graphql-hive-client-0.24.0.tgz","_integrity":"sha512-9SbqkVTUwgIjorX0yCvGKz/RHnx1KtXYiFvZIXIx6vTY6ICk9qBqw13AJihDxiaESUlVyCcYikVc4htmjpLYQA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.0_1687941363502_0.7716789448492052","host":"s3://npm-registry-packages"}},"0.24.1-alpha-20230711083346-835ec800":{"name":"@graphql-hive/client","version":"0.24.1-alpha-20230711083346-835ec800","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.1-alpha-20230711083346-835ec800","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"a5e7aef2b126088d6ab2730f9b470f2311b89dae","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.1-alpha-20230711083346-835ec800.tgz","fileCount":64,"integrity":"sha512-s9nKc4UBYZxlprpIwF7o55HgZqvtWoG95bqzgnRf40xZZbqf/2U8UIywTxvS6A+1w/2WnJJk/LV1Frn69laTOg==","signatures":[{"sig":"MEYCIQCcC0S2ln00nR3TDjH/fMRQS+YjJZLHgPe29vN0zFIg4QIhAKScGyOpEAQdZq8xYqElJiOMb7T7is948SxgHtErQ98b","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195680},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.1-alpha-20230711083346-835ec800.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/cc62b314d2eb6c2e507aa0c61a5fce52/graphql-hive-client-0.24.1-alpha-20230711083346-835ec800.tgz","_integrity":"sha512-s9nKc4UBYZxlprpIwF7o55HgZqvtWoG95bqzgnRf40xZZbqf/2U8UIywTxvS6A+1w/2WnJJk/LV1Frn69laTOg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.1-alpha-20230711083346-835ec800_1689064468395_0.9436585205653822","host":"s3://npm-registry-packages"}},"0.24.1-alpha-20230711083601-561c8084":{"name":"@graphql-hive/client","version":"0.24.1-alpha-20230711083601-561c8084","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.1-alpha-20230711083601-561c8084","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"eff84ef6089eb899aae8d2266e5d2001ee09f91d","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.1-alpha-20230711083601-561c8084.tgz","fileCount":64,"integrity":"sha512-T6wLkmwF3Za4qF/oKrW1hfvJeNrCpDG06Pjf6xuoy0oKi+vn8CqvRq1bsQEXuXLYj0zXT6EdfVpWsDxTao8iyA==","signatures":[{"sig":"MEQCIHqR+8BYGIQZzp6HXt8VQHxnDZFAKvnfsaLmfBz3dx1SAiAapES9UtKqyZ5cfWm97W3i8VYcxZ3269jABeamAMx9Cw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195680},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.1-alpha-20230711083601-561c8084.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/86e995a053b5458f51d77489f88d9e51/graphql-hive-client-0.24.1-alpha-20230711083601-561c8084.tgz","_integrity":"sha512-T6wLkmwF3Za4qF/oKrW1hfvJeNrCpDG06Pjf6xuoy0oKi+vn8CqvRq1bsQEXuXLYj0zXT6EdfVpWsDxTao8iyA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.1-alpha-20230711083601-561c8084_1689064601291_0.04362115847300663","host":"s3://npm-registry-packages"}},"0.24.1-alpha-20230711083637-ff504576":{"name":"@graphql-hive/client","version":"0.24.1-alpha-20230711083637-ff504576","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.1-alpha-20230711083637-ff504576","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"3d3ef93cb9ece30a4f4709bfddebc7b412ff4a22","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.1-alpha-20230711083637-ff504576.tgz","fileCount":64,"integrity":"sha512-YSta8EQ5MSHIEdPozS96YykwwZSdm357ftWe7KMpagEuk8S/FN6jaUOEqBR7O/2h/lTrT2UpxxvCFDEBMNor9A==","signatures":[{"sig":"MEUCIQCl9/MkLOjeYFi8pZjUNm85YgFRqMcfQvnwN5Kli6m4eAIgGy4ycbKalsGbk37VLMGq0djJ+i5OGH1vPQuwbprzQxs=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195680},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.1-alpha-20230711083637-ff504576.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/b1818d4f856500f33be46e4ab6a4df61/graphql-hive-client-0.24.1-alpha-20230711083637-ff504576.tgz","_integrity":"sha512-YSta8EQ5MSHIEdPozS96YykwwZSdm357ftWe7KMpagEuk8S/FN6jaUOEqBR7O/2h/lTrT2UpxxvCFDEBMNor9A==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.1-alpha-20230711083637-ff504576_1689064634746_0.08000489635241226","host":"s3://npm-registry-packages"}},"0.24.1-alpha-20230711090946-12496b03":{"name":"@graphql-hive/client","version":"0.24.1-alpha-20230711090946-12496b03","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.1-alpha-20230711090946-12496b03","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"e688dda19b5407174deb443651dccf415d100f89","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.1-alpha-20230711090946-12496b03.tgz","fileCount":64,"integrity":"sha512-n8QTDrr5xRb4++E/C8E8MqBsQyvxARJt2OfpWJA+tPGEWxET4xMho51sji/BZ7UCSCa2H7Z3cU5usHUkHcuAlA==","signatures":[{"sig":"MEQCIGDWTpmp0m78vIo+v1UTEeLQ/4s3dbHKgpQw2p+AQ/9uAiBBrXyYG1ZR22IwboJqUJyfqCDvBDPICIQVWE0Lnn/Fbw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195680},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.1-alpha-20230711090946-12496b03.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/6d9ae8f0ec4c191ee6d9262c2f7a1195/graphql-hive-client-0.24.1-alpha-20230711090946-12496b03.tgz","_integrity":"sha512-n8QTDrr5xRb4++E/C8E8MqBsQyvxARJt2OfpWJA+tPGEWxET4xMho51sji/BZ7UCSCa2H7Z3cU5usHUkHcuAlA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.1-alpha-20230711090946-12496b03_1689066627199_0.8478046957164351","host":"s3://npm-registry-packages"}},"0.24.1-alpha-20230711092328-642e2c88":{"name":"@graphql-hive/client","version":"0.24.1-alpha-20230711092328-642e2c88","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.1-alpha-20230711092328-642e2c88","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"b8468ad40f4043f6cab4d1beddefd09f525c5d9c","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.1-alpha-20230711092328-642e2c88.tgz","fileCount":64,"integrity":"sha512-dP9a0JozQaTaoorTDot1oaYji1SaD259Rz8h7tgRVm0/0T/dLRMdYfA2X5b26xqPOv1aE8shngjYHK4jYpbklw==","signatures":[{"sig":"MEUCICrg756EIXy7Wh8FGcJ5qEKZ2RqM63H38Cy/pK0v9r7NAiEA4DbRb/jE1mtYGAfAB6TJ5OBlcf4UPqflcIqc0QVV3zU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195680},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.1-alpha-20230711092328-642e2c88.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/cce3fbe2a303e0bc419b569c1446440a/graphql-hive-client-0.24.1-alpha-20230711092328-642e2c88.tgz","_integrity":"sha512-dP9a0JozQaTaoorTDot1oaYji1SaD259Rz8h7tgRVm0/0T/dLRMdYfA2X5b26xqPOv1aE8shngjYHK4jYpbklw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.1-alpha-20230711092328-642e2c88_1689067444948_0.40917749105170675","host":"s3://npm-registry-packages"}},"0.24.1-alpha-20230711092450-5f84cc9b":{"name":"@graphql-hive/client","version":"0.24.1-alpha-20230711092450-5f84cc9b","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.1-alpha-20230711092450-5f84cc9b","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"6d7e84c9f983b18cfdb64fb7e17e5265e4ea09f6","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.1-alpha-20230711092450-5f84cc9b.tgz","fileCount":64,"integrity":"sha512-oNNj6rnlUNAqeBrtxCxYS2GfK2SVphaJonAy8guCEhyhGGIXP6F62VdaOm9H7ujr9NNHiGgkfCW1dDkxcS7QMQ==","signatures":[{"sig":"MEQCIEjiAzc5v0vskeEP9snVIVEd1mCAOfELTXTAir3WuGXiAiAnAgBEoDN+Z2oqkCQYOMDBDsH279wnSUOL9JVDLRej8g==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195680},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.1-alpha-20230711092450-5f84cc9b.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/436d1139474c843d4502e36ffe2f032a/graphql-hive-client-0.24.1-alpha-20230711092450-5f84cc9b.tgz","_integrity":"sha512-oNNj6rnlUNAqeBrtxCxYS2GfK2SVphaJonAy8guCEhyhGGIXP6F62VdaOm9H7ujr9NNHiGgkfCW1dDkxcS7QMQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.1-alpha-20230711092450-5f84cc9b_1689067528124_0.28105347444534523","host":"s3://npm-registry-packages"}},"0.24.1-alpha-20230711093219-df93e330":{"name":"@graphql-hive/client","version":"0.24.1-alpha-20230711093219-df93e330","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.1-alpha-20230711093219-df93e330","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"bd174afdea2eadf77b3dfcbd39995c1b459df2c5","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.1-alpha-20230711093219-df93e330.tgz","fileCount":64,"integrity":"sha512-q14smUOSFgBjn21zmJ1VnQjkdqSbODbGgpRT6Ib+osXiLCQtArJWjU/lpWzuQxtOa91SuskJ4pDuju04Kv6Gtg==","signatures":[{"sig":"MEYCIQCBR5QonYPhjAwZe6T6Xg9hyhqQ5Wy8k9arotYtDMPxxwIhAKw2oxK79qfiAfp3V+OwZfwHqiU+dieDNBX5Y17RDrFj","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195680},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.1-alpha-20230711093219-df93e330.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/540e3d7635abb95f49a75ec9acb8560d/graphql-hive-client-0.24.1-alpha-20230711093219-df93e330.tgz","_integrity":"sha512-q14smUOSFgBjn21zmJ1VnQjkdqSbODbGgpRT6Ib+osXiLCQtArJWjU/lpWzuQxtOa91SuskJ4pDuju04Kv6Gtg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.1-alpha-20230711093219-df93e330_1689067975307_0.9957373416785131","host":"s3://npm-registry-packages"}},"0.24.1-alpha-20230711093707-3a682256":{"name":"@graphql-hive/client","version":"0.24.1-alpha-20230711093707-3a682256","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.1-alpha-20230711093707-3a682256","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"2c46387698de5bbb8c591803a14e9fef071d45a4","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.1-alpha-20230711093707-3a682256.tgz","fileCount":64,"integrity":"sha512-ObvHchp0jAyYtqgtPhXnc5jc922BaGHG15izbLgmXKgd6+7RqoQ8d33/0AmO9PxRGsDdn3NfRUNQxYD3bMmlFw==","signatures":[{"sig":"MEUCIHLE5WxbAt1QnMv2XNeK6vUX4wsyp3+Fc5coqPg3k5GPAiEA/Oq6777BAF0gWrqH5jdE5UJ0sammQ6go5xjNuGU+FJs=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195680},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.1-alpha-20230711093707-3a682256.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/04408bb5cf4f4a84909479147eb43aa9/graphql-hive-client-0.24.1-alpha-20230711093707-3a682256.tgz","_integrity":"sha512-ObvHchp0jAyYtqgtPhXnc5jc922BaGHG15izbLgmXKgd6+7RqoQ8d33/0AmO9PxRGsDdn3NfRUNQxYD3bMmlFw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.1-alpha-20230711093707-3a682256_1689068261552_0.346149045399194","host":"s3://npm-registry-packages"}},"0.24.1-alpha-20230711094721-563ef15e":{"name":"@graphql-hive/client","version":"0.24.1-alpha-20230711094721-563ef15e","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.1-alpha-20230711094721-563ef15e","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"05c3d68cbd50986d9bd140c903e9ac8fe599c947","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.1-alpha-20230711094721-563ef15e.tgz","fileCount":64,"integrity":"sha512-ooeNfQ1YiGwI8+uS+bj/qjieJurSmvdKZYJMrBowtQpb+/cc7oY8AxEmId3elnxqoHtoJpu0xBqLuQXL4Kv7yg==","signatures":[{"sig":"MEYCIQDDn1Yp+SIIAv0OGSz5vs5J/lmpYphqooU814RKuxkbMgIhAN+UqZsc5FjZoRG1g+oUef89rDP9/vud43B3M7NtspfS","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195680},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.1-alpha-20230711094721-563ef15e.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/82606bac73a294c8571c4360b431759d/graphql-hive-client-0.24.1-alpha-20230711094721-563ef15e.tgz","_integrity":"sha512-ooeNfQ1YiGwI8+uS+bj/qjieJurSmvdKZYJMrBowtQpb+/cc7oY8AxEmId3elnxqoHtoJpu0xBqLuQXL4Kv7yg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.1-alpha-20230711094721-563ef15e_1689068878637_0.8984164968086015","host":"s3://npm-registry-packages"}},"0.24.1-alpha-20230711101034-12496b03":{"name":"@graphql-hive/client","version":"0.24.1-alpha-20230711101034-12496b03","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.1-alpha-20230711101034-12496b03","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"84ffce75348003d6b1030fedde9986959adb2f12","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.1-alpha-20230711101034-12496b03.tgz","fileCount":64,"integrity":"sha512-BWFJeSNguLSko+n+cMWn000QcroPMlFHElw+cagGm9LoGY70mLwXCWzRasvxUWTMDG1/AJHmq9Givy41i/8Rrw==","signatures":[{"sig":"MEQCIB2kXHbDOGmCksOL3byoMAFJsWmT0H0ukQuZ4I7jWohUAiBmBDZChyFK0b7xRDtlwcGUCJZKCwqq3R7NrEJF54N7xg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195680},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.1-alpha-20230711101034-12496b03.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/0fbd97cccc27ce29b7778abd3fd629d0/graphql-hive-client-0.24.1-alpha-20230711101034-12496b03.tgz","_integrity":"sha512-BWFJeSNguLSko+n+cMWn000QcroPMlFHElw+cagGm9LoGY70mLwXCWzRasvxUWTMDG1/AJHmq9Givy41i/8Rrw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.1-alpha-20230711101034-12496b03_1689070268729_0.9960220330233085","host":"s3://npm-registry-packages"}},"0.24.1-alpha-20230711104647-4f4dd09a":{"name":"@graphql-hive/client","version":"0.24.1-alpha-20230711104647-4f4dd09a","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.1-alpha-20230711104647-4f4dd09a","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"58da5d0f5ef1ae42b7ed9209ad0ca8750a66b850","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.1-alpha-20230711104647-4f4dd09a.tgz","fileCount":64,"integrity":"sha512-r4Q+tUJUj1EqP4FjpgBQEALPYL2e5KPYeFsh3oOWBF1guV9BBXk+xvjv2wODQQI0SArybo69DhaQ/+Jr9A80Zg==","signatures":[{"sig":"MEUCIQDekTcb++xzeTnfa2IGnsmYYODuxCu1W8e1Jvk0W1whtAIgSoI/tf09sNCP3aTT+DoUK6f2NdCmXMZbGDm3Vk1S8Tc=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195680},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.1-alpha-20230711104647-4f4dd09a.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/a46044e11e5b884e6f9942cb0b38d723/graphql-hive-client-0.24.1-alpha-20230711104647-4f4dd09a.tgz","_integrity":"sha512-r4Q+tUJUj1EqP4FjpgBQEALPYL2e5KPYeFsh3oOWBF1guV9BBXk+xvjv2wODQQI0SArybo69DhaQ/+Jr9A80Zg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.1-alpha-20230711104647-4f4dd09a_1689072451404_0.3398555091459696","host":"s3://npm-registry-packages"}},"0.24.1-alpha-20230711105947-90321fe8":{"name":"@graphql-hive/client","version":"0.24.1-alpha-20230711105947-90321fe8","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.1-alpha-20230711105947-90321fe8","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"9ab056a678a2d8ef4e9d8e8db12e31d6e6f5cab8","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.1-alpha-20230711105947-90321fe8.tgz","fileCount":64,"integrity":"sha512-M72v9NRfl6H1FMTmH/L3WsMRvyccCPrnKNt7bCtkf/IzKEsgVIoxStNnO19TL86qfFTRoLacmf8TzbWfxrbmQQ==","signatures":[{"sig":"MEQCIDUGnJUuDJK1Szu37RdjAoz4PcC+jYXZB/P/0hF3wr0iAiBAuSDsIj+fH+Fp0pwAnanTLjAVdy1XKfbLwGxOsNDlUg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195680},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.1-alpha-20230711105947-90321fe8.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/cde5c9af269253f0c0f10493b7252607/graphql-hive-client-0.24.1-alpha-20230711105947-90321fe8.tgz","_integrity":"sha512-M72v9NRfl6H1FMTmH/L3WsMRvyccCPrnKNt7bCtkf/IzKEsgVIoxStNnO19TL86qfFTRoLacmf8TzbWfxrbmQQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.1-alpha-20230711105947-90321fe8_1689073226101_0.8948778294368211","host":"s3://npm-registry-packages"}},"0.24.1-alpha-20230711112657-6eb7b0f9":{"name":"@graphql-hive/client","version":"0.24.1-alpha-20230711112657-6eb7b0f9","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.1-alpha-20230711112657-6eb7b0f9","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"37fb83e984b77629cf607106fd11e995c448ce0a","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.1-alpha-20230711112657-6eb7b0f9.tgz","fileCount":64,"integrity":"sha512-HTqQNSUBTZ5vSwBCTgvo7w1B7BVuXQuMkwauFHINhZpfpr6f85Krv9qxeoHpgRaVe0OnnEkjgxGPGZT2i6WfdQ==","signatures":[{"sig":"MEUCIFvDqWmp36/9xxFedl1wOz+o2ZWc/Sb4LtQYldlNE7LHAiEA/Y42alRWGqcKl9UilFxOzc6JT4St45RGKtkX99lcLtQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195680},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.1-alpha-20230711112657-6eb7b0f9.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/a8c5196443ea3011d0ce66b55a910787/graphql-hive-client-0.24.1-alpha-20230711112657-6eb7b0f9.tgz","_integrity":"sha512-HTqQNSUBTZ5vSwBCTgvo7w1B7BVuXQuMkwauFHINhZpfpr6f85Krv9qxeoHpgRaVe0OnnEkjgxGPGZT2i6WfdQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.1-alpha-20230711112657-6eb7b0f9_1689074862341_0.5678031117475104","host":"s3://npm-registry-packages"}},"0.24.1-alpha-20230711113035-05a0cc2e":{"name":"@graphql-hive/client","version":"0.24.1-alpha-20230711113035-05a0cc2e","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.1-alpha-20230711113035-05a0cc2e","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"03755e4f63f348a8970bb14cabd554924714308a","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.1-alpha-20230711113035-05a0cc2e.tgz","fileCount":64,"integrity":"sha512-yET9XBinqEWhBQ4fbujPlUHV4ltVGOYaamNSEO8QjzHEkq4O3aqkfH+5NGOe4osqkj6nDZipDCgaDtcfG4RYWg==","signatures":[{"sig":"MEUCIQD12KVJiGiRPI2myiYj4pR5bjsNteRrxfnC63COOBrfHwIgd1pA2MZ0QWcbtRdKvgAyQ3leZlJt7kllwFQYjRjDNXY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195680},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.1-alpha-20230711113035-05a0cc2e.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/3e79e8d94aa5b515aacd12ad2fafb7be/graphql-hive-client-0.24.1-alpha-20230711113035-05a0cc2e.tgz","_integrity":"sha512-yET9XBinqEWhBQ4fbujPlUHV4ltVGOYaamNSEO8QjzHEkq4O3aqkfH+5NGOe4osqkj6nDZipDCgaDtcfG4RYWg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.1-alpha-20230711113035-05a0cc2e_1689075076743_0.7972626037798451","host":"s3://npm-registry-packages"}},"0.24.1-alpha-20230711134058-af0ebb8b":{"name":"@graphql-hive/client","version":"0.24.1-alpha-20230711134058-af0ebb8b","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.1-alpha-20230711134058-af0ebb8b","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"bdff64162cb225efb40090818d4e4a1a5c6ab731","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.1-alpha-20230711134058-af0ebb8b.tgz","fileCount":64,"integrity":"sha512-KiGVHToq27agHhvcBWzcMZghbI/b5EtY3qLG8yaHHK/puoJfvcuW6k7AAo9MkiyGztpRVtYkgwXtS8v6El6AEA==","signatures":[{"sig":"MEUCIQCiKjSISDTI2a3NqlvukH7DtAKlFWfFpIJn5tFAjRdIXwIgLsBZc5ZhLlZQn96rl9LRgSIeSdpt9duBMAIXuidqt58=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":196094},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.1-alpha-20230711134058-af0ebb8b.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/57834ebc6640f9a8d278977ddc4e595c/graphql-hive-client-0.24.1-alpha-20230711134058-af0ebb8b.tgz","_integrity":"sha512-KiGVHToq27agHhvcBWzcMZghbI/b5EtY3qLG8yaHHK/puoJfvcuW6k7AAo9MkiyGztpRVtYkgwXtS8v6El6AEA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.1-alpha-20230711134058-af0ebb8b_1689082892053_0.048954130383711325","host":"s3://npm-registry-packages"}},"0.24.1-alpha-20230712073019-1769edb9":{"name":"@graphql-hive/client","version":"0.24.1-alpha-20230712073019-1769edb9","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.1-alpha-20230712073019-1769edb9","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"f7a49a4945ca8c2394d9f81fbaf66f8ae90f44b8","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.1-alpha-20230712073019-1769edb9.tgz","fileCount":64,"integrity":"sha512-rh3u5+OibwgRw8QqTEzPspit/DA72zg2LgpL7kh2dpNy01cGX165yjthrDfR18zIWXOxNprr6d7kXoEVg2Ivvw==","signatures":[{"sig":"MEYCIQCXkDsCm28no7dTuDR942VPK3Ddmm3w8Ij7iyUhg6BCwwIhAOinubTt2pZfv3lI6fFFTrrAbbgcN5LkXdjDeEZgQ6jz","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195680},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.1-alpha-20230712073019-1769edb9.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/539781883c8dc110242ca57226c49ddd/graphql-hive-client-0.24.1-alpha-20230712073019-1769edb9.tgz","_integrity":"sha512-rh3u5+OibwgRw8QqTEzPspit/DA72zg2LgpL7kh2dpNy01cGX165yjthrDfR18zIWXOxNprr6d7kXoEVg2Ivvw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.1-alpha-20230712073019-1769edb9_1689147053406_0.12409537441936602","host":"s3://npm-registry-packages"}},"0.24.1-alpha-20230712074255-11c3c862":{"name":"@graphql-hive/client","version":"0.24.1-alpha-20230712074255-11c3c862","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.1-alpha-20230712074255-11c3c862","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"5d54186fc9f041759c9aada37c531808b67f0862","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.1-alpha-20230712074255-11c3c862.tgz","fileCount":64,"integrity":"sha512-pA8plBeitiPzi2MxCLxaCND3w8QPnKFuL4hM5X4X7LHLR6RfIQsZlzsFciKwtEJiKN4WvhplWddCe3gbtlYk1A==","signatures":[{"sig":"MEUCIQClF0r2PSmjFd1MSMmqs4lgC7nzRWbh8xtSUDitoKZkZwIgDsvl03hqQ225GNXAREQrfTa6qgHmkjUKg/Ixj3cBcLM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195680},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.1-alpha-20230712074255-11c3c862.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/a5519f00267aebcfdcbb0d13204bda34/graphql-hive-client-0.24.1-alpha-20230712074255-11c3c862.tgz","_integrity":"sha512-pA8plBeitiPzi2MxCLxaCND3w8QPnKFuL4hM5X4X7LHLR6RfIQsZlzsFciKwtEJiKN4WvhplWddCe3gbtlYk1A==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.1-alpha-20230712074255-11c3c862_1689147813192_0.605832595934622","host":"s3://npm-registry-packages"}},"0.24.1-alpha-20230712084903-30cc8f9b":{"name":"@graphql-hive/client","version":"0.24.1-alpha-20230712084903-30cc8f9b","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.1-alpha-20230712084903-30cc8f9b","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"a904e38f59984f59bfb445c7ea3dba71999f9b60","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.1-alpha-20230712084903-30cc8f9b.tgz","fileCount":64,"integrity":"sha512-S6o21EbWLq2EDdh7MsSnzmWBKYJxrQKeC9L8dQzdfdCWQpyPTJxi344ppr7wAMg09fz7luSgPQjbA6CDJDzk6Q==","signatures":[{"sig":"MEYCIQC/K8ZdHduIMikO1+GtJjn9hURsHbDBUcJ51zgNz/kF1gIhAPrFBNY96YLCCEgjVvTe7MWDs2FyxfDEWI40Sf6QOIdK","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195680},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.1-alpha-20230712084903-30cc8f9b.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/937a6685c49f31ea5d37c78e325ac01d/graphql-hive-client-0.24.1-alpha-20230712084903-30cc8f9b.tgz","_integrity":"sha512-S6o21EbWLq2EDdh7MsSnzmWBKYJxrQKeC9L8dQzdfdCWQpyPTJxi344ppr7wAMg09fz7luSgPQjbA6CDJDzk6Q==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.1-alpha-20230712084903-30cc8f9b_1689151777816_0.5793457633314985","host":"s3://npm-registry-packages"}},"0.24.1-alpha-20230712092724-cb5c70a7":{"name":"@graphql-hive/client","version":"0.24.1-alpha-20230712092724-cb5c70a7","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.1-alpha-20230712092724-cb5c70a7","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"ca7b7c47b4451451dd05c2c2a2346bf88b31c7bf","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.1-alpha-20230712092724-cb5c70a7.tgz","fileCount":64,"integrity":"sha512-fHVu6omCXCOhp8xXq5mcS9EZngenvVcp4WNWT3MxwZMJYAGPnVLpv0IgyaQ8WRW686whesleBPaIM0eB4kCM2w==","signatures":[{"sig":"MEQCIF8y1gtqE/J5nr4Kqr0Ed124l71U8SiZ8/z/ZovXEVoYAiAySM7eaEGxgbILm7k34syQxpmYmxfe2jvqC8vMSlH/8Q==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195680},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.1-alpha-20230712092724-cb5c70a7.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/9b48f98599302f8017f9cc5999d5a92d/graphql-hive-client-0.24.1-alpha-20230712092724-cb5c70a7.tgz","_integrity":"sha512-fHVu6omCXCOhp8xXq5mcS9EZngenvVcp4WNWT3MxwZMJYAGPnVLpv0IgyaQ8WRW686whesleBPaIM0eB4kCM2w==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.1-alpha-20230712092724-cb5c70a7_1689154080202_0.5257686746794288","host":"s3://npm-registry-packages"}},"0.24.1-alpha-20230712100406-ef15a8a7":{"name":"@graphql-hive/client","version":"0.24.1-alpha-20230712100406-ef15a8a7","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.1-alpha-20230712100406-ef15a8a7","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"9e61c1001943ff5d933b4061dfab628b71336f2b","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.1-alpha-20230712100406-ef15a8a7.tgz","fileCount":64,"integrity":"sha512-v39YdrU7YVn3ytBmBjzodftQQedL/JeMEwORIP2aj2uZHRLWckHRomtKw5tQGf78j/m5zhvyalJ7l4zB1v35WQ==","signatures":[{"sig":"MEQCIH0LCv6vYuCkocfNtTBeM4CdEDTnQ9kx+kCkVuwDs4dZAiB7D4tIb1N1dZ9BsL8n/uVdDyn6NSGKI1WLG87OKmvK/g==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195680},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.1-alpha-20230712100406-ef15a8a7.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/4c851b80d5857cfd3af5c7cce7d6d216/graphql-hive-client-0.24.1-alpha-20230712100406-ef15a8a7.tgz","_integrity":"sha512-v39YdrU7YVn3ytBmBjzodftQQedL/JeMEwORIP2aj2uZHRLWckHRomtKw5tQGf78j/m5zhvyalJ7l4zB1v35WQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.1-alpha-20230712100406-ef15a8a7_1689156281572_0.460450620159762","host":"s3://npm-registry-packages"}},"0.24.1-alpha-20230712112639-afbf9aa0":{"name":"@graphql-hive/client","version":"0.24.1-alpha-20230712112639-afbf9aa0","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.1-alpha-20230712112639-afbf9aa0","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"51dbef093b270b782f4e00700f20197453c2f512","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.1-alpha-20230712112639-afbf9aa0.tgz","fileCount":64,"integrity":"sha512-N4r77zSg558hK76sbepxvsPQoER8nePu8t5w+H5MB7cCDeF7YdsSB2xmCtMPvEwL+wmfqJS92uiC4K8KRm/GKA==","signatures":[{"sig":"MEUCIFPj12xbj9mCNArCfvy+WQS9hCnTFx+bxExKu8CPsJQ7AiEAraULFjMb7TUkf40w7W2+8Zbk5h/WkN4QDD/mXEoKNiU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195680},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.1-alpha-20230712112639-afbf9aa0.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/aaed0e40b09d135d985fd683913aa968/graphql-hive-client-0.24.1-alpha-20230712112639-afbf9aa0.tgz","_integrity":"sha512-N4r77zSg558hK76sbepxvsPQoER8nePu8t5w+H5MB7cCDeF7YdsSB2xmCtMPvEwL+wmfqJS92uiC4K8KRm/GKA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.1-alpha-20230712112639-afbf9aa0_1689161242872_0.10378530751828108","host":"s3://npm-registry-packages"}},"0.24.1-alpha-20230712142835-5ff29214":{"name":"@graphql-hive/client","version":"0.24.1-alpha-20230712142835-5ff29214","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.1-alpha-20230712142835-5ff29214","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"d225746e7a73a5fecdfe6a4d339cae4de91209e3","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.1-alpha-20230712142835-5ff29214.tgz","fileCount":64,"integrity":"sha512-f1v7EIL1XaWaU5va5YEXyZpimmGq+f4MDV5vu0bcyJuRm3j8EUDpoCFnWfD0Y27LjCTmJRH+3LnsoidRs4BJSA==","signatures":[{"sig":"MEYCIQC7umRPlnqztAMW0WLFSJeOio1tLOzHitkyfggfHOkx/AIhAJD0wXbqANiGTvhXKqJq1jVvkkuEkyfiHUcpBujs8o6U","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":196094},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.1-alpha-20230712142835-5ff29214.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/b89e04973cc7256a462c697b55d43805/graphql-hive-client-0.24.1-alpha-20230712142835-5ff29214.tgz","_integrity":"sha512-f1v7EIL1XaWaU5va5YEXyZpimmGq+f4MDV5vu0bcyJuRm3j8EUDpoCFnWfD0Y27LjCTmJRH+3LnsoidRs4BJSA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.1-alpha-20230712142835-5ff29214_1689172157805_0.04330972361595675","host":"s3://npm-registry-packages"}},"0.24.1-alpha-20230712162743-d7089332":{"name":"@graphql-hive/client","version":"0.24.1-alpha-20230712162743-d7089332","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.1-alpha-20230712162743-d7089332","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"c89621b2d1bbe256358049a9b5889799ed7f0b98","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.1-alpha-20230712162743-d7089332.tgz","fileCount":64,"integrity":"sha512-+P/LiEJcOcA6EbucdVM8ekugtGcTFBLfOXKuU91dPDqdw1Coy0hfDnmoZ1/1GIBvFRu/JBKDTVVSEHik6RsIwg==","signatures":[{"sig":"MEQCIFhRz/7a4gqBpSRA7wJM9Rwv5kG0xG38OG4Wbnt+H0TxAiADwAvgNWuZyDno+qOtZW32Ao2OM9qJ4ynXSAZiiTpncA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195680},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.1-alpha-20230712162743-d7089332.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/6ea11469bf40c6dd24eeb0fbfcd39bf9/graphql-hive-client-0.24.1-alpha-20230712162743-d7089332.tgz","_integrity":"sha512-+P/LiEJcOcA6EbucdVM8ekugtGcTFBLfOXKuU91dPDqdw1Coy0hfDnmoZ1/1GIBvFRu/JBKDTVVSEHik6RsIwg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.1-alpha-20230712162743-d7089332_1689179303133_0.780414769705023","host":"s3://npm-registry-packages"}},"0.24.1-alpha-20230712162927-feb591b2":{"name":"@graphql-hive/client","version":"0.24.1-alpha-20230712162927-feb591b2","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.1-alpha-20230712162927-feb591b2","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"e0b9dcf7de340c70b83b2c3d320cab3970c5a9d5","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.1-alpha-20230712162927-feb591b2.tgz","fileCount":64,"integrity":"sha512-y5U/vGIkkVqYO+D5Z/FzgxII6jEj1Mu3sZBye5IGmkxid6fOjESWiVZjaSQeifZjxPAwKLiiJAgiS8jrqY6sWQ==","signatures":[{"sig":"MEQCICLLZ1GNHXhuWG6od6D9i6pdkWkgH2AhoE1HcpA78C+TAiANPj1IyfuQAcJFKAc/0uitPKhdHpIvzm4G9yVn29mlZw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195680},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.1-alpha-20230712162927-feb591b2.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/5041a465086ddd7ceede02685f9e654e/graphql-hive-client-0.24.1-alpha-20230712162927-feb591b2.tgz","_integrity":"sha512-y5U/vGIkkVqYO+D5Z/FzgxII6jEj1Mu3sZBye5IGmkxid6fOjESWiVZjaSQeifZjxPAwKLiiJAgiS8jrqY6sWQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.1-alpha-20230712162927-feb591b2_1689179410039_0.8374630026787908","host":"s3://npm-registry-packages"}},"0.24.1-alpha-20230713044311-a63f2da3":{"name":"@graphql-hive/client","version":"0.24.1-alpha-20230713044311-a63f2da3","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.1-alpha-20230713044311-a63f2da3","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"9df2ff16b35604076717b1360c48ceab9510eb32","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.1-alpha-20230713044311-a63f2da3.tgz","fileCount":64,"integrity":"sha512-p+tWl6zRG+tjq14/r+PmiCNJrJOxrZ9oUlxpimfDrp/G9F7Xss0HQgdxRQCmcxa4ibGtPZdMI6CJM+UBhKe9qg==","signatures":[{"sig":"MEYCIQDMSFvDSIwkELl2ejRPg4E1Ugv6ChlCJpXOIiEvzOK1xgIhAPNAtKVxGz9/KcnGDE7vbII2J538f3mdf4a5UHRe8xjk","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195680},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.1-alpha-20230713044311-a63f2da3.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/5c1b1e19494aec86ba991670756ba3a1/graphql-hive-client-0.24.1-alpha-20230713044311-a63f2da3.tgz","_integrity":"sha512-p+tWl6zRG+tjq14/r+PmiCNJrJOxrZ9oUlxpimfDrp/G9F7Xss0HQgdxRQCmcxa4ibGtPZdMI6CJM+UBhKe9qg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.1-alpha-20230713044311-a63f2da3_1689223427363_0.8847373914254328","host":"s3://npm-registry-packages"}},"0.24.1-alpha-20230713070230-8071969e":{"name":"@graphql-hive/client","version":"0.24.1-alpha-20230713070230-8071969e","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.1-alpha-20230713070230-8071969e","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"570bf4242f3bb7c9ac0ad3add0792aff08b89ef0","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.1-alpha-20230713070230-8071969e.tgz","fileCount":64,"integrity":"sha512-hGrlu0UxWSW+yl5QpWB2J/IP8C7T6FjnbA1StIAHxA6mbV7DQ/1oIWWa8PulqQqrXbEJdNwSsDXUDL3t+D1olg==","signatures":[{"sig":"MEUCIQCdaCB9Q+Xz4e/ZxsA+Xt/M1Cq8Dl/LFLtsteRXTvF22wIgOiZ+bRna7X1l6rj5g7v0LW+UADWY+g6VbVW6nRlUsx4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195680},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.1-alpha-20230713070230-8071969e.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/d7e54c91bc243416c5d8e67d8d5eb2fa/graphql-hive-client-0.24.1-alpha-20230713070230-8071969e.tgz","_integrity":"sha512-hGrlu0UxWSW+yl5QpWB2J/IP8C7T6FjnbA1StIAHxA6mbV7DQ/1oIWWa8PulqQqrXbEJdNwSsDXUDL3t+D1olg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.1-alpha-20230713070230-8071969e_1689231787802_0.2433593324613681","host":"s3://npm-registry-packages"}},"0.24.1-alpha-20230713075451-303565f2":{"name":"@graphql-hive/client","version":"0.24.1-alpha-20230713075451-303565f2","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.1-alpha-20230713075451-303565f2","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"a3cd95e7b30afc2f1901c66c4415ce0ccc974d43","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.1-alpha-20230713075451-303565f2.tgz","fileCount":64,"integrity":"sha512-VvayV3tXnlDGSErOAAMzkk+4P66m8h3mIBbHzcHRJmCzCcKWWVMMrZXcdKcYB4U0901vPM6k7ztZMuD6n0pZsA==","signatures":[{"sig":"MEUCIQDmffcM0iPN4lUM7aBfGhEP/4BDjUQKHvBLRKd7oMMEmQIgFxUrxGfQH1sWqm/MT0SSqaoXO1bOMXj9YKUW9B8fCJ8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195680},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.1-alpha-20230713075451-303565f2.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/af5d2de35837d6b6aace4afa5e92e3b0/graphql-hive-client-0.24.1-alpha-20230713075451-303565f2.tgz","_integrity":"sha512-VvayV3tXnlDGSErOAAMzkk+4P66m8h3mIBbHzcHRJmCzCcKWWVMMrZXcdKcYB4U0901vPM6k7ztZMuD6n0pZsA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.1-alpha-20230713075451-303565f2_1689234932878_0.11278041530863847","host":"s3://npm-registry-packages"}},"0.24.1-alpha-20230713081613-46703519":{"name":"@graphql-hive/client","version":"0.24.1-alpha-20230713081613-46703519","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.1-alpha-20230713081613-46703519","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"a8f21e65a90fc596cd3fb646e518d072e9fc36ca","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.1-alpha-20230713081613-46703519.tgz","fileCount":64,"integrity":"sha512-oq+vX4crgfAl9FcUOqgURn2fi5TNyzR+qvaXDdJMY0Q1KksnRL/C1vC7Nux/WU+Z98SNlb9Pmoyx4TVnCSvB9A==","signatures":[{"sig":"MEYCIQC0Efr9vaTFS2QtrcVoPQqX1R4iHRi3ONOCugBYPIODogIhAN1MabfBQzjKV8/07A/KMhHij6yC4HKe5ODGtUQpQT5m","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":196094},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.1-alpha-20230713081613-46703519.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/462480b563ed6a9f5123fd5a1b237546/graphql-hive-client-0.24.1-alpha-20230713081613-46703519.tgz","_integrity":"sha512-oq+vX4crgfAl9FcUOqgURn2fi5TNyzR+qvaXDdJMY0Q1KksnRL/C1vC7Nux/WU+Z98SNlb9Pmoyx4TVnCSvB9A==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.1-alpha-20230713081613-46703519_1689236209149_0.9756731312109967","host":"s3://npm-registry-packages"}},"0.24.1-alpha-20230713083916-4ece1aac":{"name":"@graphql-hive/client","version":"0.24.1-alpha-20230713083916-4ece1aac","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.1-alpha-20230713083916-4ece1aac","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"d760978b990559370686aec13fae87c774f03c9a","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.1-alpha-20230713083916-4ece1aac.tgz","fileCount":64,"integrity":"sha512-h5sfNeu+SzmuGEmPF25YvNh5e/3ZKefMv6jNJVu5dJmuTuydW+QQJ4J/btRNhq4ITwwkOUL7tJp+GfqblQ40Fg==","signatures":[{"sig":"MEUCIQDX/HAPiU9dJkzMZq7iTYEg6UZOha1QMTn+xIXmnMDGPQIgN04OjkZOAOVA5liGfNaaETGBujCDkMNYnkZb/wdK+SQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":196094},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.1-alpha-20230713083916-4ece1aac.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/384c2a7400a27fdd6492f52ca8823763/graphql-hive-client-0.24.1-alpha-20230713083916-4ece1aac.tgz","_integrity":"sha512-h5sfNeu+SzmuGEmPF25YvNh5e/3ZKefMv6jNJVu5dJmuTuydW+QQJ4J/btRNhq4ITwwkOUL7tJp+GfqblQ40Fg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.1-alpha-20230713083916-4ece1aac_1689237599195_0.8358814160945285","host":"s3://npm-registry-packages"}},"0.24.1-alpha-20230713084133-2079c1fc":{"name":"@graphql-hive/client","version":"0.24.1-alpha-20230713084133-2079c1fc","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.1-alpha-20230713084133-2079c1fc","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"bded6dd113953102a522c804672a8988a039dcfe","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.1-alpha-20230713084133-2079c1fc.tgz","fileCount":64,"integrity":"sha512-MoQ0RzSk8DfopksOllFnh1ISUH8OlJo/EYTRiJKD8DtMZl9ZARMQwXeMy9ht8BMMwIhQEGWV4V0yl5zC97SeBA==","signatures":[{"sig":"MEUCIQCjzwutj0dHk3ETEkmwElslGvSgawhMwllDeiG4Y81GMAIgJA1n89IGoTy8XiEK3ER5G1LlyaRS+6TOeG5pszjowKo=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195680},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.1-alpha-20230713084133-2079c1fc.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/d322bab1e9b0040aecca57d7703f4c31/graphql-hive-client-0.24.1-alpha-20230713084133-2079c1fc.tgz","_integrity":"sha512-MoQ0RzSk8DfopksOllFnh1ISUH8OlJo/EYTRiJKD8DtMZl9ZARMQwXeMy9ht8BMMwIhQEGWV4V0yl5zC97SeBA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.1-alpha-20230713084133-2079c1fc_1689237731470_0.19405304510822474","host":"s3://npm-registry-packages"}},"0.24.1-alpha-20230713090241-f2096f53":{"name":"@graphql-hive/client","version":"0.24.1-alpha-20230713090241-f2096f53","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.1-alpha-20230713090241-f2096f53","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"dced44908a000c9c1b899cba1e62cb5c51c097c9","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.1-alpha-20230713090241-f2096f53.tgz","fileCount":64,"integrity":"sha512-pczOWOffIa/s+yZAUDuYcBO1EDLQrAOV8qd4tWFxCF3OSzMyS16KqRGCJ6QO7tDUAypu48Uj5CM3enwrgUUeeg==","signatures":[{"sig":"MEQCIDqektjPdJSEmCcMUDNxipoQY/jGLZ5kw50rS/NEjyVfAiB+ge7npRU3YmfMPiY7dIOOL8JGkILsWXu8eMKwP/i0Ag==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":196094},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.1-alpha-20230713090241-f2096f53.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/c4e1fdcecd9871bd8279f2f89f879552/graphql-hive-client-0.24.1-alpha-20230713090241-f2096f53.tgz","_integrity":"sha512-pczOWOffIa/s+yZAUDuYcBO1EDLQrAOV8qd4tWFxCF3OSzMyS16KqRGCJ6QO7tDUAypu48Uj5CM3enwrgUUeeg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.1-alpha-20230713090241-f2096f53_1689238995310_0.2020792943534926","host":"s3://npm-registry-packages"}},"0.24.1":{"name":"@graphql-hive/client","version":"0.24.1","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.1","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"2de125d03eb154a922e3cd2143f3d96fec9afda2","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.1.tgz","fileCount":64,"integrity":"sha512-eXbe1KuddoSeJj8CGeUDw0bNGwCKC72iSXhRiLCXR/fR7KZXYzIBLXCQy66TBdMIPxrE51ZO0K+EHwk5kbJ/6w==","signatures":[{"sig":"MEUCIQDc5yZDFMPSPzuyUQekCBjKOoAhHbwYNYutjlQ+uEoqmwIgHW1YGiuQuZqe3Q9qebqPtA7ufV0nYnJL+P+f/KPTLHM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":195530},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.1.tgz","module":"esm/index.js","exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/1eb2496a4601a3a3f151a49a6615e6dc/graphql-hive-client-0.24.1.tgz","_integrity":"sha512-eXbe1KuddoSeJj8CGeUDw0bNGwCKC72iSXhRiLCXR/fR7KZXYzIBLXCQy66TBdMIPxrE51ZO0K+EHwk5kbJ/6w==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.5.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.16.1","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.1_1689240221617_0.16858257299907464","host":"s3://npm-registry-packages"}},"0.24.2-alpha-20230928151650-fb1f0fa0":{"name":"@graphql-hive/client","version":"0.24.2-alpha-20230928151650-fb1f0fa0","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.2-alpha-20230928151650-fb1f0fa0","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"bebeeff9579e15978ed4e0e966e3d7d4d3cc1c1d","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.2-alpha-20230928151650-fb1f0fa0.tgz","fileCount":64,"integrity":"sha512-hOdbhAtMJ21muVLImtumB6G/MOm7e4PpIpCXGdELzxmjCtbivcEy0pLVvpaiBFNczj4VQY87LbuKK8dEc9y3YQ==","signatures":[{"sig":"MEQCID+8ViwqGsIptn8oUzu4DnSC6b7iqvhoWCIAtBZWYLNIAiB8sHg5orRK1VlFFLD5giEgi1Il8Y3wf9V32lVUnvdUtA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":201511},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.2-alpha-20230928151650-fb1f0fa0.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/30b3e316a37509dd21102ca45b53b253/graphql-hive-client-0.24.2-alpha-20230928151650-fb1f0fa0.tgz","_integrity":"sha512-hOdbhAtMJ21muVLImtumB6G/MOm7e4PpIpCXGdELzxmjCtbivcEy0pLVvpaiBFNczj4VQY87LbuKK8dEc9y3YQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.8.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.18.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.2-alpha-20230928151650-fb1f0fa0_1695914256135_0.6013762201287782","host":"s3://npm-registry-packages"}},"0.24.2-rc-20230929103826-eee4d536":{"name":"@graphql-hive/client","version":"0.24.2-rc-20230929103826-eee4d536","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.2-rc-20230929103826-eee4d536","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"a71e7260972280fec6217a577e4e467dc2fac513","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.2-rc-20230929103826-eee4d536.tgz","fileCount":64,"integrity":"sha512-bYD28XazijH5zvQS6UhBM4kPncZWFEwuZUWwmTj3tKICj6Z28AXvXM2hbkuSCE9kDk4AboXjMVtN9azZJY7dfQ==","signatures":[{"sig":"MEYCIQDW5DsinFRDZ0F2laOcFWfk+SJZk28J+cNVb3zAY+GrsgIhAPjhZKMT86ZCixfl0oaYFj8BAyjcvbgwVtN1vSkynanI","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":201496},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.2-rc-20230929103826-eee4d536.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/bd9e61a7d85dce19146e3e4a9813ed35/graphql-hive-client-0.24.2-rc-20230929103826-eee4d536.tgz","_integrity":"sha512-bYD28XazijH5zvQS6UhBM4kPncZWFEwuZUWwmTj3tKICj6Z28AXvXM2hbkuSCE9kDk4AboXjMVtN9azZJY7dfQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.8.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.18.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.2-rc-20230929103826-eee4d536_1695983946279_0.9959461963771328","host":"s3://npm-registry-packages"}},"0.24.2":{"name":"@graphql-hive/client","version":"0.24.2","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.2","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"c10c7543eba0b49736c2ece889340ad725b84d64","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.2.tgz","fileCount":64,"integrity":"sha512-jmb1JasT+zLBuS3MUV6cOjIfhPQuxKr+MTSyhXskJ1uTZ1PAVBVtYEnQxl+WDMSs9Bqv+ymhvhdGZMoFg0pHdA==","signatures":[{"sig":"MEUCIE/ROtTxKfKSFPVyukkiFDG/uaL8ZH7W+LIOQIDlGm+aAiEAoIRUYkHjyH3AQGPEjvX3TkirylPC4nQ2Q6wkKG2FV/0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":201361},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.2.tgz","module":"esm/index.js","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/a044c104ac20b5d4ac15fb89d79440a0/graphql-hive-client-0.24.2.tgz","_integrity":"sha512-jmb1JasT+zLBuS3MUV6cOjIfhPQuxKr+MTSyhXskJ1uTZ1PAVBVtYEnQxl+WDMSs9Bqv+ymhvhdGZMoFg0pHdA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.8.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.18.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.2_1695984066108_0.9817077589643468","host":"s3://npm-registry-packages"}},"0.24.3-alpha-20231005081633-eea71f5f":{"name":"@graphql-hive/client","version":"0.24.3-alpha-20231005081633-eea71f5f","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.3-alpha-20231005081633-eea71f5f","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"c57bba4291b4cd69e516cf0edb12223ed0baffbf","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.3-alpha-20231005081633-eea71f5f.tgz","fileCount":64,"integrity":"sha512-9aqZw+o1558SpKGaIKHTjQ2Nnewvv0PfYLcyv9rDt9fAEXfMOy+pM75gJjIFJZc9XIaYojTrIzHxhUR3UNni9Q==","signatures":[{"sig":"MEUCIQDeAyCoA7j+EwV4rnCN++3JYHFAByvKfojEzn1Zobq5SQIgP/g8u7w35LDWqTqDazOVVS1S5o0N+fbZbglD5NhPPEk=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":202379},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.3-alpha-20231005081633-eea71f5f.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/d5d995e340b3498071465f61c5b8c90e/graphql-hive-client-0.24.3-alpha-20231005081633-eea71f5f.tgz","_integrity":"sha512-9aqZw+o1558SpKGaIKHTjQ2Nnewvv0PfYLcyv9rDt9fAEXfMOy+pM75gJjIFJZc9XIaYojTrIzHxhUR3UNni9Q==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.1.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"20.8.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.3-alpha-20231005081633-eea71f5f_1696493840933_0.4073273411932734","host":"s3://npm-registry-packages"}},"0.24.3-alpha-20231005085447-ceb7a201":{"name":"@graphql-hive/client","version":"0.24.3-alpha-20231005085447-ceb7a201","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.3-alpha-20231005085447-ceb7a201","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"d3303b85114184bfff7fc575f41ea9f7a6113035","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.3-alpha-20231005085447-ceb7a201.tgz","fileCount":64,"integrity":"sha512-hezOqSbkfYrC8c8s4guc7EmQxg//nEyXIqj/DejXsfVZfrrDw2suwm99BccsNstXQgLBuJ6nn311ZIdxt9OeWQ==","signatures":[{"sig":"MEYCIQDJP55+YqkpoUehCDGfY6u41fPyz6wpWEyXoYouHV4R/wIhANF8pMjxB+zBnn8cWIt58M3W3+u1zqT/OUK2DbYsU6rK","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":206627},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.3-alpha-20231005085447-ceb7a201.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/730d9be0b4ea17e9c46f0992f1fcec06/graphql-hive-client-0.24.3-alpha-20231005085447-ceb7a201.tgz","_integrity":"sha512-hezOqSbkfYrC8c8s4guc7EmQxg//nEyXIqj/DejXsfVZfrrDw2suwm99BccsNstXQgLBuJ6nn311ZIdxt9OeWQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.1.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"20.8.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.3-alpha-20231005085447-ceb7a201_1696496144499_0.9130912716324626","host":"s3://npm-registry-packages"}},"0.24.3-alpha-20231009144310-9d666f54":{"name":"@graphql-hive/client","version":"0.24.3-alpha-20231009144310-9d666f54","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.3-alpha-20231009144310-9d666f54","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"8a806069ed82ef484b906b60649dfc8a8d3796b3","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.3-alpha-20231009144310-9d666f54.tgz","fileCount":64,"integrity":"sha512-GjoK9RipQpz5pZreQJKzdlbxl9M63ClEaqF8LR6loJmLiDkSPKTunRtkoO4aJ27ecgmfZKFN69uzAAvFAstHuQ==","signatures":[{"sig":"MEUCIDf7VALg4ELmlvH0/G92l8rXl3fmPwbqP3PHffb53RKkAiEA0n0g8bCoDDmrRzr1RVdNSKYLAE8y4XkIIyELRkYeT4M=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":206283},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.3-alpha-20231009144310-9d666f54.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/db1479061f4aba2e5d1222e79121e044/graphql-hive-client-0.24.3-alpha-20231009144310-9d666f54.tgz","_integrity":"sha512-GjoK9RipQpz5pZreQJKzdlbxl9M63ClEaqF8LR6loJmLiDkSPKTunRtkoO4aJ27ecgmfZKFN69uzAAvFAstHuQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.1.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"20.8.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.3-alpha-20231009144310-9d666f54_1696862629623_0.35284156983938453","host":"s3://npm-registry-packages"}},"0.24.3-alpha-20231010091547-53c041d7":{"name":"@graphql-hive/client","version":"0.24.3-alpha-20231010091547-53c041d7","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.3-alpha-20231010091547-53c041d7","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"9589f394cd5589c8160d97c6c62d4e87fd3848af","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.3-alpha-20231010091547-53c041d7.tgz","fileCount":64,"integrity":"sha512-HFfgq08EJt/FsA5ycf84f0S48CxEMDKWqduC2gABBSauK7GmlYof/xz5n9/bu44FzeBryTTU+0XrqW702wi+Eg==","signatures":[{"sig":"MEUCIAY35ZLtfyhU5jbpX/mWIxEQwZ6ER4IfAkxL+6S1FrW5AiEA8qX5BWJHtKk3L0J2+tFNxShF2HCIG+nLwF7j7vJ1n4M=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":207751},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.3-alpha-20231010091547-53c041d7.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/165d54ae393f8cc09cd19a6d6376185c/graphql-hive-client-0.24.3-alpha-20231010091547-53c041d7.tgz","_integrity":"sha512-HFfgq08EJt/FsA5ycf84f0S48CxEMDKWqduC2gABBSauK7GmlYof/xz5n9/bu44FzeBryTTU+0XrqW702wi+Eg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.1.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"20.8.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.3-alpha-20231010091547-53c041d7_1696929397672_0.9123306879818915","host":"s3://npm-registry-packages"}},"0.24.3-rc-20231010121508-12c166eb":{"name":"@graphql-hive/client","version":"0.24.3-rc-20231010121508-12c166eb","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.3-rc-20231010121508-12c166eb","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"c4ffe8f1fd26b63090726c15e7a19969be30834f","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.3-rc-20231010121508-12c166eb.tgz","fileCount":64,"integrity":"sha512-ea9cpOagHJPdQb+3YeTiGKG16I7lLX4kV9Zm6ExCR2cXue2xj9CeHAXP0AAz4Q8GSS/+9BuF6mF/l2UhEgVXhw==","signatures":[{"sig":"MEUCIH1X684T8QdxWkBdtVNmYcYvwvmsbxoF+nK1aENky1AIAiEA32rwoBpENyiGUF8NBcZ+Cg2NimasXWE+A+HL3Is2dbI=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":207736},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.3-rc-20231010121508-12c166eb.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/3e5f40bac4f642fdc34f14c8e3a74d30/graphql-hive-client-0.24.3-rc-20231010121508-12c166eb.tgz","_integrity":"sha512-ea9cpOagHJPdQb+3YeTiGKG16I7lLX4kV9Zm6ExCR2cXue2xj9CeHAXP0AAz4Q8GSS/+9BuF6mF/l2UhEgVXhw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.8.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.18.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.3-rc-20231010121508-12c166eb_1696940147442_0.48426649279264855","host":"s3://npm-registry-packages"}},"0.24.3-alpha-20231010121806-9d441a83":{"name":"@graphql-hive/client","version":"0.24.3-alpha-20231010121806-9d441a83","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.3-alpha-20231010121806-9d441a83","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"a49dc3b5bb82abacf12527299d5571d271fa5dc7","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.3-alpha-20231010121806-9d441a83.tgz","fileCount":64,"integrity":"sha512-wLVBKBSdv0i39PVWxEcBGhjJpP3A6/ygv4jAG8kA752aYKhMdoPW4a08VcSDB4ctIFPBeD1f7jjCbw8PtheoVg==","signatures":[{"sig":"MEQCIAfc14FJw5SIY3mNSxlIh2m6sWfwDU6fNWjM3E+60QOjAiBzBf3SZd0unWkPJkmkiVvQ+NS+BJrHXS6yLMopYtujCw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":210993},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.3-alpha-20231010121806-9d441a83.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/1adfe3d1498bfdc94664cca4c279596f/graphql-hive-client-0.24.3-alpha-20231010121806-9d441a83.tgz","_integrity":"sha512-wLVBKBSdv0i39PVWxEcBGhjJpP3A6/ygv4jAG8kA752aYKhMdoPW4a08VcSDB4ctIFPBeD1f7jjCbw8PtheoVg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.8.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.18.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.3-alpha-20231010121806-9d441a83_1696940334579_0.43960760868999205","host":"s3://npm-registry-packages"}},"0.24.3-alpha-20231010121826-5e714d9a":{"name":"@graphql-hive/client","version":"0.24.3-alpha-20231010121826-5e714d9a","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.3-alpha-20231010121826-5e714d9a","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"dd2308d84a40ed384a50fbb5c824334706e24d3a","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.3-alpha-20231010121826-5e714d9a.tgz","fileCount":64,"integrity":"sha512-2QcPqXcjO8Q2RVPnfQQXRJwYdIBMJv0Ty0a2EeaR1qTiyt9SIpTYy3CdG7EeOeyhzwbZjgPOcBB+QvZ540HzTw==","signatures":[{"sig":"MEYCIQCo0y618XAd1pfqkjQM3IIBCUssRh++SruyOnc61/+4mQIhAJB7Nh587asRow/qUM7sHiwhCuDGGgHAhJva3Xc/mBSs","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":207751},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.3-alpha-20231010121826-5e714d9a.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/5bae9512cef243165ebddacd9aedb1e8/graphql-hive-client-0.24.3-alpha-20231010121826-5e714d9a.tgz","_integrity":"sha512-2QcPqXcjO8Q2RVPnfQQXRJwYdIBMJv0Ty0a2EeaR1qTiyt9SIpTYy3CdG7EeOeyhzwbZjgPOcBB+QvZ540HzTw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.8.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.18.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.3-alpha-20231010121826-5e714d9a_1696940344597_0.4985547104422703","host":"s3://npm-registry-packages"}},"0.24.3-rc-20231010123313-9a886f3f":{"name":"@graphql-hive/client","version":"0.24.3-rc-20231010123313-9a886f3f","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.3-rc-20231010123313-9a886f3f","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"970f9f6f586987020ae649716e5167aca6e5e9fa","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.3-rc-20231010123313-9a886f3f.tgz","fileCount":64,"integrity":"sha512-a3+jzzF60fGSapCHaeKWlGa/N75ftdXqmITk4VtuR446spWbjcFQqejdkyYhT/mZGe7DF/RTXPRHglnHNhCPog==","signatures":[{"sig":"MEYCIQDn3vOhW2zNYN8LbXWBoEO/n3O0KUUOxcHUMhBu8wrjpQIhAIl9gfT749b08uPApMbshrTQyiniYk90K1w2taD3yU22","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":207736},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.3-rc-20231010123313-9a886f3f.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/a0beb533d7bc90359e4ca757655b331b/graphql-hive-client-0.24.3-rc-20231010123313-9a886f3f.tgz","_integrity":"sha512-a3+jzzF60fGSapCHaeKWlGa/N75ftdXqmITk4VtuR446spWbjcFQqejdkyYhT/mZGe7DF/RTXPRHglnHNhCPog==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.8.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.18.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.3-rc-20231010123313-9a886f3f_1696941232227_0.47105537378906326","host":"s3://npm-registry-packages"}},"0.24.3-rc-20231010125614-556d3e1a":{"name":"@graphql-hive/client","version":"0.24.3-rc-20231010125614-556d3e1a","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.3-rc-20231010125614-556d3e1a","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"a9c07f9497c3883bff6ba6d61f1fdd3fd892b7b0","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.3-rc-20231010125614-556d3e1a.tgz","fileCount":64,"integrity":"sha512-Kl1NliuIjMsFQsR8SqVQ6M9ntYi/qlE54JFR08Xw3gps2pzZ5VtBZmH7iado/iLPKCA9cHKRfDuTVyRcYUt3rg==","signatures":[{"sig":"MEUCIC2YGP+60h5OzSSVVOhfh+xzS4uOu4STaZgFH/IEnnQ8AiEA29F1S03iqJXhDqi01n6l2ztxHdIH9tK+zAV0XABfMNE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":210978},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.3-rc-20231010125614-556d3e1a.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/530bb1e39b2e2cebb4d6bcb9c132d2b0/graphql-hive-client-0.24.3-rc-20231010125614-556d3e1a.tgz","_integrity":"sha512-Kl1NliuIjMsFQsR8SqVQ6M9ntYi/qlE54JFR08Xw3gps2pzZ5VtBZmH7iado/iLPKCA9cHKRfDuTVyRcYUt3rg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.8.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.18.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.3-rc-20231010125614-556d3e1a_1696942619603_0.48997105124121365","host":"s3://npm-registry-packages"}},"0.24.3":{"name":"@graphql-hive/client","version":"0.24.3","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.3","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"ec520aca97ff1fee0c6cbbd366736d103056d4b2","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.3.tgz","fileCount":64,"integrity":"sha512-xBhnQXdSdvBSaRrlS/NYBdCrHMG+rzwlXeKgcblffem8jSWse5bo4ufmZH3e5PySg/vx2arkWiLR2uDpE+dB6w==","signatures":[{"sig":"MEYCIQD0FbMrmwrM65ajY2RwolkpyFtqHOm+9lm78GqHGRJjygIhAP5u2H/ibOH9llGsaXNl6VWAAW+ReAcs3ucCCEJnHuo/","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":210843},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.3.tgz","module":"esm/index.js","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/b5821959d563fb9e1a893aa639515eab/graphql-hive-client-0.24.3.tgz","_integrity":"sha512-xBhnQXdSdvBSaRrlS/NYBdCrHMG+rzwlXeKgcblffem8jSWse5bo4ufmZH3e5PySg/vx2arkWiLR2uDpE+dB6w==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.8.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.18.0","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.3_1696943707307_0.7333908842016543","host":"s3://npm-registry-packages"}},"0.25.0-alpha-20231030120701-9c1b15e5":{"name":"@graphql-hive/client","version":"0.25.0-alpha-20231030120701-9c1b15e5","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.25.0-alpha-20231030120701-9c1b15e5","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"5492a277129e764e00eae90497fb1e29705c14df","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.25.0-alpha-20231030120701-9c1b15e5.tgz","fileCount":60,"integrity":"sha512-k3mXtot5mP4ATvll1+abSmIBGvef3Yd7mLgKNfKf3c+sPkGpD196VplUPr2fIymiBX13azaCeEGSseEnH3fQ+g==","signatures":[{"sig":"MEQCIGyM9x0O8ekGOoraZKKQTn9AgljhN+E7kAVxZG2GLp79AiAM5ZChj/ZbSKUkQ2Lq7x/+Az2gZ30GVb4pBShcvzEVXQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":203898},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.25.0-alpha-20231030120701-9c1b15e5.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/b6e439746efe9b47a0d680c4b93688e3/graphql-hive-client-0.25.0-alpha-20231030120701-9c1b15e5.tgz","_integrity":"sha512-k3mXtot5mP4ATvll1+abSmIBGvef3Yd7mLgKNfKf3c+sPkGpD196VplUPr2fIymiBX13azaCeEGSseEnH3fQ+g==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.8.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.18.2","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.25.0-alpha-20231030120701-9c1b15e5_1698667662278_0.3074603469836825","host":"s3://npm-registry-packages"}},"0.25.0-alpha-20231030121725-1219bb28":{"name":"@graphql-hive/client","version":"0.25.0-alpha-20231030121725-1219bb28","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.25.0-alpha-20231030121725-1219bb28","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"58b6e6b19444df070895291d945e3e53b2691fb1","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.25.0-alpha-20231030121725-1219bb28.tgz","fileCount":60,"integrity":"sha512-aLWFDsp2yPoSQPPvzlnCSna5SqlA6cBq64GWW/Lq5iJRUf5hx1lOitSm9N7mr+k+OuU3nNBZ7jFVJh75BjzBxA==","signatures":[{"sig":"MEYCIQDvOjUL77n4EVgNfQsecalUi1Mqvsb7YPYsCu5KaRlipgIhAOtTTI/gXJ1g4bTTGvg0ah92Y9A85z4dfE/dmECxmGDT","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":203898},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.25.0-alpha-20231030121725-1219bb28.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/21c07bd369a67cdb1a1590d0d80d1e4d/graphql-hive-client-0.25.0-alpha-20231030121725-1219bb28.tgz","_integrity":"sha512-aLWFDsp2yPoSQPPvzlnCSna5SqlA6cBq64GWW/Lq5iJRUf5hx1lOitSm9N7mr+k+OuU3nNBZ7jFVJh75BjzBxA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.8.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.18.2","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.25.0-alpha-20231030121725-1219bb28_1698668283838_0.38453049163438613","host":"s3://npm-registry-packages"}},"0.24.4-alpha-20231030122518-f1c4ba5e":{"name":"@graphql-hive/client","version":"0.24.4-alpha-20231030122518-f1c4ba5e","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.24.4-alpha-20231030122518-f1c4ba5e","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"919fc760bfac72a2f0b8a05a2d72724bc0d85c0d","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.24.4-alpha-20231030122518-f1c4ba5e.tgz","fileCount":64,"integrity":"sha512-yGLUB5SMjz5peUrULK24ki/juqFZWnrg2ita1dMl4zrneAi+5zUDBPMrxqMnR3Hc1fwFjHSfQVzdk+HoDFyyLA==","signatures":[{"sig":"MEUCIQCG0Qih/bGdKpOf0+ppHDIfO3V4sgnNUT2QLzgnK2YiAwIgSt/FE8qBwLM+VIm61+Jhs0jW+UyDNybx8TFnhpJXivI=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":210993},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.24.4-alpha-20231030122518-f1c4ba5e.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/01bfa743264dae73c8a34c6587950620/graphql-hive-client-0.24.4-alpha-20231030122518-f1c4ba5e.tgz","_integrity":"sha512-yGLUB5SMjz5peUrULK24ki/juqFZWnrg2ita1dMl4zrneAi+5zUDBPMrxqMnR3Hc1fwFjHSfQVzdk+HoDFyyLA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.8.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.18.2","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.24.4-alpha-20231030122518-f1c4ba5e_1698668756288_0.12677637211201787","host":"s3://npm-registry-packages"}},"0.25.0-alpha-20231030150901-aa84edf4":{"name":"@graphql-hive/client","version":"0.25.0-alpha-20231030150901-aa84edf4","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.25.0-alpha-20231030150901-aa84edf4","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"0c0b9e1b2e484d93a4631712710ab4034e84afd7","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.25.0-alpha-20231030150901-aa84edf4.tgz","fileCount":60,"integrity":"sha512-bKjfrCxYOaqZibHBSCYtU+AJGHFJ6Y2n1nmXcicHZcoDcBHs3nw7jwc9FD43Uat+i4/qyO7odH1UKOBYvIwP9A==","signatures":[{"sig":"MEYCIQDKjrVvn0PrJFiSkjoyF7PyUHKMuWFS2v8NPydcFphevAIhANvWE2ivMnQMgnrgcuBhHKuNZ5eUOUK07HArQ7Odn4Ee","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":203731},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.25.0-alpha-20231030150901-aa84edf4.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/c514a3e32fa1fe1d462258be7996ccaa/graphql-hive-client-0.25.0-alpha-20231030150901-aa84edf4.tgz","_integrity":"sha512-bKjfrCxYOaqZibHBSCYtU+AJGHFJ6Y2n1nmXcicHZcoDcBHs3nw7jwc9FD43Uat+i4/qyO7odH1UKOBYvIwP9A==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.8.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.18.2","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.25.0-alpha-20231030150901-aa84edf4_1698678588573_0.6625005690624148","host":"s3://npm-registry-packages"}},"0.25.0-alpha-20231030152508-4b39d815":{"name":"@graphql-hive/client","version":"0.25.0-alpha-20231030152508-4b39d815","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.25.0-alpha-20231030152508-4b39d815","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"a354d94340dd1f10d6516b8390e4d67b3c763342","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.25.0-alpha-20231030152508-4b39d815.tgz","fileCount":60,"integrity":"sha512-cmuLp/uVpSSGZ1xVp7XC/shpxvchXuhf9p9aUyyraDvgftOH9D10+vQSmPm9beJQI1caL4rmoO3FWTGigS9rmg==","signatures":[{"sig":"MEUCIB5xmvZyJMum32Ndf6Ll+Kf186BXNbgTkiZcePj+AYg2AiEA4n/YVAS2GSzXA3ENbcPbOtQRgx+o9vxHSC8QM5whf/M=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":203731},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.25.0-alpha-20231030152508-4b39d815.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/8d597a6c860ca0190edc10664e4aae37/graphql-hive-client-0.25.0-alpha-20231030152508-4b39d815.tgz","_integrity":"sha512-cmuLp/uVpSSGZ1xVp7XC/shpxvchXuhf9p9aUyyraDvgftOH9D10+vQSmPm9beJQI1caL4rmoO3FWTGigS9rmg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.8.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.18.2","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.25.0-alpha-20231030152508-4b39d815_1698679554128_0.06714096941806491","host":"s3://npm-registry-packages"}},"0.25.0-rc-20231031072840-bacaf744":{"name":"@graphql-hive/client","version":"0.25.0-rc-20231031072840-bacaf744","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.25.0-rc-20231031072840-bacaf744","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"0b5e6078e292d6f2e0908e990bed5e395c343c4a","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.25.0-rc-20231031072840-bacaf744.tgz","fileCount":60,"integrity":"sha512-x1aZpV72I9MHOE5/MYW+MYKGK/ZSb5IgOKj3dFXUvAi8od/50hiPC+GCcPYA1J6Bor73BF4XelndtQMA/U/obQ==","signatures":[{"sig":"MEYCIQDMJKV1Fca2MFAjg9hDWqJFZcv9pLLVJKDcy5OTbCPpvQIhAI0jngvKTDjrfKRCQTYhO67jjtRP6Yr9/oH36pmXidXz","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":203716},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.25.0-rc-20231031072840-bacaf744.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/1aa8dc189d605966a8c6aa90dd7d78d3/graphql-hive-client-0.25.0-rc-20231031072840-bacaf744.tgz","_integrity":"sha512-x1aZpV72I9MHOE5/MYW+MYKGK/ZSb5IgOKj3dFXUvAi8od/50hiPC+GCcPYA1J6Bor73BF4XelndtQMA/U/obQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.8.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.18.2","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.25.0-rc-20231031072840-bacaf744_1698737358398_0.2877600783191021","host":"s3://npm-registry-packages"}},"0.25.0-alpha-20231031073158-9b3eacf8":{"name":"@graphql-hive/client","version":"0.25.0-alpha-20231031073158-9b3eacf8","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.25.0-alpha-20231031073158-9b3eacf8","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"ceea60dadfd7e432b223581a2fc9cc031328e8d7","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.25.0-alpha-20231031073158-9b3eacf8.tgz","fileCount":60,"integrity":"sha512-AOFLMCP/Tnd+A58AkYRyOEz4TkcQaB9CSZPZEVziACvJ/IhUhw/bNYw2B7+yZg8ANoUD0DiR6ibx7FhjeP9R8g==","signatures":[{"sig":"MEYCIQDbX0k48LMuNEtwJ90+XrIRuUdVEWdTldLB9v0OhQxdeQIhAM1imvzUIHiXK28dFr4Gx51n9CSeOGqhTxvrf4f2pH38","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":203898},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.25.0-alpha-20231031073158-9b3eacf8.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/df964af662a8ae9d6482815317d224fc/graphql-hive-client-0.25.0-alpha-20231031073158-9b3eacf8.tgz","_integrity":"sha512-AOFLMCP/Tnd+A58AkYRyOEz4TkcQaB9CSZPZEVziACvJ/IhUhw/bNYw2B7+yZg8ANoUD0DiR6ibx7FhjeP9R8g==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.8.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.18.2","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^4.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.25.0-alpha-20231031073158-9b3eacf8_1698737559661_0.8705696146066679","host":"s3://npm-registry-packages"}},"0.25.0-rc-20231031074406-e186f404":{"name":"@graphql-hive/client","version":"0.25.0-rc-20231031074406-e186f404","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.25.0-rc-20231031074406-e186f404","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"916a35f40753cd6cce2f3d0d654e65e2474c7db7","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.25.0-rc-20231031074406-e186f404.tgz","fileCount":60,"integrity":"sha512-yFQTYGTrstBOehrIsWiXUdIgfVTyQIoEjJ0LXGIZ4uD6Fyrpa4F1L8z1bGEuJ1EowQxY2h0trh6ygolTAfmqbw==","signatures":[{"sig":"MEYCIQDZ+3eiJIpwnlw6KXzEQ2782ZqFmt3DGf0MM8XxTrqFcwIhALePWzzEhM+ASzTi1ru6u8NBKAXurMM8ZUr1v1TYiEeJ","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":203716},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.25.0-rc-20231031074406-e186f404.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/84cf503f68b39f3c23a76a29e6072c4c/graphql-hive-client-0.25.0-rc-20231031074406-e186f404.tgz","_integrity":"sha512-yFQTYGTrstBOehrIsWiXUdIgfVTyQIoEjJ0LXGIZ4uD6Fyrpa4F1L8z1bGEuJ1EowQxY2h0trh6ygolTAfmqbw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.8.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.18.2","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.25.0-rc-20231031074406-e186f404_1698738286056_0.7784033290526471","host":"s3://npm-registry-packages"}},"0.25.0-alpha-20231031074450-9dfb6f4e":{"name":"@graphql-hive/client","version":"0.25.0-alpha-20231031074450-9dfb6f4e","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.25.0-alpha-20231031074450-9dfb6f4e","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"7df1262610cc8548b9de3f8f9bb30a22cc793b5a","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.25.0-alpha-20231031074450-9dfb6f4e.tgz","fileCount":60,"integrity":"sha512-ZOaAPqg+4AXOht9gneaFjFfqtsYEvo01Z8jZ1vBiERfN2xixSfWVQAiOeWc8WyL0sKEa4jlzO/m4edJF16Z5og==","signatures":[{"sig":"MEQCIAIg9SQoePRRCoj7WRGte/hEV+vJZDj/ap6xgQWr68DEAiA+Jr8g/m4TkgeqJx/QVTzIn/FHaXqfo38tCP0CUDq7uw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":203731},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.25.0-alpha-20231031074450-9dfb6f4e.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/66fc3384bd3dff6679dd2cb2ffe6373b/graphql-hive-client-0.25.0-alpha-20231031074450-9dfb6f4e.tgz","_integrity":"sha512-ZOaAPqg+4AXOht9gneaFjFfqtsYEvo01Z8jZ1vBiERfN2xixSfWVQAiOeWc8WyL0sKEa4jlzO/m4edJF16Z5og==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.8.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.18.2","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.25.0-alpha-20231031074450-9dfb6f4e_1698738344296_0.9224970240759045","host":"s3://npm-registry-packages"}},"0.25.0-alpha-20231031074555-ac409d78":{"name":"@graphql-hive/client","version":"0.25.0-alpha-20231031074555-ac409d78","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.25.0-alpha-20231031074555-ac409d78","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"62a6baccca211bccb34c46f7b0120b37dd661433","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.25.0-alpha-20231031074555-ac409d78.tgz","fileCount":60,"integrity":"sha512-3zienZKny+9Wqv2UUGwZ5ZwYxvaQhwwXLl0alpxKojFxqwd0Ojfadem7hUaMesnkgy2go6vysUbmq7HrFLjo4Q==","signatures":[{"sig":"MEYCIQDRTNcBE9GOkDP7j2YjEGk5uexUgF1gurc6beV3lpLhGwIhAN+wZjQ1Rb4Jb1SfhXX2ILArBfOkvd3Fr0zZLuEh9RHM","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":203731},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.25.0-alpha-20231031074555-ac409d78.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/ffb3d3f583238ddd91ace87bee665828/graphql-hive-client-0.25.0-alpha-20231031074555-ac409d78.tgz","_integrity":"sha512-3zienZKny+9Wqv2UUGwZ5ZwYxvaQhwwXLl0alpxKojFxqwd0Ojfadem7hUaMesnkgy2go6vysUbmq7HrFLjo4Q==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.8.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.18.2","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.25.0-alpha-20231031074555-ac409d78_1698738394045_0.19162076034201636","host":"s3://npm-registry-packages"}},"0.25.0-alpha-20231031074826-54826226":{"name":"@graphql-hive/client","version":"0.25.0-alpha-20231031074826-54826226","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.25.0-alpha-20231031074826-54826226","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"b90b973c87bafe1a1380e7d075d3402a67ce5b13","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.25.0-alpha-20231031074826-54826226.tgz","fileCount":60,"integrity":"sha512-Eqmw2rLvhrXoofFb9cDT3GPCQdyc1ycXn7H04amTUx/T7pgcydZ8Bn4Ut6LgRVvVRiUEurnBC8GdyVzxpmMHVA==","signatures":[{"sig":"MEQCICbVgz53quUrHtThkLmIIY21xIL0uPiCmPkX3ydTryHYAiBigSvADxBFdnFwzr3qB6bK8IP+vqebe+4QwVm2sZIV/g==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":203731},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.25.0-alpha-20231031074826-54826226.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/d34674d653197841f39c8c80d965b006/graphql-hive-client-0.25.0-alpha-20231031074826-54826226.tgz","_integrity":"sha512-Eqmw2rLvhrXoofFb9cDT3GPCQdyc1ycXn7H04amTUx/T7pgcydZ8Bn4Ut6LgRVvVRiUEurnBC8GdyVzxpmMHVA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.8.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.18.2","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.25.0-alpha-20231031074826-54826226_1698738557623_0.04207932334734954","host":"s3://npm-registry-packages"}},"0.25.0-rc-20231031085447-8769faa7":{"name":"@graphql-hive/client","version":"0.25.0-rc-20231031085447-8769faa7","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.25.0-rc-20231031085447-8769faa7","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"2b72d06cd12c534581d099ff40882d4fdb2f13f2","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.25.0-rc-20231031085447-8769faa7.tgz","fileCount":60,"integrity":"sha512-2t31dLqoel7y2sguAsSuNrwnNvtqkLII2ucM3oKvfwXtzw8cirPOuVeTn7cvPDIG2iPd19Dw5zT7Ce0HsUwOEQ==","signatures":[{"sig":"MEUCIQDzZq2CwwY9MpyV3AECJTqxVuXqko2rq/nPimr8R3+GKgIgYEdB/KDZPqW8h0XAJQkvWyq4v7egjhsPVOnSZltzL48=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":203716},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.25.0-rc-20231031085447-8769faa7.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/2ac288acc0b4e158366c978c119e1184/graphql-hive-client-0.25.0-rc-20231031085447-8769faa7.tgz","_integrity":"sha512-2t31dLqoel7y2sguAsSuNrwnNvtqkLII2ucM3oKvfwXtzw8cirPOuVeTn7cvPDIG2iPd19Dw5zT7Ce0HsUwOEQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.8.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.18.2","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.25.0-rc-20231031085447-8769faa7_1698742531312_0.3072592409210315","host":"s3://npm-registry-packages"}},"0.25.0-rc-20231031090210-90a6d05a":{"name":"@graphql-hive/client","version":"0.25.0-rc-20231031090210-90a6d05a","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.25.0-rc-20231031090210-90a6d05a","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"c50e900690fdd387506f23065ddb6ab6ecf309fd","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.25.0-rc-20231031090210-90a6d05a.tgz","fileCount":60,"integrity":"sha512-4ZAcRoJtsv84tfGqMQA2Dkdze4evUwTqqVsm44BvG67iNMJGfxXYKXoWIGTCGPeM1UBIVuftoYofCFpvq54+1w==","signatures":[{"sig":"MEUCIQDzwg9ooHa65yk7myMNjpIOGBWFAoOeKDRIrcZk9x5pSAIgbjHL7lhyY9+POIIjhXkl7pFuMfun4pT94/116vQNuPA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":203716},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.25.0-rc-20231031090210-90a6d05a.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/6b371079b5dc60835d7752427eb6bdd8/graphql-hive-client-0.25.0-rc-20231031090210-90a6d05a.tgz","_integrity":"sha512-4ZAcRoJtsv84tfGqMQA2Dkdze4evUwTqqVsm44BvG67iNMJGfxXYKXoWIGTCGPeM1UBIVuftoYofCFpvq54+1w==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.8.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.18.2","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.25.0-rc-20231031090210-90a6d05a_1698742969705_0.8157116989702016","host":"s3://npm-registry-packages"}},"0.25.0-rc-20231031090235-90a6d05a":{"name":"@graphql-hive/client","version":"0.25.0-rc-20231031090235-90a6d05a","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.25.0-rc-20231031090235-90a6d05a","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"3a62aa78b77cecd0c834519ac8a829c4b34de658","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.25.0-rc-20231031090235-90a6d05a.tgz","fileCount":60,"integrity":"sha512-vUFEoZO+tJdPeibY5Ex7ClC//PhU7/zvme+f7M8SuTurZ6cW0Wqcxja/a6oNMqRYE7K1buGfHTgZt9l1IkYidg==","signatures":[{"sig":"MEUCIQCbYPGNR0m68tgbXDaGDV1FA89BRZj0M8dg1bAmIB5tsAIgMLjCpj2QB1653sON4LSDT79t8+FvmWPI/wQQqBfHSgI=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":203716},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.25.0-rc-20231031090235-90a6d05a.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/dba868a5aadd12e7a2299de6c991c1bd/graphql-hive-client-0.25.0-rc-20231031090235-90a6d05a.tgz","_integrity":"sha512-vUFEoZO+tJdPeibY5Ex7ClC//PhU7/zvme+f7M8SuTurZ6cW0Wqcxja/a6oNMqRYE7K1buGfHTgZt9l1IkYidg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.8.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.18.2","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.25.0-rc-20231031090235-90a6d05a_1698742995369_0.8804595571880907","host":"s3://npm-registry-packages"}},"0.25.0-alpha-20231031090447-580da5d5":{"name":"@graphql-hive/client","version":"0.25.0-alpha-20231031090447-580da5d5","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.25.0-alpha-20231031090447-580da5d5","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"0aaa5bac002b7dd9a5bb90f5b937823140cb494b","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.25.0-alpha-20231031090447-580da5d5.tgz","fileCount":60,"integrity":"sha512-fFu30HKOIND68Q1YwBuST+25vNI2HrZlOtMCOS5fZ+lDrnJ6JDk/6QsCQH/CxHRE3+iXey4JIACJ1YWJMopDcg==","signatures":[{"sig":"MEUCIQDlcYJHvH3aOuaOUURB9ll+5kClwGZzQL4+haEPUMrSXQIgWZO/NeHDUUxjr7YsMQglEZuOrerj4VWdZSGWHonhnLA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":203731},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.25.0-alpha-20231031090447-580da5d5.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/140b7fb02693bd2ad2a346e5f909481b/graphql-hive-client-0.25.0-alpha-20231031090447-580da5d5.tgz","_integrity":"sha512-fFu30HKOIND68Q1YwBuST+25vNI2HrZlOtMCOS5fZ+lDrnJ6JDk/6QsCQH/CxHRE3+iXey4JIACJ1YWJMopDcg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.8.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.18.2","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.25.0-alpha-20231031090447-580da5d5_1698743127237_0.633988864821823","host":"s3://npm-registry-packages"}},"0.25.0-rc-20231031090654-a94711c1":{"name":"@graphql-hive/client","version":"0.25.0-rc-20231031090654-a94711c1","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.25.0-rc-20231031090654-a94711c1","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"dfca7cf47d8b58f56a3523c29cfece999efb39e6","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.25.0-rc-20231031090654-a94711c1.tgz","fileCount":60,"integrity":"sha512-xjtcNHODEhCIt+O5JrRTpEZ5Gramyi14vjVASjvGb/5Y2CIr1I3R2YP+oLmIZShREA7BkLTwzlZ4v9PPJwdVhg==","signatures":[{"sig":"MEQCIH3cM9hyiiY1J7ALbPdF8r/W/qpChhD0t7Cveci+aF9TAiAzywmeSfPhkcIGF205s66MKQS+Qx63LJCr7oRhTY0Gmg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":203716},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.25.0-rc-20231031090654-a94711c1.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/9056da47753963cda97b20181ef67b2c/graphql-hive-client-0.25.0-rc-20231031090654-a94711c1.tgz","_integrity":"sha512-xjtcNHODEhCIt+O5JrRTpEZ5Gramyi14vjVASjvGb/5Y2CIr1I3R2YP+oLmIZShREA7BkLTwzlZ4v9PPJwdVhg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.8.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.18.2","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.25.0-rc-20231031090654-a94711c1_1698743251251_0.364705505159187","host":"s3://npm-registry-packages"}},"0.25.0-alpha-20231031090814-3f4c1cde":{"name":"@graphql-hive/client","version":"0.25.0-alpha-20231031090814-3f4c1cde","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.25.0-alpha-20231031090814-3f4c1cde","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"63e976e3707748e0e32e3ff80b5be3773c7a7aef","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.25.0-alpha-20231031090814-3f4c1cde.tgz","fileCount":60,"integrity":"sha512-lK5/3AJhEudMmT1JlJsOD8P/nBpSbXY0LJCmAJFIKx+lNaydnOdYAW8slrBMbhKyJ3tzEP5f9FEBKeA8iekxqw==","signatures":[{"sig":"MEUCIQD+6N+kwVjQPSxyUeNS7ZTKCRbLFVsmJQKCODEOih+SYgIgElov9tIe+vsZuCz9WTuXzuRGyXNBCiKtWZpcVrTGC7w=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":203731},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.25.0-alpha-20231031090814-3f4c1cde.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/5b4df7928c77694309ca866751c657aa/graphql-hive-client-0.25.0-alpha-20231031090814-3f4c1cde.tgz","_integrity":"sha512-lK5/3AJhEudMmT1JlJsOD8P/nBpSbXY0LJCmAJFIKx+lNaydnOdYAW8slrBMbhKyJ3tzEP5f9FEBKeA8iekxqw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.8.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.18.2","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.25.0-alpha-20231031090814-3f4c1cde_1698743349283_0.9384930689657336","host":"s3://npm-registry-packages"}},"0.25.0-alpha-20231031090921-b04c348d":{"name":"@graphql-hive/client","version":"0.25.0-alpha-20231031090921-b04c348d","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.25.0-alpha-20231031090921-b04c348d","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"7bc4e8d5edf9295e6397850e32936ecd7ee394aa","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.25.0-alpha-20231031090921-b04c348d.tgz","fileCount":60,"integrity":"sha512-ck9/VIaYqmPXgfEQ12PWL40lYxwR6aOEt2Vtkgj7lTXLBIkTLTg58BhBvAysvldoWl3Y4kRGi0i5i5D2+jWTgg==","signatures":[{"sig":"MEUCIQDkVfcaTnIt3gW5nJbu8hTyDSOPm9cO964bvzlJrTZQOAIgX8Qag73WcOdC+f7m5dWnB+0CgYBgxdQb8KP9L9Wlwh0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":203731},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.25.0-alpha-20231031090921-b04c348d.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/cddc13ac120e6d6e928ec10cac00d09e/graphql-hive-client-0.25.0-alpha-20231031090921-b04c348d.tgz","_integrity":"sha512-ck9/VIaYqmPXgfEQ12PWL40lYxwR6aOEt2Vtkgj7lTXLBIkTLTg58BhBvAysvldoWl3Y4kRGi0i5i5D2+jWTgg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.8.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.18.2","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.25.0-alpha-20231031090921-b04c348d_1698743415381_0.34122137486091186","host":"s3://npm-registry-packages"}},"0.25.0-alpha-20231031091151-b8aa2ffa":{"name":"@graphql-hive/client","version":"0.25.0-alpha-20231031091151-b8aa2ffa","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.25.0-alpha-20231031091151-b8aa2ffa","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"416e7e704e87d1d5e29c4478215793dc1feb7f1c","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.25.0-alpha-20231031091151-b8aa2ffa.tgz","fileCount":60,"integrity":"sha512-G0LVP2aRDcCF6nZhKztQzLDM847VjnVjRNQQztgkIkwRjdmEqJBE3NBmXMYt3bD+2altOIkFrH6EJtlcOMGbLA==","signatures":[{"sig":"MEYCIQCV/DHe3vIulsj7ShZaPIEH1/J7ETqt9IieQcDQskIK9wIhAIjFMHrBE9O4k2nYo8foFBqzKgLmhw7R9j8m4z53eMH3","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":203731},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.25.0-alpha-20231031091151-b8aa2ffa.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/b810921585af33a73a9d88a8af215e77/graphql-hive-client-0.25.0-alpha-20231031091151-b8aa2ffa.tgz","_integrity":"sha512-G0LVP2aRDcCF6nZhKztQzLDM847VjnVjRNQQztgkIkwRjdmEqJBE3NBmXMYt3bD+2altOIkFrH6EJtlcOMGbLA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.8.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.18.2","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.25.0-alpha-20231031091151-b8aa2ffa_1698743561038_0.41087359680253166","host":"s3://npm-registry-packages"}},"0.25.0-rc-20231031091327-ddae0ade":{"name":"@graphql-hive/client","version":"0.25.0-rc-20231031091327-ddae0ade","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.25.0-rc-20231031091327-ddae0ade","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"988372c66acb4662e86820893e6e6405131c4093","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.25.0-rc-20231031091327-ddae0ade.tgz","fileCount":60,"integrity":"sha512-hR444bTnf+qA6/WZO8/dE7ezS48DzkNUNpwwrTgyhyGeVFsZaPb9Q0lijC+KIaLAl5/1qeS/17/jjz4f98O/Iw==","signatures":[{"sig":"MEYCIQDhg19zKrqOFAjkti2K6pbD2mW7Mjd3ys16nqDpdtxj/AIhALA1/EMz34dhpJ+FbIZZXt5m90X+AwdVvFjJVgr6JRuQ","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":203716},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.25.0-rc-20231031091327-ddae0ade.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/d96f1fb2a0812e16e457741e20135bd6/graphql-hive-client-0.25.0-rc-20231031091327-ddae0ade.tgz","_integrity":"sha512-hR444bTnf+qA6/WZO8/dE7ezS48DzkNUNpwwrTgyhyGeVFsZaPb9Q0lijC+KIaLAl5/1qeS/17/jjz4f98O/Iw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.8.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.18.2","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.25.0-rc-20231031091327-ddae0ade_1698743654051_0.2903396978058981","host":"s3://npm-registry-packages"}},"0.25.0-alpha-20231031114705-472f2519":{"name":"@graphql-hive/client","version":"0.25.0-alpha-20231031114705-472f2519","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.25.0-alpha-20231031114705-472f2519","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"7826507a0716faa7e3a89edb2a0cfb12e6f58a08","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.25.0-alpha-20231031114705-472f2519.tgz","fileCount":60,"integrity":"sha512-Qi+Ush92qJ3af2EAGnRku8cwe3n+sNFQdsGH/SK+7bodynncS8UBBj4fbAqzeLrQw+TwGy7TtROTS0uYnNWuUw==","signatures":[{"sig":"MEQCIFr9zzoruVlRUWr21JH2qbmnoCrtbfCXGwXSO7K8gSwJAiALLumbcPgO+me13rOdbR0QQS6w9kx/lSFcy+HLnTYl1w==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":204025},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.25.0-alpha-20231031114705-472f2519.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/fea1898025fc0e2b9d83c71853d0ddb1/graphql-hive-client-0.25.0-alpha-20231031114705-472f2519.tgz","_integrity":"sha512-Qi+Ush92qJ3af2EAGnRku8cwe3n+sNFQdsGH/SK+7bodynncS8UBBj4fbAqzeLrQw+TwGy7TtROTS0uYnNWuUw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.8.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.18.2","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.25.0-alpha-20231031114705-472f2519_1698752863467_0.9679380947463099","host":"s3://npm-registry-packages"}},"0.25.0-alpha-20231031134123-77954bdc":{"name":"@graphql-hive/client","version":"0.25.0-alpha-20231031134123-77954bdc","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.25.0-alpha-20231031134123-77954bdc","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"ccd5bf5a1531ebfb1760033370e204d513b300e1","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.25.0-alpha-20231031134123-77954bdc.tgz","fileCount":60,"integrity":"sha512-RY1B/zAJ0aKqBeAMlA3uEqbExAW1kbj8UoE9Nx4I59gWqYOaPtEOG6p4vFMwzgJZQyhqPwA+1Kbw45b6Cq8gAg==","signatures":[{"sig":"MEQCIBdx6Dg0SFQZrK9C4oDlMV3STXzCEh/8ZZMtev4JUl0wAiB2a52lSvH1q5wx2v5PB36Ra9RmKOYg+GfCsVgYw91QPA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":204025},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.25.0-alpha-20231031134123-77954bdc.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/893ed1f23d1fbc7dd97d36b15c6a37ea/graphql-hive-client-0.25.0-alpha-20231031134123-77954bdc.tgz","_integrity":"sha512-RY1B/zAJ0aKqBeAMlA3uEqbExAW1kbj8UoE9Nx4I59gWqYOaPtEOG6p4vFMwzgJZQyhqPwA+1Kbw45b6Cq8gAg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.8.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.18.2","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.25.0-alpha-20231031134123-77954bdc_1698759729318_0.8450183225968968","host":"s3://npm-registry-packages"}},"0.25.0-alpha-20231031135300-b41368d5":{"name":"@graphql-hive/client","version":"0.25.0-alpha-20231031135300-b41368d5","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.25.0-alpha-20231031135300-b41368d5","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"58cc5bcfa646323dfed9c1867b3c62dddf68d179","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.25.0-alpha-20231031135300-b41368d5.tgz","fileCount":60,"integrity":"sha512-nNy1oiRfalL0TbH0dZFurab/wypjVJXjlUpxfCJbZqn/np+v1Wco66zrJB0RjJKPbhu5lwJJGv9pCkGUxT3ylQ==","signatures":[{"sig":"MEUCIQDXb4KJRSz9p6FkBJJXQMhu52NRybQ9hNIA2YvFG2vC6gIgC2T0PeWjIMzSWkoDr1F8r3DB62ntWgpBpcZgq5ySl6A=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":204025},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.25.0-alpha-20231031135300-b41368d5.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/f10973b2a006ef7ccf218f62aee531e1/graphql-hive-client-0.25.0-alpha-20231031135300-b41368d5.tgz","_integrity":"sha512-nNy1oiRfalL0TbH0dZFurab/wypjVJXjlUpxfCJbZqn/np+v1Wco66zrJB0RjJKPbhu5lwJJGv9pCkGUxT3ylQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.8.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.18.2","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.25.0-alpha-20231031135300-b41368d5_1698760434667_0.6562493016115194","host":"s3://npm-registry-packages"}},"0.25.0-alpha-20231031135519-5875b3ab":{"name":"@graphql-hive/client","version":"0.25.0-alpha-20231031135519-5875b3ab","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.25.0-alpha-20231031135519-5875b3ab","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"538ba6b5e204d8e7e03ea03c690625075d78f16d","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.25.0-alpha-20231031135519-5875b3ab.tgz","fileCount":60,"integrity":"sha512-DcWxt7S638Ez8o3X3pa92L7EgrO+VFqWL7Va3ANs7MKRQCDJ+PssHUa1sWur+xdKwo31cS3LWjoCBv0y63oRyg==","signatures":[{"sig":"MEYCIQCkFeMtADYvNJW2ucu98gvnk46bQaChS5sBO+sMlIDNfQIhAK4PqmHxIyWrRebu0WRFZzW7U6kr3tLp4xPaj/ZNLHHp","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":204025},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.25.0-alpha-20231031135519-5875b3ab.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/2a48c15117c6896f41af23452c757278/graphql-hive-client-0.25.0-alpha-20231031135519-5875b3ab.tgz","_integrity":"sha512-DcWxt7S638Ez8o3X3pa92L7EgrO+VFqWL7Va3ANs7MKRQCDJ+PssHUa1sWur+xdKwo31cS3LWjoCBv0y63oRyg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.8.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.18.2","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.25.0-alpha-20231031135519-5875b3ab_1698760560513_0.7812079107793897","host":"s3://npm-registry-packages"}},"0.25.0-alpha-20231031140451-a7867c1f":{"name":"@graphql-hive/client","version":"0.25.0-alpha-20231031140451-a7867c1f","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.25.0-alpha-20231031140451-a7867c1f","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"d9fbf930247947e88f47c221e121daf6e124b010","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.25.0-alpha-20231031140451-a7867c1f.tgz","fileCount":60,"integrity":"sha512-GG2+pCgBacpp5yk9s4VeDqjoBp47FXnew1wRkqkBN3+kNZ4IOpfXQUAxnNQQEJe5Zt2q5pUpAGhiMoYcjSN00g==","signatures":[{"sig":"MEQCIDZpg5HzSxJIUEnOOVwZ7p/KLiacPN6kbhfs9GBGydHqAiAwOMDtQNjz6FGwJcAxe+6S2QG7M8wSWd8p/DzajRs/gQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":204025},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.25.0-alpha-20231031140451-a7867c1f.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/224634a7e6c6893bb1faf73598f1ec24/graphql-hive-client-0.25.0-alpha-20231031140451-a7867c1f.tgz","_integrity":"sha512-GG2+pCgBacpp5yk9s4VeDqjoBp47FXnew1wRkqkBN3+kNZ4IOpfXQUAxnNQQEJe5Zt2q5pUpAGhiMoYcjSN00g==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.8.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.18.2","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.25.0-alpha-20231031140451-a7867c1f_1698761129322_0.5092502059065582","host":"s3://npm-registry-packages"}},"0.25.0-alpha-20231031140846-60e26853":{"name":"@graphql-hive/client","version":"0.25.0-alpha-20231031140846-60e26853","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.25.0-alpha-20231031140846-60e26853","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"7cd26c0ae94a365b97312e2652cdbbdea66c6b0d","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.25.0-alpha-20231031140846-60e26853.tgz","fileCount":60,"integrity":"sha512-yseWmQ59dgWET7Tm5SMzjzhUKgmsK2gtfzp/WkXn2rWIp4TXYiBFe6s6S8akSp1+kdUdlCLevkaWfSmNa7gu/A==","signatures":[{"sig":"MEYCIQD1/O0QiOMD+FsuRQsKua3R4bZV5FeDcY5bknMnpQTxigIhANQ9Es2GTJhPxIMsND0K29zAzByMRTQNavSF5SS2zmms","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":203731},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.25.0-alpha-20231031140846-60e26853.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/06a0729b3556b2481793378a681b6f6e/graphql-hive-client-0.25.0-alpha-20231031140846-60e26853.tgz","_integrity":"sha512-yseWmQ59dgWET7Tm5SMzjzhUKgmsK2gtfzp/WkXn2rWIp4TXYiBFe6s6S8akSp1+kdUdlCLevkaWfSmNa7gu/A==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.8.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.18.2","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.25.0-alpha-20231031140846-60e26853_1698761373717_0.11719774838049779","host":"s3://npm-registry-packages"}},"0.25.0-alpha-20231031141122-ae748cad":{"name":"@graphql-hive/client","version":"0.25.0-alpha-20231031141122-ae748cad","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.25.0-alpha-20231031141122-ae748cad","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"8051e9a22ae5ea02cd83d250f22d5c334b9ca14f","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.25.0-alpha-20231031141122-ae748cad.tgz","fileCount":60,"integrity":"sha512-bp/NIx7wvyL0w9yqq99hF3sdLFsV/T4jbaHljB4WaqkprNe0YQto+r6rXQxhsM/e+hkqf2sOTuwil5CGMH/WlA==","signatures":[{"sig":"MEYCIQDZ5cgFEgpYGk9x5bNLWy/NYA7ClLKIccYxt/t+N8wiDAIhANyDhrW0ZHPSQQGa/Rp7/Om4EG4OGqnnuC4YlqvZCzYj","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":204025},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.25.0-alpha-20231031141122-ae748cad.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/e14f6c4bfb6e82da227c0a481c8eb67c/graphql-hive-client-0.25.0-alpha-20231031141122-ae748cad.tgz","_integrity":"sha512-bp/NIx7wvyL0w9yqq99hF3sdLFsV/T4jbaHljB4WaqkprNe0YQto+r6rXQxhsM/e+hkqf2sOTuwil5CGMH/WlA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.8.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.18.2","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.25.0-alpha-20231031141122-ae748cad_1698761528927_0.13633809334669666","host":"s3://npm-registry-packages"}},"0.25.0-rc-20231031141141-5302e5bb":{"name":"@graphql-hive/client","version":"0.25.0-rc-20231031141141-5302e5bb","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.25.0-rc-20231031141141-5302e5bb","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"fc525d70ecdb884d6a3ec438dba2581a3200059e","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.25.0-rc-20231031141141-5302e5bb.tgz","fileCount":60,"integrity":"sha512-loetMsCOVN0nbbfhbdRKfvTqeB7wXuRrqnl0RPzbWcJaObBBWJIjestjXjndI++JpZJ4grtZYwvIchxLJuMjrQ==","signatures":[{"sig":"MEYCIQC05QvYlS7/gBEva5xiSjUaDbhoz9Hd+k4SLaBkk4AsVwIhANcVQnqxcL3UIHA7qWJvmmFyVoVrf3nNHCJt0dsUdKFe","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":203716},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.25.0-rc-20231031141141-5302e5bb.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/0a49d4da48603bb4756635875df6c99e/graphql-hive-client-0.25.0-rc-20231031141141-5302e5bb.tgz","_integrity":"sha512-loetMsCOVN0nbbfhbdRKfvTqeB7wXuRrqnl0RPzbWcJaObBBWJIjestjXjndI++JpZJ4grtZYwvIchxLJuMjrQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.8.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.18.2","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.25.0-rc-20231031141141-5302e5bb_1698761551283_0.43307280969333695","host":"s3://npm-registry-packages"}},"0.25.0-alpha-20231031141307-73aa3eb1":{"name":"@graphql-hive/client","version":"0.25.0-alpha-20231031141307-73aa3eb1","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.25.0-alpha-20231031141307-73aa3eb1","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"e3100f6dc89b412b90d05d37232b0de9a617a976","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.25.0-alpha-20231031141307-73aa3eb1.tgz","fileCount":60,"integrity":"sha512-EKYcJFnzmSPc7wm9s8+oiX0kmeiIIXMrKmAAbnLJCRqzJ8GM6eBZIE9REEZGFmctF9TAMr4AtVIeYFAKJ5CS0Q==","signatures":[{"sig":"MEUCIAaJ5C1A50s4KhvyKfj4/KgDRBup4XRZ+SPc0hsZFWDqAiEA82opoSlUv2u0A1SbsDzH9vFzsFZPQPpfoJtvQ2IM/W4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":203731},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.25.0-alpha-20231031141307-73aa3eb1.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/d724bc8debb0f72bc88274448b1b7c3a/graphql-hive-client-0.25.0-alpha-20231031141307-73aa3eb1.tgz","_integrity":"sha512-EKYcJFnzmSPc7wm9s8+oiX0kmeiIIXMrKmAAbnLJCRqzJ8GM6eBZIE9REEZGFmctF9TAMr4AtVIeYFAKJ5CS0Q==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.8.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.18.2","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.25.0-alpha-20231031141307-73aa3eb1_1698761636472_0.5983351193732136","host":"s3://npm-registry-packages"}},"0.25.0-alpha-20231031141421-c839137c":{"name":"@graphql-hive/client","version":"0.25.0-alpha-20231031141421-c839137c","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.25.0-alpha-20231031141421-c839137c","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"de12d1a4df65d26393680a30ebe2f133d169364b","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.25.0-alpha-20231031141421-c839137c.tgz","fileCount":60,"integrity":"sha512-1iGhJXalSr9DiJlEPJob5c5LO6FMLwJ6cRxyzx5PuyFVfwSqfQT9jwOLsguLhpJlogW7UcdtNlRBfFjnP1Ux2Q==","signatures":[{"sig":"MEUCIFicbcF1As4YiBqAhbC+UEx83ESFiFYowVLxGbHZ9aFtAiEAqSGQrfCMh5F8+KSG661+sA6+9Hy4fIAhRemOSxjGm90=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":203731},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.25.0-alpha-20231031141421-c839137c.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/b9ad66af368c910b252f3331dd89c9eb/graphql-hive-client-0.25.0-alpha-20231031141421-c839137c.tgz","_integrity":"sha512-1iGhJXalSr9DiJlEPJob5c5LO6FMLwJ6cRxyzx5PuyFVfwSqfQT9jwOLsguLhpJlogW7UcdtNlRBfFjnP1Ux2Q==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.8.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.18.2","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.25.0-alpha-20231031141421-c839137c_1698761703192_0.23611428257725398","host":"s3://npm-registry-packages"}},"0.25.0-alpha-20231031141953-addfe1b6":{"name":"@graphql-hive/client","version":"0.25.0-alpha-20231031141953-addfe1b6","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.25.0-alpha-20231031141953-addfe1b6","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"4611aa294713b4a88c326206db99916c48fd66ee","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.25.0-alpha-20231031141953-addfe1b6.tgz","fileCount":60,"integrity":"sha512-9/tSC0kMsJACsDUpQQxzWyo/8IbG2/LINr3J6+SgoJ4SBUG9SPIGgL12kN/mjCUhG1U9czv1zz2FGXRAW8F8Og==","signatures":[{"sig":"MEQCIEDdVuw9I4COofkhcYxGR8h1A9cqIrJEhKcnuO//w0POAiBFCI1GbftTCWR9G4GzqHyOALCGCAIvMeCDZyb2z0t6DQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":203731},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.25.0-alpha-20231031141953-addfe1b6.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/099efc849f700dbe8c0c3ba1619b0757/graphql-hive-client-0.25.0-alpha-20231031141953-addfe1b6.tgz","_integrity":"sha512-9/tSC0kMsJACsDUpQQxzWyo/8IbG2/LINr3J6+SgoJ4SBUG9SPIGgL12kN/mjCUhG1U9czv1zz2FGXRAW8F8Og==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.8.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.18.2","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.25.0-alpha-20231031141953-addfe1b6_1698762032419_0.8610889573370704","host":"s3://npm-registry-packages"}},"0.25.0-alpha-20231031142139-19f579cc":{"name":"@graphql-hive/client","version":"0.25.0-alpha-20231031142139-19f579cc","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.25.0-alpha-20231031142139-19f579cc","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"258f2a4b73eb323920c88920d6e48e729f305698","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.25.0-alpha-20231031142139-19f579cc.tgz","fileCount":60,"integrity":"sha512-VsgFU64JXaxGIMo3M6mZwzpbdmfWn3zBDJoKry72SXZIFgdysi/BDMS2To+djZdcv+R+LFn0CKWMMa8kCkfCGw==","signatures":[{"sig":"MEUCIDiwk8oMFl6VQplZJu49V++aOBAXtuuyY70b4BSfMxBNAiEAixMB5tldJSeOYYouBmnq7G8JK1yHn79fMXD2kSOmiKo=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":203731},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.25.0-alpha-20231031142139-19f579cc.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/aefd425d1464e39ed1e6dd12e7e7de0b/graphql-hive-client-0.25.0-alpha-20231031142139-19f579cc.tgz","_integrity":"sha512-VsgFU64JXaxGIMo3M6mZwzpbdmfWn3zBDJoKry72SXZIFgdysi/BDMS2To+djZdcv+R+LFn0CKWMMa8kCkfCGw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.8.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.18.2","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.25.0-alpha-20231031142139-19f579cc_1698762137554_0.1551173473339007","host":"s3://npm-registry-packages"}},"0.25.0-alpha-20231031142258-286f6eb6":{"name":"@graphql-hive/client","version":"0.25.0-alpha-20231031142258-286f6eb6","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.25.0-alpha-20231031142258-286f6eb6","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"6dfe7e1079e7f9a7956aad75ad2fc8de5c61b010","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.25.0-alpha-20231031142258-286f6eb6.tgz","fileCount":60,"integrity":"sha512-9ycMr4Oj2n9mZaYlTdVbSNKMkYC4MKXwM7rz9jGQGKgsKTouNnDnSdmKFNvksiRmv+886j6AKYeLlypYA64s+w==","signatures":[{"sig":"MEUCIB0pOBCsIiBNEqLvBqh+kdQkrwhwhRn5n+lOus4VBmcLAiEAsLP9+Um07ypBf8voOWxpSfXT2M4R3mrk65+d82FsWVw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":204025},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.25.0-alpha-20231031142258-286f6eb6.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/91c0e80458921028e89ad2450d4fd5b0/graphql-hive-client-0.25.0-alpha-20231031142258-286f6eb6.tgz","_integrity":"sha512-9ycMr4Oj2n9mZaYlTdVbSNKMkYC4MKXwM7rz9jGQGKgsKTouNnDnSdmKFNvksiRmv+886j6AKYeLlypYA64s+w==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.8.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.18.2","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.25.0-alpha-20231031142258-286f6eb6_1698762227310_0.7631717662420705","host":"s3://npm-registry-packages"}},"0.25.0-rc-20231031142703-c99a33e3":{"name":"@graphql-hive/client","version":"0.25.0-rc-20231031142703-c99a33e3","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.25.0-rc-20231031142703-c99a33e3","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"b0167c9ddb64291ea5d1784c3b8621426f6b93dd","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.25.0-rc-20231031142703-c99a33e3.tgz","fileCount":60,"integrity":"sha512-cBKxiJmcFFw6/xps6VhIatrIL8/2fXd/6UQ/LAYZHkrcuJ+AEvmX2j9eX98l4ufRu50+Wqd7N9iQQiRiFu8Z7Q==","signatures":[{"sig":"MEYCIQCNZMiXe4F1FqRf8covkgxVSj7ihsXz6UyLcfzncZXg3wIhAOwd+goJk5/X1Nl5bpXDneKRrG+cpiTqXnhAeCUqz5BD","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":203716},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.25.0-rc-20231031142703-c99a33e3.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/bc550603d6564692136ad6b085bb6f60/graphql-hive-client-0.25.0-rc-20231031142703-c99a33e3.tgz","_integrity":"sha512-cBKxiJmcFFw6/xps6VhIatrIL8/2fXd/6UQ/LAYZHkrcuJ+AEvmX2j9eX98l4ufRu50+Wqd7N9iQQiRiFu8Z7Q==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.8.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.18.2","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.25.0-rc-20231031142703-c99a33e3_1698762463496_0.4158890894931173","host":"s3://npm-registry-packages"}},"0.25.0-alpha-20231031142907-e13db453":{"name":"@graphql-hive/client","version":"0.25.0-alpha-20231031142907-e13db453","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.25.0-alpha-20231031142907-e13db453","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"11adb52d0d347b1020a31ad63535027fde56d0f6","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.25.0-alpha-20231031142907-e13db453.tgz","fileCount":60,"integrity":"sha512-8BXdet5Ff5sakpRqfSl7RoLJKl2VBfZ/U7pyxaDiiu8QHzNMmt6ehZ3i8cEe50dIkZkhk6ZSUN7WYGMAVBnJ0g==","signatures":[{"sig":"MEYCIQDGwZnW0NMQWkk7VCtad72K3AZzvWwvbMTH/fdReuWk+AIhALZ3v/g/Ka2DVzgkK8ak9KMKVnCU4u8KltKkZM7swdjj","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":204025},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.25.0-alpha-20231031142907-e13db453.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/1ca7404fd3fe0d76e37a6e8f44b29cf2/graphql-hive-client-0.25.0-alpha-20231031142907-e13db453.tgz","_integrity":"sha512-8BXdet5Ff5sakpRqfSl7RoLJKl2VBfZ/U7pyxaDiiu8QHzNMmt6ehZ3i8cEe50dIkZkhk6ZSUN7WYGMAVBnJ0g==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.8.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.18.2","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.25.0-alpha-20231031142907-e13db453_1698762589580_0.5345431904581195","host":"s3://npm-registry-packages"}},"0.25.0-alpha-20231031145007-d8f1ec91":{"name":"@graphql-hive/client","version":"0.25.0-alpha-20231031145007-d8f1ec91","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.25.0-alpha-20231031145007-d8f1ec91","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"b64ab6426bd9fda6e17695ee74597ecf9f7a93e5","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.25.0-alpha-20231031145007-d8f1ec91.tgz","fileCount":60,"integrity":"sha512-Jrh+BwRsSw1ackuaQzdTwUOy/Rmq1vBKK15/Nss+h3FmlHPwjZaQZcC01iP1/zOq41CWJbmjkh0vlZ32AQYWoA==","signatures":[{"sig":"MEUCIQC5i7XX46IJpAYCoDjEj2NEQMCrwmL3ID0CZCTDMiOgqQIgPQhhfKc8USOBUYBDPSfmfg26oZbd+zy5WyILv84mWbk=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":203731},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.25.0-alpha-20231031145007-d8f1ec91.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/166f5a5fa3dd0191bfe8503d1136b320/graphql-hive-client-0.25.0-alpha-20231031145007-d8f1ec91.tgz","_integrity":"sha512-Jrh+BwRsSw1ackuaQzdTwUOy/Rmq1vBKK15/Nss+h3FmlHPwjZaQZcC01iP1/zOq41CWJbmjkh0vlZ32AQYWoA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.8.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.18.2","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.25.0-alpha-20231031145007-d8f1ec91_1698763847321_0.6591061190653462","host":"s3://npm-registry-packages"}},"0.25.0-rc-20231031145049-fef07f5b":{"name":"@graphql-hive/client","version":"0.25.0-rc-20231031145049-fef07f5b","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.25.0-rc-20231031145049-fef07f5b","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"7f0987b6888d40d7f38758bc4024f5e368494019","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.25.0-rc-20231031145049-fef07f5b.tgz","fileCount":60,"integrity":"sha512-YujitT/hYAgLohKJVEvmcgnumPpOBJ2u2NERGz0vKR9mcfcoVkIgBoP9HdRQeUuYbo1shM1CjvhF2d+x3wiEvA==","signatures":[{"sig":"MEUCIHshHUeEfNwyOMeFSwPSV+tUKqEaSTnpRxirQJ5cv4urAiEAggHnSmHP+HU/UNDdyztHedjRFv6Z4h/LqS4aIeMaEXU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":203716},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.25.0-rc-20231031145049-fef07f5b.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/55a4a53fc413f7fd62c25ce9d79a75e8/graphql-hive-client-0.25.0-rc-20231031145049-fef07f5b.tgz","_integrity":"sha512-YujitT/hYAgLohKJVEvmcgnumPpOBJ2u2NERGz0vKR9mcfcoVkIgBoP9HdRQeUuYbo1shM1CjvhF2d+x3wiEvA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.8.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.18.2","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.25.0-rc-20231031145049-fef07f5b_1698763888943_0.19685020595565184","host":"s3://npm-registry-packages"}},"0.25.0-alpha-20231031145259-7324e496":{"name":"@graphql-hive/client","version":"0.25.0-alpha-20231031145259-7324e496","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.25.0-alpha-20231031145259-7324e496","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"dae72a86b26a4def8a8855988fc3fed999e79875","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.25.0-alpha-20231031145259-7324e496.tgz","fileCount":60,"integrity":"sha512-arq8CiwGAWPfR/zDVEQY9wt/Y9fjoO5iEYmGSWvtyy+2sESmpkZ6U3/dot6hef4I6mw0WsR2tz2kKUuyVY5SBw==","signatures":[{"sig":"MEUCIQCc9W98Ix+NKinwsIgDpRX42ISX/rvCACMzPUx1j+932QIgQPy5CyQXRN15UK9Hu4GNvoDt/rR7hfaD6rayN2u1s9A=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":203731},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.25.0-alpha-20231031145259-7324e496.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/24603897fa4b691a1f17443f77dfc3de/graphql-hive-client-0.25.0-alpha-20231031145259-7324e496.tgz","_integrity":"sha512-arq8CiwGAWPfR/zDVEQY9wt/Y9fjoO5iEYmGSWvtyy+2sESmpkZ6U3/dot6hef4I6mw0WsR2tz2kKUuyVY5SBw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.8.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.18.2","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.25.0-alpha-20231031145259-7324e496_1698764023704_0.1466860198316715","host":"s3://npm-registry-packages"}},"0.25.0-alpha-20231031160713-dda5d8d2":{"name":"@graphql-hive/client","version":"0.25.0-alpha-20231031160713-dda5d8d2","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.25.0-alpha-20231031160713-dda5d8d2","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"e253940acc6335c057ba95afb0dbfb51639dfbbe","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.25.0-alpha-20231031160713-dda5d8d2.tgz","fileCount":60,"integrity":"sha512-nWQEmbUQdZfO6coTrOKqqVuYiQerS5v7S58bE2SXYBLc61DpEnCdcwLETyWCbejKKS4Om37BD0YaF5wkCpQ81g==","signatures":[{"sig":"MEQCIHQNKtLye1/W56QFeFz7p97+Ucv1jDNGUpwLsrYuxpVjAiAXRBfduvfewIUzgDkxBmGQiTnm7FsF9e82+3w/eFjR9g==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":203731},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.25.0-alpha-20231031160713-dda5d8d2.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/ec686df92156b7d71a805ec388d24246/graphql-hive-client-0.25.0-alpha-20231031160713-dda5d8d2.tgz","_integrity":"sha512-nWQEmbUQdZfO6coTrOKqqVuYiQerS5v7S58bE2SXYBLc61DpEnCdcwLETyWCbejKKS4Om37BD0YaF5wkCpQ81g==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.8.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.18.2","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.25.0-alpha-20231031160713-dda5d8d2_1698768482476_0.3771337200973275","host":"s3://npm-registry-packages"}},"0.25.0-rc-20231031171315-7a716826":{"name":"@graphql-hive/client","version":"0.25.0-rc-20231031171315-7a716826","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.25.0-rc-20231031171315-7a716826","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"fed2b6975cc5eba9b2a0c14ba2ce033b1b01feba","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.25.0-rc-20231031171315-7a716826.tgz","fileCount":60,"integrity":"sha512-UikyAgHsriNNmosZM7FdGCypq0EnGgMe9/WoyQIeaeG8ukWEV6rTq7I18v+s++/k0Z+TmOT1RuMtkRbKzKqJKw==","signatures":[{"sig":"MEQCIBYxrhZveWTsTxIeODF+313G0b1KQxRIiFuqrPs8M29LAiAWdzgs8eQOgCtMJWAwCj/R2He6UMX1GbzZ68kt+l97eg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":203716},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.25.0-rc-20231031171315-7a716826.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/383b22b2cd099dbe95b636c2f44031d1/graphql-hive-client-0.25.0-rc-20231031171315-7a716826.tgz","_integrity":"sha512-UikyAgHsriNNmosZM7FdGCypq0EnGgMe9/WoyQIeaeG8ukWEV6rTq7I18v+s++/k0Z+TmOT1RuMtkRbKzKqJKw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.8.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.18.2","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.25.0-rc-20231031171315-7a716826_1698772443947_0.13316043294616797","host":"s3://npm-registry-packages"}},"0.25.0-alpha-20231101075150-6d877e22":{"name":"@graphql-hive/client","version":"0.25.0-alpha-20231101075150-6d877e22","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.25.0-alpha-20231101075150-6d877e22","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"3b3f5dac533b46784db55608998cde5e3ada89ed","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.25.0-alpha-20231101075150-6d877e22.tgz","fileCount":60,"integrity":"sha512-dA8c+AXZAdiBOuKqMztHCLEuFSSleIE8XJigC9ZJExyzq5pZh5g0nFyVA0FMXF7/Mpsr6sR0KRP7G9hKshMxRQ==","signatures":[{"sig":"MEUCIBf1wYFKlxo15in0TB30YwZsqKngUnuu5A/nJascoUliAiEAse5Urne3oIXUg7GbkYt20B1wV0FsK3XaWU7mKja3wUA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":203731},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.25.0-alpha-20231101075150-6d877e22.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/412fe5e9be6e54144efdcf1c3d20ef77/graphql-hive-client-0.25.0-alpha-20231101075150-6d877e22.tgz","_integrity":"sha512-dA8c+AXZAdiBOuKqMztHCLEuFSSleIE8XJigC9ZJExyzq5pZh5g0nFyVA0FMXF7/Mpsr6sR0KRP7G9hKshMxRQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.8.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.18.2","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.25.0-alpha-20231101075150-6d877e22_1698825165354_0.3538956953083887","host":"s3://npm-registry-packages"}},"0.25.0-alpha-20231101075723-62d9449a":{"name":"@graphql-hive/client","version":"0.25.0-alpha-20231101075723-62d9449a","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.25.0-alpha-20231101075723-62d9449a","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"e4109a9a60ebe71bcc0e3ffedff6ba74aa1c683f","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.25.0-alpha-20231101075723-62d9449a.tgz","fileCount":60,"integrity":"sha512-bV7+GToJlGaHmUCzU22gDS3Wq2/t5q3AEVS49xuA1E8T7rqDMINIaazY2ROE0E1JPm6k2vYNf1cdTBVXucPBQA==","signatures":[{"sig":"MEQCIBN/YjJ+xuGNwrIeaKrcPsbBx7iKpVc/TNrgP3mKIdwSAiAFsqsdWWN9V8EEzfbwMTV24IWR7G3uGR6iqK/1LzWkpg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":203731},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.25.0-alpha-20231101075723-62d9449a.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/0a1618631c88707c6237cf0b2794ee87/graphql-hive-client-0.25.0-alpha-20231101075723-62d9449a.tgz","_integrity":"sha512-bV7+GToJlGaHmUCzU22gDS3Wq2/t5q3AEVS49xuA1E8T7rqDMINIaazY2ROE0E1JPm6k2vYNf1cdTBVXucPBQA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.8.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.18.2","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.25.0-alpha-20231101075723-62d9449a_1698825490212_0.9632894894553967","host":"s3://npm-registry-packages"}},"0.25.0-rc-20231101082022-abbaf302":{"name":"@graphql-hive/client","version":"0.25.0-rc-20231101082022-abbaf302","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.25.0-rc-20231101082022-abbaf302","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"e63fb72a65068f6d178a519c39494e1e3fb9ee85","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.25.0-rc-20231101082022-abbaf302.tgz","fileCount":60,"integrity":"sha512-6lEkHBYm0loGzs7vgN8RO577SoRnG9vxNZWdLXdJ6G2xFPXz4UJv4XVpBEZCw5YZehg7HyY/duUczeFHJy/QFQ==","signatures":[{"sig":"MEUCIQCGq9EGWV9xItB2Oz4H4tGdwIHIVpR2dH+s1b/dvrcXmQIgBaT3/TGxzHPSabFD1JgUayKyQIesEHK3XSK2T33hyPA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":203716},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.25.0-rc-20231101082022-abbaf302.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/e67e35367e66bfc01ec91d1ec421ea55/graphql-hive-client-0.25.0-rc-20231101082022-abbaf302.tgz","_integrity":"sha512-6lEkHBYm0loGzs7vgN8RO577SoRnG9vxNZWdLXdJ6G2xFPXz4UJv4XVpBEZCw5YZehg7HyY/duUczeFHJy/QFQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.8.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.18.2","dependencies":{"axios":"^1.2.1","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.25.0-rc-20231101082022-abbaf302_1698826872359_0.1569278838514483","host":"s3://npm-registry-packages"}},"0.25.0-rc-20231101082324-36a832a8":{"name":"@graphql-hive/client","version":"0.25.0-rc-20231101082324-36a832a8","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.25.0-rc-20231101082324-36a832a8","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"130c82e897eee23962b28ea0e32ffcff6547cc3e","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.25.0-rc-20231101082324-36a832a8.tgz","fileCount":60,"integrity":"sha512-YG7Kn/9Pd769lsqCqe0DbStKDwKR04HT2Ytf5azJVcMJHPfCZA/GufR1R6HhgaCpx1ZWjX7nFov+3Mqdf772bQ==","signatures":[{"sig":"MEYCIQDvvVKNe9zSDV8WWdBkOA0zIC2J4YvLmYB6Wtw3vxhSEwIhALGyhGUpGyc96VB9kx2SNlsD58npr6YszIqq4B+4PlIr","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":203716},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.25.0-rc-20231101082324-36a832a8.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/b84532d303603feb7fb532c5ad940f8f/graphql-hive-client-0.25.0-rc-20231101082324-36a832a8.tgz","_integrity":"sha512-YG7Kn/9Pd769lsqCqe0DbStKDwKR04HT2Ytf5azJVcMJHPfCZA/GufR1R6HhgaCpx1ZWjX7nFov+3Mqdf772bQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.8.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.18.2","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.25.0-rc-20231101082324-36a832a8_1698827054536_0.22380107994027587","host":"s3://npm-registry-packages"}},"0.25.0":{"name":"@graphql-hive/client","version":"0.25.0","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.25.0","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"9602ee81ebd8c9c1a737343ede59865781f3b49a","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.25.0.tgz","fileCount":60,"integrity":"sha512-69QD8DrQ28SQKMhhwnr8eqtG+E93aQBMadfMspnM8zsYtdchI/B9XL3FVDiaNWapHFExOP83lIphbukHesaBlQ==","signatures":[{"sig":"MEUCIQC/CkogJd6OdQ3ZDy9YRHrvd/nkSTLklp9jbz1w7y19vgIgEvXKrvsbzd7FQaOsOcztc9HYiyBzEWF3cDSbvpBF+4E=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":203581},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.25.0.tgz","module":"esm/index.js","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/5a313f596cb9264567718a13573290c2/graphql-hive-client-0.25.0.tgz","_integrity":"sha512-69QD8DrQ28SQKMhhwnr8eqtG+E93aQBMadfMspnM8zsYtdchI/B9XL3FVDiaNWapHFExOP83lIphbukHesaBlQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.8.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.18.2","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.25.0_1698828354001_0.7053179621031425","host":"s3://npm-registry-packages"}},"0.26.0-alpha-20231103140036-43467e10":{"name":"@graphql-hive/client","version":"0.26.0-alpha-20231103140036-43467e10","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.26.0-alpha-20231103140036-43467e10","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"520016e215b5d182a51dd2d715599e53b28b9a40","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.26.0-alpha-20231103140036-43467e10.tgz","fileCount":60,"integrity":"sha512-atcU7x9PJnmg9SOEIbTMnEP7sQ1uFFsy4pxUsta5pvDsd+y2IlDyYnp37Ydow1WqrOyUUE//kXf0XghcMz0QfQ==","signatures":[{"sig":"MEUCID8wlVTGnJCm/PJ6pXd5qUADRGsGEt5waUPDlcT8jxUvAiEA2A9oDbdqXBAT52T75f4w/PUBS6u4Q/HNjS1tk8+3t3w=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":204773},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.26.0-alpha-20231103140036-43467e10.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/3f7b73900ad66f9c0240b8f63d66008f/graphql-hive-client-0.26.0-alpha-20231103140036-43467e10.tgz","_integrity":"sha512-atcU7x9PJnmg9SOEIbTMnEP7sQ1uFFsy4pxUsta5pvDsd+y2IlDyYnp37Ydow1WqrOyUUE//kXf0XghcMz0QfQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.8.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.18.2","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.26.0-alpha-20231103140036-43467e10_1699020066241_0.8266145045457731","host":"s3://npm-registry-packages"}},"0.26.0-rc-20231103141956-0ab03423":{"name":"@graphql-hive/client","version":"0.26.0-rc-20231103141956-0ab03423","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.26.0-rc-20231103141956-0ab03423","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"1b7911b3ac58072f39ac13919410533e9a6b4fcc","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.26.0-rc-20231103141956-0ab03423.tgz","fileCount":60,"integrity":"sha512-pX0tb4uxtWxZU+QNPnQW4ReegimY2Zfvhc3J3NBkmnsM0j2QW75pPzYjtwVjlB3oHYH+4K197pI9l6/JhraUGw==","signatures":[{"sig":"MEUCIELaGuq/q51p1rjqQOvNVFWxv3WR9psE8xvLnkxUC45oAiEAgLTD10Q7CeLiRHUIxFkzosjeLJHxGDZ3fpEDZMHYSpk=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":204758},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.26.0-rc-20231103141956-0ab03423.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/d273d4f183ea1eafe0362d35df4865b0/graphql-hive-client-0.26.0-rc-20231103141956-0ab03423.tgz","_integrity":"sha512-pX0tb4uxtWxZU+QNPnQW4ReegimY2Zfvhc3J3NBkmnsM0j2QW75pPzYjtwVjlB3oHYH+4K197pI9l6/JhraUGw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.8.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.18.2","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.26.0-rc-20231103141956-0ab03423_1699021248979_0.03248777010754211","host":"s3://npm-registry-packages"}},"0.26.0-rc-20231103152855-629bebd4":{"name":"@graphql-hive/client","version":"0.26.0-rc-20231103152855-629bebd4","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.26.0-rc-20231103152855-629bebd4","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"f8ce5705c8297272c77c30dac2d4eb58ac44b77b","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.26.0-rc-20231103152855-629bebd4.tgz","fileCount":60,"integrity":"sha512-l3VIisXOfb5LRTqzd9pAnN7skT6E82l9u+y7aF6z3561BgumncFmzv85rw2TdCJl6ht3b7qa4wnRWKropsw3kw==","signatures":[{"sig":"MEYCIQCzfzJEyffC/1jAvbuRRWOMdPhX1KcuHQF40qaL+sFJcgIhAN+q7DQU3YUxxnW7IsZGWf1u3nqVFZfDiQQlatYJlTrj","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":204758},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.26.0-rc-20231103152855-629bebd4.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/547858605d2c7a76e29c5fef763549f7/graphql-hive-client-0.26.0-rc-20231103152855-629bebd4.tgz","_integrity":"sha512-l3VIisXOfb5LRTqzd9pAnN7skT6E82l9u+y7aF6z3561BgumncFmzv85rw2TdCJl6ht3b7qa4wnRWKropsw3kw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.8.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.18.2","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.26.0-rc-20231103152855-629bebd4_1699025383948_0.3861407084678996","host":"s3://npm-registry-packages"}},"0.26.0-alpha-20231103154051-62d3f475":{"name":"@graphql-hive/client","version":"0.26.0-alpha-20231103154051-62d3f475","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.26.0-alpha-20231103154051-62d3f475","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"d105251ab8da8a6c4c96702ee0f1b53ccb94e080","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.26.0-alpha-20231103154051-62d3f475.tgz","fileCount":60,"integrity":"sha512-PdF03Sv6QqxG8l3Z4H1QXCsKi0EX3DRNWSd9LgPxT4GycjZ8vfuxP4x53a4Gi1/jgnKxK3kWKGkEsDLOs8ZKQA==","signatures":[{"sig":"MEYCIQDhv3AWSEOeEH6zNBz3J/gM46lI+dxXmewiaa/rIS7PLQIhAMGvUjH6Fb4zfnvgDTULgcOnGyoDGoVuKToHoB7k35j2","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":204773},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.26.0-alpha-20231103154051-62d3f475.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/e1e019badc60472ec1ea1ecdab2fc08d/graphql-hive-client-0.26.0-alpha-20231103154051-62d3f475.tgz","_integrity":"sha512-PdF03Sv6QqxG8l3Z4H1QXCsKi0EX3DRNWSd9LgPxT4GycjZ8vfuxP4x53a4Gi1/jgnKxK3kWKGkEsDLOs8ZKQA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.8.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.18.2","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.26.0-alpha-20231103154051-62d3f475_1699026079593_0.22140510744823305","host":"s3://npm-registry-packages"}},"0.26.0-alpha-20231103154517-fa3cffa3":{"name":"@graphql-hive/client","version":"0.26.0-alpha-20231103154517-fa3cffa3","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.26.0-alpha-20231103154517-fa3cffa3","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"d87ec1401d746f6a8479340138197baae331683c","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.26.0-alpha-20231103154517-fa3cffa3.tgz","fileCount":60,"integrity":"sha512-Nv/09fgnvzDOKhjRhZ8HsQbeecXaKy96RNBwx8aYT/Z0dlXk6p1vM+jGSTiXd1sTzUhmhrluCA/lA0GjVtJwkw==","signatures":[{"sig":"MEUCIFdb8yIzlxQz7uLwFKcdd9TOM8UHtcFotTy2TJV5fV42AiEA0Q5tCcJfdNv1NCKFtkn6h2W8I1q/YVgi0UmvQYUbjbQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":204773},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.26.0-alpha-20231103154517-fa3cffa3.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/5db9af967185982b1a04e58e71136361/graphql-hive-client-0.26.0-alpha-20231103154517-fa3cffa3.tgz","_integrity":"sha512-Nv/09fgnvzDOKhjRhZ8HsQbeecXaKy96RNBwx8aYT/Z0dlXk6p1vM+jGSTiXd1sTzUhmhrluCA/lA0GjVtJwkw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.8.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.18.2","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.26.0-alpha-20231103154517-fa3cffa3_1699026366179_0.9384246693594507","host":"s3://npm-registry-packages"}},"0.26.0-alpha-20231103155216-cb406210":{"name":"@graphql-hive/client","version":"0.26.0-alpha-20231103155216-cb406210","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.26.0-alpha-20231103155216-cb406210","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"3712ba477bf2e4a74e4434937e59af008d1f3714","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.26.0-alpha-20231103155216-cb406210.tgz","fileCount":60,"integrity":"sha512-XaMILBbzAcLU78Z/I5pLv6zujDIIDeKKLjvI/zNeBW7vdv/SdwQDiLBVw4oRXu8lQLF7UIG0YKTUnCuQvOEBFA==","signatures":[{"sig":"MEUCIBVAKpm1nUM9HjWA7owlq+3Hyb6FxOQYyTiO/z7fQ9vTAiEAoGE93UqjKBmXbzjGfbStJXSnSN36xlZ+7YY9ZdwhLL8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":204773},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.26.0-alpha-20231103155216-cb406210.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/e6b64237a97187159f82ba605b5db91a/graphql-hive-client-0.26.0-alpha-20231103155216-cb406210.tgz","_integrity":"sha512-XaMILBbzAcLU78Z/I5pLv6zujDIIDeKKLjvI/zNeBW7vdv/SdwQDiLBVw4oRXu8lQLF7UIG0YKTUnCuQvOEBFA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.8.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.18.2","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.26.0-alpha-20231103155216-cb406210_1699026775314_0.680072818705544","host":"s3://npm-registry-packages"}},"0.26.0-alpha-20231103160019-3dfb685c":{"name":"@graphql-hive/client","version":"0.26.0-alpha-20231103160019-3dfb685c","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.26.0-alpha-20231103160019-3dfb685c","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"7d224424186d15d4b411acb0d352d3a7ab4c4e7a","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.26.0-alpha-20231103160019-3dfb685c.tgz","fileCount":60,"integrity":"sha512-4n9B3UB47iH0l1BnXLFzQe/c1cCQbfQV6gw8trhFekdb/DpGyRXIiDhdBjjylJWzKf/nuiKo9aEDQM8XOZ5vkQ==","signatures":[{"sig":"MEYCIQDKb7Q+EtKHfnCOzQXnM9DEcR1Fg44SJRQrdxC+lgOHzQIhAJhlSIFq8kicH33JWyDwe6euNww8u1h/6BKzX3yuvV9r","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":204773},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.26.0-alpha-20231103160019-3dfb685c.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/8e303d347df42b4c7f24357af47ebb2d/graphql-hive-client-0.26.0-alpha-20231103160019-3dfb685c.tgz","_integrity":"sha512-4n9B3UB47iH0l1BnXLFzQe/c1cCQbfQV6gw8trhFekdb/DpGyRXIiDhdBjjylJWzKf/nuiKo9aEDQM8XOZ5vkQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.8.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.18.2","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.26.0-alpha-20231103160019-3dfb685c_1699027249353_0.03789711787346062","host":"s3://npm-registry-packages"}},"0.26.0-alpha-20231103160335-5db3de26":{"name":"@graphql-hive/client","version":"0.26.0-alpha-20231103160335-5db3de26","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.26.0-alpha-20231103160335-5db3de26","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"adeff3e1cf7626860f3e5cbc3d826b88bd9a6a25","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.26.0-alpha-20231103160335-5db3de26.tgz","fileCount":60,"integrity":"sha512-tU+ORq3SD0oTJ+Rm6fYjDw9h48Y/Bzpdg4eYOJwROCI5xupljLLopv8X9S2N7u+gdcyY+sXj2kTqMyPSl1gUwA==","signatures":[{"sig":"MEQCIHoWN30GahFa9+I0KiOmLWwrb1rbEoM9+T1Qxv0y4QYvAiBwUTmxMUlQkmQg3Jo2enzZ2Qv7vxX4JCZ8NkzyJzLzAw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":204773},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.26.0-alpha-20231103160335-5db3de26.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/d8fb240f57fad631b4a307e9bc845eb3/graphql-hive-client-0.26.0-alpha-20231103160335-5db3de26.tgz","_integrity":"sha512-tU+ORq3SD0oTJ+Rm6fYjDw9h48Y/Bzpdg4eYOJwROCI5xupljLLopv8X9S2N7u+gdcyY+sXj2kTqMyPSl1gUwA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.8.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.18.2","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.26.0-alpha-20231103160335-5db3de26_1699027466814_0.021309707206931483","host":"s3://npm-registry-packages"}},"0.26.0-alpha-20231103160704-9f667371":{"name":"@graphql-hive/client","version":"0.26.0-alpha-20231103160704-9f667371","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.26.0-alpha-20231103160704-9f667371","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"66637cf455bb30a2bd66d90736a6fb7a6d7dc294","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.26.0-alpha-20231103160704-9f667371.tgz","fileCount":60,"integrity":"sha512-m6vBXasGNgosx48lMOiNM0dvLLnukwn5siiY4/RZpaVN/hLKEv4WzUX4FFB7Cjky0qsTimK6L83etnZPlpfuUQ==","signatures":[{"sig":"MEYCIQDjXIgGVfz3lrDoIbmkbVw1tQd5DciCj+fVtv8+LX/B6QIhAKKCnrUOAxAtqKMDuEQWmiRv3U3/Xx61rBgIILLBKV7R","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":204773},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.26.0-alpha-20231103160704-9f667371.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/2608d7cab04e08a283282a42177d5ddf/graphql-hive-client-0.26.0-alpha-20231103160704-9f667371.tgz","_integrity":"sha512-m6vBXasGNgosx48lMOiNM0dvLLnukwn5siiY4/RZpaVN/hLKEv4WzUX4FFB7Cjky0qsTimK6L83etnZPlpfuUQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.8.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.18.2","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.26.0-alpha-20231103160704-9f667371_1699027653169_0.6301211007258423","host":"s3://npm-registry-packages"}},"0.26.0":{"name":"@graphql-hive/client","version":"0.26.0","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.26.0","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"6f70edafdfdf338bf566e978c2a126fcb28f977f","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.26.0.tgz","fileCount":60,"integrity":"sha512-oPygB1DjChXsAMLJbmpUDRURlqRXLQOddmwxujZg1QU+sLJiR3GI61lMl9KCFZu4CgUeY1oVQg0oYHp3JwUPtQ==","signatures":[{"sig":"MEUCIQDNGG/Ug+BAgU0cfyIAssOCEYFlhDrGjeAr5tgLFELWqAIgZsiU9TUiHdz8FI/HUW7/XCiXbpxGJuKcXvbpxPjRR/Q=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":204623},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.26.0.tgz","module":"esm/index.js","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/30025b583fb8ce3078956dda753dbfcd/graphql-hive-client-0.26.0.tgz","_integrity":"sha512-oPygB1DjChXsAMLJbmpUDRURlqRXLQOddmwxujZg1QU+sLJiR3GI61lMl9KCFZu4CgUeY1oVQg0oYHp3JwUPtQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.8.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.18.2","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.26.0_1699027868599_0.5183337544433215","host":"s3://npm-registry-packages"}},"0.26.0-alpha-20231103161227-65452cb6":{"name":"@graphql-hive/client","version":"0.26.0-alpha-20231103161227-65452cb6","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.26.0-alpha-20231103161227-65452cb6","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"138019537c53ca241a41af6273c16be9e36dc70a","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.26.0-alpha-20231103161227-65452cb6.tgz","fileCount":60,"integrity":"sha512-dhw7yPB66ehkmfdaKzkzKDoN0pAK2hC/luJZG2BSWxUdvaFYSZ0wzPlSdlEvt3hTfo9fSLRsdGKgxuwP1MJAoA==","signatures":[{"sig":"MEUCIGS/vj6ASBA9lhhaVVO0k536kE3DlX67LyzX2m8VTIDjAiEAyk9UwzqSFpUZ94HDBld+h+tc1iVx8e6gdxFez42WPnk=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":204773},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.26.0-alpha-20231103161227-65452cb6.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/be1edfff5282ec4859243c88a97c9c19/graphql-hive-client-0.26.0-alpha-20231103161227-65452cb6.tgz","_integrity":"sha512-dhw7yPB66ehkmfdaKzkzKDoN0pAK2hC/luJZG2BSWxUdvaFYSZ0wzPlSdlEvt3hTfo9fSLRsdGKgxuwP1MJAoA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.8.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.18.2","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.26.0-alpha-20231103161227-65452cb6_1699028001921_0.9378239101117516","host":"s3://npm-registry-packages"}},"0.26.0-alpha-20231103163951-edce4bf0":{"name":"@graphql-hive/client","version":"0.26.0-alpha-20231103163951-edce4bf0","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.26.0-alpha-20231103163951-edce4bf0","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"f440506d2b177fb3cf8975b48df2a7cf8ef9758a","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.26.0-alpha-20231103163951-edce4bf0.tgz","fileCount":60,"integrity":"sha512-peAj5TKrUKLHvIScnFzh7k/h0zPi4iRCZoM1Fmk4HC8YOKH3f+GDE4AsclXqftQO8+ULYmnIa6rgTIDwmmfHQw==","signatures":[{"sig":"MEUCIDE2zE4IbVLOUl1cIlRdZbJJSWRUz2uG4IOlEx9ZVr07AiEAmy62/CmkI7uR0DCxKpK6pBxwxveq4HyT713SKRx7d+U=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":204773},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.26.0-alpha-20231103163951-edce4bf0.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/18075ffc85ab9f08280a81fdbecd0a1b/graphql-hive-client-0.26.0-alpha-20231103163951-edce4bf0.tgz","_integrity":"sha512-peAj5TKrUKLHvIScnFzh7k/h0zPi4iRCZoM1Fmk4HC8YOKH3f+GDE4AsclXqftQO8+ULYmnIa6rgTIDwmmfHQw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.8.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.18.2","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.26.0-alpha-20231103163951-edce4bf0_1699029631798_0.378613653927685","host":"s3://npm-registry-packages"}},"0.26.0-alpha-20231106125332-f4f34253":{"name":"@graphql-hive/client","version":"0.26.0-alpha-20231106125332-f4f34253","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.26.0-alpha-20231106125332-f4f34253","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"74d38098201cefb3373c49b6e2b274c06cf10452","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.26.0-alpha-20231106125332-f4f34253.tgz","fileCount":60,"integrity":"sha512-JahkQ3NDXr8toB+PadK8xIHZrFHvzEJya6+UOqD0pBuuN0IvKCzia42IOxhzYDoCr2XHXKFI+wQq0f/sd5MSjQ==","signatures":[{"sig":"MEUCIHsVz52YECp9uymk70icJuzlr94z/KGoNS4NG7qi0ZJWAiEAqF7G4Kv3LSW8AZs1MHC++b5cfXC5aXtpRoMchfZgACw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":204773},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.26.0-alpha-20231106125332-f4f34253.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/1eb49d6fab6f6296fe2804fb77453652/graphql-hive-client-0.26.0-alpha-20231106125332-f4f34253.tgz","_integrity":"sha512-JahkQ3NDXr8toB+PadK8xIHZrFHvzEJya6+UOqD0pBuuN0IvKCzia42IOxhzYDoCr2XHXKFI+wQq0f/sd5MSjQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.8.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.18.2","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.26.0-alpha-20231106125332-f4f34253_1699275252599_0.05187591755331278","host":"s3://npm-registry-packages"}},"0.27.0-alpha-20231108152420-6fcdec9f":{"name":"@graphql-hive/client","version":"0.27.0-alpha-20231108152420-6fcdec9f","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.27.0-alpha-20231108152420-6fcdec9f","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"c12ccd432b8d713eae601226a6e28c6dc0b1acc5","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.27.0-alpha-20231108152420-6fcdec9f.tgz","fileCount":60,"integrity":"sha512-2YLLAdRuAL/xtrA2RARM6BNI+wEohmHCNWfUuFlpgEiQW1XoansWQxvxU3JnzJmiC90XDCpQpmF4Sgt+nYhOdQ==","signatures":[{"sig":"MEQCIBk4wPL0bq0KnF/1OPGoGZIsGdT1Ea5TPFXmF55WHmeYAiATNt/I8okjnlzljYA1qHN5I29k0z3E+giljxEtpQ/7Dw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":207952},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.27.0-alpha-20231108152420-6fcdec9f.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/d44bbc70c4afe252ebb2063a926e1ce3/graphql-hive-client-0.27.0-alpha-20231108152420-6fcdec9f.tgz","_integrity":"sha512-2YLLAdRuAL/xtrA2RARM6BNI+wEohmHCNWfUuFlpgEiQW1XoansWQxvxU3JnzJmiC90XDCpQpmF4Sgt+nYhOdQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.8.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.18.2","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.27.0-alpha-20231108152420-6fcdec9f_1699457089769_0.9118299934313479","host":"s3://npm-registry-packages"}},"0.27.0-alpha-20231108155352-6d9f32aa":{"name":"@graphql-hive/client","version":"0.27.0-alpha-20231108155352-6d9f32aa","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.27.0-alpha-20231108155352-6d9f32aa","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"62b042b54983790e92d4ba33761dae86d2af2c68","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.27.0-alpha-20231108155352-6d9f32aa.tgz","fileCount":64,"integrity":"sha512-O+qfWVlR+Q0lcJx7XslVwBSu3N9okPaZrBa/1bjDJgyNRvHCU/oF0B+BPoWDcJg1V/nCklwq0uTa/0ZSpFYpfA==","signatures":[{"sig":"MEUCIDmjeBU7l1fgjBrCh12zwFw0EWqpGjSJTqbCMmCbiHm7AiEA3Ng93VUP0FuvzdwmT3umZ5387lHpajwcVHp2ckfUWEg=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":210602},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.27.0-alpha-20231108155352-6d9f32aa.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/0355e66e3335f731a0d7ba422203b686/graphql-hive-client-0.27.0-alpha-20231108155352-6d9f32aa.tgz","_integrity":"sha512-O+qfWVlR+Q0lcJx7XslVwBSu3N9okPaZrBa/1bjDJgyNRvHCU/oF0B+BPoWDcJg1V/nCklwq0uTa/0ZSpFYpfA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.8.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.18.2","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.27.0-alpha-20231108155352-6d9f32aa_1699458862964_0.1395951405252729","host":"s3://npm-registry-packages"}},"0.27.0-alpha-20231109082711-3ec3cf5b":{"name":"@graphql-hive/client","version":"0.27.0-alpha-20231109082711-3ec3cf5b","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.27.0-alpha-20231109082711-3ec3cf5b","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"60ddaa44cc991039371c9266afcaab72e429f9a2","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.27.0-alpha-20231109082711-3ec3cf5b.tgz","fileCount":64,"integrity":"sha512-6V1AQTAIbykyBjNmVK7j4aFRuhDPgalW9ESXyelwXZG9kueRRu0ErWS4fap5edQWm2PaRpXX08RDGZiGR6MTdQ==","signatures":[{"sig":"MEUCIQCYUwiOvrw0N/PX20afQNzNf7kN2Zmb+wHo93uwDrLirQIgNLDWszrJdtfv0/KTDllDGNfQ8dcQRcfZrq++hKVbWto=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":212780},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.27.0-alpha-20231109082711-3ec3cf5b.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/cdb8cb3a677846f0b59d8261e5faa6ba/graphql-hive-client-0.27.0-alpha-20231109082711-3ec3cf5b.tgz","_integrity":"sha512-6V1AQTAIbykyBjNmVK7j4aFRuhDPgalW9ESXyelwXZG9kueRRu0ErWS4fap5edQWm2PaRpXX08RDGZiGR6MTdQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.8.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.18.2","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.27.0-alpha-20231109082711-3ec3cf5b_1699518486082_0.9724358495300642","host":"s3://npm-registry-packages"}},"0.27.0-rc-20231205091621-f0bfe8fcdf28de5264bbfa2e733c862020bbdcf5":{"name":"@graphql-hive/client","version":"0.27.0-rc-20231205091621-f0bfe8fcdf28de5264bbfa2e733c862020bbdcf5","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.27.0-rc-20231205091621-f0bfe8fcdf28de5264bbfa2e733c862020bbdcf5","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"61c21b5b9491ed4fbd67974798642f72f1d659cc","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.27.0-rc-20231205091621-f0bfe8fcdf28de5264bbfa2e733c862020bbdcf5.tgz","fileCount":64,"integrity":"sha512-ofAUELrUfaT1GK+rHXJh5qZslE2HbvUUdYY8xfVYxeok62iCH03yeRygXMmH2fljfj/U/Tb47Y5bqKHWRoeoiw==","signatures":[{"sig":"MEQCIA1F5UAoU/p3GtxFpGFENYJ5cey/2I24nkuE5Sjn8k1aAiBj9rMtd6L6JjY0bciIyw2ERS8GseecfRfYkjNKIisvXg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":214639},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.27.0-rc-20231205091621-f0bfe8fcdf28de5264bbfa2e733c862020bbdcf5.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/75d187e98257e98a2606372bcf7ed883/graphql-hive-client-0.27.0-rc-20231205091621-f0bfe8fcdf28de5264bbfa2e733c862020bbdcf5.tgz","_integrity":"sha512-ofAUELrUfaT1GK+rHXJh5qZslE2HbvUUdYY8xfVYxeok62iCH03yeRygXMmH2fljfj/U/Tb47Y5bqKHWRoeoiw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.8.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.18.2","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.27.0-rc-20231205091621-f0bfe8fcdf28de5264bbfa2e733c862020bbdcf5_1701767809176_0.3760177749369584","host":"s3://npm-registry-packages"}},"0.27.0-alpha-20231205092100-147c8f01e68f74e8f0033eedd750bd1c9a6484c9":{"name":"@graphql-hive/client","version":"0.27.0-alpha-20231205092100-147c8f01e68f74e8f0033eedd750bd1c9a6484c9","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.27.0-alpha-20231205092100-147c8f01e68f74e8f0033eedd750bd1c9a6484c9","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"42f07ddce064fca7b660d4c0bf12633c6661681b","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.27.0-alpha-20231205092100-147c8f01e68f74e8f0033eedd750bd1c9a6484c9.tgz","fileCount":64,"integrity":"sha512-4dHxHILJ+64QttMqyNXlOmjXiYGEokCRRPMnu5z8RMdJFnkvtObp9qyk9pexxRs4+ungX5tQfpWIg+3YH6D2VQ==","signatures":[{"sig":"MEUCIQDXrfskgHhf9ZsQ0bg75UHQckx3ZXDe7XT0SlKgmIk0mQIgHy+mli6olkfCxSr1W8En/XoF2eVWF48J7tHfMPoooBw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":214654},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.27.0-alpha-20231205092100-147c8f01e68f74e8f0033eedd750bd1c9a6484c9.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/39be5a5fce2279d36180577d8d5583d7/graphql-hive-client-0.27.0-alpha-20231205092100-147c8f01e68f74e8f0033eedd750bd1c9a6484c9.tgz","_integrity":"sha512-4dHxHILJ+64QttMqyNXlOmjXiYGEokCRRPMnu5z8RMdJFnkvtObp9qyk9pexxRs4+ungX5tQfpWIg+3YH6D2VQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.8.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.18.2","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.27.0-alpha-20231205092100-147c8f01e68f74e8f0033eedd750bd1c9a6484c9_1701768088797_0.24679803180112625","host":"s3://npm-registry-packages"}},"0.27.0-alpha-20231205093716-3c32205bc2a9a67c378a664f5050d55785f3da6e":{"name":"@graphql-hive/client","version":"0.27.0-alpha-20231205093716-3c32205bc2a9a67c378a664f5050d55785f3da6e","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.27.0-alpha-20231205093716-3c32205bc2a9a67c378a664f5050d55785f3da6e","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"eef3a94d76088f04e1ae1cae7a35bb560ac3911f","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.27.0-alpha-20231205093716-3c32205bc2a9a67c378a664f5050d55785f3da6e.tgz","fileCount":64,"integrity":"sha512-ZLqq3GYGfHfYD78Qdw+b0X71nsCbb1jcijipQM4dV5I/WLSuZZ3jLjSaX70NVWrcCieDfKYKY14DnoujRDyeBg==","signatures":[{"sig":"MEYCIQCvVvq7U5PfnHiLCpwNSyE9EAtHABGLz3T/LGmcOPo4FAIhAPXmIAUvuV5ZJXgpzLw+8URUsoY699nQL0f/8dJhZBAT","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":214654},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.27.0-alpha-20231205093716-3c32205bc2a9a67c378a664f5050d55785f3da6e.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/60011df68282d28ad9b2203f15ddba5f/graphql-hive-client-0.27.0-alpha-20231205093716-3c32205bc2a9a67c378a664f5050d55785f3da6e.tgz","_integrity":"sha512-ZLqq3GYGfHfYD78Qdw+b0X71nsCbb1jcijipQM4dV5I/WLSuZZ3jLjSaX70NVWrcCieDfKYKY14DnoujRDyeBg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.8.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.18.2","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.27.0-alpha-20231205093716-3c32205bc2a9a67c378a664f5050d55785f3da6e_1701769064643_0.2701093669202035","host":"s3://npm-registry-packages"}},"0.27.0-alpha-20231205094359-17c20b7e1304e25ba81ac5d1cf16bf5bc922cfa9":{"name":"@graphql-hive/client","version":"0.27.0-alpha-20231205094359-17c20b7e1304e25ba81ac5d1cf16bf5bc922cfa9","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.27.0-alpha-20231205094359-17c20b7e1304e25ba81ac5d1cf16bf5bc922cfa9","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"e28a36c731a628af8419c5a1ad83dc3a6eaa141b","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.27.0-alpha-20231205094359-17c20b7e1304e25ba81ac5d1cf16bf5bc922cfa9.tgz","fileCount":64,"integrity":"sha512-Ml+WpC+kApXfZ9NoX8PKLjNe1zWoao3DBFLrxEVDwtITkH/6i2jhVrvJDSV398PKAcID8Ya44tWCuDz331ScvQ==","signatures":[{"sig":"MEUCIQChZsmcdyYonV6IiiSqvYIpTRV83eFnt7h4uifIqEwnWQIgRVFz+eIsmjzn/BIUYWI2yUvMSL4RKbTT3mqGRTYXFrI=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":218470},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.27.0-alpha-20231205094359-17c20b7e1304e25ba81ac5d1cf16bf5bc922cfa9.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/3f463af1f02188769f3eb66013d04a50/graphql-hive-client-0.27.0-alpha-20231205094359-17c20b7e1304e25ba81ac5d1cf16bf5bc922cfa9.tgz","_integrity":"sha512-Ml+WpC+kApXfZ9NoX8PKLjNe1zWoao3DBFLrxEVDwtITkH/6i2jhVrvJDSV398PKAcID8Ya44tWCuDz331ScvQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.8.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.18.2","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.27.0-alpha-20231205094359-17c20b7e1304e25ba81ac5d1cf16bf5bc922cfa9_1701769468957_0.4936393750989392","host":"s3://npm-registry-packages"}},"0.27.0-alpha-20231205101758-af91ac0d6fb47661e03e5fa74e9680c8cce36519":{"name":"@graphql-hive/client","version":"0.27.0-alpha-20231205101758-af91ac0d6fb47661e03e5fa74e9680c8cce36519","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.27.0-alpha-20231205101758-af91ac0d6fb47661e03e5fa74e9680c8cce36519","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"d06b87e741ea70464395ca0e0ea43aba3934be86","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.27.0-alpha-20231205101758-af91ac0d6fb47661e03e5fa74e9680c8cce36519.tgz","fileCount":64,"integrity":"sha512-K1TUkbwb1MXSgxngAAm3LGy/8TYDN4wia1XzTJKIh3YU/FN38pPZvX0BQV+fvnN1gvG/zaNEqnev7cbHlsqA9A==","signatures":[{"sig":"MEUCIF6cUICppbgayrX13K54xlXbRzG5/j/z378nBVuJPoqoAiEApKBIsmE0XM6vjfgd4lDxITC6nWtzQILS+UELMJYv3ys=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":218470},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.27.0-alpha-20231205101758-af91ac0d6fb47661e03e5fa74e9680c8cce36519.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/7314ab974ef3781300d41ce14ce47629/graphql-hive-client-0.27.0-alpha-20231205101758-af91ac0d6fb47661e03e5fa74e9680c8cce36519.tgz","_integrity":"sha512-K1TUkbwb1MXSgxngAAm3LGy/8TYDN4wia1XzTJKIh3YU/FN38pPZvX0BQV+fvnN1gvG/zaNEqnev7cbHlsqA9A==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.8.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.18.2","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.27.0-alpha-20231205101758-af91ac0d6fb47661e03e5fa74e9680c8cce36519_1701771507148_0.3215966311327676","host":"s3://npm-registry-packages"}},"0.27.0-rc-20231205105656-459012e657575a39f5824b014298fdf09be4c664":{"name":"@graphql-hive/client","version":"0.27.0-rc-20231205105656-459012e657575a39f5824b014298fdf09be4c664","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.27.0-rc-20231205105656-459012e657575a39f5824b014298fdf09be4c664","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"e13af7f50fe56f03f30909960aa9cb2e7f957dde","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.27.0-rc-20231205105656-459012e657575a39f5824b014298fdf09be4c664.tgz","fileCount":64,"integrity":"sha512-YzyD7sr+iAGeJjX9NAc59n64nlggf6NXdRbEkn50H0ZZGV7kVnE62G5hutLhZurB90IwJ6ys8GSgILZvolbVaA==","signatures":[{"sig":"MEUCIQC6fsQ8AiqsLTP+lrmhSiqE/rwe9I6Ytmv1XnAkXZFkiQIgFV5qjF6Z6kmnmbJ9k/hDU82ZrUvV7AnKslw2pZPRYrM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":218455},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.27.0-rc-20231205105656-459012e657575a39f5824b014298fdf09be4c664.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/a6a5e6eac6a6ed30c98da0a373cf0bb1/graphql-hive-client-0.27.0-rc-20231205105656-459012e657575a39f5824b014298fdf09be4c664.tgz","_integrity":"sha512-YzyD7sr+iAGeJjX9NAc59n64nlggf6NXdRbEkn50H0ZZGV7kVnE62G5hutLhZurB90IwJ6ys8GSgILZvolbVaA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.8.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.18.2","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.27.0-rc-20231205105656-459012e657575a39f5824b014298fdf09be4c664_1701773845854_0.5666140468597443","host":"s3://npm-registry-packages"}},"0.27.0":{"name":"@graphql-hive/client","version":"0.27.0","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.27.0","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"ba9510e0f733fc9001d92e5008bb64254a75d4eb","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.27.0.tgz","fileCount":64,"integrity":"sha512-o1NpC2Cq0A65EUw1h3lDcRMw2GjGFq3t1xg+rsHONc57terN5TrqV6AsfajQy//S4vYGS3zZBfrEGCIGJmS3Uw==","signatures":[{"sig":"MEYCIQDrUpYP0CZxlXu5F5D0w7x5eM72fZVhQg318AGMfnyMcAIhAIq649kLEixchIxjPPdZYGVSLu+8u1PN5F2xAoL41qy6","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":218160},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.27.0.tgz","module":"esm/index.js","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/9466298cb304b4638a51bb39b8f003a0/graphql-hive-client-0.27.0.tgz","_integrity":"sha512-o1NpC2Cq0A65EUw1h3lDcRMw2GjGFq3t1xg+rsHONc57terN5TrqV6AsfajQy//S4vYGS3zZBfrEGCIGJmS3Uw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.8.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.18.2","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.27.0_1701776810825_0.19733958058771295","host":"s3://npm-registry-packages"}},"0.28.0-alpha-20231214083356-6eb8b2b7517382eb835291f089a40d7a791a5343":{"name":"@graphql-hive/client","version":"0.28.0-alpha-20231214083356-6eb8b2b7517382eb835291f089a40d7a791a5343","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.28.0-alpha-20231214083356-6eb8b2b7517382eb835291f089a40d7a791a5343","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"1f89187a36fc2b37c3b6b165cd0db64a7819ca48","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.28.0-alpha-20231214083356-6eb8b2b7517382eb835291f089a40d7a791a5343.tgz","fileCount":64,"integrity":"sha512-ilQRmM7ojfAzPMgKTR7/K6s1KHnc2d1Vtlvu4NJxzXPR2H7UUczZ6AzMCbGZv8GGfQ7OkkkFbF9iIZvvgho/yg==","signatures":[{"sig":"MEUCICzhOxJzRqz4ZwoeLMOScQlGTlHQiBa51kumGb9ydF59AiEAtquZ7T1K4afVWuZ8CypFPO4I3CUcnyaOvO3EcSIgVpk=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":219198},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.28.0-alpha-20231214083356-6eb8b2b7517382eb835291f089a40d7a791a5343.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/1ef5590ee222b3c9ef96ac47ac7f00de/graphql-hive-client-0.28.0-alpha-20231214083356-6eb8b2b7517382eb835291f089a40d7a791a5343.tgz","_integrity":"sha512-ilQRmM7ojfAzPMgKTR7/K6s1KHnc2d1Vtlvu4NJxzXPR2H7UUczZ6AzMCbGZv8GGfQ7OkkkFbF9iIZvvgho/yg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.2.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.19.0","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.28.0-alpha-20231214083356-6eb8b2b7517382eb835291f089a40d7a791a5343_1702542864368_0.27026226488219063","host":"s3://npm-registry-packages"}},"0.28.0-rc-20231214085001-6757efe085e3670fd9477adab05b2dfefdeb0482":{"name":"@graphql-hive/client","version":"0.28.0-rc-20231214085001-6757efe085e3670fd9477adab05b2dfefdeb0482","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.28.0-rc-20231214085001-6757efe085e3670fd9477adab05b2dfefdeb0482","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"c91fc825e0a531519ce877b63f69016611dd095d","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.28.0-rc-20231214085001-6757efe085e3670fd9477adab05b2dfefdeb0482.tgz","fileCount":64,"integrity":"sha512-zNpvXDHtgGp78n7xg+GanSX0EJAUhl8QzLcggbB8lQTUbOmS7oOcOFVU9dwB4UFqipNDXqOJXh+DQac4/FyRLQ==","signatures":[{"sig":"MEUCIFyefhsh2n1TvbLSL8/N6d8zE+oKzYU97pP1qJapOlPlAiEAmImnEiDTPdiQjCAp9Qp8NIallknCSBYGrdu5qUazzsw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":219183},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.28.0-rc-20231214085001-6757efe085e3670fd9477adab05b2dfefdeb0482.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/c0eab5d6c4a3cd07a6a8eadd36792a0e/graphql-hive-client-0.28.0-rc-20231214085001-6757efe085e3670fd9477adab05b2dfefdeb0482.tgz","_integrity":"sha512-zNpvXDHtgGp78n7xg+GanSX0EJAUhl8QzLcggbB8lQTUbOmS7oOcOFVU9dwB4UFqipNDXqOJXh+DQac4/FyRLQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.2.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.19.0","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.28.0-rc-20231214085001-6757efe085e3670fd9477adab05b2dfefdeb0482_1702543827724_0.54579153887005","host":"s3://npm-registry-packages"}},"0.28.0-alpha-20231214085646-5f24f0e62f834769c0feeddab2bf560d057eb5e3":{"name":"@graphql-hive/client","version":"0.28.0-alpha-20231214085646-5f24f0e62f834769c0feeddab2bf560d057eb5e3","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.28.0-alpha-20231214085646-5f24f0e62f834769c0feeddab2bf560d057eb5e3","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"350ea8c950da7f3f483331652d4e1e1588e9ceec","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.28.0-alpha-20231214085646-5f24f0e62f834769c0feeddab2bf560d057eb5e3.tgz","fileCount":64,"integrity":"sha512-rpRaJzcIMm1xHeVDBC1nvgwx5/LTQzFTgjaTiR/E7F/jGgJVj8KNkxdH7Ehena6WWJ7xaYdIixCibTeXb00cnA==","signatures":[{"sig":"MEYCIQDilKv6/8yBeRQJicmx4yJFezyfMkRHVOBGBAiIP2+qbAIhAMHq7NpwNtL6QYEUvC9yrJPluLo58HB06FluTrRMeowp","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":219198},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.28.0-alpha-20231214085646-5f24f0e62f834769c0feeddab2bf560d057eb5e3.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/83cdece4bcb37972669af144f39435ce/graphql-hive-client-0.28.0-alpha-20231214085646-5f24f0e62f834769c0feeddab2bf560d057eb5e3.tgz","_integrity":"sha512-rpRaJzcIMm1xHeVDBC1nvgwx5/LTQzFTgjaTiR/E7F/jGgJVj8KNkxdH7Ehena6WWJ7xaYdIixCibTeXb00cnA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.2.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.19.0","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.28.0-alpha-20231214085646-5f24f0e62f834769c0feeddab2bf560d057eb5e3_1702544234485_0.2607894474163013","host":"s3://npm-registry-packages"}},"0.28.0-rc-20231214090055-75aac203329eab5765674f72db0e0542d7ec246e":{"name":"@graphql-hive/client","version":"0.28.0-rc-20231214090055-75aac203329eab5765674f72db0e0542d7ec246e","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.28.0-rc-20231214090055-75aac203329eab5765674f72db0e0542d7ec246e","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"a53c6591c0a158d4532305444ca0635236e78b05","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.28.0-rc-20231214090055-75aac203329eab5765674f72db0e0542d7ec246e.tgz","fileCount":64,"integrity":"sha512-gfnvrYzMt2PNKxfZ0GzVm2l/LiWmsvo7lLCBTm06fXOWJnsddc79lffT9PxUcahwA3xdMXlB/D9PxEuKTql5gw==","signatures":[{"sig":"MEUCIH48C86xmJAV85k7/gtmKWfsp1KUNHJlf4wFIdXomGqkAiEA2he5+vgnl1f73F6aEZ2CFetWgNyyGzW2DJEeWDyk2PY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":219183},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.28.0-rc-20231214090055-75aac203329eab5765674f72db0e0542d7ec246e.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/c2cd5d2bec55bca082a3fa941e7366ca/graphql-hive-client-0.28.0-rc-20231214090055-75aac203329eab5765674f72db0e0542d7ec246e.tgz","_integrity":"sha512-gfnvrYzMt2PNKxfZ0GzVm2l/LiWmsvo7lLCBTm06fXOWJnsddc79lffT9PxUcahwA3xdMXlB/D9PxEuKTql5gw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.2.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.19.0","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.28.0-rc-20231214090055-75aac203329eab5765674f72db0e0542d7ec246e_1702544482686_0.5717286370524914","host":"s3://npm-registry-packages"}},"0.28.0":{"name":"@graphql-hive/client","version":"0.28.0","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.28.0","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"5db0c3fc4f5cb9e99afacba4ca72bf292e5d3039","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.28.0.tgz","fileCount":64,"integrity":"sha512-8+3gDCQ8yGE2Jotk1N2VYHTCalwaHlS/u4JJSw8k2oyiL/73v9zCOdA3T1swe4QWNCDktZD2CII1jvqTVh3svA==","signatures":[{"sig":"MEYCIQD10J0izFPkxe2RwbtpGnK4xZ5xcHSSleeWdBuV9K/JsgIhAKcidlK2xOi4GKQmbx8lgs+6q+qvqy2SCFG594ayOZUZ","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":218888},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.28.0.tgz","module":"esm/index.js","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/b4d2141002d190972ecbb715d29865af/graphql-hive-client-0.28.0.tgz","_integrity":"sha512-8+3gDCQ8yGE2Jotk1N2VYHTCalwaHlS/u4JJSw8k2oyiL/73v9zCOdA3T1swe4QWNCDktZD2CII1jvqTVh3svA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.8.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.18.2","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.28.0_1702545177002_0.06291046618056728","host":"s3://npm-registry-packages"}},"0.28.1-alpha-20240116110654-26801bd2110783c5ac87243b7cc730d97c5e440a":{"name":"@graphql-hive/client","version":"0.28.1-alpha-20240116110654-26801bd2110783c5ac87243b7cc730d97c5e440a","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.28.1-alpha-20240116110654-26801bd2110783c5ac87243b7cc730d97c5e440a","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"d1200236f99dc913784e7b47676f7aae684a470c","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.28.1-alpha-20240116110654-26801bd2110783c5ac87243b7cc730d97c5e440a.tgz","fileCount":64,"integrity":"sha512-Jof+83Yo8W88DzFS60TIXgg4PB0dPIoHJ89slJG17SYUNgO9NcaAFCV21pIptNhlmX5a/XAcZuG7261b3L4irw==","signatures":[{"sig":"MEUCIQD72NbD3QZ7gaCYK9wimwyiyDxUT0ctx/73o7cZHKH1TAIgWzghF0OQobdESjjDB8VUF9IkKoienVLcCzkBHiCYw0Q=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":219320},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.28.1-alpha-20240116110654-26801bd2110783c5ac87243b7cc730d97c5e440a.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/4a9cb40ca94f6bf0ff1204bb1961e9d0/graphql-hive-client-0.28.1-alpha-20240116110654-26801bd2110783c5ac87243b7cc730d97c5e440a.tgz","_integrity":"sha512-Jof+83Yo8W88DzFS60TIXgg4PB0dPIoHJ89slJG17SYUNgO9NcaAFCV21pIptNhlmX5a/XAcZuG7261b3L4irw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.2.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.19.0","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.28.1-alpha-20240116110654-26801bd2110783c5ac87243b7cc730d97c5e440a_1705403242066_0.38640460277436817","host":"s3://npm-registry-packages"}},"0.28.1-alpha-20240116111445-1f3909f5589ce42c9b4310fd6d9d838190f2c2ef":{"name":"@graphql-hive/client","version":"0.28.1-alpha-20240116111445-1f3909f5589ce42c9b4310fd6d9d838190f2c2ef","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.28.1-alpha-20240116111445-1f3909f5589ce42c9b4310fd6d9d838190f2c2ef","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"9e06b5751532f7d05b8385c071087abbdd1d67b1","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.28.1-alpha-20240116111445-1f3909f5589ce42c9b4310fd6d9d838190f2c2ef.tgz","fileCount":64,"integrity":"sha512-qn1ZkR5NZlQHIsiAVxEC7NnQ6VAYHLQOxK+FpntLw/yFo/u/gAxAyD9XSWpXkRpvHo8FcBiZOwMLxAQKgv0Ykg==","signatures":[{"sig":"MEUCIQDiZFTdoloPPRMtI4cLQSvLam3quIFdghpE6aTfGBCV5gIgI+w9YOMXJ9D8RrRoQ86FM0zMUMRIXLqmXdMcBvZ/V4w=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":219568},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.28.1-alpha-20240116111445-1f3909f5589ce42c9b4310fd6d9d838190f2c2ef.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/8bfc14ea0974cd458431e00b1123f271/graphql-hive-client-0.28.1-alpha-20240116111445-1f3909f5589ce42c9b4310fd6d9d838190f2c2ef.tgz","_integrity":"sha512-qn1ZkR5NZlQHIsiAVxEC7NnQ6VAYHLQOxK+FpntLw/yFo/u/gAxAyD9XSWpXkRpvHo8FcBiZOwMLxAQKgv0Ykg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.2.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.19.0","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.28.1-alpha-20240116111445-1f3909f5589ce42c9b4310fd6d9d838190f2c2ef_1705403712595_0.5879401958829584","host":"s3://npm-registry-packages"}},"0.28.1-alpha-20240116111859-734d96d0afe27f54d771fc47041451ccdecfff1b":{"name":"@graphql-hive/client","version":"0.28.1-alpha-20240116111859-734d96d0afe27f54d771fc47041451ccdecfff1b","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.28.1-alpha-20240116111859-734d96d0afe27f54d771fc47041451ccdecfff1b","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"93d7cd4cd2a3c0561f507627084276005e74432c","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.28.1-alpha-20240116111859-734d96d0afe27f54d771fc47041451ccdecfff1b.tgz","fileCount":64,"integrity":"sha512-6xVikPZ+PbNIyQWVCJOQpF/a/XzunfD9CN279bh/5YzwRtOoeEIWyqNcDp4xvF0Fp+GWeJWHHqXmKottPtq6Jw==","signatures":[{"sig":"MEQCIDm6a6AVoe//efwkPofsnOse3BE3yau7l6Tad+WAf+pPAiB0tHPw1PH6Wwora1beg/51GefFiGGacjUA+I5UulGCHA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":219568},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.28.1-alpha-20240116111859-734d96d0afe27f54d771fc47041451ccdecfff1b.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/417e390995433798af9e21c66cbe1a62/graphql-hive-client-0.28.1-alpha-20240116111859-734d96d0afe27f54d771fc47041451ccdecfff1b.tgz","_integrity":"sha512-6xVikPZ+PbNIyQWVCJOQpF/a/XzunfD9CN279bh/5YzwRtOoeEIWyqNcDp4xvF0Fp+GWeJWHHqXmKottPtq6Jw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.2.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.19.0","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.28.1-alpha-20240116111859-734d96d0afe27f54d771fc47041451ccdecfff1b_1705403967384_0.9943258475543231","host":"s3://npm-registry-packages"}},"0.28.1-alpha-20240116121934-699d6e6fd23284a3e819490d91cc8b8f9271990c":{"name":"@graphql-hive/client","version":"0.28.1-alpha-20240116121934-699d6e6fd23284a3e819490d91cc8b8f9271990c","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.28.1-alpha-20240116121934-699d6e6fd23284a3e819490d91cc8b8f9271990c","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"b5e299e62f39d91f87953bf9f1e2598d2b6012e0","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.28.1-alpha-20240116121934-699d6e6fd23284a3e819490d91cc8b8f9271990c.tgz","fileCount":64,"integrity":"sha512-AgHm/ILYVJAdJrLU9SxCF3abmMYAmdUZmUnepG0iLoJYqm7GU1GxEF2bC+WJDAFkGyl9scqWxD3oPAvlOR5bxg==","signatures":[{"sig":"MEUCIFTvI9HNsZb+mDwJhj7RfdmSoDb/aQ4P0tZ9Uu1AjyG4AiEArDiGwv23wXqldBMZ9diPdhdIKB827mDRhDiGdwOZaCE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":219568},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.28.1-alpha-20240116121934-699d6e6fd23284a3e819490d91cc8b8f9271990c.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/8137966d7b13fed5f6ab8affa7b07475/graphql-hive-client-0.28.1-alpha-20240116121934-699d6e6fd23284a3e819490d91cc8b8f9271990c.tgz","_integrity":"sha512-AgHm/ILYVJAdJrLU9SxCF3abmMYAmdUZmUnepG0iLoJYqm7GU1GxEF2bC+WJDAFkGyl9scqWxD3oPAvlOR5bxg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.2.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.19.0","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.28.1-alpha-20240116121934-699d6e6fd23284a3e819490d91cc8b8f9271990c_1705407603400_0.7137792227051141","host":"s3://npm-registry-packages"}},"0.28.1-alpha-20240116142655-0296755a1ea7ac7507d3cd239be65f5996f362c3":{"name":"@graphql-hive/client","version":"0.28.1-alpha-20240116142655-0296755a1ea7ac7507d3cd239be65f5996f362c3","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.28.1-alpha-20240116142655-0296755a1ea7ac7507d3cd239be65f5996f362c3","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"3870df393b85c16a5a3cd3650ee6205874e892c6","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.28.1-alpha-20240116142655-0296755a1ea7ac7507d3cd239be65f5996f362c3.tgz","fileCount":64,"integrity":"sha512-o/orIplnLrM5xSIcAQzRUm1GvoG/w66X1KdVeM39yI0FflHargydT1CFP4B3Ra7+sWodPcenGazcTzGw8bj33w==","signatures":[{"sig":"MEUCIFJwfByRuieoxG+xCE0y8qN47ASuOrcTYJmtsHSGecy+AiEA4vQmfQ/1493WX2O+LkOK7Pfu1XQHqTkRqIHhiCDXtL4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":219568},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.28.1-alpha-20240116142655-0296755a1ea7ac7507d3cd239be65f5996f362c3.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/1a1b67bdb73d53f40e7348af1e0a77b8/graphql-hive-client-0.28.1-alpha-20240116142655-0296755a1ea7ac7507d3cd239be65f5996f362c3.tgz","_integrity":"sha512-o/orIplnLrM5xSIcAQzRUm1GvoG/w66X1KdVeM39yI0FflHargydT1CFP4B3Ra7+sWodPcenGazcTzGw8bj33w==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.2.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.19.0","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.28.1-alpha-20240116142655-0296755a1ea7ac7507d3cd239be65f5996f362c3_1705415245044_0.752657927390725","host":"s3://npm-registry-packages"}},"0.28.1-alpha-20240117100704-0296755a1ea7ac7507d3cd239be65f5996f362c3":{"name":"@graphql-hive/client","version":"0.28.1-alpha-20240117100704-0296755a1ea7ac7507d3cd239be65f5996f362c3","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.28.1-alpha-20240117100704-0296755a1ea7ac7507d3cd239be65f5996f362c3","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"8791933ccc04ed5cbd14510332f268ef7b09d87a","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.28.1-alpha-20240117100704-0296755a1ea7ac7507d3cd239be65f5996f362c3.tgz","fileCount":64,"integrity":"sha512-NB6sN8KU/Pmif2a8JPeHY99+FjoPuyz8hlSlhLIfbOKyXAhSC2v8aKDcEnbBlcMdVS+xyy1uQYfz5k/YS5KgIw==","signatures":[{"sig":"MEUCIQC+MNfxwXLzwaOL42miN6QKlBEchis6dQ2HyDttjp3kEgIgbISRavPGXri9SU1Ewnco2aHoM/rDGaydOZFRMcIShoU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":219568},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.28.1-alpha-20240117100704-0296755a1ea7ac7507d3cd239be65f5996f362c3.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/58a9c99f4a74c603871d85e9acb0a483/graphql-hive-client-0.28.1-alpha-20240117100704-0296755a1ea7ac7507d3cd239be65f5996f362c3.tgz","_integrity":"sha512-NB6sN8KU/Pmif2a8JPeHY99+FjoPuyz8hlSlhLIfbOKyXAhSC2v8aKDcEnbBlcMdVS+xyy1uQYfz5k/YS5KgIw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.2.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.19.0","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.28.1-alpha-20240117100704-0296755a1ea7ac7507d3cd239be65f5996f362c3_1705486052054_0.11962219083376557","host":"s3://npm-registry-packages"}},"0.28.1-rc-20240117102113-6e5167513484597ee3d704d9dafd6bf31fa752ff":{"name":"@graphql-hive/client","version":"0.28.1-rc-20240117102113-6e5167513484597ee3d704d9dafd6bf31fa752ff","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.28.1-rc-20240117102113-6e5167513484597ee3d704d9dafd6bf31fa752ff","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"2700ebb62b3b2a5a66b73e42896c5e175fa1e1ed","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.28.1-rc-20240117102113-6e5167513484597ee3d704d9dafd6bf31fa752ff.tgz","fileCount":64,"integrity":"sha512-HC+YUES/Zhj817xkpk84+y6T3v4qD8ZFLVmK32IG+dWgPfHvCCP1rHXkuNhzEbuvCcDqSuCnQl2tfo9xUS4TrA==","signatures":[{"sig":"MEQCICIbquA3iGBWX3CAvV+zY5NnJenNjpgwpnt/pm46U3UYAiBwNo2yABWNeFcTX5tnwi9mD25RM18wJJYCJYnMQqWOMA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":219553},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.28.1-rc-20240117102113-6e5167513484597ee3d704d9dafd6bf31fa752ff.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/b38e554221280ed75170d85713c0fad9/graphql-hive-client-0.28.1-rc-20240117102113-6e5167513484597ee3d704d9dafd6bf31fa752ff.tgz","_integrity":"sha512-HC+YUES/Zhj817xkpk84+y6T3v4qD8ZFLVmK32IG+dWgPfHvCCP1rHXkuNhzEbuvCcDqSuCnQl2tfo9xUS4TrA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.2.3","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.19.0","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.28.1-rc-20240117102113-6e5167513484597ee3d704d9dafd6bf31fa752ff_1705486905763_0.35040027298345233","host":"s3://npm-registry-packages"}},"0.28.1":{"name":"@graphql-hive/client","version":"0.28.1","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.28.1","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"739e49ce8db7a287bde775f4c7e4dde2336b8e3c","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.28.1.tgz","fileCount":64,"integrity":"sha512-DSuzEIMWwFxRPfuNWE7xP4jwvomoUW69oINwN1YrtmsDJUTtOqavqMQy1+H7Sb1c2LmuT9nGpiN03F+yGDeyjA==","signatures":[{"sig":"MEYCIQDk+7unaUWGy9hrscLUHsIAXT1s6Zyg2KkOW6DV+keOgwIhAOxqQpn6AhPax6GAIZ7EtVjjmdT6PmMy6ASJGpFJZDSa","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":219258},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.28.1.tgz","module":"esm/index.js","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/7928079f585dadb3c2e34e529e045479/graphql-hive-client-0.28.1.tgz","_integrity":"sha512-DSuzEIMWwFxRPfuNWE7xP4jwvomoUW69oINwN1YrtmsDJUTtOqavqMQy1+H7Sb1c2LmuT9nGpiN03F+yGDeyjA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"9.8.1","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"18.18.2","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.28.1_1705488201230_0.652536232052416","host":"s3://npm-registry-packages"}},"0.29.0-alpha-20240228155204-c86962123ed6e5f7b92119d82d2fdd1df5d8ec04":{"name":"@graphql-hive/client","version":"0.29.0-alpha-20240228155204-c86962123ed6e5f7b92119d82d2fdd1df5d8ec04","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.29.0-alpha-20240228155204-c86962123ed6e5f7b92119d82d2fdd1df5d8ec04","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"2c347b11708884b2da6888137028c29afdd823c9","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.29.0-alpha-20240228155204-c86962123ed6e5f7b92119d82d2fdd1df5d8ec04.tgz","fileCount":64,"integrity":"sha512-4+YaWDte4Hvs6Yh2yUPEJdXqAL9ZeCu8JTmjelQ1jr4F4afi9ymVD7MjSnxe3DwOugNYAqKJHYksVx3QYbjEFA==","signatures":[{"sig":"MEUCIQDGLksu1F/TLUDVPLAfFhuELLht97wAJTryUzWwmck/ZAIgcMD33E6h4DzamynqcK4cx09OrdquWDQr53AwLK7ZcCw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":221222},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.29.0-alpha-20240228155204-c86962123ed6e5f7b92119d82d2fdd1df5d8ec04.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/89ec9be862ef485d99e353a378bf98ba/graphql-hive-client-0.29.0-alpha-20240228155204-c86962123ed6e5f7b92119d82d2fdd1df5d8ec04.tgz","_integrity":"sha512-4+YaWDte4Hvs6Yh2yUPEJdXqAL9ZeCu8JTmjelQ1jr4F4afi9ymVD7MjSnxe3DwOugNYAqKJHYksVx3QYbjEFA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.2.4","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.6.2","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.29.0-alpha-20240228155204-c86962123ed6e5f7b92119d82d2fdd1df5d8ec04_1709135551185_0.6270631257259687","host":"s3://npm-registry-packages"}},"0.29.0-alpha-20240229095018-cdfa18f6ff998bf992e8780699bba1b02d494562":{"name":"@graphql-hive/client","version":"0.29.0-alpha-20240229095018-cdfa18f6ff998bf992e8780699bba1b02d494562","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.29.0-alpha-20240229095018-cdfa18f6ff998bf992e8780699bba1b02d494562","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"7a8654a2d17b4ce11c17e094af3cc9a9fef7ca11","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.29.0-alpha-20240229095018-cdfa18f6ff998bf992e8780699bba1b02d494562.tgz","fileCount":64,"integrity":"sha512-vlKVKVR+q0rtLsSxt2VzcsmbEJj5pm9kvdnJP1XXlNsuQuuosEp6q7xv5zR4+toPjdUatGQ9kLhmzhI+doj+/w==","signatures":[{"sig":"MEYCIQDhWHclM7I7+94BSrQlVthO4Tcud1XjQDEXWLgUP+c/wgIhAPyg/WB4wwIy2/iVfj0cnbIixCgElEIo5IEZHQ3JBmNc","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":220814},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.29.0-alpha-20240229095018-cdfa18f6ff998bf992e8780699bba1b02d494562.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/9fcba1643dca72a3fd13781af34026a0/graphql-hive-client-0.29.0-alpha-20240229095018-cdfa18f6ff998bf992e8780699bba1b02d494562.tgz","_integrity":"sha512-vlKVKVR+q0rtLsSxt2VzcsmbEJj5pm9kvdnJP1XXlNsuQuuosEp6q7xv5zR4+toPjdUatGQ9kLhmzhI+doj+/w==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.2.4","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.6.2","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.29.0-alpha-20240229095018-cdfa18f6ff998bf992e8780699bba1b02d494562_1709200244316_0.047386906352457014","host":"s3://npm-registry-packages"}},"0.29.0-alpha-20240307151351-9f5b393612bb58a8f0a2eca5bb75d3f43c3a2172":{"name":"@graphql-hive/client","version":"0.29.0-alpha-20240307151351-9f5b393612bb58a8f0a2eca5bb75d3f43c3a2172","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.29.0-alpha-20240307151351-9f5b393612bb58a8f0a2eca5bb75d3f43c3a2172","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"8122eab615051f405678697474a766bd1b563b11","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.29.0-alpha-20240307151351-9f5b393612bb58a8f0a2eca5bb75d3f43c3a2172.tgz","fileCount":64,"integrity":"sha512-wIuH/HeNBR5K/QYW2vy+tZXBq0q5rTnkz55GRY1sHepSpsKbVs1P/cEzIcUsHtlz9D+oQaRce2s4avOL1gdqFw==","signatures":[{"sig":"MEYCIQC3cOb5/fsdNxF3Q5mQzOdaDa5StmPXoZhpouynxJkUQAIhAJEQVq0VF8oPRhxpbZaBsIwAyCwHQ+4ji+5ATJgCXSxl","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":224078},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.29.0-alpha-20240307151351-9f5b393612bb58a8f0a2eca5bb75d3f43c3a2172.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/98cb0d9a67c9d0830d00873fddea8fce/graphql-hive-client-0.29.0-alpha-20240307151351-9f5b393612bb58a8f0a2eca5bb75d3f43c3a2172.tgz","_integrity":"sha512-wIuH/HeNBR5K/QYW2vy+tZXBq0q5rTnkz55GRY1sHepSpsKbVs1P/cEzIcUsHtlz9D+oQaRce2s4avOL1gdqFw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.0","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.29.0-alpha-20240307151351-9f5b393612bb58a8f0a2eca5bb75d3f43c3a2172_1709824457445_0.9995298208529315","host":"s3://npm-registry-packages"}},"0.29.0-alpha-20240307151832-32cbde7039f3c0ef0baf1ee6a8d2988133c736a8":{"name":"@graphql-hive/client","version":"0.29.0-alpha-20240307151832-32cbde7039f3c0ef0baf1ee6a8d2988133c736a8","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.29.0-alpha-20240307151832-32cbde7039f3c0ef0baf1ee6a8d2988133c736a8","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"74d28e804c681358e0128172dc8c1bcd0b80f666","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.29.0-alpha-20240307151832-32cbde7039f3c0ef0baf1ee6a8d2988133c736a8.tgz","fileCount":64,"integrity":"sha512-uLVIYZURVNlaNsaLn1jKLw045AahdIY1tkGb7WZM7T1Sn1rzU/fpdZ3+PMqeP83xiuAr64NNOLHdXI029pju/A==","signatures":[{"sig":"MEUCICsPsqOUejkgKhvK6/1VL4PH+70Tf0kInfyLsAxsKSmgAiEA7RUdqoB1OBByL2s5ECh4NHObMeykoFt/zS6JRubOXrY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":223778},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.29.0-alpha-20240307151832-32cbde7039f3c0ef0baf1ee6a8d2988133c736a8.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/52f1504585ec088bacb061a4251ce253/graphql-hive-client-0.29.0-alpha-20240307151832-32cbde7039f3c0ef0baf1ee6a8d2988133c736a8.tgz","_integrity":"sha512-uLVIYZURVNlaNsaLn1jKLw045AahdIY1tkGb7WZM7T1Sn1rzU/fpdZ3+PMqeP83xiuAr64NNOLHdXI029pju/A==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.0","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.29.0-alpha-20240307151832-32cbde7039f3c0ef0baf1ee6a8d2988133c736a8_1709824740127_0.5153173315155677","host":"s3://npm-registry-packages"}},"0.29.0-alpha-20240307154710-7c834a9b552f462253a6905dd8b74936e834a2d0":{"name":"@graphql-hive/client","version":"0.29.0-alpha-20240307154710-7c834a9b552f462253a6905dd8b74936e834a2d0","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.29.0-alpha-20240307154710-7c834a9b552f462253a6905dd8b74936e834a2d0","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"f46e165558cc4a97ec0ded639cca6b5703714489","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.29.0-alpha-20240307154710-7c834a9b552f462253a6905dd8b74936e834a2d0.tgz","fileCount":64,"integrity":"sha512-XyH+ak6kOSIXOoTf15PbFmNkwSDDJw7sEHj5B7SGBQ3VYBBF5yptlRa95bfzQt0QVlY6vQSgvd3uCRn1TcZLOg==","signatures":[{"sig":"MEUCIQDy2jjCifOtsv35XEdz65Fdm5da4f+xHDa3KJmT+fDnWQIgIero+lVApFQE4bf0VU9mZ/0mK594rT1ROmj+XCZTYmk=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":223894},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.29.0-alpha-20240307154710-7c834a9b552f462253a6905dd8b74936e834a2d0.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/f562c8a140301ee765c7d34ad3952b8c/graphql-hive-client-0.29.0-alpha-20240307154710-7c834a9b552f462253a6905dd8b74936e834a2d0.tgz","_integrity":"sha512-XyH+ak6kOSIXOoTf15PbFmNkwSDDJw7sEHj5B7SGBQ3VYBBF5yptlRa95bfzQt0QVlY6vQSgvd3uCRn1TcZLOg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.0","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.29.0-alpha-20240307154710-7c834a9b552f462253a6905dd8b74936e834a2d0_1709826456869_0.21116859414713507","host":"s3://npm-registry-packages"}},"0.29.0-alpha-20240307154937-694b4ce9b8e1c4ebea5617e10cf13223fdef5949":{"name":"@graphql-hive/client","version":"0.29.0-alpha-20240307154937-694b4ce9b8e1c4ebea5617e10cf13223fdef5949","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.29.0-alpha-20240307154937-694b4ce9b8e1c4ebea5617e10cf13223fdef5949","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"d31ee0f9ba0ff0533e205971718b1d07f2860bbb","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.29.0-alpha-20240307154937-694b4ce9b8e1c4ebea5617e10cf13223fdef5949.tgz","fileCount":64,"integrity":"sha512-4ENx2gnDip698AhrJLi5MZKnEFcB6a5h13RfYlxwzUpwkqj0tfj5jDDE+zjXDNF3OqTQBGfhl2JND/ew2vPFoQ==","signatures":[{"sig":"MEYCIQCtnp1l9qM2yylOCjDQcRT/us2BVrDEt538hWevILCtGAIhAMM4Qhh0PY0aqeL/qAS6zhCRY5imsBHmsejINkdbVRZ1","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":223896},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.29.0-alpha-20240307154937-694b4ce9b8e1c4ebea5617e10cf13223fdef5949.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/400b29066e1f2d183981d58390882add/graphql-hive-client-0.29.0-alpha-20240307154937-694b4ce9b8e1c4ebea5617e10cf13223fdef5949.tgz","_integrity":"sha512-4ENx2gnDip698AhrJLi5MZKnEFcB6a5h13RfYlxwzUpwkqj0tfj5jDDE+zjXDNF3OqTQBGfhl2JND/ew2vPFoQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.0","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.29.0-alpha-20240307154937-694b4ce9b8e1c4ebea5617e10cf13223fdef5949_1709826604432_0.3465600793051149","host":"s3://npm-registry-packages"}},"0.29.0-alpha-20240318085921-e14fcd97f46f2213bd24afb64ece0d19f032ee2e":{"name":"@graphql-hive/client","version":"0.29.0-alpha-20240318085921-e14fcd97f46f2213bd24afb64ece0d19f032ee2e","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.29.0-alpha-20240318085921-e14fcd97f46f2213bd24afb64ece0d19f032ee2e","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"5831ba37b51fae06d29778809866edca3f38f89c","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.29.0-alpha-20240318085921-e14fcd97f46f2213bd24afb64ece0d19f032ee2e.tgz","fileCount":64,"integrity":"sha512-mId+RbkhXXFvOljSEo9YM5GS9un7+RGRovZ/YiQj9b51LNtjDiCMgGMX8XG1RQh3vRcAdlBUuPcN2/XAt9/s8A==","signatures":[{"sig":"MEUCIQDA/GBSI4dzQyx3LztpYKcNZdqF8Hp7ha005tyWLrdTHAIgKp7NqXJHtBkS8WgCfh/CVwwd7XeYmYJH8tfSKbfxcT4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":237453},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.29.0-alpha-20240318085921-e14fcd97f46f2213bd24afb64ece0d19f032ee2e.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/337b4a282389d98a67b749ce56c5e4ff/graphql-hive-client-0.29.0-alpha-20240318085921-e14fcd97f46f2213bd24afb64ece0d19f032ee2e.tgz","_integrity":"sha512-mId+RbkhXXFvOljSEo9YM5GS9un7+RGRovZ/YiQj9b51LNtjDiCMgGMX8XG1RQh3vRcAdlBUuPcN2/XAt9/s8A==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.29.0-alpha-20240318085921-e14fcd97f46f2213bd24afb64ece0d19f032ee2e_1710752388798_0.4095093950209088","host":"s3://npm-registry-packages"}},"0.29.0-alpha-20240318090322-35cab27b2e46cda9ed18a247e108cab65ceb454d":{"name":"@graphql-hive/client","version":"0.29.0-alpha-20240318090322-35cab27b2e46cda9ed18a247e108cab65ceb454d","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.29.0-alpha-20240318090322-35cab27b2e46cda9ed18a247e108cab65ceb454d","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"1a1ec3093782194a512702396d93567d984cccfe","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.29.0-alpha-20240318090322-35cab27b2e46cda9ed18a247e108cab65ceb454d.tgz","fileCount":64,"integrity":"sha512-WxdqN9cU6EWrCydAMxLQt/aS9M1+Yvcoiiyz4C4uQXFKlwB7ZDgSgRrz14yPK/B5Akeqapd+Zmv8B8vHfM0l4A==","signatures":[{"sig":"MEQCICYtpm+dKoxnOMduyFGwS8WjAVMqGLKBxNfwOq/16jzzAiBPbKJgrKTtMW7FxeBZJWsyo5Ht+Jtk/YxrF97el8uTXw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":237485},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.29.0-alpha-20240318090322-35cab27b2e46cda9ed18a247e108cab65ceb454d.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/1679681473b997112580632915da16fc/graphql-hive-client-0.29.0-alpha-20240318090322-35cab27b2e46cda9ed18a247e108cab65ceb454d.tgz","_integrity":"sha512-WxdqN9cU6EWrCydAMxLQt/aS9M1+Yvcoiiyz4C4uQXFKlwB7ZDgSgRrz14yPK/B5Akeqapd+Zmv8B8vHfM0l4A==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.29.0-alpha-20240318090322-35cab27b2e46cda9ed18a247e108cab65ceb454d_1710752628660_0.10600028451480537","host":"s3://npm-registry-packages"}},"0.29.0-alpha-20240318111045-ca9ad6cafb6c02d725df2b8271fcc2fd8f89dddd":{"name":"@graphql-hive/client","version":"0.29.0-alpha-20240318111045-ca9ad6cafb6c02d725df2b8271fcc2fd8f89dddd","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.29.0-alpha-20240318111045-ca9ad6cafb6c02d725df2b8271fcc2fd8f89dddd","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"656da3fac29818ed0cd7af2f158932d517735bfc","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.29.0-alpha-20240318111045-ca9ad6cafb6c02d725df2b8271fcc2fd8f89dddd.tgz","fileCount":64,"integrity":"sha512-lfFy1N/fQXaxt5Up2JxspK56CSkli0xvVuoqroXJrRBZW/8r8yHgWBZ8npy999Tps/4RvBUs3GX0rHR9DYV+4g==","signatures":[{"sig":"MEYCIQCUDhMKw5+rZpKY9ue1NgaBZnkdnuQ1mVcuom24PWNC8AIhAMzxAmU7bK63/A/shJNr2xfICvavQ2dxNWB/yFQY9twu","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":237579},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.29.0-alpha-20240318111045-ca9ad6cafb6c02d725df2b8271fcc2fd8f89dddd.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/6eabb0799a10802a223ff8048e43ff40/graphql-hive-client-0.29.0-alpha-20240318111045-ca9ad6cafb6c02d725df2b8271fcc2fd8f89dddd.tgz","_integrity":"sha512-lfFy1N/fQXaxt5Up2JxspK56CSkli0xvVuoqroXJrRBZW/8r8yHgWBZ8npy999Tps/4RvBUs3GX0rHR9DYV+4g==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.29.0-alpha-20240318111045-ca9ad6cafb6c02d725df2b8271fcc2fd8f89dddd_1710760276457_0.8509274961829267","host":"s3://npm-registry-packages"}},"0.29.0-alpha-20240318115013-df34f6593116adb60bb6c84a7db897f909a2fbdf":{"name":"@graphql-hive/client","version":"0.29.0-alpha-20240318115013-df34f6593116adb60bb6c84a7db897f909a2fbdf","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.29.0-alpha-20240318115013-df34f6593116adb60bb6c84a7db897f909a2fbdf","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"cc5f378de87dc0581b4411db7c2abfff9ac94e24","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.29.0-alpha-20240318115013-df34f6593116adb60bb6c84a7db897f909a2fbdf.tgz","fileCount":64,"integrity":"sha512-DpQo0qrJbeiHsk4xKpd+3VRnZ5KxordDs84VirLTqp4QeFzYRecm5gaYU11yyOog868nl5AujWjtqJN/FTFBtg==","signatures":[{"sig":"MEYCIQDS+Hz6LMLd3iSSLLQPBglH/2JiWy2EUL15EvaKi4WbRAIhAPMHqDU0qvRlgH5Riqz440s9uNTNPcAa+vg11a7ficpC","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":236449},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.29.0-alpha-20240318115013-df34f6593116adb60bb6c84a7db897f909a2fbdf.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/3bd482f306f5d8acc5de6f77e8b94f15/graphql-hive-client-0.29.0-alpha-20240318115013-df34f6593116adb60bb6c84a7db897f909a2fbdf.tgz","_integrity":"sha512-DpQo0qrJbeiHsk4xKpd+3VRnZ5KxordDs84VirLTqp4QeFzYRecm5gaYU11yyOog868nl5AujWjtqJN/FTFBtg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.29.0-alpha-20240318115013-df34f6593116adb60bb6c84a7db897f909a2fbdf_1710762639779_0.7065664360041868","host":"s3://npm-registry-packages"}},"0.29.0-alpha-20240318115333-30169eb5cbd55b43b8b9755d673b5467e5775c7f":{"name":"@graphql-hive/client","version":"0.29.0-alpha-20240318115333-30169eb5cbd55b43b8b9755d673b5467e5775c7f","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.29.0-alpha-20240318115333-30169eb5cbd55b43b8b9755d673b5467e5775c7f","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"e8d43fe38639f30750f06d15ecb36c53bf9656c2","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.29.0-alpha-20240318115333-30169eb5cbd55b43b8b9755d673b5467e5775c7f.tgz","fileCount":64,"integrity":"sha512-ncW1J3L4q0bRsI+Z5xZn9Uso4XdoUX3fUDOLA+bwVJQnboVF4uE+htkKpXxfjgBbYg0Vqo43n7ff6Nyj9wadOQ==","signatures":[{"sig":"MEYCIQC8twCh4I1wASmlcq2j0862OEFB9pHNN4prg3p9MOWQdgIhAP6J4221A01/KHQrEk/OpaPZTatpgUzBADesq87eSqMJ","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":236449},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.29.0-alpha-20240318115333-30169eb5cbd55b43b8b9755d673b5467e5775c7f.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/234f82db5ef7b008b3cd309cf142f29a/graphql-hive-client-0.29.0-alpha-20240318115333-30169eb5cbd55b43b8b9755d673b5467e5775c7f.tgz","_integrity":"sha512-ncW1J3L4q0bRsI+Z5xZn9Uso4XdoUX3fUDOLA+bwVJQnboVF4uE+htkKpXxfjgBbYg0Vqo43n7ff6Nyj9wadOQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.29.0-alpha-20240318115333-30169eb5cbd55b43b8b9755d673b5467e5775c7f_1710762839425_0.13662913870347815","host":"s3://npm-registry-packages"}},"0.29.0-alpha-20240318125246-d2ba64388cee7ef9614de338abf9d013d422af42":{"name":"@graphql-hive/client","version":"0.29.0-alpha-20240318125246-d2ba64388cee7ef9614de338abf9d013d422af42","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.29.0-alpha-20240318125246-d2ba64388cee7ef9614de338abf9d013d422af42","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"66c73680c20bd405b5f9314765fd2bf2132b70b6","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.29.0-alpha-20240318125246-d2ba64388cee7ef9614de338abf9d013d422af42.tgz","fileCount":64,"integrity":"sha512-E33ktXMAkhf1LhFlLgx5RnOI5OlN7DDfIzjSSMIPU2ZupQg7l+IVwrwxENNrW7o6Ec9Zx6E93A7YtB+riGkBCw==","signatures":[{"sig":"MEYCIQD/jUkhrmc1bc94UujNcWkXep8TVb9A47rryuSIlC1eHwIhAMYh3q2cvB8WqgA+T/t7+K1ya9yxabGD1vX7PfVkeysH","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":236449},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.29.0-alpha-20240318125246-d2ba64388cee7ef9614de338abf9d013d422af42.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/09a0676a7a04e49343da4f340a95bea1/graphql-hive-client-0.29.0-alpha-20240318125246-d2ba64388cee7ef9614de338abf9d013d422af42.tgz","_integrity":"sha512-E33ktXMAkhf1LhFlLgx5RnOI5OlN7DDfIzjSSMIPU2ZupQg7l+IVwrwxENNrW7o6Ec9Zx6E93A7YtB+riGkBCw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.29.0-alpha-20240318125246-d2ba64388cee7ef9614de338abf9d013d422af42_1710766392458_0.6363197388404067","host":"s3://npm-registry-packages"}},"0.29.0-alpha-20240318130111-7653a807a54d482e47962407658711336435d7a7":{"name":"@graphql-hive/client","version":"0.29.0-alpha-20240318130111-7653a807a54d482e47962407658711336435d7a7","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.29.0-alpha-20240318130111-7653a807a54d482e47962407658711336435d7a7","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"99d943624429012092d56d7bf062dff7a9b1a6e6","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.29.0-alpha-20240318130111-7653a807a54d482e47962407658711336435d7a7.tgz","fileCount":64,"integrity":"sha512-j90Dm5JZ+f3MREB0ZDEeg05JJwUPQBuG1t3VeZI+YiH6pJlf8f6rK0zZQqJiGqtyaggq9v5022ZRmNfDiGDgKQ==","signatures":[{"sig":"MEYCIQCIsU0lDce1EQoE8O7LzYImVoheeFu9WdVOdTiqxDWvbwIhAPmMsHStBSs3OTDufF09DhW6WM/6qOKGv6TXGHh1ETFl","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":236449},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.29.0-alpha-20240318130111-7653a807a54d482e47962407658711336435d7a7.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/f7872ad94dae508e3559e359ea5f04ee/graphql-hive-client-0.29.0-alpha-20240318130111-7653a807a54d482e47962407658711336435d7a7.tgz","_integrity":"sha512-j90Dm5JZ+f3MREB0ZDEeg05JJwUPQBuG1t3VeZI+YiH6pJlf8f6rK0zZQqJiGqtyaggq9v5022ZRmNfDiGDgKQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.29.0-alpha-20240318130111-7653a807a54d482e47962407658711336435d7a7_1710766898715_0.9872825255998903","host":"s3://npm-registry-packages"}},"0.29.0-alpha-20240318134414-95e2bbcb4f28b697367f29eeb49af59ad83ec90a":{"name":"@graphql-hive/client","version":"0.29.0-alpha-20240318134414-95e2bbcb4f28b697367f29eeb49af59ad83ec90a","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.29.0-alpha-20240318134414-95e2bbcb4f28b697367f29eeb49af59ad83ec90a","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"cf264fdbf3ae34bb5114ced287dcbacb9c30b749","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.29.0-alpha-20240318134414-95e2bbcb4f28b697367f29eeb49af59ad83ec90a.tgz","fileCount":64,"integrity":"sha512-MfU7VgV6Gyxwr5Zqgw2ABiY4woUwGngjtk3BMSVH5kLFxInwKULbDXkEa8Ryt8B+3zmSTFSmNH0h3gJqfhZfDg==","signatures":[{"sig":"MEUCIEuwqEqfzFOGlSKZLLs9H+cp74ye6h+oYHn8kHJ5beVWAiEAyZihA1PUjZEg4iXf77iGDmTp/TdxqYBJMINjcN5YIC4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":236449},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.29.0-alpha-20240318134414-95e2bbcb4f28b697367f29eeb49af59ad83ec90a.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/4b28dfe040589c2fc39b2e3bc4da94d1/graphql-hive-client-0.29.0-alpha-20240318134414-95e2bbcb4f28b697367f29eeb49af59ad83ec90a.tgz","_integrity":"sha512-MfU7VgV6Gyxwr5Zqgw2ABiY4woUwGngjtk3BMSVH5kLFxInwKULbDXkEa8Ryt8B+3zmSTFSmNH0h3gJqfhZfDg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.29.0-alpha-20240318134414-95e2bbcb4f28b697367f29eeb49af59ad83ec90a_1710769479885_0.07425542752261705","host":"s3://npm-registry-packages"}},"0.29.0-alpha-20240318135144-aa210cdb8ffde06a090e09913a96aa1cffeaa054":{"name":"@graphql-hive/client","version":"0.29.0-alpha-20240318135144-aa210cdb8ffde06a090e09913a96aa1cffeaa054","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.29.0-alpha-20240318135144-aa210cdb8ffde06a090e09913a96aa1cffeaa054","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"369e360f83e68315c4306a5dff7dacf756b95b8b","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.29.0-alpha-20240318135144-aa210cdb8ffde06a090e09913a96aa1cffeaa054.tgz","fileCount":64,"integrity":"sha512-5pkNv7mgBCmbVnBRVDBYTA6Us9HuO6v8nTJicpKwyZHV80MKTzluG2gad6c8pJxuW7NmXSmnTkgc7DtoQVDMPg==","signatures":[{"sig":"MEQCIGCwi09u7qs6yFqjYmFeeTyQ2+FgYMY/nZIe1NjbgvVlAiAWCzhtOBT3YBYBEZgJQ8r9QihpdSpj4yN9YtqTUiw0rg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":224080},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.29.0-alpha-20240318135144-aa210cdb8ffde06a090e09913a96aa1cffeaa054.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/da761429c43550fe05f7b697987a9dac/graphql-hive-client-0.29.0-alpha-20240318135144-aa210cdb8ffde06a090e09913a96aa1cffeaa054.tgz","_integrity":"sha512-5pkNv7mgBCmbVnBRVDBYTA6Us9HuO6v8nTJicpKwyZHV80MKTzluG2gad6c8pJxuW7NmXSmnTkgc7DtoQVDMPg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.29.0-alpha-20240318135144-aa210cdb8ffde06a090e09913a96aa1cffeaa054_1710769930636_0.491156882706151","host":"s3://npm-registry-packages"}},"0.29.0-alpha-20240318142728-04637b90a657aa4eafe45ea8e3618156b0528307":{"name":"@graphql-hive/client","version":"0.29.0-alpha-20240318142728-04637b90a657aa4eafe45ea8e3618156b0528307","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.29.0-alpha-20240318142728-04637b90a657aa4eafe45ea8e3618156b0528307","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"f0bb1a209e52737c46a8f1bb1596bb0e597b35a2","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.29.0-alpha-20240318142728-04637b90a657aa4eafe45ea8e3618156b0528307.tgz","fileCount":64,"integrity":"sha512-ppNK6vdVXjWaUhJD3dsuIyoT+xikdxeDbAK7PS4Guc9hPp4iNSxwksd6p2ApDvhq9O1Pf4+7HNHutIr0RjX/dw==","signatures":[{"sig":"MEQCICOw9uKYK+aIyH7IcfFP6GB3WPL+PptUiWvckrb8VcTuAiB0xP7LNiFmosJqP7//69iX/I+39sRuNNSMDrRF3BMlaQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":236449},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.29.0-alpha-20240318142728-04637b90a657aa4eafe45ea8e3618156b0528307.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/5eddfbb2e19c74986e8183b08e482e7a/graphql-hive-client-0.29.0-alpha-20240318142728-04637b90a657aa4eafe45ea8e3618156b0528307.tgz","_integrity":"sha512-ppNK6vdVXjWaUhJD3dsuIyoT+xikdxeDbAK7PS4Guc9hPp4iNSxwksd6p2ApDvhq9O1Pf4+7HNHutIr0RjX/dw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.29.0-alpha-20240318142728-04637b90a657aa4eafe45ea8e3618156b0528307_1710772074229_0.8395143549000255","host":"s3://npm-registry-packages"}},"0.29.0-rc-20240318143553-bd0fba2bd34eb9d6816ce41d72617a07f8ba2515":{"name":"@graphql-hive/client","version":"0.29.0-rc-20240318143553-bd0fba2bd34eb9d6816ce41d72617a07f8ba2515","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.29.0-rc-20240318143553-bd0fba2bd34eb9d6816ce41d72617a07f8ba2515","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"c1c6fb9d04059e78f2151005bc80cc5ca90c5468","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.29.0-rc-20240318143553-bd0fba2bd34eb9d6816ce41d72617a07f8ba2515.tgz","fileCount":64,"integrity":"sha512-KUigWmwqCIc9mUX68jzLx8Gc63EE8s/vRHY0aUXMqFv+PgU/5dwjubRBOrwgACpTViU04xEnXtO86snoKClhig==","signatures":[{"sig":"MEUCIGHMrpkMN41gl81rIx3EGSxCn1k6bcrmAXqFseCFQMKEAiEAiZn4GnqajOLfO27gu8SRu5YFUPiYZ7wMkR6DiaGOxaA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":224065},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.29.0-rc-20240318143553-bd0fba2bd34eb9d6816ce41d72617a07f8ba2515.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/679bd07258c2d9d8808f66d3ee259dfc/graphql-hive-client-0.29.0-rc-20240318143553-bd0fba2bd34eb9d6816ce41d72617a07f8ba2515.tgz","_integrity":"sha512-KUigWmwqCIc9mUX68jzLx8Gc63EE8s/vRHY0aUXMqFv+PgU/5dwjubRBOrwgACpTViU04xEnXtO86snoKClhig==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.29.0-rc-20240318143553-bd0fba2bd34eb9d6816ce41d72617a07f8ba2515_1710772579246_0.47304845351300484","host":"s3://npm-registry-packages"}},"0.29.0-alpha-20240318143747-451863f33dd91a661cc084ca09fbb3b253bd18b8":{"name":"@graphql-hive/client","version":"0.29.0-alpha-20240318143747-451863f33dd91a661cc084ca09fbb3b253bd18b8","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.29.0-alpha-20240318143747-451863f33dd91a661cc084ca09fbb3b253bd18b8","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"018f6cae2c1a4e2c5337b56550218b753d0e52a0","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.29.0-alpha-20240318143747-451863f33dd91a661cc084ca09fbb3b253bd18b8.tgz","fileCount":64,"integrity":"sha512-MDrEPnV51RYsmJ7b3lmlsad0v4Bo5gNaSMVyq41G5ruaHmwydOGmAzpv8J97DHWuZonLUtqzYn2DmLz2K0Cjaw==","signatures":[{"sig":"MEUCIAOuoU/xamFX1cVZ5B4ZYXu+33zy9KSvb3hKm20+4OGMAiEA1EAqp0f0Jd4iWIpbbH15ZD0/464vLVC+TSTv4WCnMiA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":224080},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.29.0-alpha-20240318143747-451863f33dd91a661cc084ca09fbb3b253bd18b8.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/2f884b43d6a9c27f362790cccaabba33/graphql-hive-client-0.29.0-alpha-20240318143747-451863f33dd91a661cc084ca09fbb3b253bd18b8.tgz","_integrity":"sha512-MDrEPnV51RYsmJ7b3lmlsad0v4Bo5gNaSMVyq41G5ruaHmwydOGmAzpv8J97DHWuZonLUtqzYn2DmLz2K0Cjaw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.29.0-alpha-20240318143747-451863f33dd91a661cc084ca09fbb3b253bd18b8_1710772693861_0.23149915066952897","host":"s3://npm-registry-packages"}},"0.29.0":{"name":"@graphql-hive/client","version":"0.29.0","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.29.0","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"7e42a80ec52be3d6c0420c35cf30e7a64b4267ef","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.29.0.tgz","fileCount":64,"integrity":"sha512-36kJXqIUBzO9AQp3Nvi0CAT/ZigBv7f1crdv8PBbvPQu4xOyKjULZ1uNphwucmd1pkvargtxysjYlAFdd9Z9bg==","signatures":[{"sig":"MEUCIAIFBAY/6nCeo10IrsiejfhLSyTBMOequrrnF4tdikopAiEAxIAxc245Fhn+yWaDEgzYhH1BDclFOy25rssq0XFJnOs=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":223770},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.29.0.tgz","module":"esm/index.js","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/97c57216ae43a82c7d5944e142a91141/graphql-hive-client-0.29.0.tgz","_integrity":"sha512-36kJXqIUBzO9AQp3Nvi0CAT/ZigBv7f1crdv8PBbvPQu4xOyKjULZ1uNphwucmd1pkvargtxysjYlAFdd9Z9bg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.29.0_1710773194356_0.007263715449430608","host":"s3://npm-registry-packages"}},"0.29.0-alpha-20240319084129-18ccf88d53de98f8c5d652bfbf32b38bd5d68e1e":{"name":"@graphql-hive/client","version":"0.29.0-alpha-20240319084129-18ccf88d53de98f8c5d652bfbf32b38bd5d68e1e","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.29.0-alpha-20240319084129-18ccf88d53de98f8c5d652bfbf32b38bd5d68e1e","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"743c2c3429af95d1ccede383987ae78b2922f1c3","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.29.0-alpha-20240319084129-18ccf88d53de98f8c5d652bfbf32b38bd5d68e1e.tgz","fileCount":64,"integrity":"sha512-ly5hs7llpl+b/LY8l29PWIbss4mg4dMVAt51iGDScdVQNId97imajz4OdvZ3wks143u/Z7F+sPK4jcC0nWdnpQ==","signatures":[{"sig":"MEYCIQCEqtr0TNl0lAcVnQTzv9vVynieMB0oe5BqguLS/vNkAAIhANp0SRJnKySJV60xTJAt9PaBWLzC/bGQrtn0NeCbAmjd","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":236449},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.29.0-alpha-20240319084129-18ccf88d53de98f8c5d652bfbf32b38bd5d68e1e.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/e57f019de23d89241b1e0f9db0ab3363/graphql-hive-client-0.29.0-alpha-20240319084129-18ccf88d53de98f8c5d652bfbf32b38bd5d68e1e.tgz","_integrity":"sha512-ly5hs7llpl+b/LY8l29PWIbss4mg4dMVAt51iGDScdVQNId97imajz4OdvZ3wks143u/Z7F+sPK4jcC0nWdnpQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.29.0-alpha-20240319084129-18ccf88d53de98f8c5d652bfbf32b38bd5d68e1e_1710837715556_0.049925818229720864","host":"s3://npm-registry-packages"}},"0.30.0-alpha-20240319092820-fa6bd35dcc8926136495d5f6adbdb0b5dde47bc4":{"name":"@graphql-hive/client","version":"0.30.0-alpha-20240319092820-fa6bd35dcc8926136495d5f6adbdb0b5dde47bc4","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-alpha-20240319092820-fa6bd35dcc8926136495d5f6adbdb0b5dde47bc4","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"85a53abc2c510eaf410fd11290a746d1a9a02f00","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-alpha-20240319092820-fa6bd35dcc8926136495d5f6adbdb0b5dde47bc4.tgz","fileCount":64,"integrity":"sha512-35YDnGaZFjXGTob3Ujy5PbEb1CwbqhZ+RTkipRB8BDnO7A8vLtGJahe+IjI1HrPzGBpioZ7Wre53MBb4OW7Ctw==","signatures":[{"sig":"MEYCIQCr742dkR4MfL8tq2/MCCBb1jDowbRBxrU3XcxGUAMPDgIhAOQJGBfUXzemuZYpHIG7gdPHHGO9Ogp9I9Cqsb+lgsTO","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242133},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-alpha-20240319092820-fa6bd35dcc8926136495d5f6adbdb0b5dde47bc4.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/2ed170b3654f010048b3d40e82d2a601/graphql-hive-client-0.30.0-alpha-20240319092820-fa6bd35dcc8926136495d5f6adbdb0b5dde47bc4.tgz","_integrity":"sha512-35YDnGaZFjXGTob3Ujy5PbEb1CwbqhZ+RTkipRB8BDnO7A8vLtGJahe+IjI1HrPzGBpioZ7Wre53MBb4OW7Ctw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-alpha-20240319092820-fa6bd35dcc8926136495d5f6adbdb0b5dde47bc4_1710840526080_0.07461115981644273","host":"s3://npm-registry-packages"}},"0.30.0-alpha-20240319100626-a400e46e7f29f462a0a776241516cc5b9f2cacaf":{"name":"@graphql-hive/client","version":"0.30.0-alpha-20240319100626-a400e46e7f29f462a0a776241516cc5b9f2cacaf","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-alpha-20240319100626-a400e46e7f29f462a0a776241516cc5b9f2cacaf","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"b5d5d05dec34e4983ba60bb253e6d69ea82ada9f","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-alpha-20240319100626-a400e46e7f29f462a0a776241516cc5b9f2cacaf.tgz","fileCount":64,"integrity":"sha512-sCpengomuWHqCDaICGygTLi15HB7SffvRcORvv1y2AUzgpAxP8Yg3RV/diHrjWOAcQ3D60mACgb9y+MeSCxSjg==","signatures":[{"sig":"MEQCIHdg3aUct+JlwZhmY7LLHbIQisK14/+2EL9KUDz+ulqNAiBjfbj8Z2/fKSu018l9ic2DbuoyaM48YV1MsFAU1j68SA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242133},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-alpha-20240319100626-a400e46e7f29f462a0a776241516cc5b9f2cacaf.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/3988ecd269d0794bfd10d0f67ecb8420/graphql-hive-client-0.30.0-alpha-20240319100626-a400e46e7f29f462a0a776241516cc5b9f2cacaf.tgz","_integrity":"sha512-sCpengomuWHqCDaICGygTLi15HB7SffvRcORvv1y2AUzgpAxP8Yg3RV/diHrjWOAcQ3D60mACgb9y+MeSCxSjg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-alpha-20240319100626-a400e46e7f29f462a0a776241516cc5b9f2cacaf_1710842813093_0.15065450910415024","host":"s3://npm-registry-packages"}},"0.30.0-alpha-20240319100803-f9a060690ab1d3adb77d53ace2022937dffa8259":{"name":"@graphql-hive/client","version":"0.30.0-alpha-20240319100803-f9a060690ab1d3adb77d53ace2022937dffa8259","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-alpha-20240319100803-f9a060690ab1d3adb77d53ace2022937dffa8259","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"5aa4722c3b0bdaa86fa3bbe1ba5b6d2cb3b43a98","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-alpha-20240319100803-f9a060690ab1d3adb77d53ace2022937dffa8259.tgz","fileCount":64,"integrity":"sha512-ZLqzr2wV/jmQGl8ja+V4nEHPQjkuejUvQiuA8PkgehTTJd3IMOXQaYEKWdnPPVau0olXQS5uLucMkqxiisEvRA==","signatures":[{"sig":"MEUCIQDhESQG+raEextqFo4S8/pBXjorZNminLFMPDcjNZUaiAIgYhKnTvUzG4mA72xNeax2hxqgCaECw/TfRvca1SxIO/Q=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242133},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-alpha-20240319100803-f9a060690ab1d3adb77d53ace2022937dffa8259.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/d92e912a0bea31904a911c5959ef698d/graphql-hive-client-0.30.0-alpha-20240319100803-f9a060690ab1d3adb77d53ace2022937dffa8259.tgz","_integrity":"sha512-ZLqzr2wV/jmQGl8ja+V4nEHPQjkuejUvQiuA8PkgehTTJd3IMOXQaYEKWdnPPVau0olXQS5uLucMkqxiisEvRA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-alpha-20240319100803-f9a060690ab1d3adb77d53ace2022937dffa8259_1710842912818_0.5498439541728697","host":"s3://npm-registry-packages"}},"0.30.0-alpha-20240319101437-656fb001039150d71fafc91d94c529bdc6dccf83":{"name":"@graphql-hive/client","version":"0.30.0-alpha-20240319101437-656fb001039150d71fafc91d94c529bdc6dccf83","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-alpha-20240319101437-656fb001039150d71fafc91d94c529bdc6dccf83","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"66e24f8637f68d905fb7fa93a6638f1e8252e4f4","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-alpha-20240319101437-656fb001039150d71fafc91d94c529bdc6dccf83.tgz","fileCount":64,"integrity":"sha512-mBHAJektGyBRKOMiAom0FlVTlOJWBWNnQoiNZ73yNgOOU2u95mQsQzbJh0hkg65JneJR19rcIhb5ViApgQ9jYg==","signatures":[{"sig":"MEQCIC5DmCa1dJ/kCDMQVDaJBsDt1uncTDS/UVD1xTbUCDY1AiAp7wYe8dVUN9DSIb8JeNDKdrg5vD81F6qAlXiCXVkBAA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242133},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-alpha-20240319101437-656fb001039150d71fafc91d94c529bdc6dccf83.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/f901975d1c62afcbe8ef6b7f1d9a2075/graphql-hive-client-0.30.0-alpha-20240319101437-656fb001039150d71fafc91d94c529bdc6dccf83.tgz","_integrity":"sha512-mBHAJektGyBRKOMiAom0FlVTlOJWBWNnQoiNZ73yNgOOU2u95mQsQzbJh0hkg65JneJR19rcIhb5ViApgQ9jYg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-alpha-20240319101437-656fb001039150d71fafc91d94c529bdc6dccf83_1710843307127_0.7726734729073872","host":"s3://npm-registry-packages"}},"0.30.0-alpha-20240319101915-9d657de68a22ae6fb27e031d85831fa82521d751":{"name":"@graphql-hive/client","version":"0.30.0-alpha-20240319101915-9d657de68a22ae6fb27e031d85831fa82521d751","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-alpha-20240319101915-9d657de68a22ae6fb27e031d85831fa82521d751","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"08d6a4db7d4c9d176e2a01326db29ef0ba2c55e9","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-alpha-20240319101915-9d657de68a22ae6fb27e031d85831fa82521d751.tgz","fileCount":64,"integrity":"sha512-U75LdcenCbW7AVV0W4tCoGPbfvlhZff4R+hX0T5Yvh+Mgzc2ytTZcou4mZTJCoreV86d9lODZP7HaGcVsaVcCw==","signatures":[{"sig":"MEYCIQCRcxgNBO6SEMoyvLVrv5fMnC5DubT0+6e3CyS5qdMCxwIhAIiwb1118EIiZn0c6wArP6/NnRrDvhoSx0hUGEvA/bSY","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242133},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-alpha-20240319101915-9d657de68a22ae6fb27e031d85831fa82521d751.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/4d17de828df8e976682982db0703e9dc/graphql-hive-client-0.30.0-alpha-20240319101915-9d657de68a22ae6fb27e031d85831fa82521d751.tgz","_integrity":"sha512-U75LdcenCbW7AVV0W4tCoGPbfvlhZff4R+hX0T5Yvh+Mgzc2ytTZcou4mZTJCoreV86d9lODZP7HaGcVsaVcCw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-alpha-20240319101915-9d657de68a22ae6fb27e031d85831fa82521d751_1710843582018_0.35033348489058813","host":"s3://npm-registry-packages"}},"0.30.0-alpha-20240319112829-d69821dfa46ab09302453552af90136973db7daa":{"name":"@graphql-hive/client","version":"0.30.0-alpha-20240319112829-d69821dfa46ab09302453552af90136973db7daa","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-alpha-20240319112829-d69821dfa46ab09302453552af90136973db7daa","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"7e58a136a8bd5b5eb0604c67fea02c46daf15f13","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-alpha-20240319112829-d69821dfa46ab09302453552af90136973db7daa.tgz","fileCount":64,"integrity":"sha512-P/kgeNpT4gg10yeI4L1O3SydmPPcF+BmPOXUQViQCrotfSb/Ig39AE9r3cSgdQHO2ixALLr0adftoIGhKlafBQ==","signatures":[{"sig":"MEYCIQDUu7WmdtIMBX+GCBRU0ICCksa7M+7Knusz9oLLv2oWywIhAMCIivha3HtxJBqJzUndPnlQ9FcDEstbjcjeiAJQlKP5","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242608},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-alpha-20240319112829-d69821dfa46ab09302453552af90136973db7daa.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/d30362e40371ec8f4a056acffc825539/graphql-hive-client-0.30.0-alpha-20240319112829-d69821dfa46ab09302453552af90136973db7daa.tgz","_integrity":"sha512-P/kgeNpT4gg10yeI4L1O3SydmPPcF+BmPOXUQViQCrotfSb/Ig39AE9r3cSgdQHO2ixALLr0adftoIGhKlafBQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-alpha-20240319112829-d69821dfa46ab09302453552af90136973db7daa_1710847735633_0.0674992260173417","host":"s3://npm-registry-packages"}},"0.30.0-alpha-20240319134508-86e13f46ed89e707ae5e2f3d7cdb4b31d21fe070":{"name":"@graphql-hive/client","version":"0.30.0-alpha-20240319134508-86e13f46ed89e707ae5e2f3d7cdb4b31d21fe070","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-alpha-20240319134508-86e13f46ed89e707ae5e2f3d7cdb4b31d21fe070","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"a79a3be11783babe1d5b6671ec3cd048105f1845","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-alpha-20240319134508-86e13f46ed89e707ae5e2f3d7cdb4b31d21fe070.tgz","fileCount":64,"integrity":"sha512-HnHCSYxk3ioyavjnaJXcwgJQkHnQ1Se4t9VMWxtHZ6Ddr65aIOialOyazPm+zYwXv8rshw/fRtxNayDSaC1ZRw==","signatures":[{"sig":"MEQCIELXHp57rtnYIN4jjaq0jepohjbJ4ciPVQS7ADKUWQRlAiAayXfCrKxLJx7CRzUFmETSg63ntDFiMwE5PDMEQHAZlQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242608},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-alpha-20240319134508-86e13f46ed89e707ae5e2f3d7cdb4b31d21fe070.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/d7560a807a46b1c2ee7ba11a00577b99/graphql-hive-client-0.30.0-alpha-20240319134508-86e13f46ed89e707ae5e2f3d7cdb4b31d21fe070.tgz","_integrity":"sha512-HnHCSYxk3ioyavjnaJXcwgJQkHnQ1Se4t9VMWxtHZ6Ddr65aIOialOyazPm+zYwXv8rshw/fRtxNayDSaC1ZRw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-alpha-20240319134508-86e13f46ed89e707ae5e2f3d7cdb4b31d21fe070_1710855934666_0.7129499620423021","host":"s3://npm-registry-packages"}},"0.30.0-alpha-20240319151847-ee6346a8ffd6ad2dbb279ac274cab5e06bf748bb":{"name":"@graphql-hive/client","version":"0.30.0-alpha-20240319151847-ee6346a8ffd6ad2dbb279ac274cab5e06bf748bb","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-alpha-20240319151847-ee6346a8ffd6ad2dbb279ac274cab5e06bf748bb","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"e4fa51ed860852420214744df648bf8cb96f7bb4","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-alpha-20240319151847-ee6346a8ffd6ad2dbb279ac274cab5e06bf748bb.tgz","fileCount":64,"integrity":"sha512-mP+yyY2zidT1cyrlNou1wFdWX+cn/UOkLVQJC8XaS32HbcWJ3+y2NOd8HvhWXcGJvU9hGA2ZU0QHHew1/NPChQ==","signatures":[{"sig":"MEQCIA1390T7/3Tu+ikCuOpv1kGqwFYpdMsbJJ8M1stlBqLqAiA3wPpB2LmcbRId9e0eRq1U1eKNklv7AINoUnXjFihb5w==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242608},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-alpha-20240319151847-ee6346a8ffd6ad2dbb279ac274cab5e06bf748bb.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/696c1b43931271c1714ca05773840398/graphql-hive-client-0.30.0-alpha-20240319151847-ee6346a8ffd6ad2dbb279ac274cab5e06bf748bb.tgz","_integrity":"sha512-mP+yyY2zidT1cyrlNou1wFdWX+cn/UOkLVQJC8XaS32HbcWJ3+y2NOd8HvhWXcGJvU9hGA2ZU0QHHew1/NPChQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-alpha-20240319151847-ee6346a8ffd6ad2dbb279ac274cab5e06bf748bb_1710861554713_0.9970645757607461","host":"s3://npm-registry-packages"}},"0.30.0-alpha-20240320133324-0298f71426d843f319895301a1cd03d207021c8b":{"name":"@graphql-hive/client","version":"0.30.0-alpha-20240320133324-0298f71426d843f319895301a1cd03d207021c8b","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-alpha-20240320133324-0298f71426d843f319895301a1cd03d207021c8b","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"a1ffeccc4608290bebf7c37692532cc2cbeb0892","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-alpha-20240320133324-0298f71426d843f319895301a1cd03d207021c8b.tgz","fileCount":64,"integrity":"sha512-DkybrLkYfzKHD52XELXgYq2yjW/mqNQwxJm8EhSBKYUER/DmFe7wO5g91CNBx89xdVHzaN3PyJMhcTd1/mVvuw==","signatures":[{"sig":"MEQCIBh0zpMMBYKjzjsKVImALiwJeCnktPJk4pmi1RzfAf3fAiARo+zIOkStdX+Sc6G6wxGCrBKEwkeoqRqSxRz0XhDfww==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242602},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-alpha-20240320133324-0298f71426d843f319895301a1cd03d207021c8b.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/8a2a26a8e3ba1b0e752e59c8d6f4b0b5/graphql-hive-client-0.30.0-alpha-20240320133324-0298f71426d843f319895301a1cd03d207021c8b.tgz","_integrity":"sha512-DkybrLkYfzKHD52XELXgYq2yjW/mqNQwxJm8EhSBKYUER/DmFe7wO5g91CNBx89xdVHzaN3PyJMhcTd1/mVvuw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-alpha-20240320133324-0298f71426d843f319895301a1cd03d207021c8b_1710941630524_0.384943408907815","host":"s3://npm-registry-packages"}},"0.30.0-alpha-20240320151335-2a06e268824a41e6b2cf91ac13917a846499d49a":{"name":"@graphql-hive/client","version":"0.30.0-alpha-20240320151335-2a06e268824a41e6b2cf91ac13917a846499d49a","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-alpha-20240320151335-2a06e268824a41e6b2cf91ac13917a846499d49a","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"9501dc0f777ecb2720be2ce488bb552caeee8963","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-alpha-20240320151335-2a06e268824a41e6b2cf91ac13917a846499d49a.tgz","fileCount":64,"integrity":"sha512-CQ1BURFD4Hs9oK9wrmsA5B+RawRJ5vEl1dNYSSQiORXsiE66WyMtUDC96Y9mk+x6EqwgE2bP5yf1gwruZfCxkg==","signatures":[{"sig":"MEQCIDYX1Tcq9m9Lt78LR2T1HtSUpZ2wNyp9vT3+t4UN3lcWAiA4Z/xP+0U1FLhaCSorg/vQYFVhuHFY18YnqSXIZllsMA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242602},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-alpha-20240320151335-2a06e268824a41e6b2cf91ac13917a846499d49a.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/8d5fe31903ccc4c64d3f85099c5d29d6/graphql-hive-client-0.30.0-alpha-20240320151335-2a06e268824a41e6b2cf91ac13917a846499d49a.tgz","_integrity":"sha512-CQ1BURFD4Hs9oK9wrmsA5B+RawRJ5vEl1dNYSSQiORXsiE66WyMtUDC96Y9mk+x6EqwgE2bP5yf1gwruZfCxkg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-alpha-20240320151335-2a06e268824a41e6b2cf91ac13917a846499d49a_1710947642071_0.7375178871709553","host":"s3://npm-registry-packages"}},"0.30.0-alpha-20240320152059-84c86ef0f483a56c8d5fd86e690ba1be2e40a800":{"name":"@graphql-hive/client","version":"0.30.0-alpha-20240320152059-84c86ef0f483a56c8d5fd86e690ba1be2e40a800","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-alpha-20240320152059-84c86ef0f483a56c8d5fd86e690ba1be2e40a800","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"15139450004a8e2ff6849a88c2421e5f1ae6fac0","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-alpha-20240320152059-84c86ef0f483a56c8d5fd86e690ba1be2e40a800.tgz","fileCount":64,"integrity":"sha512-UXyJunh8CqOd+zDdFV4ZseUV+8M4FdhOKenqR2Q/dlUvvnfL7VYzbkUL12UP2/gUM4mK0+xB1S/uYKk46xCc1g==","signatures":[{"sig":"MEUCIDSSoivH/+okQDrQFYG734LiMntrAc+9uBMpSX7QaslsAiEAgqQShcR8gi+9sY+p3O8uPncpWeKJKHvch5Sya4JGVqw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242602},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-alpha-20240320152059-84c86ef0f483a56c8d5fd86e690ba1be2e40a800.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/eb12272fac467b5743c0ab62190559e3/graphql-hive-client-0.30.0-alpha-20240320152059-84c86ef0f483a56c8d5fd86e690ba1be2e40a800.tgz","_integrity":"sha512-UXyJunh8CqOd+zDdFV4ZseUV+8M4FdhOKenqR2Q/dlUvvnfL7VYzbkUL12UP2/gUM4mK0+xB1S/uYKk46xCc1g==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-alpha-20240320152059-84c86ef0f483a56c8d5fd86e690ba1be2e40a800_1710948092935_0.20307963843996624","host":"s3://npm-registry-packages"}},"0.30.0-alpha-20240320154305-ce101c66a79858342bfffa55dfd0240445dd9912":{"name":"@graphql-hive/client","version":"0.30.0-alpha-20240320154305-ce101c66a79858342bfffa55dfd0240445dd9912","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-alpha-20240320154305-ce101c66a79858342bfffa55dfd0240445dd9912","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"f8638397d7340f0bf66b8f68e9b1d4419656d2dd","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-alpha-20240320154305-ce101c66a79858342bfffa55dfd0240445dd9912.tgz","fileCount":64,"integrity":"sha512-h1ncA/FKVHOHNLs8s4owvOEOfuT5DiH8DTp6EsN4HAUDmr+YNxz+GCUo/IBU8TXSV8CKhHPY4mXA8kFjxSdeZA==","signatures":[{"sig":"MEYCIQDJpHeYTZ2AIFTZNFd5ai213RtGYdUFXKo/UZcDoeApdQIhAK7BxfGlnYEGVvu9LCIvl9KzN8M6xsjEgWjIUodMt9qX","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242602},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-alpha-20240320154305-ce101c66a79858342bfffa55dfd0240445dd9912.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/108c869ecf4baa9327816bef2187e7a6/graphql-hive-client-0.30.0-alpha-20240320154305-ce101c66a79858342bfffa55dfd0240445dd9912.tgz","_integrity":"sha512-h1ncA/FKVHOHNLs8s4owvOEOfuT5DiH8DTp6EsN4HAUDmr+YNxz+GCUo/IBU8TXSV8CKhHPY4mXA8kFjxSdeZA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-alpha-20240320154305-ce101c66a79858342bfffa55dfd0240445dd9912_1710949411918_0.4817366322484731","host":"s3://npm-registry-packages"}},"0.30.0-alpha-20240325082747-6590220194683b5210d11394504f8eec4cb82db6":{"name":"@graphql-hive/client","version":"0.30.0-alpha-20240325082747-6590220194683b5210d11394504f8eec4cb82db6","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-alpha-20240325082747-6590220194683b5210d11394504f8eec4cb82db6","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"da2c7bb0ac43131f4b7a2364f68c54fd86bfc128","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-alpha-20240325082747-6590220194683b5210d11394504f8eec4cb82db6.tgz","fileCount":64,"integrity":"sha512-sKSUZPFbedGCXWLVbBqW8N9mZI4Z8qw/jYQ/hPYfkwQznUUObL8J7By02kt6VDRIYYd6phmge/JyEuYDzKx/+w==","signatures":[{"sig":"MEUCIQCAMCXGFQ3JRD7qNVLAEmn7hHv0UJ8P7YDQYBdcuYWnTwIgNQY6pqpHPwAdRo6Dgyv1fcbklPv9xe+JgyzFlBXdE8c=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242602},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-alpha-20240325082747-6590220194683b5210d11394504f8eec4cb82db6.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/1b55dbba662bf6abf1437098a3b00922/graphql-hive-client-0.30.0-alpha-20240325082747-6590220194683b5210d11394504f8eec4cb82db6.tgz","_integrity":"sha512-sKSUZPFbedGCXWLVbBqW8N9mZI4Z8qw/jYQ/hPYfkwQznUUObL8J7By02kt6VDRIYYd6phmge/JyEuYDzKx/+w==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.3","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-alpha-20240325082747-6590220194683b5210d11394504f8eec4cb82db6_1711355293709_0.47505663919325647","host":"s3://npm-registry-packages"}},"0.29.1-rc-20240325112321-720a01659edb97457cd3ea522e1ae9f4c7f5845d":{"name":"@graphql-hive/client","version":"0.29.1-rc-20240325112321-720a01659edb97457cd3ea522e1ae9f4c7f5845d","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.29.1-rc-20240325112321-720a01659edb97457cd3ea522e1ae9f4c7f5845d","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"d7595567b52f0511d7c1ada9813041a0356b9354","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.29.1-rc-20240325112321-720a01659edb97457cd3ea522e1ae9f4c7f5845d.tgz","fileCount":64,"integrity":"sha512-0ArTDccqmgCFU00agDVwP3l9TNuMOzPH1pI5yhFe1vmjyKD5b2O2Bh9A5QiEiYsJ+iyPEphfDGKnObEHcXGA9g==","signatures":[{"sig":"MEQCIDrPdrDQ0lW0E3pxf6078ghETNJLIYFRSQurTcZ87d4+AiB5gwC4IJ8DjJGkmThAWOH8aBA1W2FtwIDOTyrGby47tg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":224183},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.29.1-rc-20240325112321-720a01659edb97457cd3ea522e1ae9f4c7f5845d.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/0ad26566ac5c264495ab49de0fc761b0/graphql-hive-client-0.29.1-rc-20240325112321-720a01659edb97457cd3ea522e1ae9f4c7f5845d.tgz","_integrity":"sha512-0ArTDccqmgCFU00agDVwP3l9TNuMOzPH1pI5yhFe1vmjyKD5b2O2Bh9A5QiEiYsJ+iyPEphfDGKnObEHcXGA9g==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"0.2.4-rc-20240325112321-720a01659edb97457cd3ea522e1ae9f4c7f5845d","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.29.1-rc-20240325112321-720a01659edb97457cd3ea522e1ae9f4c7f5845d_1711365828352_0.7047181405093816","host":"s3://npm-registry-packages"}},"0.29.1-rc-20240325112732-7df9c9ac446bf5ad8588559283b79029bfc903c9":{"name":"@graphql-hive/client","version":"0.29.1-rc-20240325112732-7df9c9ac446bf5ad8588559283b79029bfc903c9","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.29.1-rc-20240325112732-7df9c9ac446bf5ad8588559283b79029bfc903c9","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"f4bc066f6a7cb5d7d6e27d7007ccf301adc53f06","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.29.1-rc-20240325112732-7df9c9ac446bf5ad8588559283b79029bfc903c9.tgz","fileCount":64,"integrity":"sha512-bXDXb1vNqCPBbQG/2xRGXAOyA7dfwWcIJPqvovdI0rJDsJKY1qy2nRoHuINWdDUkDOJTDemCMG3imAWTlHgDCg==","signatures":[{"sig":"MEYCIQCZRPMDP5T372uATE7DrEsvMshmcJv4prjopvDHYF379wIhAO78AmrDnf8zEMWEhNyIAtohR1673Kcb4spIDyak9UBM","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":224183},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.29.1-rc-20240325112732-7df9c9ac446bf5ad8588559283b79029bfc903c9.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/854c1b21d87d140b79e4f2a9bdc88259/graphql-hive-client-0.29.1-rc-20240325112732-7df9c9ac446bf5ad8588559283b79029bfc903c9.tgz","_integrity":"sha512-bXDXb1vNqCPBbQG/2xRGXAOyA7dfwWcIJPqvovdI0rJDsJKY1qy2nRoHuINWdDUkDOJTDemCMG3imAWTlHgDCg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"0.2.4-rc-20240325112732-7df9c9ac446bf5ad8588559283b79029bfc903c9","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.29.1-rc-20240325112732-7df9c9ac446bf5ad8588559283b79029bfc903c9_1711366078236_0.3556712199653478","host":"s3://npm-registry-packages"}},"0.30.0-alpha-20240325113809-b0cce1bccd91f098d5265f5e7b2337e32c5bc8f7":{"name":"@graphql-hive/client","version":"0.30.0-alpha-20240325113809-b0cce1bccd91f098d5265f5e7b2337e32c5bc8f7","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-alpha-20240325113809-b0cce1bccd91f098d5265f5e7b2337e32c5bc8f7","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"8d4e420cda3e6e4ef16bc9cc167f9501a52ce214","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-alpha-20240325113809-b0cce1bccd91f098d5265f5e7b2337e32c5bc8f7.tgz","fileCount":64,"integrity":"sha512-RIv2W8ByfXlpp2FIwjCn2ISF98HmkTlRyFWcZ3fow+3WCOEqaNV/70839gHbx2dBQuGapELKyGxTWxUbbYpz5g==","signatures":[{"sig":"MEUCIBc4qeItsV1iy4gsIsE5APVgAR47nNpaxTAZt4uUwIv2AiEA3bQiNsBlvrfOQAYy/UaUhJPuqxINsqf4a8IH25DJF/c=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242723},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-alpha-20240325113809-b0cce1bccd91f098d5265f5e7b2337e32c5bc8f7.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/49ca127cecc628fabbffb2a87a2df83a/graphql-hive-client-0.30.0-alpha-20240325113809-b0cce1bccd91f098d5265f5e7b2337e32c5bc8f7.tgz","_integrity":"sha512-RIv2W8ByfXlpp2FIwjCn2ISF98HmkTlRyFWcZ3fow+3WCOEqaNV/70839gHbx2dBQuGapELKyGxTWxUbbYpz5g==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"0.2.4-alpha-20240325113809-b0cce1bccd91f098d5265f5e7b2337e32c5bc8f7","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-alpha-20240325113809-b0cce1bccd91f098d5265f5e7b2337e32c5bc8f7_1711366717342_0.924030602548259","host":"s3://npm-registry-packages"}},"0.30.0-alpha-20240325122646-3e5cd939d56ead63cbb9547c4a20b16744523895":{"name":"@graphql-hive/client","version":"0.30.0-alpha-20240325122646-3e5cd939d56ead63cbb9547c4a20b16744523895","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-alpha-20240325122646-3e5cd939d56ead63cbb9547c4a20b16744523895","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"06fd351e1117a18b3f7373ef3f525019ec891285","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-alpha-20240325122646-3e5cd939d56ead63cbb9547c4a20b16744523895.tgz","fileCount":64,"integrity":"sha512-OsATjg/kKCsB422nLuDwMF7E1sEcAw790MVGT+qpTecX1dzfBWIk/8um6oeFPoNB2XeKVSlMN0O0euKer8aTDw==","signatures":[{"sig":"MEYCIQDktEPr49jNRDbZFpl0T42w6/AbM4zbKWaTUMMWum/bhAIhAL/aCmW5XoAKCAkvwTBKfUdxCxk2jahsMrx31Gw8fYdF","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242662},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-alpha-20240325122646-3e5cd939d56ead63cbb9547c4a20b16744523895.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/82d457e33a5a3ca22c8c85c16032dbfa/graphql-hive-client-0.30.0-alpha-20240325122646-3e5cd939d56ead63cbb9547c4a20b16744523895.tgz","_integrity":"sha512-OsATjg/kKCsB422nLuDwMF7E1sEcAw790MVGT+qpTecX1dzfBWIk/8um6oeFPoNB2XeKVSlMN0O0euKer8aTDw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-alpha-20240325122646-3e5cd939d56ead63cbb9547c4a20b16744523895_1711369633667_0.9997433756882952","host":"s3://npm-registry-packages"}},"0.30.0-alpha-20240325123205-b49898675ce5fac824364aa7aa43e29c7d33658a":{"name":"@graphql-hive/client","version":"0.30.0-alpha-20240325123205-b49898675ce5fac824364aa7aa43e29c7d33658a","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-alpha-20240325123205-b49898675ce5fac824364aa7aa43e29c7d33658a","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"649684c67babe0da925f1124e8e7f0133a91c96a","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-alpha-20240325123205-b49898675ce5fac824364aa7aa43e29c7d33658a.tgz","fileCount":64,"integrity":"sha512-3T/P5DTQdPbjMLjpPFU2CI0/vjc/g5Ih5l2p5Pz4YUceWSBFbdAUZ3Z4uqt9Ig0lLjkR3E9rYOnK0Cs98HmYSw==","signatures":[{"sig":"MEYCIQDUgBM+IzLcH1CeAaJXy+5wTGxzFGDn0a+4o/ndbhOrvwIhAJJatBKsXw0xbC7rs+ioCzjJweZmOk/1ID97q5iQ0aZy","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242662},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-alpha-20240325123205-b49898675ce5fac824364aa7aa43e29c7d33658a.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/69d212968b2287141a43f5f57f078b1d/graphql-hive-client-0.30.0-alpha-20240325123205-b49898675ce5fac824364aa7aa43e29c7d33658a.tgz","_integrity":"sha512-3T/P5DTQdPbjMLjpPFU2CI0/vjc/g5Ih5l2p5Pz4YUceWSBFbdAUZ3Z4uqt9Ig0lLjkR3E9rYOnK0Cs98HmYSw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-alpha-20240325123205-b49898675ce5fac824364aa7aa43e29c7d33658a_1711369951882_0.7723113124830481","host":"s3://npm-registry-packages"}},"0.30.0-alpha-20240325123709-ad2e9a517b1574aef1dfa7359e8a7b1b266c9b33":{"name":"@graphql-hive/client","version":"0.30.0-alpha-20240325123709-ad2e9a517b1574aef1dfa7359e8a7b1b266c9b33","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-alpha-20240325123709-ad2e9a517b1574aef1dfa7359e8a7b1b266c9b33","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"e107c4204aaa4393b343111e5bba4502ff568c66","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-alpha-20240325123709-ad2e9a517b1574aef1dfa7359e8a7b1b266c9b33.tgz","fileCount":64,"integrity":"sha512-+6OHfH1R92CouZlFDWRpRAc8Hbx/EotKCjHuuAmLzhgQuTAuIbKBuTQvNwaWUOuE5HzgaWtaVPr1fxO+QQlxYg==","signatures":[{"sig":"MEQCIFmJmtMKjWKvVVsGIE0ne2doy6tX+WEpmOBsjU1s/Dq1AiBYr5IjFuCssPI2/CuWLAoircB9e3XlNOlf6x1An/Hkdw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242662},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-alpha-20240325123709-ad2e9a517b1574aef1dfa7359e8a7b1b266c9b33.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/95be5bb5a82bbd3865205f540d977ffd/graphql-hive-client-0.30.0-alpha-20240325123709-ad2e9a517b1574aef1dfa7359e8a7b1b266c9b33.tgz","_integrity":"sha512-+6OHfH1R92CouZlFDWRpRAc8Hbx/EotKCjHuuAmLzhgQuTAuIbKBuTQvNwaWUOuE5HzgaWtaVPr1fxO+QQlxYg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-alpha-20240325123709-ad2e9a517b1574aef1dfa7359e8a7b1b266c9b33_1711370255140_0.7264210285307686","host":"s3://npm-registry-packages"}},"0.30.0-alpha-20240325124147-5d3d28c55b09f975ff40bb7cea60ef4700776a6d":{"name":"@graphql-hive/client","version":"0.30.0-alpha-20240325124147-5d3d28c55b09f975ff40bb7cea60ef4700776a6d","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-alpha-20240325124147-5d3d28c55b09f975ff40bb7cea60ef4700776a6d","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"00599d4e01a7f9cd1dfe6845b73b4ae38b20d440","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-alpha-20240325124147-5d3d28c55b09f975ff40bb7cea60ef4700776a6d.tgz","fileCount":64,"integrity":"sha512-8NiRVrn7r/6iRyx6zf90151axMlO+uKzFa5jPuFwNo5ZIu2MLXF9Ws9J5TorwZGrMbY2uxdX1mHR2/joz8H07Q==","signatures":[{"sig":"MEQCIE7x4N/Ec9/d28oVpoEfDlGuXINAGLqWvcWcvolTFcHrAiBF91UFRttnT/dubl+E3za0cNKAbhgJ2oObLPLq/Dqkzw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242662},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-alpha-20240325124147-5d3d28c55b09f975ff40bb7cea60ef4700776a6d.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/b7223b68c8152094be6981a5ab728448/graphql-hive-client-0.30.0-alpha-20240325124147-5d3d28c55b09f975ff40bb7cea60ef4700776a6d.tgz","_integrity":"sha512-8NiRVrn7r/6iRyx6zf90151axMlO+uKzFa5jPuFwNo5ZIu2MLXF9Ws9J5TorwZGrMbY2uxdX1mHR2/joz8H07Q==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-alpha-20240325124147-5d3d28c55b09f975ff40bb7cea60ef4700776a6d_1711370532645_0.22696567990105243","host":"s3://npm-registry-packages"}},"0.30.0-alpha-20240325124730-4682c0852c133ac48ca27c668f314deac46f9e0f":{"name":"@graphql-hive/client","version":"0.30.0-alpha-20240325124730-4682c0852c133ac48ca27c668f314deac46f9e0f","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-alpha-20240325124730-4682c0852c133ac48ca27c668f314deac46f9e0f","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"b3036bde0d4f3a443c2f300c4a7275cf03230901","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-alpha-20240325124730-4682c0852c133ac48ca27c668f314deac46f9e0f.tgz","fileCount":64,"integrity":"sha512-foyiLqDrvFhANymmMjbLHX/tAAiPttHyI4tj+n7/FrXjfuUw1iXoh9tgJ9kCeNAp34EUyRA1VNdLGkzbbfGHag==","signatures":[{"sig":"MEUCIQCOVO8esZWAiqJFY5SUg89Lf2gCDi+1pP9EHjh5aVUL0AIgIWkyrSXFhfklYhnqsVMV56Fxv2obONqIg6jcit3NYQo=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242662},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-alpha-20240325124730-4682c0852c133ac48ca27c668f314deac46f9e0f.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/e0736b9eba661b422fc74887fe26ae9b/graphql-hive-client-0.30.0-alpha-20240325124730-4682c0852c133ac48ca27c668f314deac46f9e0f.tgz","_integrity":"sha512-foyiLqDrvFhANymmMjbLHX/tAAiPttHyI4tj+n7/FrXjfuUw1iXoh9tgJ9kCeNAp34EUyRA1VNdLGkzbbfGHag==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-alpha-20240325124730-4682c0852c133ac48ca27c668f314deac46f9e0f_1711370876353_0.7093753408575381","host":"s3://npm-registry-packages"}},"0.30.0-alpha-20240325124821-d92e220bcf23edd4fb44c5f08b85cc40c35b513b":{"name":"@graphql-hive/client","version":"0.30.0-alpha-20240325124821-d92e220bcf23edd4fb44c5f08b85cc40c35b513b","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-alpha-20240325124821-d92e220bcf23edd4fb44c5f08b85cc40c35b513b","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"a232b6d9b539f8dfafb63a23887511f002551a27","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-alpha-20240325124821-d92e220bcf23edd4fb44c5f08b85cc40c35b513b.tgz","fileCount":64,"integrity":"sha512-QXmWEzE6H424akc6TKrMrQv2Ol9mTFu5YgEPMMAwi42xDvWDoRMJaARss7xTKDDJZWrJARwXz+ozR4ggQGXy3A==","signatures":[{"sig":"MEYCIQDM3/5199Cy8Uwy0n1gWfomSGQ9MByRpT9sMDiRLKhIcgIhAIf2EbKRIGOnHQK6aEC29IX5gn7c0Z28bNYy45AwSgau","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242662},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-alpha-20240325124821-d92e220bcf23edd4fb44c5f08b85cc40c35b513b.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/4af693c5f1e6289c11d90bccc03558c5/graphql-hive-client-0.30.0-alpha-20240325124821-d92e220bcf23edd4fb44c5f08b85cc40c35b513b.tgz","_integrity":"sha512-QXmWEzE6H424akc6TKrMrQv2Ol9mTFu5YgEPMMAwi42xDvWDoRMJaARss7xTKDDJZWrJARwXz+ozR4ggQGXy3A==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-alpha-20240325124821-d92e220bcf23edd4fb44c5f08b85cc40c35b513b_1711370927719_0.5327732257210636","host":"s3://npm-registry-packages"}},"0.30.0-rc-20240325125259-6e112ab7ff5a2f30904a1f27fc1b0133a7c8eb91":{"name":"@graphql-hive/client","version":"0.30.0-rc-20240325125259-6e112ab7ff5a2f30904a1f27fc1b0133a7c8eb91","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-rc-20240325125259-6e112ab7ff5a2f30904a1f27fc1b0133a7c8eb91","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"0ab9c80d6cbb2d388d4fc3f416c3b94c01c924a7","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-rc-20240325125259-6e112ab7ff5a2f30904a1f27fc1b0133a7c8eb91.tgz","fileCount":64,"integrity":"sha512-4njx8JqgrJwaKLGq49dK8V2zhqBB7zAp4sMFoSCC32A/dnb3hLlfs7ghp8oHZE/uFNEqDhmMZUhEhCtdYSHn6A==","signatures":[{"sig":"MEQCIF4vnuWdbJmScgjUqcRvUjUB7E1mkCfvx0eVPPEg5DC4AiB2XgBNbs5jWqRgVG2uI5lJQt8ieH6dltqu8u2AFi2CKA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242647},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-rc-20240325125259-6e112ab7ff5a2f30904a1f27fc1b0133a7c8eb91.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/78e015fbb297e5ce9d2f25d069a0e438/graphql-hive-client-0.30.0-rc-20240325125259-6e112ab7ff5a2f30904a1f27fc1b0133a7c8eb91.tgz","_integrity":"sha512-4njx8JqgrJwaKLGq49dK8V2zhqBB7zAp4sMFoSCC32A/dnb3hLlfs7ghp8oHZE/uFNEqDhmMZUhEhCtdYSHn6A==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-rc-20240325125259-6e112ab7ff5a2f30904a1f27fc1b0133a7c8eb91_1711371205636_0.054049327137929426","host":"s3://npm-registry-packages"}},"0.30.0-alpha-20240325125919-0e0896ac7352de9fa367c13e4b5602a403a63a77":{"name":"@graphql-hive/client","version":"0.30.0-alpha-20240325125919-0e0896ac7352de9fa367c13e4b5602a403a63a77","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-alpha-20240325125919-0e0896ac7352de9fa367c13e4b5602a403a63a77","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"97c2403a7fd04a5fe5447621882758e6d8e08c59","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-alpha-20240325125919-0e0896ac7352de9fa367c13e4b5602a403a63a77.tgz","fileCount":64,"integrity":"sha512-U+py24zR9Jizg23MUlbV8P/6SBWAxQ734auBY9CrgjUG4RVBGggcbYzu+V2JDcNmxkgae3UV3AXVYrZB6u1Xlg==","signatures":[{"sig":"MEUCIQCxxGhJ2g/y+mcuodZwdU+eu7RJ4ueYGwPZY2/YwTs65gIgYzpeAH32BwCbWJSQbFdsRURaBXlMUgqShWXh5f6z/6M=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242662},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-alpha-20240325125919-0e0896ac7352de9fa367c13e4b5602a403a63a77.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/062cd4f4f265a9f09d79b7e866adbdb6/graphql-hive-client-0.30.0-alpha-20240325125919-0e0896ac7352de9fa367c13e4b5602a403a63a77.tgz","_integrity":"sha512-U+py24zR9Jizg23MUlbV8P/6SBWAxQ734auBY9CrgjUG4RVBGggcbYzu+V2JDcNmxkgae3UV3AXVYrZB6u1Xlg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-alpha-20240325125919-0e0896ac7352de9fa367c13e4b5602a403a63a77_1711371584584_0.8722665675375743","host":"s3://npm-registry-packages"}},"0.30.0-alpha-20240325130306-b0b650ac2e21d96dcb3d9111427ce94af799ee76":{"name":"@graphql-hive/client","version":"0.30.0-alpha-20240325130306-b0b650ac2e21d96dcb3d9111427ce94af799ee76","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-alpha-20240325130306-b0b650ac2e21d96dcb3d9111427ce94af799ee76","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"d368d17511590d112aea807775dca7ca994c88df","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-alpha-20240325130306-b0b650ac2e21d96dcb3d9111427ce94af799ee76.tgz","fileCount":64,"integrity":"sha512-1nAU9ktYM5kFlxgR8vwfUzvenV+lOBCxixd/Eor7guKAobIsD4SZJzYCLT2QiI0R1lWa35We88zyVWRzCZV0Uw==","signatures":[{"sig":"MEQCIADBTs03q0fMhKyXCMg2Ctwelnce27Qyl821FQU4GWi8AiAW1C7iWwrZaCLo4LM5Kg9v0UHBBnt74Vh8P0JZeNgMfw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242662},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-alpha-20240325130306-b0b650ac2e21d96dcb3d9111427ce94af799ee76.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/cfaaf22c347a46af7006b52034e053dc/graphql-hive-client-0.30.0-alpha-20240325130306-b0b650ac2e21d96dcb3d9111427ce94af799ee76.tgz","_integrity":"sha512-1nAU9ktYM5kFlxgR8vwfUzvenV+lOBCxixd/Eor7guKAobIsD4SZJzYCLT2QiI0R1lWa35We88zyVWRzCZV0Uw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-alpha-20240325130306-b0b650ac2e21d96dcb3d9111427ce94af799ee76_1711371812534_0.08631539424338142","host":"s3://npm-registry-packages"}},"0.30.0-alpha-20240325130901-11ddb4d0e694c03b195ae57704fdcf7d5546548c":{"name":"@graphql-hive/client","version":"0.30.0-alpha-20240325130901-11ddb4d0e694c03b195ae57704fdcf7d5546548c","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-alpha-20240325130901-11ddb4d0e694c03b195ae57704fdcf7d5546548c","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"56378b7d7eccbb0579b6862869544a6380b5c2f8","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-alpha-20240325130901-11ddb4d0e694c03b195ae57704fdcf7d5546548c.tgz","fileCount":64,"integrity":"sha512-ZAGYzMzjbmiQPURS9Q1AWJjENSTxm0BDRnFJjIql5KUiqIwoBJ6TGEBApRAKfhut/sYPbzjR/LcyZOjJNgUAyQ==","signatures":[{"sig":"MEUCIQC2AUbWzUvAms4oiGL6EfOWrtqTfYYaOdb0IZIoZ8eEgwIgTsNw3MAuBIbmlnMGbtigYGNcLa3rz+APqSSjC3Wo4pE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242662},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-alpha-20240325130901-11ddb4d0e694c03b195ae57704fdcf7d5546548c.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/27c1f8346c357c44f3448b96f2d6d205/graphql-hive-client-0.30.0-alpha-20240325130901-11ddb4d0e694c03b195ae57704fdcf7d5546548c.tgz","_integrity":"sha512-ZAGYzMzjbmiQPURS9Q1AWJjENSTxm0BDRnFJjIql5KUiqIwoBJ6TGEBApRAKfhut/sYPbzjR/LcyZOjJNgUAyQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-alpha-20240325130901-11ddb4d0e694c03b195ae57704fdcf7d5546548c_1711372166919_0.9797507148909401","host":"s3://npm-registry-packages"}},"0.30.0-alpha-20240325131613-d55fa83dc90b460fac9473b9b5a5e1fce205cc08":{"name":"@graphql-hive/client","version":"0.30.0-alpha-20240325131613-d55fa83dc90b460fac9473b9b5a5e1fce205cc08","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-alpha-20240325131613-d55fa83dc90b460fac9473b9b5a5e1fce205cc08","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"21695fd643c075520ad369cfc58c1c92af0e09ee","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-alpha-20240325131613-d55fa83dc90b460fac9473b9b5a5e1fce205cc08.tgz","fileCount":64,"integrity":"sha512-oh8ssPQU6HmJrb0Yget/Z0b3w1b2uVFU2rqrT/F+bHOXiwQ0wE+yrPn4jPMJX5wDSPMJoHG/C52PR2bq9l1v2A==","signatures":[{"sig":"MEYCIQD/e6FOnTLl/qgXDEYCfNqbWk+sIQj7FMNJesDFWfOZJgIhAJ8oNSkp2IfgxtqbOwtX85QTP0miDdFJt+cslqfmbH5W","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242662},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-alpha-20240325131613-d55fa83dc90b460fac9473b9b5a5e1fce205cc08.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/731a20415ffe210fb4d8cc8907d121ae/graphql-hive-client-0.30.0-alpha-20240325131613-d55fa83dc90b460fac9473b9b5a5e1fce205cc08.tgz","_integrity":"sha512-oh8ssPQU6HmJrb0Yget/Z0b3w1b2uVFU2rqrT/F+bHOXiwQ0wE+yrPn4jPMJX5wDSPMJoHG/C52PR2bq9l1v2A==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-alpha-20240325131613-d55fa83dc90b460fac9473b9b5a5e1fce205cc08_1711372600281_0.022741862752904574","host":"s3://npm-registry-packages"}},"0.30.0-alpha-20240325131929-43ca0442e7726910ecc3cc2bb75190425bdaf1f9":{"name":"@graphql-hive/client","version":"0.30.0-alpha-20240325131929-43ca0442e7726910ecc3cc2bb75190425bdaf1f9","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-alpha-20240325131929-43ca0442e7726910ecc3cc2bb75190425bdaf1f9","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"6d6f353e9142aa1c4a3687135b42e3ee68aa0d9d","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-alpha-20240325131929-43ca0442e7726910ecc3cc2bb75190425bdaf1f9.tgz","fileCount":64,"integrity":"sha512-41Z42SHn5n9BSpmWon5St3FFC3Yd2yEW0JfipfRFVwmEitF3AYP5KMNFfmxV5pOwt+qk0psBbI/RWWTnIGTTwg==","signatures":[{"sig":"MEQCIHhP8HeXlnvxGMVoYDhbjUH1BTI+zb/cC10ZA+YwFFeMAiBwjVj/IR9I8zfy3zRW6i+YJrW4ZEDKMIA5H20NnDUgJw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242662},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-alpha-20240325131929-43ca0442e7726910ecc3cc2bb75190425bdaf1f9.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/f9fafdc5bcc339f1ce4b70daff05a73f/graphql-hive-client-0.30.0-alpha-20240325131929-43ca0442e7726910ecc3cc2bb75190425bdaf1f9.tgz","_integrity":"sha512-41Z42SHn5n9BSpmWon5St3FFC3Yd2yEW0JfipfRFVwmEitF3AYP5KMNFfmxV5pOwt+qk0psBbI/RWWTnIGTTwg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-alpha-20240325131929-43ca0442e7726910ecc3cc2bb75190425bdaf1f9_1711372800208_0.9628600235539473","host":"s3://npm-registry-packages"}},"0.30.0-alpha-20240325132509-0f90875e8aed3e2f565c2e308814417de2c0d9d5":{"name":"@graphql-hive/client","version":"0.30.0-alpha-20240325132509-0f90875e8aed3e2f565c2e308814417de2c0d9d5","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-alpha-20240325132509-0f90875e8aed3e2f565c2e308814417de2c0d9d5","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"2c6f417227bb815e494d60e5f45807455a5f1111","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-alpha-20240325132509-0f90875e8aed3e2f565c2e308814417de2c0d9d5.tgz","fileCount":64,"integrity":"sha512-9swCmAGNxXXBse6BoG+Ln384q/relvzEZqCVqP9imI4iOmGQuuK0uGrGPt47fA7ly4qP1CnP7YkrrNG8Pr0WXw==","signatures":[{"sig":"MEQCID5xvejYrQrcRGKmNoPj6AJxh59YI/JnFcpxGp0PnBSMAiBQpdFz08i5WCRmu6uSAjjOLXXc240fAM+a98hc/Z9h8w==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242662},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-alpha-20240325132509-0f90875e8aed3e2f565c2e308814417de2c0d9d5.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/863c89ae4d2606669e40be350d948243/graphql-hive-client-0.30.0-alpha-20240325132509-0f90875e8aed3e2f565c2e308814417de2c0d9d5.tgz","_integrity":"sha512-9swCmAGNxXXBse6BoG+Ln384q/relvzEZqCVqP9imI4iOmGQuuK0uGrGPt47fA7ly4qP1CnP7YkrrNG8Pr0WXw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-alpha-20240325132509-0f90875e8aed3e2f565c2e308814417de2c0d9d5_1711373137861_0.6990825299115451","host":"s3://npm-registry-packages"}},"0.30.0-alpha-20240325132549-daa9c18c1708b3bb89f0bf69616b0699e29cde8e":{"name":"@graphql-hive/client","version":"0.30.0-alpha-20240325132549-daa9c18c1708b3bb89f0bf69616b0699e29cde8e","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-alpha-20240325132549-daa9c18c1708b3bb89f0bf69616b0699e29cde8e","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"9fc1ef4c2a5d922c1bc324b2843df337f6d5f2cc","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-alpha-20240325132549-daa9c18c1708b3bb89f0bf69616b0699e29cde8e.tgz","fileCount":64,"integrity":"sha512-tj4SSt4zG6huuDK5o7SevuVRvuYWvCopcwY6P0FwnnLmgyCb5UlWhnco74Mu5Y+WQWasVaKVvay3BZQ13U3nAw==","signatures":[{"sig":"MEUCIAZjfU/2GKpMjotiXtOoMfRl1aMxI84ncbC0K5Bb13rEAiEA3MhSxu2Qo3FqLeiiUS36m9t97TI7QiTIpCH2BQHiw70=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242662},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-alpha-20240325132549-daa9c18c1708b3bb89f0bf69616b0699e29cde8e.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/c6bc0e564c92e75a771997b9d0c07b39/graphql-hive-client-0.30.0-alpha-20240325132549-daa9c18c1708b3bb89f0bf69616b0699e29cde8e.tgz","_integrity":"sha512-tj4SSt4zG6huuDK5o7SevuVRvuYWvCopcwY6P0FwnnLmgyCb5UlWhnco74Mu5Y+WQWasVaKVvay3BZQ13U3nAw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-alpha-20240325132549-daa9c18c1708b3bb89f0bf69616b0699e29cde8e_1711373175420_0.5317515612361301","host":"s3://npm-registry-packages"}},"0.30.0-alpha-20240325132808-68e7501afad8aaa2453721eaebed0540b0899305":{"name":"@graphql-hive/client","version":"0.30.0-alpha-20240325132808-68e7501afad8aaa2453721eaebed0540b0899305","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-alpha-20240325132808-68e7501afad8aaa2453721eaebed0540b0899305","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"fec9dd90a02c896b0adfdeac4748fe7128578575","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-alpha-20240325132808-68e7501afad8aaa2453721eaebed0540b0899305.tgz","fileCount":64,"integrity":"sha512-C2gd/L++wLzcmlEQyouRP5L4dzs7tadHVuYvJke9wFSkBmaZEblu95dDTlcoTnPSKCChQJ2U1VrTYiR0xKdmVQ==","signatures":[{"sig":"MEUCIGaws7zQN8RGxbsQ9p9PlquSUU/Z1E5vrjOz+LpvqeoOAiEA3atCBc6vlGzcVPnEI/Prr8qGA6UrlfHlR4WLsKPdtyQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242662},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-alpha-20240325132808-68e7501afad8aaa2453721eaebed0540b0899305.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/e126e1768c8d4acfa26fa161220aa3c8/graphql-hive-client-0.30.0-alpha-20240325132808-68e7501afad8aaa2453721eaebed0540b0899305.tgz","_integrity":"sha512-C2gd/L++wLzcmlEQyouRP5L4dzs7tadHVuYvJke9wFSkBmaZEblu95dDTlcoTnPSKCChQJ2U1VrTYiR0xKdmVQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-alpha-20240325132808-68e7501afad8aaa2453721eaebed0540b0899305_1711373314275_0.46220225948455207","host":"s3://npm-registry-packages"}},"0.30.0-alpha-20240325132825-c868b61c7c38496a3a89a031aec060a188f9f53d":{"name":"@graphql-hive/client","version":"0.30.0-alpha-20240325132825-c868b61c7c38496a3a89a031aec060a188f9f53d","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-alpha-20240325132825-c868b61c7c38496a3a89a031aec060a188f9f53d","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"029896959d842496aaa01430783e203cd22536ab","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-alpha-20240325132825-c868b61c7c38496a3a89a031aec060a188f9f53d.tgz","fileCount":64,"integrity":"sha512-wjeZOy2Wi8P2h2MUSCGSZ3O6ySjRypbWtaxoLPNCIefw0W87RTuThVgOJLsCAjMCTqDW9eD6akfoNwvPXYcSsg==","signatures":[{"sig":"MEYCIQCULOvhCuk2cAiC/b8ZlBuiSjIFHLauVinEUItjJEyEWwIhAMEoaUcpgq2ccODL5sv8uCC3K4/UZyS15iD0Jr5db0aS","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242662},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-alpha-20240325132825-c868b61c7c38496a3a89a031aec060a188f9f53d.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/15c788f3c0e716bcc0084dd52ef14710/graphql-hive-client-0.30.0-alpha-20240325132825-c868b61c7c38496a3a89a031aec060a188f9f53d.tgz","_integrity":"sha512-wjeZOy2Wi8P2h2MUSCGSZ3O6ySjRypbWtaxoLPNCIefw0W87RTuThVgOJLsCAjMCTqDW9eD6akfoNwvPXYcSsg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-alpha-20240325132825-c868b61c7c38496a3a89a031aec060a188f9f53d_1711373330725_0.23270323936557147","host":"s3://npm-registry-packages"}},"0.30.0-alpha-20240325132853-ceb9d2796cf602c7332c380ce7b5240fef1d6fc2":{"name":"@graphql-hive/client","version":"0.30.0-alpha-20240325132853-ceb9d2796cf602c7332c380ce7b5240fef1d6fc2","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-alpha-20240325132853-ceb9d2796cf602c7332c380ce7b5240fef1d6fc2","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"cf6f7e6bda590b267929d0938fc48e575cb9940b","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-alpha-20240325132853-ceb9d2796cf602c7332c380ce7b5240fef1d6fc2.tgz","fileCount":64,"integrity":"sha512-P1Oj2WxfYiAOWu11DGcoqGAOcbTXnj2sacbygCsApYKiK5O+Y8qr9xZC9JoKXGc6hoy9Xj2OY1JiojvpxySfow==","signatures":[{"sig":"MEQCIHeMC+oAkjMEoe/6H4QaEkrfrnE3jWFkEbFLqTwxIZxnAiB4n7d67OmMjJAvDgc59JdgwwxZJz1L2zkTq60/2vLENA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242662},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-alpha-20240325132853-ceb9d2796cf602c7332c380ce7b5240fef1d6fc2.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/a95226283d70ece63ab1a225f013d112/graphql-hive-client-0.30.0-alpha-20240325132853-ceb9d2796cf602c7332c380ce7b5240fef1d6fc2.tgz","_integrity":"sha512-P1Oj2WxfYiAOWu11DGcoqGAOcbTXnj2sacbygCsApYKiK5O+Y8qr9xZC9JoKXGc6hoy9Xj2OY1JiojvpxySfow==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-alpha-20240325132853-ceb9d2796cf602c7332c380ce7b5240fef1d6fc2_1711373359430_0.6389631908899269","host":"s3://npm-registry-packages"}},"0.30.0-alpha-20240325133203-7cf36c4ad117ad59c046a2b2e698c282deb933fc":{"name":"@graphql-hive/client","version":"0.30.0-alpha-20240325133203-7cf36c4ad117ad59c046a2b2e698c282deb933fc","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-alpha-20240325133203-7cf36c4ad117ad59c046a2b2e698c282deb933fc","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"7acd6d74ec689e71ab9026802783a9fcad7ce08a","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-alpha-20240325133203-7cf36c4ad117ad59c046a2b2e698c282deb933fc.tgz","fileCount":64,"integrity":"sha512-SsHgq0zudZxDgGDML4v88IFsXrf5VsqkKPrUi5M/3o8yxa59pRUQolQ9K//M9/LD5hh+8VYKQW5Oz6dFYRDFmg==","signatures":[{"sig":"MEQCIHXZ7S5N7Fu9HP8NykXbB88ZBCGDRuGZyw6OKy9bwaAXAiANrMARKimWkJmLQHgi2r+wdE90NyTkZsY+5oKFFvvnAw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242662},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-alpha-20240325133203-7cf36c4ad117ad59c046a2b2e698c282deb933fc.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/54825ba5e93f5bb18d9964aaa491165b/graphql-hive-client-0.30.0-alpha-20240325133203-7cf36c4ad117ad59c046a2b2e698c282deb933fc.tgz","_integrity":"sha512-SsHgq0zudZxDgGDML4v88IFsXrf5VsqkKPrUi5M/3o8yxa59pRUQolQ9K//M9/LD5hh+8VYKQW5Oz6dFYRDFmg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-alpha-20240325133203-7cf36c4ad117ad59c046a2b2e698c282deb933fc_1711373550518_0.6424398695926106","host":"s3://npm-registry-packages"}},"0.30.0-alpha-20240325133748-e7e49a7227658a0f6c136eb0a2b30d002a41b95c":{"name":"@graphql-hive/client","version":"0.30.0-alpha-20240325133748-e7e49a7227658a0f6c136eb0a2b30d002a41b95c","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-alpha-20240325133748-e7e49a7227658a0f6c136eb0a2b30d002a41b95c","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"eee5715e1c3043b0da16156029106c19a76aaf7b","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-alpha-20240325133748-e7e49a7227658a0f6c136eb0a2b30d002a41b95c.tgz","fileCount":64,"integrity":"sha512-Lr2HiDzGwgomMCaSKLaJAJ4bbVfrlYQogx4l65ru5ep/t7zwqsDP4U260UU4vp5lmwd76olVOnW6RARjuds/ww==","signatures":[{"sig":"MEUCIQD2SXcqP1t0DZNrNBYsQ36piUQ81C6aC3NiJfQ3ChdhRQIgAqKoF968mPmHPUY9NH6aAc2ByWcZo3bJzslZFJPebrg=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242662},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-alpha-20240325133748-e7e49a7227658a0f6c136eb0a2b30d002a41b95c.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/4d87a25005a6b3e1f1ff70a24a8f74c1/graphql-hive-client-0.30.0-alpha-20240325133748-e7e49a7227658a0f6c136eb0a2b30d002a41b95c.tgz","_integrity":"sha512-Lr2HiDzGwgomMCaSKLaJAJ4bbVfrlYQogx4l65ru5ep/t7zwqsDP4U260UU4vp5lmwd76olVOnW6RARjuds/ww==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-alpha-20240325133748-e7e49a7227658a0f6c136eb0a2b30d002a41b95c_1711373894026_0.9831370231408234","host":"s3://npm-registry-packages"}},"0.30.0-alpha-20240325135546-c3532a59a93e6f891f72465a90f659976a74c7fc":{"name":"@graphql-hive/client","version":"0.30.0-alpha-20240325135546-c3532a59a93e6f891f72465a90f659976a74c7fc","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-alpha-20240325135546-c3532a59a93e6f891f72465a90f659976a74c7fc","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"bd43f980658fd4d7a6242f69d15090952ff1ce05","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-alpha-20240325135546-c3532a59a93e6f891f72465a90f659976a74c7fc.tgz","fileCount":64,"integrity":"sha512-fCEkt8HyaWlo7LQ7JyQClcwFXbcXSWxEVGeaS/IZGcu2IFhJ4z6U4Q13MfVAQ+QhHzvhNvU7NeGmVfOKu7Yj+w==","signatures":[{"sig":"MEUCIEHX0IfIbMWG7B/RP0Dw46X0zp5ujogsUgX7MSzdz56AAiEA5oeiRA2hK4+e3rhTmFPGeevYQS2QL8CU5z1C9PaZ1o8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242662},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-alpha-20240325135546-c3532a59a93e6f891f72465a90f659976a74c7fc.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/76e4385e433d46ce7818ec1e090744b5/graphql-hive-client-0.30.0-alpha-20240325135546-c3532a59a93e6f891f72465a90f659976a74c7fc.tgz","_integrity":"sha512-fCEkt8HyaWlo7LQ7JyQClcwFXbcXSWxEVGeaS/IZGcu2IFhJ4z6U4Q13MfVAQ+QhHzvhNvU7NeGmVfOKu7Yj+w==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-alpha-20240325135546-c3532a59a93e6f891f72465a90f659976a74c7fc_1711374973924_0.0037354244406391235","host":"s3://npm-registry-packages"}},"0.30.0-alpha-20240325135635-df18d1758c9f58390e40e4e35d4a36f8667942c3":{"name":"@graphql-hive/client","version":"0.30.0-alpha-20240325135635-df18d1758c9f58390e40e4e35d4a36f8667942c3","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-alpha-20240325135635-df18d1758c9f58390e40e4e35d4a36f8667942c3","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"e5772134343aa704dc228239de4aa32e3bf9b6e5","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-alpha-20240325135635-df18d1758c9f58390e40e4e35d4a36f8667942c3.tgz","fileCount":64,"integrity":"sha512-/yas9EhEvIXDRAtAIB25IOJ+c+r4tJzFlsDf7901Ght4LxCJEaY+sK2OtvQjFoUDLqDa+7dfy/fytMVKIq4OPg==","signatures":[{"sig":"MEQCIGVFar6cW50LBw1iDer8wpsy5+WGlqp6paUhRexWFcl6AiBQ4mT4pO2tMc9Hl7aQi8YbriBPg9461tCerWhwFb3ufA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242662},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-alpha-20240325135635-df18d1758c9f58390e40e4e35d4a36f8667942c3.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/b67bbaecd63d1b7ee0411975368e50ac/graphql-hive-client-0.30.0-alpha-20240325135635-df18d1758c9f58390e40e4e35d4a36f8667942c3.tgz","_integrity":"sha512-/yas9EhEvIXDRAtAIB25IOJ+c+r4tJzFlsDf7901Ght4LxCJEaY+sK2OtvQjFoUDLqDa+7dfy/fytMVKIq4OPg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-alpha-20240325135635-df18d1758c9f58390e40e4e35d4a36f8667942c3_1711375020855_0.5350104511134806","host":"s3://npm-registry-packages"}},"0.30.0-alpha-20240325142727-2c1e9cbd6fea82c8b4f853f820015c995e697457":{"name":"@graphql-hive/client","version":"0.30.0-alpha-20240325142727-2c1e9cbd6fea82c8b4f853f820015c995e697457","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-alpha-20240325142727-2c1e9cbd6fea82c8b4f853f820015c995e697457","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"c4c420ae799be896917ee367f7438f377d987e44","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-alpha-20240325142727-2c1e9cbd6fea82c8b4f853f820015c995e697457.tgz","fileCount":64,"integrity":"sha512-Wo5QgrNrxw/9WwS0qtAGLF2hY+FjPwzlt/VDrtgVxEAmPYc3OPa6MVsFt+M8165eKIFnMDq/pdjFxYzhlW0BpQ==","signatures":[{"sig":"MEUCIBlNDQBBdIFKbzwxJCStODENc7/Nk/s3QBu8ZoBW9OkGAiEAg23DysL/B6gRPmAQZuTnbGIUFUe1QLUzGSwtVua/RLs=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242662},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-alpha-20240325142727-2c1e9cbd6fea82c8b4f853f820015c995e697457.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/f40d63db9273376ac36f62c14db280b2/graphql-hive-client-0.30.0-alpha-20240325142727-2c1e9cbd6fea82c8b4f853f820015c995e697457.tgz","_integrity":"sha512-Wo5QgrNrxw/9WwS0qtAGLF2hY+FjPwzlt/VDrtgVxEAmPYc3OPa6MVsFt+M8165eKIFnMDq/pdjFxYzhlW0BpQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-alpha-20240325142727-2c1e9cbd6fea82c8b4f853f820015c995e697457_1711376873286_0.14582722148472382","host":"s3://npm-registry-packages"}},"0.30.0-alpha-20240325142838-945e623014b4aa42fe3c78279e1eb3077eaa6090":{"name":"@graphql-hive/client","version":"0.30.0-alpha-20240325142838-945e623014b4aa42fe3c78279e1eb3077eaa6090","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-alpha-20240325142838-945e623014b4aa42fe3c78279e1eb3077eaa6090","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"56e514567fbc544cd81864620da23758005efc6d","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-alpha-20240325142838-945e623014b4aa42fe3c78279e1eb3077eaa6090.tgz","fileCount":64,"integrity":"sha512-cbSTbxoH0c3i4Kqkopw9x7G8yzqodhTBiqJseUv+B2GrX91I16MsChgF9myxjUGfEXxb9LxyBV5rNZ/MOZ4mCw==","signatures":[{"sig":"MEUCICzCa0nW7glNNZmJajxyGLMD6yB3fw2cPPBghNu7qBK2AiEAtiEz03Xf3psM6qvEsThIFHHUXMuD8PlVQhLTghnFBKI=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242662},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-alpha-20240325142838-945e623014b4aa42fe3c78279e1eb3077eaa6090.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/3fe4839eadb93ee308ef0e7e2e2496c8/graphql-hive-client-0.30.0-alpha-20240325142838-945e623014b4aa42fe3c78279e1eb3077eaa6090.tgz","_integrity":"sha512-cbSTbxoH0c3i4Kqkopw9x7G8yzqodhTBiqJseUv+B2GrX91I16MsChgF9myxjUGfEXxb9LxyBV5rNZ/MOZ4mCw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-alpha-20240325142838-945e623014b4aa42fe3c78279e1eb3077eaa6090_1711376944149_0.46382360056636696","host":"s3://npm-registry-packages"}},"0.30.0-rc-20240325142936-0b09c2dc4cc9aeb77b4609ba8be595961e33d678":{"name":"@graphql-hive/client","version":"0.30.0-rc-20240325142936-0b09c2dc4cc9aeb77b4609ba8be595961e33d678","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-rc-20240325142936-0b09c2dc4cc9aeb77b4609ba8be595961e33d678","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"e25c482a02dbe9f7f2d8e03fcc777138f56d6c94","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-rc-20240325142936-0b09c2dc4cc9aeb77b4609ba8be595961e33d678.tgz","fileCount":64,"integrity":"sha512-N7IT/WtGq9lNabeoGX4ypdWmS7cSKj/USpi1epwji7/dHanFWLlKb88qHZNBwof5O6nUymUMpFY6oAICm0SjdQ==","signatures":[{"sig":"MEYCIQCqdcsfNx/ZMmdeG2CFyGkdIdm2lN6bmcrZXoU3U0Sp/wIhAPFT9XX7oRV7AKbXQ28cDos17fJGAbOWh7GVvC2yFXeW","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242647},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-rc-20240325142936-0b09c2dc4cc9aeb77b4609ba8be595961e33d678.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/52b03f2a2bac204dc23344136e891bd2/graphql-hive-client-0.30.0-rc-20240325142936-0b09c2dc4cc9aeb77b4609ba8be595961e33d678.tgz","_integrity":"sha512-N7IT/WtGq9lNabeoGX4ypdWmS7cSKj/USpi1epwji7/dHanFWLlKb88qHZNBwof5O6nUymUMpFY6oAICm0SjdQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-rc-20240325142936-0b09c2dc4cc9aeb77b4609ba8be595961e33d678_1711377003237_0.6632014693308343","host":"s3://npm-registry-packages"}},"0.30.0-alpha-20240325155817-2c1e9cbd6fea82c8b4f853f820015c995e697457":{"name":"@graphql-hive/client","version":"0.30.0-alpha-20240325155817-2c1e9cbd6fea82c8b4f853f820015c995e697457","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-alpha-20240325155817-2c1e9cbd6fea82c8b4f853f820015c995e697457","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"b61bfb9ca3991244a7cc22dd21275417841ba308","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-alpha-20240325155817-2c1e9cbd6fea82c8b4f853f820015c995e697457.tgz","fileCount":64,"integrity":"sha512-tnlcMBeqJwqxhrDbExVwjk+AwAlRWXNO08wIq56OYDdS4ts4iQyosdXL1WbrRPiUBbr2LK4A6oApalMuSssauA==","signatures":[{"sig":"MEUCIBeIrgolg2q+CbbnakmDNTcjv0aNiJgFK05z1yjsrVNAAiEAmOZMeatyekLLGV8VC3MiFrjynzOBNQm+oHUwY9ct8+k=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242662},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-alpha-20240325155817-2c1e9cbd6fea82c8b4f853f820015c995e697457.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/a2d1986713b2f9372e6e74e630f6ea11/graphql-hive-client-0.30.0-alpha-20240325155817-2c1e9cbd6fea82c8b4f853f820015c995e697457.tgz","_integrity":"sha512-tnlcMBeqJwqxhrDbExVwjk+AwAlRWXNO08wIq56OYDdS4ts4iQyosdXL1WbrRPiUBbr2LK4A6oApalMuSssauA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-alpha-20240325155817-2c1e9cbd6fea82c8b4f853f820015c995e697457_1711382325645_0.05148973766250764","host":"s3://npm-registry-packages"}},"0.30.0-alpha-20240325165050-fba680a924213c2a8365ff313ffd739134cfb340":{"name":"@graphql-hive/client","version":"0.30.0-alpha-20240325165050-fba680a924213c2a8365ff313ffd739134cfb340","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-alpha-20240325165050-fba680a924213c2a8365ff313ffd739134cfb340","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"6fbe4fac2c5706bceb07aea5046b768f6e54cdf4","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-alpha-20240325165050-fba680a924213c2a8365ff313ffd739134cfb340.tgz","fileCount":64,"integrity":"sha512-eIYWWhiZKz1Pokczq0lNkyU5HPxPQOk+yHDLjedcmjIB8LMj+xOxR38WH46zlj1nVrcgSOxaFeFEK8lCCBc23A==","signatures":[{"sig":"MEUCIFF3OLrHNJBzkAvAdP11zBGVMX2nJezMraoJ7Scq4v+/AiEAkBwr+n6pcMPUfo1RG3MnkJICGNxdI4DaL0+vAfVE5Xk=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242662},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-alpha-20240325165050-fba680a924213c2a8365ff313ffd739134cfb340.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/a50ee3fbfde0ecebbd7e894458bc519e/graphql-hive-client-0.30.0-alpha-20240325165050-fba680a924213c2a8365ff313ffd739134cfb340.tgz","_integrity":"sha512-eIYWWhiZKz1Pokczq0lNkyU5HPxPQOk+yHDLjedcmjIB8LMj+xOxR38WH46zlj1nVrcgSOxaFeFEK8lCCBc23A==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-alpha-20240325165050-fba680a924213c2a8365ff313ffd739134cfb340_1711385477689_0.050664097849916656","host":"s3://npm-registry-packages"}},"0.30.0-alpha-20240325172809-50e4ecdd330219a7d79caeb0a01207668b6e09b7":{"name":"@graphql-hive/client","version":"0.30.0-alpha-20240325172809-50e4ecdd330219a7d79caeb0a01207668b6e09b7","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-alpha-20240325172809-50e4ecdd330219a7d79caeb0a01207668b6e09b7","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"2bff17561c0f0e3783111737a11385a373f230ae","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-alpha-20240325172809-50e4ecdd330219a7d79caeb0a01207668b6e09b7.tgz","fileCount":64,"integrity":"sha512-rnw1+G/am1Ek1bRsB5dFZfLTBXI+yGldnK/seWwd2mORzS/Ecm9hh5mc1fZPQa/y9jcD2Xz2Gc96wxbNjvcpYw==","signatures":[{"sig":"MEYCIQDLvUvMQ0aPc3QHuTO1PCKISfg/DoBQ7017NsjZZa2dcgIhAI1GJczY6luR9o07Mfe1yPqZUzITcidNPRgk+mAYSWG/","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242662},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-alpha-20240325172809-50e4ecdd330219a7d79caeb0a01207668b6e09b7.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/cefbd23debee2a84b67eef93b4798f28/graphql-hive-client-0.30.0-alpha-20240325172809-50e4ecdd330219a7d79caeb0a01207668b6e09b7.tgz","_integrity":"sha512-rnw1+G/am1Ek1bRsB5dFZfLTBXI+yGldnK/seWwd2mORzS/Ecm9hh5mc1fZPQa/y9jcD2Xz2Gc96wxbNjvcpYw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-alpha-20240325172809-50e4ecdd330219a7d79caeb0a01207668b6e09b7_1711387716950_0.5616289239161285","host":"s3://npm-registry-packages"}},"0.30.0-rc-20240325173629-6f492e243c0172898fa88d5b45d020f0c931fc62":{"name":"@graphql-hive/client","version":"0.30.0-rc-20240325173629-6f492e243c0172898fa88d5b45d020f0c931fc62","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-rc-20240325173629-6f492e243c0172898fa88d5b45d020f0c931fc62","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"23bb19378ee17ff5d969fc24cd1acf7c8205b998","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-rc-20240325173629-6f492e243c0172898fa88d5b45d020f0c931fc62.tgz","fileCount":64,"integrity":"sha512-kEYuB37xfiZw15aWLV2q18Wtcb7lq6p0vJZc7xdsSdJrtvM6cDMdt6bfMcN+V0NnUznm/ZojSx55bQsncK6P2A==","signatures":[{"sig":"MEQCIAadvbBggk3EppbMh7ysQDY56N8YcGfLlmuVMzWMQnZkAiB6IkCi0AW/oTNtuzlndjetjP/GE5+W8qSuI+pIJZmzXg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242647},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-rc-20240325173629-6f492e243c0172898fa88d5b45d020f0c931fc62.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/68577ee3042f24fb4686f98cb180f44f/graphql-hive-client-0.30.0-rc-20240325173629-6f492e243c0172898fa88d5b45d020f0c931fc62.tgz","_integrity":"sha512-kEYuB37xfiZw15aWLV2q18Wtcb7lq6p0vJZc7xdsSdJrtvM6cDMdt6bfMcN+V0NnUznm/ZojSx55bQsncK6P2A==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-rc-20240325173629-6f492e243c0172898fa88d5b45d020f0c931fc62_1711388214917_0.61254416267734","host":"s3://npm-registry-packages"}},"0.30.0-alpha-20240325173751-dbb49b78c8a867cacafc5f5caf929e3295fafef5":{"name":"@graphql-hive/client","version":"0.30.0-alpha-20240325173751-dbb49b78c8a867cacafc5f5caf929e3295fafef5","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-alpha-20240325173751-dbb49b78c8a867cacafc5f5caf929e3295fafef5","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"e51504c2f51b79dabc6d7dff64d12675837496d8","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-alpha-20240325173751-dbb49b78c8a867cacafc5f5caf929e3295fafef5.tgz","fileCount":64,"integrity":"sha512-LCwsTQzgPRB/YHfut6z6HHQS3E80cdrZrYycxg898yM+9TNXeMozCW3S8xXfy06FeJ1n6BKSWtdjaoM8yU4sSQ==","signatures":[{"sig":"MEUCIE2rnyHQMabGORqLAHrhx1P+kZlrgauAvjOC6+DWanifAiEA6wNDPCJk4uulaIhKV9Ig0b6OnMv7yTkdDvltreN2/0w=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242662},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-alpha-20240325173751-dbb49b78c8a867cacafc5f5caf929e3295fafef5.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/a1fabb65f86346aaaa45470bf39498d9/graphql-hive-client-0.30.0-alpha-20240325173751-dbb49b78c8a867cacafc5f5caf929e3295fafef5.tgz","_integrity":"sha512-LCwsTQzgPRB/YHfut6z6HHQS3E80cdrZrYycxg898yM+9TNXeMozCW3S8xXfy06FeJ1n6BKSWtdjaoM8yU4sSQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-alpha-20240325173751-dbb49b78c8a867cacafc5f5caf929e3295fafef5_1711388301186_0.4280863644343169","host":"s3://npm-registry-packages"}},"0.30.0-alpha-20240325173844-fba0c45f9a8fffd8c50a9e318372c15606bacccf":{"name":"@graphql-hive/client","version":"0.30.0-alpha-20240325173844-fba0c45f9a8fffd8c50a9e318372c15606bacccf","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-alpha-20240325173844-fba0c45f9a8fffd8c50a9e318372c15606bacccf","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"c9deb50d40c3d8bab3bee83fc896456a3e106105","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-alpha-20240325173844-fba0c45f9a8fffd8c50a9e318372c15606bacccf.tgz","fileCount":64,"integrity":"sha512-FAgc7fJX+gOuhJk9J3Fznbe3mvlVnBXTDQfE8QYqqgXttwoFI4Se0mzfYV8nzyS9UkRkdiFsvIcYzCI3pO3VPg==","signatures":[{"sig":"MEQCIHEAlC0v3u+Ev2cfJp7di0H7bP5CQg/LBpgqmDH4i0/bAiAWhtnzCU3kp+Kl39nyjKfSFNAjWWfeyk25jtxX9gfxGA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242662},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-alpha-20240325173844-fba0c45f9a8fffd8c50a9e318372c15606bacccf.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/dc0e7933bdca4c0cd21376a14a861bdc/graphql-hive-client-0.30.0-alpha-20240325173844-fba0c45f9a8fffd8c50a9e318372c15606bacccf.tgz","_integrity":"sha512-FAgc7fJX+gOuhJk9J3Fznbe3mvlVnBXTDQfE8QYqqgXttwoFI4Se0mzfYV8nzyS9UkRkdiFsvIcYzCI3pO3VPg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-alpha-20240325173844-fba0c45f9a8fffd8c50a9e318372c15606bacccf_1711388351307_0.2126917084421438","host":"s3://npm-registry-packages"}},"0.30.0-rc-20240326065042-95710614dc235ae09402933b188a92c0f9e7574e":{"name":"@graphql-hive/client","version":"0.30.0-rc-20240326065042-95710614dc235ae09402933b188a92c0f9e7574e","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-rc-20240326065042-95710614dc235ae09402933b188a92c0f9e7574e","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"3aa6bca0f14a52c5cac9c0a9aa859decb12522a8","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-rc-20240326065042-95710614dc235ae09402933b188a92c0f9e7574e.tgz","fileCount":64,"integrity":"sha512-LVusiilQ64KvE61fyO2twLVH2dx9Sy8WErTSaxtgVoKVsN8NPELEkCalA8X5FKH9fmVv5hlX0twWMTcE87t8ag==","signatures":[{"sig":"MEUCIFsjE4D8R9B3DEBa2oQ9fUkwqaccjnxjsYGzGdm4FdZYAiEA0hMEta/4IuYS9fqAYCxRDScJ2nIrGZjTGqr3XGlC/x0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242647},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-rc-20240326065042-95710614dc235ae09402933b188a92c0f9e7574e.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/76727d8c88e24045afac2f274fdae49d/graphql-hive-client-0.30.0-rc-20240326065042-95710614dc235ae09402933b188a92c0f9e7574e.tgz","_integrity":"sha512-LVusiilQ64KvE61fyO2twLVH2dx9Sy8WErTSaxtgVoKVsN8NPELEkCalA8X5FKH9fmVv5hlX0twWMTcE87t8ag==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-rc-20240326065042-95710614dc235ae09402933b188a92c0f9e7574e_1711435870007_0.03010724494610395","host":"s3://npm-registry-packages"}},"0.30.0-alpha-20240326065230-967b5e904c6aa067d1cc5d4a103a9689debc453e":{"name":"@graphql-hive/client","version":"0.30.0-alpha-20240326065230-967b5e904c6aa067d1cc5d4a103a9689debc453e","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-alpha-20240326065230-967b5e904c6aa067d1cc5d4a103a9689debc453e","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"8d823f455b1e0e5b6c44b89b93a9b94fe0aae94d","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-alpha-20240326065230-967b5e904c6aa067d1cc5d4a103a9689debc453e.tgz","fileCount":64,"integrity":"sha512-9lIzvdM+x2ITqN8n8OQBIcr7uOAIMpW4iVLmCdGwe/aeCXz1vADbhlGjIoOejSVivAaDFBFfxsh+YIaGb8IYQw==","signatures":[{"sig":"MEUCIQDqTwd+5WtOkCzcm69czmyahar4gSt14cD86mPkNWCo0AIgT/dzvk9wE/gDQ0oQBo8BNd/+OFzF1DrIUXC8PElUolE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242662},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-alpha-20240326065230-967b5e904c6aa067d1cc5d4a103a9689debc453e.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/b116789f6ed2287bb9c1a9a7a35fbb56/graphql-hive-client-0.30.0-alpha-20240326065230-967b5e904c6aa067d1cc5d4a103a9689debc453e.tgz","_integrity":"sha512-9lIzvdM+x2ITqN8n8OQBIcr7uOAIMpW4iVLmCdGwe/aeCXz1vADbhlGjIoOejSVivAaDFBFfxsh+YIaGb8IYQw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-alpha-20240326065230-967b5e904c6aa067d1cc5d4a103a9689debc453e_1711435976950_0.0007638929385356263","host":"s3://npm-registry-packages"}},"0.30.0-alpha-20240326065318-a020756edec13a8f352e4f6f28647a06340d6a80":{"name":"@graphql-hive/client","version":"0.30.0-alpha-20240326065318-a020756edec13a8f352e4f6f28647a06340d6a80","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-alpha-20240326065318-a020756edec13a8f352e4f6f28647a06340d6a80","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"c8b9e8e84cacb49346778385638d855ff161bf84","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-alpha-20240326065318-a020756edec13a8f352e4f6f28647a06340d6a80.tgz","fileCount":64,"integrity":"sha512-HH3eAzpdPBK48Ael+iF2F9IoI8i2Q5SuaPfUp4uqOoZlTd6vJCKhofaqrtnJ/Gw5qoK0I0MdGLdqAhtyJgXBiQ==","signatures":[{"sig":"MEYCIQDJma37zbdpzAA4czxxAW6Mm7Yb4ajrGnS/eVHZ4F3aPAIhAOzXFXF2Wd6ikZlxpnPUZGENsysP3ipeYzzu+yT4hnYw","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242662},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-alpha-20240326065318-a020756edec13a8f352e4f6f28647a06340d6a80.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/1e6d6cd5600087ba397b7e05bf4bf477/graphql-hive-client-0.30.0-alpha-20240326065318-a020756edec13a8f352e4f6f28647a06340d6a80.tgz","_integrity":"sha512-HH3eAzpdPBK48Ael+iF2F9IoI8i2Q5SuaPfUp4uqOoZlTd6vJCKhofaqrtnJ/Gw5qoK0I0MdGLdqAhtyJgXBiQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-alpha-20240326065318-a020756edec13a8f352e4f6f28647a06340d6a80_1711436025025_0.8306998446523763","host":"s3://npm-registry-packages"}},"0.30.0-alpha-20240326065420-420a3360fe898ed62ac1a36b0e233ed5b6588c85":{"name":"@graphql-hive/client","version":"0.30.0-alpha-20240326065420-420a3360fe898ed62ac1a36b0e233ed5b6588c85","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-alpha-20240326065420-420a3360fe898ed62ac1a36b0e233ed5b6588c85","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"9fa1b4e51db6c0f57a871588dd90f2cb26d7f6f3","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-alpha-20240326065420-420a3360fe898ed62ac1a36b0e233ed5b6588c85.tgz","fileCount":64,"integrity":"sha512-uV5Uk5i5WfopuM4mPOsnM+jCyt3sahXNeR8QU0vZ6uzob2j9Lbr6dw5NGH4yTtNMFbl2HoZJPCoEpMP5pAvvHA==","signatures":[{"sig":"MEQCIEd6unZMxEyBep1WOBo7GSdM3FP6fVYkm6+UZ5Otni9OAiBk/Q9W5A8ccWLbtetweZrO7ARTcux8JgkrrjfedcueFQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242662},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-alpha-20240326065420-420a3360fe898ed62ac1a36b0e233ed5b6588c85.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/9f183f2b1bc24ab5947522bcdb28bdb0/graphql-hive-client-0.30.0-alpha-20240326065420-420a3360fe898ed62ac1a36b0e233ed5b6588c85.tgz","_integrity":"sha512-uV5Uk5i5WfopuM4mPOsnM+jCyt3sahXNeR8QU0vZ6uzob2j9Lbr6dw5NGH4yTtNMFbl2HoZJPCoEpMP5pAvvHA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-alpha-20240326065420-420a3360fe898ed62ac1a36b0e233ed5b6588c85_1711436085878_0.3272703915243924","host":"s3://npm-registry-packages"}},"0.30.0-alpha-20240326065525-6405c9f207c62c94d05f86bf31553c495c012d41":{"name":"@graphql-hive/client","version":"0.30.0-alpha-20240326065525-6405c9f207c62c94d05f86bf31553c495c012d41","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-alpha-20240326065525-6405c9f207c62c94d05f86bf31553c495c012d41","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"169c8611035efa8f5361e1a9f779761ac06d623c","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-alpha-20240326065525-6405c9f207c62c94d05f86bf31553c495c012d41.tgz","fileCount":64,"integrity":"sha512-K8Vs2rt2udr0DLdP9TtpgL6yVwfcB02vRjDqPtP8HMKPWVtB04wCp8k4Re7MNagNNMlbaW75IZ/ZxPE3yrIymg==","signatures":[{"sig":"MEQCIAD8JGrE8lnYXeyWgFN/ztyGd1mzD2MMUs8TaV+c58A0AiBobDyUUcgtZwftuBpxd6/NeWA+8+x4IWNlojnR4k+vRw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242662},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-alpha-20240326065525-6405c9f207c62c94d05f86bf31553c495c012d41.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/02ec11dbc08a304efd080ee7de272a77/graphql-hive-client-0.30.0-alpha-20240326065525-6405c9f207c62c94d05f86bf31553c495c012d41.tgz","_integrity":"sha512-K8Vs2rt2udr0DLdP9TtpgL6yVwfcB02vRjDqPtP8HMKPWVtB04wCp8k4Re7MNagNNMlbaW75IZ/ZxPE3yrIymg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-alpha-20240326065525-6405c9f207c62c94d05f86bf31553c495c012d41_1711436150195_0.1755430445589472","host":"s3://npm-registry-packages"}},"0.30.0-alpha-20240326065638-baab1a3153a874c0787c83236e4172c58ba55b33":{"name":"@graphql-hive/client","version":"0.30.0-alpha-20240326065638-baab1a3153a874c0787c83236e4172c58ba55b33","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-alpha-20240326065638-baab1a3153a874c0787c83236e4172c58ba55b33","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"e66f186cd2538e166a1daf1b09bc257f856b70f3","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-alpha-20240326065638-baab1a3153a874c0787c83236e4172c58ba55b33.tgz","fileCount":64,"integrity":"sha512-ho1yEz/Ry0vsVgkIGXPrQ9oor5X9LQutyEg+w0y6U9QLBtClUg72Mtl3FOqqKoeDJtd0xDQQ6j273cM+3XMI7g==","signatures":[{"sig":"MEUCIQDKWMc5RfTGveTePHZi3CUlTs2tyzvyEqROsxxPEXO62gIgPEpPg/1v+IckLj7xzXVY3VutTCi2H0AN+gH8GMHl/X0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242662},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-alpha-20240326065638-baab1a3153a874c0787c83236e4172c58ba55b33.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/7666fe5f1053f5f0bdd7b6812b307550/graphql-hive-client-0.30.0-alpha-20240326065638-baab1a3153a874c0787c83236e4172c58ba55b33.tgz","_integrity":"sha512-ho1yEz/Ry0vsVgkIGXPrQ9oor5X9LQutyEg+w0y6U9QLBtClUg72Mtl3FOqqKoeDJtd0xDQQ6j273cM+3XMI7g==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-alpha-20240326065638-baab1a3153a874c0787c83236e4172c58ba55b33_1711436226007_0.737448080399622","host":"s3://npm-registry-packages"}},"0.30.0-alpha-20240326065729-30a68ec610299a169f5aa11fd41c19b0f54eaa26":{"name":"@graphql-hive/client","version":"0.30.0-alpha-20240326065729-30a68ec610299a169f5aa11fd41c19b0f54eaa26","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-alpha-20240326065729-30a68ec610299a169f5aa11fd41c19b0f54eaa26","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"a87b269c6439d1bb429bba2448e80f79df85354d","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-alpha-20240326065729-30a68ec610299a169f5aa11fd41c19b0f54eaa26.tgz","fileCount":64,"integrity":"sha512-/y62QM9MUtabXuyb3/9Go399LoCPKo2JE6peo1gtsndqjxq4AVE9PM/gNaLl9Q85xDWmpbzSAS+xCYm0gHtyJA==","signatures":[{"sig":"MEUCIQCghJiCFFiYQUL7O6mSwSJWAPqb0l9kIvVL3D3pZEFmQQIgSO8yUOd5ORGQSXCJajd7RLdC2pRkAUY2yHR1/hAbfpw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242662},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-alpha-20240326065729-30a68ec610299a169f5aa11fd41c19b0f54eaa26.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/4b56d79a7a23ac89da3bff4e837aaee4/graphql-hive-client-0.30.0-alpha-20240326065729-30a68ec610299a169f5aa11fd41c19b0f54eaa26.tgz","_integrity":"sha512-/y62QM9MUtabXuyb3/9Go399LoCPKo2JE6peo1gtsndqjxq4AVE9PM/gNaLl9Q85xDWmpbzSAS+xCYm0gHtyJA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-alpha-20240326065729-30a68ec610299a169f5aa11fd41c19b0f54eaa26_1711436275302_0.6416206024401303","host":"s3://npm-registry-packages"}},"0.30.0-alpha-20240326065846-b918b35b4934a639a25161380485d3e8f95baf78":{"name":"@graphql-hive/client","version":"0.30.0-alpha-20240326065846-b918b35b4934a639a25161380485d3e8f95baf78","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-alpha-20240326065846-b918b35b4934a639a25161380485d3e8f95baf78","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"f638033f6eb826b32c1a45fbe4d4e71e89c408ba","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-alpha-20240326065846-b918b35b4934a639a25161380485d3e8f95baf78.tgz","fileCount":64,"integrity":"sha512-5F/KhsU0aR6JRAPPveZDs1UjAXceGwd+c3MjiOpDc3gpDBzIXEzpj9OmGwF/rqvfAJ11o306m4j1m+wdo2XisA==","signatures":[{"sig":"MEUCIQC0mdnOHlh4dWTTUYo9pMzl0B3blWTXjLGnkzv32/MZiQIgdFBfdgo9aKAq3a03wa+4HCfp1FZXy0JI7n3eHO6pu4w=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242662},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-alpha-20240326065846-b918b35b4934a639a25161380485d3e8f95baf78.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/cf8afd3f55636fe924d6f41a95971bec/graphql-hive-client-0.30.0-alpha-20240326065846-b918b35b4934a639a25161380485d3e8f95baf78.tgz","_integrity":"sha512-5F/KhsU0aR6JRAPPveZDs1UjAXceGwd+c3MjiOpDc3gpDBzIXEzpj9OmGwF/rqvfAJ11o306m4j1m+wdo2XisA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-alpha-20240326065846-b918b35b4934a639a25161380485d3e8f95baf78_1711436353536_0.15351313118270782","host":"s3://npm-registry-packages"}},"0.30.0-alpha-20240326065954-e548dc36a6caf00bad2c3d7560ab2b38681ff4b7":{"name":"@graphql-hive/client","version":"0.30.0-alpha-20240326065954-e548dc36a6caf00bad2c3d7560ab2b38681ff4b7","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-alpha-20240326065954-e548dc36a6caf00bad2c3d7560ab2b38681ff4b7","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"13f2aa4c5891cecc6c5d89b6f275e39bf64225e1","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-alpha-20240326065954-e548dc36a6caf00bad2c3d7560ab2b38681ff4b7.tgz","fileCount":64,"integrity":"sha512-5MGcDfnH9fCSMkz9yfc2Ev8eXuXUXdtr6642crA8l0ayZsHWLCxUFtA3WRtMAmlrGdnq9y/+x4uI0nivPN4c0g==","signatures":[{"sig":"MEUCIQD+sGFdOSv3Hs1THhf2iGCkIwfwlCiYQ1yMzcZGGY1JfwIgYnEbr/Kv9IWNN9YEyruNZTxZBCT5SJpisXU9yA3VmL8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242662},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-alpha-20240326065954-e548dc36a6caf00bad2c3d7560ab2b38681ff4b7.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/4b1852b89731e18687580a9642c242c8/graphql-hive-client-0.30.0-alpha-20240326065954-e548dc36a6caf00bad2c3d7560ab2b38681ff4b7.tgz","_integrity":"sha512-5MGcDfnH9fCSMkz9yfc2Ev8eXuXUXdtr6642crA8l0ayZsHWLCxUFtA3WRtMAmlrGdnq9y/+x4uI0nivPN4c0g==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-alpha-20240326065954-e548dc36a6caf00bad2c3d7560ab2b38681ff4b7_1711436419984_0.7660496741458405","host":"s3://npm-registry-packages"}},"0.30.0-rc-20240326070111-dbd33a99fbdf7c059b007e12a812037763b74402":{"name":"@graphql-hive/client","version":"0.30.0-rc-20240326070111-dbd33a99fbdf7c059b007e12a812037763b74402","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-rc-20240326070111-dbd33a99fbdf7c059b007e12a812037763b74402","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"c6f4a6f6567a61e468a834d131bf2e4c8cd4c449","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-rc-20240326070111-dbd33a99fbdf7c059b007e12a812037763b74402.tgz","fileCount":64,"integrity":"sha512-2+RySfQ9p4DVMsQ+nKbm63VqEYcXuACdM5WPkAVfZjc+SmVQthAGjNFKhguCv9vmJsCuktakZh2PgShIP8VBbQ==","signatures":[{"sig":"MEQCIHtthCDEMSH15/XHZ47A5FWY7KvbnTUJ2788hiQzNWPuAiAM9X2Ho5HPIA0X4sl3LvACZuaJ5fiXh+p9vTaJDccYRw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242647},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-rc-20240326070111-dbd33a99fbdf7c059b007e12a812037763b74402.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/c7e39a146fccbdab39ffcce9cc98b2a6/graphql-hive-client-0.30.0-rc-20240326070111-dbd33a99fbdf7c059b007e12a812037763b74402.tgz","_integrity":"sha512-2+RySfQ9p4DVMsQ+nKbm63VqEYcXuACdM5WPkAVfZjc+SmVQthAGjNFKhguCv9vmJsCuktakZh2PgShIP8VBbQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-rc-20240326070111-dbd33a99fbdf7c059b007e12a812037763b74402_1711436496730_0.06867616470281179","host":"s3://npm-registry-packages"}},"0.30.0-alpha-20240326072209-284333d417529d2e93c3ee2d5382329c083e663f":{"name":"@graphql-hive/client","version":"0.30.0-alpha-20240326072209-284333d417529d2e93c3ee2d5382329c083e663f","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-alpha-20240326072209-284333d417529d2e93c3ee2d5382329c083e663f","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"dad720d3500ee9364b02929d5311f868c0e63b9b","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-alpha-20240326072209-284333d417529d2e93c3ee2d5382329c083e663f.tgz","fileCount":64,"integrity":"sha512-tYss62XWPZ6QiQyKyzynzREN+TToGzzELiiQse4fBAiQDEpaFfYUnSmbgNKZ0xJFWYxa/sH3bW8SdMSTRwR5Kg==","signatures":[{"sig":"MEYCIQDonkhcYfTlAidPBI2X1rjN8C+myPuqP96xxklbemOYyAIhALI36IAcT6S0Tm05UlCS1ORZfCrGtU/HnKxIOvfm6sw4","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242662},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-alpha-20240326072209-284333d417529d2e93c3ee2d5382329c083e663f.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/1e19af317c42e5fad3e176f1000a3941/graphql-hive-client-0.30.0-alpha-20240326072209-284333d417529d2e93c3ee2d5382329c083e663f.tgz","_integrity":"sha512-tYss62XWPZ6QiQyKyzynzREN+TToGzzELiiQse4fBAiQDEpaFfYUnSmbgNKZ0xJFWYxa/sH3bW8SdMSTRwR5Kg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-alpha-20240326072209-284333d417529d2e93c3ee2d5382329c083e663f_1711437755208_0.05779209902179505","host":"s3://npm-registry-packages"}},"0.30.0-rc-20240326072252-c2dd53881e9380926ef4f1ef4362514b51b25a4d":{"name":"@graphql-hive/client","version":"0.30.0-rc-20240326072252-c2dd53881e9380926ef4f1ef4362514b51b25a4d","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-rc-20240326072252-c2dd53881e9380926ef4f1ef4362514b51b25a4d","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"243af15e31b537437ab250d176c6118414563abb","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-rc-20240326072252-c2dd53881e9380926ef4f1ef4362514b51b25a4d.tgz","fileCount":64,"integrity":"sha512-rO5DoCtTPDpvgBZdYovUSYC7SIZ7roSrakqOV721Tf3z5DNAkHgo1syErNQdnR4XT6GD1xUIMSZ9QpNyMDD35Q==","signatures":[{"sig":"MEQCIGjDZuwKfURItI/bbjdNTBOzSLjurDdSwP3yqEHnUZL+AiAPboKg4+ank4AzmlW7ae1c0WlK+sSLnHb9gLKWoQT8Kg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242647},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-rc-20240326072252-c2dd53881e9380926ef4f1ef4362514b51b25a4d.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/f3d12bf993f5a984578409e29632c251/graphql-hive-client-0.30.0-rc-20240326072252-c2dd53881e9380926ef4f1ef4362514b51b25a4d.tgz","_integrity":"sha512-rO5DoCtTPDpvgBZdYovUSYC7SIZ7roSrakqOV721Tf3z5DNAkHgo1syErNQdnR4XT6GD1xUIMSZ9QpNyMDD35Q==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-rc-20240326072252-c2dd53881e9380926ef4f1ef4362514b51b25a4d_1711437798547_0.6349054199627395","host":"s3://npm-registry-packages"}},"0.30.0-rc-20240326073107-688b1ceddcc49a06104b867391b2c4bc36122e94":{"name":"@graphql-hive/client","version":"0.30.0-rc-20240326073107-688b1ceddcc49a06104b867391b2c4bc36122e94","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-rc-20240326073107-688b1ceddcc49a06104b867391b2c4bc36122e94","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"eb1ce17b280edc49c0f2ebe9f3a4d358767db1cc","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-rc-20240326073107-688b1ceddcc49a06104b867391b2c4bc36122e94.tgz","fileCount":64,"integrity":"sha512-xpakzZo+kxBuRfSqCd2TuH/jXcpx16SEs0OaIjaOLrK/hO7BTx/MgRWS2iv4DN/ErXkZNXDicIm5O19+hlA5CA==","signatures":[{"sig":"MEQCIHROGxCEPiMcD7d1MkBPW5bRSRy/I5pSPMNfrGLUzXA2AiBY6JZRvmdTlbpyseqcwD3Q6OgcOnJ20BeOYzPVG0G9KA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242647},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-rc-20240326073107-688b1ceddcc49a06104b867391b2c4bc36122e94.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/58effc10d89440ffc4039151139e060a/graphql-hive-client-0.30.0-rc-20240326073107-688b1ceddcc49a06104b867391b2c4bc36122e94.tgz","_integrity":"sha512-xpakzZo+kxBuRfSqCd2TuH/jXcpx16SEs0OaIjaOLrK/hO7BTx/MgRWS2iv4DN/ErXkZNXDicIm5O19+hlA5CA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-rc-20240326073107-688b1ceddcc49a06104b867391b2c4bc36122e94_1711438292895_0.932702819784601","host":"s3://npm-registry-packages"}},"0.30.0-alpha-20240326073131-a07a625084887b65ee1320044c52a65e0fbf04a6":{"name":"@graphql-hive/client","version":"0.30.0-alpha-20240326073131-a07a625084887b65ee1320044c52a65e0fbf04a6","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-alpha-20240326073131-a07a625084887b65ee1320044c52a65e0fbf04a6","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"3b50f0efa094f8817e8185304e5c74727b67314b","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-alpha-20240326073131-a07a625084887b65ee1320044c52a65e0fbf04a6.tgz","fileCount":64,"integrity":"sha512-opp/ghcS/voPcIHHr/swK7RCJq1TI3rr1vMHrKcGRJJeX6aqEvXZjS5i0Axs8PxkqmjuAKPpOg8yJzhdcHgT7A==","signatures":[{"sig":"MEQCIDQgOBWMGL4gayHyHR7tvJ61t+vP2NbFAkvBAqNphsZ8AiBqgC6gwdm7zeT0vnoozBmldB0zDcvsMAZm+3i3ScpO6g==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242662},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-alpha-20240326073131-a07a625084887b65ee1320044c52a65e0fbf04a6.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/c621d36699b53203a25e28dbd7896708/graphql-hive-client-0.30.0-alpha-20240326073131-a07a625084887b65ee1320044c52a65e0fbf04a6.tgz","_integrity":"sha512-opp/ghcS/voPcIHHr/swK7RCJq1TI3rr1vMHrKcGRJJeX6aqEvXZjS5i0Axs8PxkqmjuAKPpOg8yJzhdcHgT7A==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-alpha-20240326073131-a07a625084887b65ee1320044c52a65e0fbf04a6_1711438316872_0.9930417903823441","host":"s3://npm-registry-packages"}},"0.30.0-alpha-20240326073218-4fe1dff1deda765d30d9e8f0acf5b768a4a66f57":{"name":"@graphql-hive/client","version":"0.30.0-alpha-20240326073218-4fe1dff1deda765d30d9e8f0acf5b768a4a66f57","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-alpha-20240326073218-4fe1dff1deda765d30d9e8f0acf5b768a4a66f57","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"fe916e600e3f5037347dda1d4f654f4b9829b5d7","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-alpha-20240326073218-4fe1dff1deda765d30d9e8f0acf5b768a4a66f57.tgz","fileCount":64,"integrity":"sha512-Nb7WW8wRGA/BzzLm+oXfKDOf1ejEHXdAysJ5pEPkJ0/G37vMzDSawWAwoKSzopH+5wVsuwK8Aypbzxp2xn/hRA==","signatures":[{"sig":"MEYCIQCl7HUhqH2+jtIq4OFXiBML/YNK8yes18uFQrAYN+wTaAIhAKdOWoGLczajBT+QE7w9glGzBS42YCK5bC03Z8RFKTEa","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242662},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-alpha-20240326073218-4fe1dff1deda765d30d9e8f0acf5b768a4a66f57.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/2269f2508cbf71bfdbdfcc61b11733c9/graphql-hive-client-0.30.0-alpha-20240326073218-4fe1dff1deda765d30d9e8f0acf5b768a4a66f57.tgz","_integrity":"sha512-Nb7WW8wRGA/BzzLm+oXfKDOf1ejEHXdAysJ5pEPkJ0/G37vMzDSawWAwoKSzopH+5wVsuwK8Aypbzxp2xn/hRA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-alpha-20240326073218-4fe1dff1deda765d30d9e8f0acf5b768a4a66f57_1711438364542_0.43704757410697215","host":"s3://npm-registry-packages"}},"0.30.0-rc-20240326073348-e906aa2918ee8a0dbd5a3133f392c9249d5d70e7":{"name":"@graphql-hive/client","version":"0.30.0-rc-20240326073348-e906aa2918ee8a0dbd5a3133f392c9249d5d70e7","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-rc-20240326073348-e906aa2918ee8a0dbd5a3133f392c9249d5d70e7","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"fa3fa93492d5ba1f76e22b0220141bdff46d8efc","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-rc-20240326073348-e906aa2918ee8a0dbd5a3133f392c9249d5d70e7.tgz","fileCount":64,"integrity":"sha512-u3KL838us34oriZp52TFpZuQ/Og3d3uZ/QNNgDruBNVNdmtqZwFJGTNN5ayj1sdVZx7T2KC0bwwbWh5hg1Nxbg==","signatures":[{"sig":"MEUCIH+1X3s/wNm1bgLMfebday8hiYMxMxbuIOAOopaKhIYaAiEAqjs4TIn9SVjGKurnARCrnJQbgYCk5Bc20dnz1hk3yXo=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242647},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-rc-20240326073348-e906aa2918ee8a0dbd5a3133f392c9249d5d70e7.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/010e1216c6412c2ac6f6e3eacd94c9e7/graphql-hive-client-0.30.0-rc-20240326073348-e906aa2918ee8a0dbd5a3133f392c9249d5d70e7.tgz","_integrity":"sha512-u3KL838us34oriZp52TFpZuQ/Og3d3uZ/QNNgDruBNVNdmtqZwFJGTNN5ayj1sdVZx7T2KC0bwwbWh5hg1Nxbg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-rc-20240326073348-e906aa2918ee8a0dbd5a3133f392c9249d5d70e7_1711438455176_0.3461976887611016","host":"s3://npm-registry-packages"}},"0.30.0-alpha-20240326073433-8cea6c473a378e6c135cb7d3574a95667a9a6e25":{"name":"@graphql-hive/client","version":"0.30.0-alpha-20240326073433-8cea6c473a378e6c135cb7d3574a95667a9a6e25","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-alpha-20240326073433-8cea6c473a378e6c135cb7d3574a95667a9a6e25","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"d8358e4bf3180265975e24224058338b7e4cee1a","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-alpha-20240326073433-8cea6c473a378e6c135cb7d3574a95667a9a6e25.tgz","fileCount":64,"integrity":"sha512-OO7UxRXk7kaJ9xm+8XFJhz8Io4bGM7fpn11mYHAH2Eaau7gUph4szhFZg4aQpIwZkzYhkF8XqH5a5LD9gD48VQ==","signatures":[{"sig":"MEYCIQC7C82lkDWhiw80qyFdsWyfhHeIOyqyFvB0hGB4aAmb9QIhAPy5Es8AbtHwBuIuQAAPxiQx1du2vUTIW6GLGYoC1DdA","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242662},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-alpha-20240326073433-8cea6c473a378e6c135cb7d3574a95667a9a6e25.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/6f2e63ce3849ff79e3d19a8784c7256d/graphql-hive-client-0.30.0-alpha-20240326073433-8cea6c473a378e6c135cb7d3574a95667a9a6e25.tgz","_integrity":"sha512-OO7UxRXk7kaJ9xm+8XFJhz8Io4bGM7fpn11mYHAH2Eaau7gUph4szhFZg4aQpIwZkzYhkF8XqH5a5LD9gD48VQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-alpha-20240326073433-8cea6c473a378e6c135cb7d3574a95667a9a6e25_1711438499295_0.8986182185402549","host":"s3://npm-registry-packages"}},"0.30.0-alpha-20240326074316-aa0db721c8e10c339d3bee5b35f6ffeb5f033028":{"name":"@graphql-hive/client","version":"0.30.0-alpha-20240326074316-aa0db721c8e10c339d3bee5b35f6ffeb5f033028","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-alpha-20240326074316-aa0db721c8e10c339d3bee5b35f6ffeb5f033028","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"899888498b6c6f440b7310c69bdfceed22aefd96","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-alpha-20240326074316-aa0db721c8e10c339d3bee5b35f6ffeb5f033028.tgz","fileCount":64,"integrity":"sha512-lX7qvaB8rYLAVb2ELwI2+aAJNq6iXnt/5z8HfPruwIcVLNGmTBShzLM2Mgk0XmEZDVkT6E2wKD9eJqD+hSWJ/A==","signatures":[{"sig":"MEQCICJ/1/OD365NZsXbo6MXv6n7sMNVeqO98fLEwNxl0GEgAiBLkGPXrsj0ap88fS0CJD0PtiykvleJf7Fb6XUfSh5Pkw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242662},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-alpha-20240326074316-aa0db721c8e10c339d3bee5b35f6ffeb5f033028.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/5707d864a5da805980abbe96080bdd09/graphql-hive-client-0.30.0-alpha-20240326074316-aa0db721c8e10c339d3bee5b35f6ffeb5f033028.tgz","_integrity":"sha512-lX7qvaB8rYLAVb2ELwI2+aAJNq6iXnt/5z8HfPruwIcVLNGmTBShzLM2Mgk0XmEZDVkT6E2wKD9eJqD+hSWJ/A==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-alpha-20240326074316-aa0db721c8e10c339d3bee5b35f6ffeb5f033028_1711439022897_0.3927786481786437","host":"s3://npm-registry-packages"}},"0.30.0-alpha-20240326075340-6c5f55c4a14e6a825db1e59cb3320872f39e0669":{"name":"@graphql-hive/client","version":"0.30.0-alpha-20240326075340-6c5f55c4a14e6a825db1e59cb3320872f39e0669","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-alpha-20240326075340-6c5f55c4a14e6a825db1e59cb3320872f39e0669","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"59d006f8a9ee507623e85ccc697e140a5c01df89","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-alpha-20240326075340-6c5f55c4a14e6a825db1e59cb3320872f39e0669.tgz","fileCount":64,"integrity":"sha512-MF3guIe6rJSjHp6THuXfR9VhoC7oX9KDgR2yNODZseD1KhNPX+gVQxwHoMwaujlwGcDKd5Arxedjs80suEoHzQ==","signatures":[{"sig":"MEYCIQDZp9j1XSqWsSl15rJCqXcnkE+kKF4QB66p/D5UF4O/8wIhAIdDXWwW6mrAK66MViDQr29e3yYXlDXgr9EaeN9WJAKu","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242662},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-alpha-20240326075340-6c5f55c4a14e6a825db1e59cb3320872f39e0669.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/b64bef9a16638606084812fd2fceee98/graphql-hive-client-0.30.0-alpha-20240326075340-6c5f55c4a14e6a825db1e59cb3320872f39e0669.tgz","_integrity":"sha512-MF3guIe6rJSjHp6THuXfR9VhoC7oX9KDgR2yNODZseD1KhNPX+gVQxwHoMwaujlwGcDKd5Arxedjs80suEoHzQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-alpha-20240326075340-6c5f55c4a14e6a825db1e59cb3320872f39e0669_1711439646049_0.4459095155827102","host":"s3://npm-registry-packages"}},"0.30.0-alpha-20240326075746-38d4fec36ecc516717af3bcb2c8716e5769a5f08":{"name":"@graphql-hive/client","version":"0.30.0-alpha-20240326075746-38d4fec36ecc516717af3bcb2c8716e5769a5f08","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-alpha-20240326075746-38d4fec36ecc516717af3bcb2c8716e5769a5f08","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"b6d478d1c10ffcd952eb390c1ebb6a1392468918","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-alpha-20240326075746-38d4fec36ecc516717af3bcb2c8716e5769a5f08.tgz","fileCount":64,"integrity":"sha512-cqs/pkRlaQdxpzJNu5gruvDSgIEiCCT2CUr5I6lAqz7/9R+pUXjuXZnDdU8fksyAKpjZvN1uRTVlhuGiOH13Xg==","signatures":[{"sig":"MEUCIQD0F0CTJuTnmk2noevgaCxOfiPkjFeuugDxZPGaCItlcAIgZ2Dj92/TiRmAbhXjWnJbd1bEcOGHA6CBLBsAwt67sf4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242662},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-alpha-20240326075746-38d4fec36ecc516717af3bcb2c8716e5769a5f08.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/bc04196deef9a3ed4fbbd597888b2987/graphql-hive-client-0.30.0-alpha-20240326075746-38d4fec36ecc516717af3bcb2c8716e5769a5f08.tgz","_integrity":"sha512-cqs/pkRlaQdxpzJNu5gruvDSgIEiCCT2CUr5I6lAqz7/9R+pUXjuXZnDdU8fksyAKpjZvN1uRTVlhuGiOH13Xg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-alpha-20240326075746-38d4fec36ecc516717af3bcb2c8716e5769a5f08_1711439890088_0.42966194144055536","host":"s3://npm-registry-packages"}},"0.30.0-rc-20240326080701-e9de96e941c4b9f7a672628ccd14bfd5ff755250":{"name":"@graphql-hive/client","version":"0.30.0-rc-20240326080701-e9de96e941c4b9f7a672628ccd14bfd5ff755250","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-rc-20240326080701-e9de96e941c4b9f7a672628ccd14bfd5ff755250","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"2872c7327df1943b4e8bd52b4085d34962bbc6a1","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-rc-20240326080701-e9de96e941c4b9f7a672628ccd14bfd5ff755250.tgz","fileCount":64,"integrity":"sha512-TTKp1JKtIadwYExWWJsLu+hoxyw2wY2LX9Aca14tbWugQnY5NKwWQiqEDZcE/+b9RuxRe9lKcWVyhlC7QiZLRg==","signatures":[{"sig":"MEUCIQD3rfaepAPLaKeJHhQJErmXMpTmwfRdV9xPa6xYQKb28QIga04qya5JgJWqV0OcBc2HHJpEMjqXlp8pE7sjYkx+b00=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242647},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-rc-20240326080701-e9de96e941c4b9f7a672628ccd14bfd5ff755250.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/1c12feea095521bb799dfe93d4d5f719/graphql-hive-client-0.30.0-rc-20240326080701-e9de96e941c4b9f7a672628ccd14bfd5ff755250.tgz","_integrity":"sha512-TTKp1JKtIadwYExWWJsLu+hoxyw2wY2LX9Aca14tbWugQnY5NKwWQiqEDZcE/+b9RuxRe9lKcWVyhlC7QiZLRg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-rc-20240326080701-e9de96e941c4b9f7a672628ccd14bfd5ff755250_1711440447146_0.8355960145741925","host":"s3://npm-registry-packages"}},"0.30.0-alpha-20240326080839-9d646bdc87fc719473d77a3f02a5ca39e802f7ca":{"name":"@graphql-hive/client","version":"0.30.0-alpha-20240326080839-9d646bdc87fc719473d77a3f02a5ca39e802f7ca","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-alpha-20240326080839-9d646bdc87fc719473d77a3f02a5ca39e802f7ca","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"5e6e49efd024f5d473305b138965655a81a618b6","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-alpha-20240326080839-9d646bdc87fc719473d77a3f02a5ca39e802f7ca.tgz","fileCount":64,"integrity":"sha512-OwKzDwaXhHCOMub0BLmea/y1C8XlqH81oZnBkRAo9GvITx3QlfvxUZNCckB2Woyh0vvPasi63oIY0rugKOaPHw==","signatures":[{"sig":"MEQCIAuBrGeuZyJkjBdPuFBPBdzJQlFDI5oFJyr10cVa8c7kAiAyV36yQB2V0kNOxgScasu3AX/QUKzzsPD/BI4/qoQ6aw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242662},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-alpha-20240326080839-9d646bdc87fc719473d77a3f02a5ca39e802f7ca.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/3a851f1abc6425c186fa546f765f7602/graphql-hive-client-0.30.0-alpha-20240326080839-9d646bdc87fc719473d77a3f02a5ca39e802f7ca.tgz","_integrity":"sha512-OwKzDwaXhHCOMub0BLmea/y1C8XlqH81oZnBkRAo9GvITx3QlfvxUZNCckB2Woyh0vvPasi63oIY0rugKOaPHw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-alpha-20240326080839-9d646bdc87fc719473d77a3f02a5ca39e802f7ca_1711440545607_0.5037971538340789","host":"s3://npm-registry-packages"}},"0.30.0-rc-20240326082003-5805658ee8c7f2468be4ce57785bea5d685197e0":{"name":"@graphql-hive/client","version":"0.30.0-rc-20240326082003-5805658ee8c7f2468be4ce57785bea5d685197e0","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-rc-20240326082003-5805658ee8c7f2468be4ce57785bea5d685197e0","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"58eca4a6cfeefd37d30e5f7160b4f9ca8cfdd21b","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-rc-20240326082003-5805658ee8c7f2468be4ce57785bea5d685197e0.tgz","fileCount":64,"integrity":"sha512-E9rTjtXKQ7qO14c3duQ85UCrC9a588weu/GOFxo7QrjwQVmpMklm1FipfYclISQXrKjU0THhm3X7kI73m22LkQ==","signatures":[{"sig":"MEQCIDBqc6JmWR55Qbkqb5y4k8WjjAX5OT7PoE/a+A1wdk8JAiACurwcnJE43YEPbMJ4a+aT0Qv2YWinHtXqN9+lV7kB/w==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242647},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-rc-20240326082003-5805658ee8c7f2468be4ce57785bea5d685197e0.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/aaa01f4ad69f7feaef12df69bb25dff4/graphql-hive-client-0.30.0-rc-20240326082003-5805658ee8c7f2468be4ce57785bea5d685197e0.tgz","_integrity":"sha512-E9rTjtXKQ7qO14c3duQ85UCrC9a588weu/GOFxo7QrjwQVmpMklm1FipfYclISQXrKjU0THhm3X7kI73m22LkQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-rc-20240326082003-5805658ee8c7f2468be4ce57785bea5d685197e0_1711441229422_0.11380504629724109","host":"s3://npm-registry-packages"}},"0.30.0-alpha-20240326082120-9387f609d5bf616c48cabceacddbb8813b30fcf0":{"name":"@graphql-hive/client","version":"0.30.0-alpha-20240326082120-9387f609d5bf616c48cabceacddbb8813b30fcf0","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-alpha-20240326082120-9387f609d5bf616c48cabceacddbb8813b30fcf0","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"e72a62a5f016b1deb4079ba9805fef1108de0583","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-alpha-20240326082120-9387f609d5bf616c48cabceacddbb8813b30fcf0.tgz","fileCount":64,"integrity":"sha512-9fn4O8fzfCiFU9E10AK40ENDJ6T4tt2YHyzlEpyyJK7x44/L/KAgHlk6LUM/87Shwn4quj9WcK2hqsZaTKkxuQ==","signatures":[{"sig":"MEYCIQDavFj8KK4Z9+0Du5jgx2Fc6pAShHIe7oL7dwek1SwjzgIhAJBAD03bsumu74Cue8lW0FlKH6ToQ1OoEOiKT5QqQ+1o","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242662},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-alpha-20240326082120-9387f609d5bf616c48cabceacddbb8813b30fcf0.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/422ce98c2e993620238888a60fd4ed32/graphql-hive-client-0.30.0-alpha-20240326082120-9387f609d5bf616c48cabceacddbb8813b30fcf0.tgz","_integrity":"sha512-9fn4O8fzfCiFU9E10AK40ENDJ6T4tt2YHyzlEpyyJK7x44/L/KAgHlk6LUM/87Shwn4quj9WcK2hqsZaTKkxuQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-alpha-20240326082120-9387f609d5bf616c48cabceacddbb8813b30fcf0_1711441306771_0.19926802727636606","host":"s3://npm-registry-packages"}},"0.30.0-alpha-20240326082229-fc6755f65fa74d1a03643fd1e1a4e3fcb68fd558":{"name":"@graphql-hive/client","version":"0.30.0-alpha-20240326082229-fc6755f65fa74d1a03643fd1e1a4e3fcb68fd558","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-alpha-20240326082229-fc6755f65fa74d1a03643fd1e1a4e3fcb68fd558","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"43920f39fdb5fb5543d111e287ddcb773150a06c","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-alpha-20240326082229-fc6755f65fa74d1a03643fd1e1a4e3fcb68fd558.tgz","fileCount":64,"integrity":"sha512-48wQNm2fV7Ehxzedxic1cqJXjxS4QPbLq/PtFSBOgG2wGSpaN6cUe2SWFFES+INX5g75+zyymkuDOY+TgUEQWg==","signatures":[{"sig":"MEYCIQCvrHppIG5UPOVNJgFK0yOt8CDKEdXblbGjCDtsYqRAFgIhAKfdq9f67/lfNOUeIFYI03w4nWD1b+mwwJNaP35fTXGO","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242662},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-alpha-20240326082229-fc6755f65fa74d1a03643fd1e1a4e3fcb68fd558.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/1fc3de24d82e3c8615ab7c84905a4f0e/graphql-hive-client-0.30.0-alpha-20240326082229-fc6755f65fa74d1a03643fd1e1a4e3fcb68fd558.tgz","_integrity":"sha512-48wQNm2fV7Ehxzedxic1cqJXjxS4QPbLq/PtFSBOgG2wGSpaN6cUe2SWFFES+INX5g75+zyymkuDOY+TgUEQWg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-alpha-20240326082229-fc6755f65fa74d1a03643fd1e1a4e3fcb68fd558_1711441375142_0.43165842938507915","host":"s3://npm-registry-packages"}},"0.30.0-rc-20240326082828-22b288474b6797cb3997603843a5553dc45093e2":{"name":"@graphql-hive/client","version":"0.30.0-rc-20240326082828-22b288474b6797cb3997603843a5553dc45093e2","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-rc-20240326082828-22b288474b6797cb3997603843a5553dc45093e2","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"35ca8a22157c98363c415b6bdeb791b21fe3f97c","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-rc-20240326082828-22b288474b6797cb3997603843a5553dc45093e2.tgz","fileCount":64,"integrity":"sha512-hTw+4rCE2enielDen3JbYP5q2RbEaTLZpgJxwP3WHh20mZAc5hGMmIqmk/ilA10oBY9M1C12jMAg37k5VtIRzg==","signatures":[{"sig":"MEYCIQDWrwqiAoYVaHltRtnovm/ve/aBDLW020BSiZWk5rqyxgIhAJqzc9/CtaE4Efwf6uuDzttRzAmpSVHbcW4IbhHdV1EI","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242647},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-rc-20240326082828-22b288474b6797cb3997603843a5553dc45093e2.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/7a1e2760bdb621ee48a041dde6bda4da/graphql-hive-client-0.30.0-rc-20240326082828-22b288474b6797cb3997603843a5553dc45093e2.tgz","_integrity":"sha512-hTw+4rCE2enielDen3JbYP5q2RbEaTLZpgJxwP3WHh20mZAc5hGMmIqmk/ilA10oBY9M1C12jMAg37k5VtIRzg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-rc-20240326082828-22b288474b6797cb3997603843a5553dc45093e2_1711441740306_0.7548546011301063","host":"s3://npm-registry-packages"}},"0.30.0-alpha-20240326082916-bd0cea91fd3ad20454d8d9303eaa38ea442389ca":{"name":"@graphql-hive/client","version":"0.30.0-alpha-20240326082916-bd0cea91fd3ad20454d8d9303eaa38ea442389ca","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-alpha-20240326082916-bd0cea91fd3ad20454d8d9303eaa38ea442389ca","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"b4faead708470ac526d774bcdcd4d9b5682d9780","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-alpha-20240326082916-bd0cea91fd3ad20454d8d9303eaa38ea442389ca.tgz","fileCount":64,"integrity":"sha512-UlEAQQj9sv6swJGX2h3XHUE2LdoGt4GhlrpS+nDSHWv/mDg8DwlGUBiE6o3D5XPHnWquCYUavAGdKW01/I4v8w==","signatures":[{"sig":"MEUCIFZ/wr2WBHNzqylzmEgIej8yuMyun8wSWMMgQTi0nyHDAiEA4DXs6ZhWeG9prhiNwjXGdoVJ//PkXld7+xfJc5clVxo=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242662},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-alpha-20240326082916-bd0cea91fd3ad20454d8d9303eaa38ea442389ca.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/3bea1dcdb75eed6e255ff91d662cc822/graphql-hive-client-0.30.0-alpha-20240326082916-bd0cea91fd3ad20454d8d9303eaa38ea442389ca.tgz","_integrity":"sha512-UlEAQQj9sv6swJGX2h3XHUE2LdoGt4GhlrpS+nDSHWv/mDg8DwlGUBiE6o3D5XPHnWquCYUavAGdKW01/I4v8w==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-alpha-20240326082916-bd0cea91fd3ad20454d8d9303eaa38ea442389ca_1711441782357_0.3595873099136795","host":"s3://npm-registry-packages"}},"0.30.0-alpha-20240326090215-f23a86e8afffa60a231fb705c5a94a4964e852d1":{"name":"@graphql-hive/client","version":"0.30.0-alpha-20240326090215-f23a86e8afffa60a231fb705c5a94a4964e852d1","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-alpha-20240326090215-f23a86e8afffa60a231fb705c5a94a4964e852d1","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"36cbfdab1216d944929a24f622827ee69e1041c0","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-alpha-20240326090215-f23a86e8afffa60a231fb705c5a94a4964e852d1.tgz","fileCount":64,"integrity":"sha512-GzHGkozXZc9NWGxWJp+vBIwEfCh/9fB/ZZY4tsddTzk+/Rc3FTohP7eG+TAbZ/Fr4Z/DYsoZNJrHwC5xpvtjqA==","signatures":[{"sig":"MEUCIEvixYD1TMA8MLngIM5pASHVmbLky3c8IQD7Mi0cQvJtAiEA+1W4pJXvU068hf7dTtW+bmkwFkhScTzNMJm3tkko3ao=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242662},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-alpha-20240326090215-f23a86e8afffa60a231fb705c5a94a4964e852d1.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/a4435f68e99564deaf4fb6b7eb5c5d07/graphql-hive-client-0.30.0-alpha-20240326090215-f23a86e8afffa60a231fb705c5a94a4964e852d1.tgz","_integrity":"sha512-GzHGkozXZc9NWGxWJp+vBIwEfCh/9fB/ZZY4tsddTzk+/Rc3FTohP7eG+TAbZ/Fr4Z/DYsoZNJrHwC5xpvtjqA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-alpha-20240326090215-f23a86e8afffa60a231fb705c5a94a4964e852d1_1711443761839_0.27778583364518017","host":"s3://npm-registry-packages"}},"0.30.0-alpha-20240326105242-e6ad5b266f791e4071d2b05ff45f0efee1dda669":{"name":"@graphql-hive/client","version":"0.30.0-alpha-20240326105242-e6ad5b266f791e4071d2b05ff45f0efee1dda669","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-alpha-20240326105242-e6ad5b266f791e4071d2b05ff45f0efee1dda669","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"fab98b62b1bb763dfc0fe7ca4b9d2aebb625d8cd","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-alpha-20240326105242-e6ad5b266f791e4071d2b05ff45f0efee1dda669.tgz","fileCount":64,"integrity":"sha512-d4/7N0TmMC7P4TB/qbY6HioBHMlntASb+RqbJd9l/SkhId2J39f/Ck/G5jgJnrrFGQMrlRib+4HoAZGcoM353w==","signatures":[{"sig":"MEYCIQDKKEpl+SBL313cafLtqpJ/sqbLIW5twx2ChKGiuPgdyQIhAMN//mGNXOmQ8H8WiyBGo1tZuP5IO1N0m0sw0pNofwVD","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242662},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-alpha-20240326105242-e6ad5b266f791e4071d2b05ff45f0efee1dda669.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/a790fcdc251f9dafd1a56d1f10ace0a6/graphql-hive-client-0.30.0-alpha-20240326105242-e6ad5b266f791e4071d2b05ff45f0efee1dda669.tgz","_integrity":"sha512-d4/7N0TmMC7P4TB/qbY6HioBHMlntASb+RqbJd9l/SkhId2J39f/Ck/G5jgJnrrFGQMrlRib+4HoAZGcoM353w==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-alpha-20240326105242-e6ad5b266f791e4071d2b05ff45f0efee1dda669_1711450388954_0.16968246135917342","host":"s3://npm-registry-packages"}},"0.30.0-alpha-20240326113741-229c1494ff7ea002f32fb78b6ba619799be1c08f":{"name":"@graphql-hive/client","version":"0.30.0-alpha-20240326113741-229c1494ff7ea002f32fb78b6ba619799be1c08f","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-alpha-20240326113741-229c1494ff7ea002f32fb78b6ba619799be1c08f","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"6ef5978be9b6a33e83fec72cfd7b562dd30b8314","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-alpha-20240326113741-229c1494ff7ea002f32fb78b6ba619799be1c08f.tgz","fileCount":64,"integrity":"sha512-3ztz9mCrs+ZxuNBTLr9UeOCOgPyu+wdectKKJ/fyuOHEzYM4XaDL8ND5uVROIG8ZyCBYqqapEpnE7gdQZCVGwg==","signatures":[{"sig":"MEQCIA0HF02X6qnPS87nSCJV29lfE6KTn5RwZPuiYvSWKyykAiBDWu+VhvZx01DFX2uS1kBwQ79mMuvsnbiR8CANlsBdJg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242662},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-alpha-20240326113741-229c1494ff7ea002f32fb78b6ba619799be1c08f.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/2a974bbe697d9b8b2126013003f2d0bb/graphql-hive-client-0.30.0-alpha-20240326113741-229c1494ff7ea002f32fb78b6ba619799be1c08f.tgz","_integrity":"sha512-3ztz9mCrs+ZxuNBTLr9UeOCOgPyu+wdectKKJ/fyuOHEzYM4XaDL8ND5uVROIG8ZyCBYqqapEpnE7gdQZCVGwg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-alpha-20240326113741-229c1494ff7ea002f32fb78b6ba619799be1c08f_1711453088418_0.8036041664718672","host":"s3://npm-registry-packages"}},"0.30.0-alpha-20240326121342-c72cb37243e297f5becf96bc5bd8767a579ad3df":{"name":"@graphql-hive/client","version":"0.30.0-alpha-20240326121342-c72cb37243e297f5becf96bc5bd8767a579ad3df","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-alpha-20240326121342-c72cb37243e297f5becf96bc5bd8767a579ad3df","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"ddac7b3ab4ffd1205cc54a15cf0f2328a7945dcc","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-alpha-20240326121342-c72cb37243e297f5becf96bc5bd8767a579ad3df.tgz","fileCount":64,"integrity":"sha512-0yzL2ylarU4Uw6/bH0EPVqrTxtdNc9icLqSTudV7+GznSb6xxZaHuKFp2z2RVaozGhK1C4HoBJktL7Y8Ue1CXQ==","signatures":[{"sig":"MEUCIQCcfPY2oSfJXTIZRQNxukHUlREvrjaOkBNj0H3loulSTQIgBRtJXxaE4cyxViQy0SCI+GTtUMcrRRigkp2plzAIcYw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242662},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-alpha-20240326121342-c72cb37243e297f5becf96bc5bd8767a579ad3df.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/afe84095034086f974429db2e0975fa5/graphql-hive-client-0.30.0-alpha-20240326121342-c72cb37243e297f5becf96bc5bd8767a579ad3df.tgz","_integrity":"sha512-0yzL2ylarU4Uw6/bH0EPVqrTxtdNc9icLqSTudV7+GznSb6xxZaHuKFp2z2RVaozGhK1C4HoBJktL7Y8Ue1CXQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-alpha-20240326121342-c72cb37243e297f5becf96bc5bd8767a579ad3df_1711455249390_0.9090162565592015","host":"s3://npm-registry-packages"}},"0.30.0-alpha-20240326122640-47a31514ae3e08525d74f674aa8391214e10c39f":{"name":"@graphql-hive/client","version":"0.30.0-alpha-20240326122640-47a31514ae3e08525d74f674aa8391214e10c39f","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-alpha-20240326122640-47a31514ae3e08525d74f674aa8391214e10c39f","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"d835dd6cf7e811852d40dd6b65cc0919b0790027","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-alpha-20240326122640-47a31514ae3e08525d74f674aa8391214e10c39f.tgz","fileCount":64,"integrity":"sha512-7u5/drdIHi/aKBeii9suzmp3MwLY6Kqmv9DOPul64gZDA1uQKnRyDw2Y/s+YBGxD9FbeTSG3JnjiwRf91jqk5A==","signatures":[{"sig":"MEYCIQCG7Uy1ly7vzHvXeWXSMd0upASnvBvBH0iQuVSqmQrUygIhALXUF9G3O32ttLad8E3pzjlU+8668NhTYJO7xsvFbNyX","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242662},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-alpha-20240326122640-47a31514ae3e08525d74f674aa8391214e10c39f.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/de6356f047287cd320486fa43e4dd337/graphql-hive-client-0.30.0-alpha-20240326122640-47a31514ae3e08525d74f674aa8391214e10c39f.tgz","_integrity":"sha512-7u5/drdIHi/aKBeii9suzmp3MwLY6Kqmv9DOPul64gZDA1uQKnRyDw2Y/s+YBGxD9FbeTSG3JnjiwRf91jqk5A==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-alpha-20240326122640-47a31514ae3e08525d74f674aa8391214e10c39f_1711456026188_0.724866120808126","host":"s3://npm-registry-packages"}},"0.30.0-rc-20240326124608-8d8b1e690278da0ff85d5b80cec05ddbcda6e858":{"name":"@graphql-hive/client","version":"0.30.0-rc-20240326124608-8d8b1e690278da0ff85d5b80cec05ddbcda6e858","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-rc-20240326124608-8d8b1e690278da0ff85d5b80cec05ddbcda6e858","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"8fc23c026db8c03fac56b29aaf41ec082ad2d6de","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-rc-20240326124608-8d8b1e690278da0ff85d5b80cec05ddbcda6e858.tgz","fileCount":64,"integrity":"sha512-K5F54qvLY90oZNNx3dIQ6lwfr7f0P7zg5Z94z86NsdCheAwmMD5nULFV06mJyJErUgeOGfXnD7TPDxJCb/lZ7g==","signatures":[{"sig":"MEYCIQCNtgSm5vZRXIr1LJWe+1oGfJLasl7Os7fpPUOX+BRkGwIhAJVtslQpuW2QWBZoqKEICIC6EKceM1n/yq7/LMbOT7Ey","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242647},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-rc-20240326124608-8d8b1e690278da0ff85d5b80cec05ddbcda6e858.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/0cd8998e83f1580e8f6695e63ee692f8/graphql-hive-client-0.30.0-rc-20240326124608-8d8b1e690278da0ff85d5b80cec05ddbcda6e858.tgz","_integrity":"sha512-K5F54qvLY90oZNNx3dIQ6lwfr7f0P7zg5Z94z86NsdCheAwmMD5nULFV06mJyJErUgeOGfXnD7TPDxJCb/lZ7g==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-rc-20240326124608-8d8b1e690278da0ff85d5b80cec05ddbcda6e858_1711457194520_0.6254713882458693","host":"s3://npm-registry-packages"}},"0.30.0-alpha-20240326124845-3af21cfc791c96489bfae44451473f0984d39152":{"name":"@graphql-hive/client","version":"0.30.0-alpha-20240326124845-3af21cfc791c96489bfae44451473f0984d39152","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-alpha-20240326124845-3af21cfc791c96489bfae44451473f0984d39152","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"ba4ccdd7bb65f0ea997619f88f18f82ce58765ba","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-alpha-20240326124845-3af21cfc791c96489bfae44451473f0984d39152.tgz","fileCount":64,"integrity":"sha512-UEGXI15tnb4udJ3ZXpvINAY8pQ9prCXpqruUky5q+li5WBMcgGi1Hvmoru6lHvevK6WyOBPXswjqPSCsHgV6hw==","signatures":[{"sig":"MEUCIEac7fKcBo4E0hOD/lzRw7H1B+hsBE6hmijR+SrjheY3AiEAhbAuwBn2iievBrZ1bNQyGLUM6EXkNl436Q+PylqUXds=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242662},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-alpha-20240326124845-3af21cfc791c96489bfae44451473f0984d39152.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/b0f91e20cf6453eb3b7b2f2c1f55c2a6/graphql-hive-client-0.30.0-alpha-20240326124845-3af21cfc791c96489bfae44451473f0984d39152.tgz","_integrity":"sha512-UEGXI15tnb4udJ3ZXpvINAY8pQ9prCXpqruUky5q+li5WBMcgGi1Hvmoru6lHvevK6WyOBPXswjqPSCsHgV6hw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-alpha-20240326124845-3af21cfc791c96489bfae44451473f0984d39152_1711457353137_0.9691278809871446","host":"s3://npm-registry-packages"}},"0.30.0-alpha-20240326124906-e1ce080d7f9f898f2a468cfb8cbc9300f22b90b7":{"name":"@graphql-hive/client","version":"0.30.0-alpha-20240326124906-e1ce080d7f9f898f2a468cfb8cbc9300f22b90b7","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-alpha-20240326124906-e1ce080d7f9f898f2a468cfb8cbc9300f22b90b7","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"098ea3f13ffe7aa294c66a4c340a2afce80cb055","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-alpha-20240326124906-e1ce080d7f9f898f2a468cfb8cbc9300f22b90b7.tgz","fileCount":64,"integrity":"sha512-9OmzFlVVu+6jZx7uDKbEMkSG9PietUfpMHRQgsxculWW2AFNtYBomfPItdvV1gy01ybZ98x80RC1E+6+0pTtxQ==","signatures":[{"sig":"MEUCIDMBfWqSzqZZ6afeXc0QUnSjscGbhitdma3+qZAl+BxJAiEAyBR3chW894Ct5ueG2WR+OfBZYPwjq1MAry0SVHNXQrk=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242662},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-alpha-20240326124906-e1ce080d7f9f898f2a468cfb8cbc9300f22b90b7.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/882035e8fc753aff0850908b6e4b7e73/graphql-hive-client-0.30.0-alpha-20240326124906-e1ce080d7f9f898f2a468cfb8cbc9300f22b90b7.tgz","_integrity":"sha512-9OmzFlVVu+6jZx7uDKbEMkSG9PietUfpMHRQgsxculWW2AFNtYBomfPItdvV1gy01ybZ98x80RC1E+6+0pTtxQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-alpha-20240326124906-e1ce080d7f9f898f2a468cfb8cbc9300f22b90b7_1711457372164_0.8157108384412517","host":"s3://npm-registry-packages"}},"0.30.0-alpha-20240326125008-506099879ff7a6f44498182473410a7262d93a61":{"name":"@graphql-hive/client","version":"0.30.0-alpha-20240326125008-506099879ff7a6f44498182473410a7262d93a61","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-alpha-20240326125008-506099879ff7a6f44498182473410a7262d93a61","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"51060b0cf0d6e3d0419aa18272d2b28bc8287745","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-alpha-20240326125008-506099879ff7a6f44498182473410a7262d93a61.tgz","fileCount":64,"integrity":"sha512-3VgA03p0qITtJgmEAWg3mA91KO5z3d8h15UHK0KGu5SCU6zKmp1bROMmCC8LDx88r0RX2LOXtbpttkFeyXaY3g==","signatures":[{"sig":"MEQCIFr6Pz/DqDku1b1bPe9az4O70CCwpqDgOzrWDKT1Jn50AiANZ2OPADS0zkRg+kogldjOnZQIkOEA9i1mNlZqqe2D7Q==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242662},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-alpha-20240326125008-506099879ff7a6f44498182473410a7262d93a61.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/0ec9b9d03b756cc472c56c0cb53e6081/graphql-hive-client-0.30.0-alpha-20240326125008-506099879ff7a6f44498182473410a7262d93a61.tgz","_integrity":"sha512-3VgA03p0qITtJgmEAWg3mA91KO5z3d8h15UHK0KGu5SCU6zKmp1bROMmCC8LDx88r0RX2LOXtbpttkFeyXaY3g==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-alpha-20240326125008-506099879ff7a6f44498182473410a7262d93a61_1711457434424_0.35404794387834104","host":"s3://npm-registry-packages"}},"0.30.0-alpha-20240326125151-d88f532d348f772b879777622b4db42a84595296":{"name":"@graphql-hive/client","version":"0.30.0-alpha-20240326125151-d88f532d348f772b879777622b4db42a84595296","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-alpha-20240326125151-d88f532d348f772b879777622b4db42a84595296","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"3de6f536c11b3cba0793ca7a7998d5ef4a449eac","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-alpha-20240326125151-d88f532d348f772b879777622b4db42a84595296.tgz","fileCount":64,"integrity":"sha512-cMKio3b/ZzVnMuXC9DMScMBMJNwyIlMxf4DXawt2HikVtSyPG9mml5D2u3U8lKQeCj1wsk4GWAcBLTYe4u4cjQ==","signatures":[{"sig":"MEUCIDubCUV05/+ciKEj8YVacP/q5SxXyDuof1yaGbbPk3srAiEA/5upZoWNDa12317USsC+OClohEOjBrg4Yrsg9/kmljs=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242662},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-alpha-20240326125151-d88f532d348f772b879777622b4db42a84595296.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/983d2f5dc09856ba1cd49d8f993f7b05/graphql-hive-client-0.30.0-alpha-20240326125151-d88f532d348f772b879777622b4db42a84595296.tgz","_integrity":"sha512-cMKio3b/ZzVnMuXC9DMScMBMJNwyIlMxf4DXawt2HikVtSyPG9mml5D2u3U8lKQeCj1wsk4GWAcBLTYe4u4cjQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-alpha-20240326125151-d88f532d348f772b879777622b4db42a84595296_1711457538067_0.41679578285454655","host":"s3://npm-registry-packages"}},"0.30.0-alpha-20240326125226-0cc213f3cbcfc3152cfec72b287006fd9792b216":{"name":"@graphql-hive/client","version":"0.30.0-alpha-20240326125226-0cc213f3cbcfc3152cfec72b287006fd9792b216","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-alpha-20240326125226-0cc213f3cbcfc3152cfec72b287006fd9792b216","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"377baf1251819d9f5bc3bccb9ad51d506b1fcfe5","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-alpha-20240326125226-0cc213f3cbcfc3152cfec72b287006fd9792b216.tgz","fileCount":64,"integrity":"sha512-gYT51Z1T//R4Ep62cP24Ftv2hbIMfooijtVGi6/GvnoASCFpbQPRClZV0PjT09SQPfTOzllHOlZtLr8BwmGZrg==","signatures":[{"sig":"MEQCIC7C2vnlH/qnTmpkxiRKGXOwK+p1g4xRNFHOzouN+yAlAiAMVjSBSgdm1lbxf8k4NIhyfwGGOFH9uwmuBZ3tGkH5LA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242662},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-alpha-20240326125226-0cc213f3cbcfc3152cfec72b287006fd9792b216.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/478249210f2b9343de033fc8c6f47968/graphql-hive-client-0.30.0-alpha-20240326125226-0cc213f3cbcfc3152cfec72b287006fd9792b216.tgz","_integrity":"sha512-gYT51Z1T//R4Ep62cP24Ftv2hbIMfooijtVGi6/GvnoASCFpbQPRClZV0PjT09SQPfTOzllHOlZtLr8BwmGZrg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-alpha-20240326125226-0cc213f3cbcfc3152cfec72b287006fd9792b216_1711457572669_0.8687385948831983","host":"s3://npm-registry-packages"}},"0.30.0-alpha-20240326125317-36e794bb090f7233965104cc7a0f2a24c6d24fa2":{"name":"@graphql-hive/client","version":"0.30.0-alpha-20240326125317-36e794bb090f7233965104cc7a0f2a24c6d24fa2","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-alpha-20240326125317-36e794bb090f7233965104cc7a0f2a24c6d24fa2","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"b8c0c2c710237394440447de3893fde3c1d918b3","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-alpha-20240326125317-36e794bb090f7233965104cc7a0f2a24c6d24fa2.tgz","fileCount":64,"integrity":"sha512-4WmiBpspBvt8ASABgyGPxvO5Za3Yu/jLn813LGIg6q6tTvRbojT3xU2qmhM8jv/ijNOXpO6hutCpjacQRnIfFw==","signatures":[{"sig":"MEYCIQClcuLKZnYJb9xyGpWZTnh0KpYALTVgt1lY4xNyjOPZuwIhAN4lFnfes7G7hSE788lsxhPZE0GcvnokNHBREKP9/gjq","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242662},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-alpha-20240326125317-36e794bb090f7233965104cc7a0f2a24c6d24fa2.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/9e7a1e54f2174314ecd8b822a1c4f885/graphql-hive-client-0.30.0-alpha-20240326125317-36e794bb090f7233965104cc7a0f2a24c6d24fa2.tgz","_integrity":"sha512-4WmiBpspBvt8ASABgyGPxvO5Za3Yu/jLn813LGIg6q6tTvRbojT3xU2qmhM8jv/ijNOXpO6hutCpjacQRnIfFw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-alpha-20240326125317-36e794bb090f7233965104cc7a0f2a24c6d24fa2_1711457623134_0.7044296456261494","host":"s3://npm-registry-packages"}},"0.30.0-alpha-20240326125948-8a7797eae50070b95973e396e7289c5c14ad5f53":{"name":"@graphql-hive/client","version":"0.30.0-alpha-20240326125948-8a7797eae50070b95973e396e7289c5c14ad5f53","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-alpha-20240326125948-8a7797eae50070b95973e396e7289c5c14ad5f53","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"fd9b5350ced5d97ddd7553a1110903aaaef7bf97","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-alpha-20240326125948-8a7797eae50070b95973e396e7289c5c14ad5f53.tgz","fileCount":64,"integrity":"sha512-wEySOVi1wSWlFCb2IPSlN/ZhFVwiLP5YbiBsyXKNqXFoh7R+9/HP3xVbGkVyD2gr0tGVow0nCSwNuj3Im9faAg==","signatures":[{"sig":"MEUCIQCgc+pyCOlPIxjE9SBtfJksaRzU1Kczf4iB7gztoojzywIgYaoZuSLxbaJqTL5hNz6bfqGKo2rhiif0LPPTku6aocs=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242662},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-alpha-20240326125948-8a7797eae50070b95973e396e7289c5c14ad5f53.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/07430f2c95bd14257de66433ceac167e/graphql-hive-client-0.30.0-alpha-20240326125948-8a7797eae50070b95973e396e7289c5c14ad5f53.tgz","_integrity":"sha512-wEySOVi1wSWlFCb2IPSlN/ZhFVwiLP5YbiBsyXKNqXFoh7R+9/HP3xVbGkVyD2gr0tGVow0nCSwNuj3Im9faAg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-alpha-20240326125948-8a7797eae50070b95973e396e7289c5c14ad5f53_1711458014190_0.7078740311190548","host":"s3://npm-registry-packages"}},"0.30.0-rc-20240326130309-fb4b2f461ab945ddb5c6a3a4c454db80caab8431":{"name":"@graphql-hive/client","version":"0.30.0-rc-20240326130309-fb4b2f461ab945ddb5c6a3a4c454db80caab8431","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-rc-20240326130309-fb4b2f461ab945ddb5c6a3a4c454db80caab8431","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"840d9608fa6b5a86aac5ae8abb76737060e27c40","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-rc-20240326130309-fb4b2f461ab945ddb5c6a3a4c454db80caab8431.tgz","fileCount":64,"integrity":"sha512-Ie4DRiu67lTSm29x6/DEBV5TFnWsg3sOGzYjVhruqeVwtDThWh6BlXKIXxE3o5KzfF8GhYeuApQmWLuLy0pDzg==","signatures":[{"sig":"MEUCIDqqhFUQabYwD9dQNBTYnfJ7xfOsIvptXG9iTAcDMHA6AiEAiT8gMLx7a9P27ZjHzCI1ntJ+9nYf1CQY9bsg7yLv4dM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242647},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-rc-20240326130309-fb4b2f461ab945ddb5c6a3a4c454db80caab8431.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/f1dd365efd33b03b8df8433b3873103d/graphql-hive-client-0.30.0-rc-20240326130309-fb4b2f461ab945ddb5c6a3a4c454db80caab8431.tgz","_integrity":"sha512-Ie4DRiu67lTSm29x6/DEBV5TFnWsg3sOGzYjVhruqeVwtDThWh6BlXKIXxE3o5KzfF8GhYeuApQmWLuLy0pDzg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-rc-20240326130309-fb4b2f461ab945ddb5c6a3a4c454db80caab8431_1711458215250_0.8316159488286203","host":"s3://npm-registry-packages"}},"0.30.0":{"name":"@graphql-hive/client","version":"0.30.0","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"298074d3600d37dcec08adc0a9a74fe49dc48c56","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0.tgz","fileCount":64,"integrity":"sha512-c2StZM54bXBmfiGbnZr90txfYm7ypm1WMbYxSatPwMrtbeT4j5aK+S4duaeZ7VduJITUjjNUzWjqSh5wJ3hW9g==","signatures":[{"sig":"MEQCIG8bk6lAI5JjGtdo6EKBOMdZwE4cnj1MgiicUTDmbQPlAiBxQ65c/I2A8odmaLkLQc3J7WrUXhRQgSGR70oQw5shCQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242352},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0.tgz","module":"esm/index.js","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/bffc30240a0d42439f26faf7f83efc58/graphql-hive-client-0.30.0.tgz","_integrity":"sha512-c2StZM54bXBmfiGbnZr90txfYm7ypm1WMbYxSatPwMrtbeT4j5aK+S4duaeZ7VduJITUjjNUzWjqSh5wJ3hW9g==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0_1711462090143_0.8273950432685608","host":"s3://npm-registry-packages"}},"0.30.0-alpha-20240326142250-cb3184d239292f0a018dc85af54978e3876ea61d":{"name":"@graphql-hive/client","version":"0.30.0-alpha-20240326142250-cb3184d239292f0a018dc85af54978e3876ea61d","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-alpha-20240326142250-cb3184d239292f0a018dc85af54978e3876ea61d","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"f7da3cb506abdfb0cbddfbe0103608a82769bfff","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-alpha-20240326142250-cb3184d239292f0a018dc85af54978e3876ea61d.tgz","fileCount":64,"integrity":"sha512-wbQ+uakhahrwWl4931zW7jeFhhvh29qwxaAAgqweVA54cGZ4nHSdqAsXuI2cyuqSmDtYBZGaRu878kTlxYi8CA==","signatures":[{"sig":"MEYCIQDBTsI2kWRq/G0AhKqtA/ocoBf1Etr8JiJ1uwXr3KVy8QIhAOS/Ia5agnRAQ0PndVJ98aMYm31h3zziqwQIcfn5TsDK","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242662},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-alpha-20240326142250-cb3184d239292f0a018dc85af54978e3876ea61d.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/58d0998ac4a21a085fed86a8a5f21929/graphql-hive-client-0.30.0-alpha-20240326142250-cb3184d239292f0a018dc85af54978e3876ea61d.tgz","_integrity":"sha512-wbQ+uakhahrwWl4931zW7jeFhhvh29qwxaAAgqweVA54cGZ4nHSdqAsXuI2cyuqSmDtYBZGaRu878kTlxYi8CA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-alpha-20240326142250-cb3184d239292f0a018dc85af54978e3876ea61d_1711463000336_0.4741861453900915","host":"s3://npm-registry-packages"}},"0.30.0-alpha-20240326143409-0517bd2c11fa07415c4d6db101163eea6aa6c073":{"name":"@graphql-hive/client","version":"0.30.0-alpha-20240326143409-0517bd2c11fa07415c4d6db101163eea6aa6c073","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-alpha-20240326143409-0517bd2c11fa07415c4d6db101163eea6aa6c073","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"0db9d1253ac962ad02e5a40e2685eef4810c394b","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-alpha-20240326143409-0517bd2c11fa07415c4d6db101163eea6aa6c073.tgz","fileCount":64,"integrity":"sha512-w2f27fpviAsZmAriyuxW9E3g8UqkN0y0JSL1JEb1FP4GDKTNvfowEgxOsAAIYfm6FBSrjtoydph/+tCQUS716w==","signatures":[{"sig":"MEUCIBCmnqM1xMG7NvmG+8pd0T7hc83kq2OYbcGm6N50NYXzAiEA6CpD1fnIPq6hHySFSOaSnyd0T7U+4/0i/pmFU8I8LKs=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242662},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-alpha-20240326143409-0517bd2c11fa07415c4d6db101163eea6aa6c073.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/4d4c4832317b0e917fb2da707c8f929a/graphql-hive-client-0.30.0-alpha-20240326143409-0517bd2c11fa07415c4d6db101163eea6aa6c073.tgz","_integrity":"sha512-w2f27fpviAsZmAriyuxW9E3g8UqkN0y0JSL1JEb1FP4GDKTNvfowEgxOsAAIYfm6FBSrjtoydph/+tCQUS716w==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-alpha-20240326143409-0517bd2c11fa07415c4d6db101163eea6aa6c073_1711463678792_0.9301990973256131","host":"s3://npm-registry-packages"}},"0.30.0-alpha-20240326150137-229dd401da671787e4f1ccf6ebd8c035ca006f57":{"name":"@graphql-hive/client","version":"0.30.0-alpha-20240326150137-229dd401da671787e4f1ccf6ebd8c035ca006f57","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-alpha-20240326150137-229dd401da671787e4f1ccf6ebd8c035ca006f57","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"a64f9f48142b68b47aae4d1927910c883142bb62","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-alpha-20240326150137-229dd401da671787e4f1ccf6ebd8c035ca006f57.tgz","fileCount":64,"integrity":"sha512-VAUOiW+9ChNiJEGYE034BBZ5GMmmzNu91QPGBR87kR2z9PNJF/IrEcquIDwx1+X3oWwq5tgXqb8N51Z0X2DJTw==","signatures":[{"sig":"MEUCIDRUcMDHkm8Y8wZbeGOaD4/pyHrYcXHDz5N6CZoA9dj4AiEA5wkNvnOC6WUMLDnhWLvEmFa1eSDf7IFfMDq42j3Gvtw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242662},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-alpha-20240326150137-229dd401da671787e4f1ccf6ebd8c035ca006f57.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/20373434f1445a971c092e18396487d6/graphql-hive-client-0.30.0-alpha-20240326150137-229dd401da671787e4f1ccf6ebd8c035ca006f57.tgz","_integrity":"sha512-VAUOiW+9ChNiJEGYE034BBZ5GMmmzNu91QPGBR87kR2z9PNJF/IrEcquIDwx1+X3oWwq5tgXqb8N51Z0X2DJTw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-alpha-20240326150137-229dd401da671787e4f1ccf6ebd8c035ca006f57_1711465324184_0.6878677260501078","host":"s3://npm-registry-packages"}},"0.30.0-alpha-20240326150611-204bec922447fe031700ac8611c7f5a13c3eddd2":{"name":"@graphql-hive/client","version":"0.30.0-alpha-20240326150611-204bec922447fe031700ac8611c7f5a13c3eddd2","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-alpha-20240326150611-204bec922447fe031700ac8611c7f5a13c3eddd2","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"f6897d4b6f0e63d4c1d56b4233aad75e57b156cc","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-alpha-20240326150611-204bec922447fe031700ac8611c7f5a13c3eddd2.tgz","fileCount":64,"integrity":"sha512-1rAfT1/OPFQqnk6rV2MNhbLbVv9Oe2bNmBpRmVWe2cTs28cv4vlto22Z3EmEamkepumCMfFvJbfm5eqYOXJAdA==","signatures":[{"sig":"MEUCIQDly5P7BCYxlnHN6glFbSViI0fuG9PNWh2jYHwmsoAMHQIgcFJfjMSzFWAJDLyAXIiJAliD2CglFuLOzGNBU4uINI4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242662},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-alpha-20240326150611-204bec922447fe031700ac8611c7f5a13c3eddd2.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/6fa7e4e4a20b48a64ee5f8baa8a9538f/graphql-hive-client-0.30.0-alpha-20240326150611-204bec922447fe031700ac8611c7f5a13c3eddd2.tgz","_integrity":"sha512-1rAfT1/OPFQqnk6rV2MNhbLbVv9Oe2bNmBpRmVWe2cTs28cv4vlto22Z3EmEamkepumCMfFvJbfm5eqYOXJAdA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-alpha-20240326150611-204bec922447fe031700ac8611c7f5a13c3eddd2_1711465597102_0.6665318316935194","host":"s3://npm-registry-packages"}},"0.30.0-alpha-20240326152018-671a8a92bfa1b5fc81e01244796536f17cdae85d":{"name":"@graphql-hive/client","version":"0.30.0-alpha-20240326152018-671a8a92bfa1b5fc81e01244796536f17cdae85d","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-alpha-20240326152018-671a8a92bfa1b5fc81e01244796536f17cdae85d","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"a408db9f9f9c009111371e09078ce40f28145dd9","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-alpha-20240326152018-671a8a92bfa1b5fc81e01244796536f17cdae85d.tgz","fileCount":64,"integrity":"sha512-05EA90FTVhwmVCwwozkgiIUmvVjatmnb+3MY0k5ULCUX2+zF23LZvBM6bVcbboRsq32m96xIuYxkAnvmjTX6rw==","signatures":[{"sig":"MEQCIGiw0HrW4BBXp86/3DGVbKXZ6dsJOEpiCzY/+9UX0K8QAiAez10ZdlQ1F8a5IJRBqgeHgeFqXijDrC8QH9AF3d0ouA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242662},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-alpha-20240326152018-671a8a92bfa1b5fc81e01244796536f17cdae85d.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/4182a99b67e74ba30f86c910c60a26d4/graphql-hive-client-0.30.0-alpha-20240326152018-671a8a92bfa1b5fc81e01244796536f17cdae85d.tgz","_integrity":"sha512-05EA90FTVhwmVCwwozkgiIUmvVjatmnb+3MY0k5ULCUX2+zF23LZvBM6bVcbboRsq32m96xIuYxkAnvmjTX6rw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-alpha-20240326152018-671a8a92bfa1b5fc81e01244796536f17cdae85d_1711466444889_0.3261028699080595","host":"s3://npm-registry-packages"}},"0.30.0-alpha-20240326153229-fd388230c4f9ea1b5ed437953f7eca1a6f6ad3a0":{"name":"@graphql-hive/client","version":"0.30.0-alpha-20240326153229-fd388230c4f9ea1b5ed437953f7eca1a6f6ad3a0","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-alpha-20240326153229-fd388230c4f9ea1b5ed437953f7eca1a6f6ad3a0","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"18dd9c47377063d6d3c98e42490210b00756c385","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-alpha-20240326153229-fd388230c4f9ea1b5ed437953f7eca1a6f6ad3a0.tgz","fileCount":64,"integrity":"sha512-YcDVWQpovdxmR9EICPH6h/XZTKkIecn3HTx9od69nHEt/853m3bJbhbkvErFUg3IqbDcoYE0+rc6KBe+srXWCg==","signatures":[{"sig":"MEUCIQCCynZgolOuKVZkC/fD3Cdl97aluVSQ3oq+3lGKzlfnkgIgXQWv7wN/4srSWWffPynRHFWMcI8KvC3wxHNU9E6kqjA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242662},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-alpha-20240326153229-fd388230c4f9ea1b5ed437953f7eca1a6f6ad3a0.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/97b30e3f5c02dce644d9f3149c6ca4cc/graphql-hive-client-0.30.0-alpha-20240326153229-fd388230c4f9ea1b5ed437953f7eca1a6f6ad3a0.tgz","_integrity":"sha512-YcDVWQpovdxmR9EICPH6h/XZTKkIecn3HTx9od69nHEt/853m3bJbhbkvErFUg3IqbDcoYE0+rc6KBe+srXWCg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-alpha-20240326153229-fd388230c4f9ea1b5ed437953f7eca1a6f6ad3a0_1711467175899_0.7086172887551916","host":"s3://npm-registry-packages"}},"0.30.0-alpha-20240326153409-2ebef2e91fececaad66cfadbaf6e2780c6554baf":{"name":"@graphql-hive/client","version":"0.30.0-alpha-20240326153409-2ebef2e91fececaad66cfadbaf6e2780c6554baf","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.30.0-alpha-20240326153409-2ebef2e91fececaad66cfadbaf6e2780c6554baf","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"d7f3a5b3342d9eefc808e54459892e6ac4dbc7b0","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.30.0-alpha-20240326153409-2ebef2e91fececaad66cfadbaf6e2780c6554baf.tgz","fileCount":64,"integrity":"sha512-2oZWsWV3QGHqR4tfUSLhMiId2gQ2BtH5l8nFPmoYTaJb53XussXs0bn0P75p5I79ka9+RWYWxhPyX66FNe0rAg==","signatures":[{"sig":"MEUCIQDIIMFtonZZ2uFelGeDtkZGnE/tpTYmJLuNDcOU0xN4awIgPa8HBS7qnw9XDNwB6pfUG+sPQad2pwnl5j0NSIPDL4g=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242662},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.30.0-alpha-20240326153409-2ebef2e91fececaad66cfadbaf6e2780c6554baf.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/838432025702fbb699e19e863555112b/graphql-hive-client-0.30.0-alpha-20240326153409-2ebef2e91fececaad66cfadbaf6e2780c6554baf.tgz","_integrity":"sha512-2oZWsWV3QGHqR4tfUSLhMiId2gQ2BtH5l8nFPmoYTaJb53XussXs0bn0P75p5I79ka9+RWYWxhPyX66FNe0rAg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.1","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.30.0-alpha-20240326153409-2ebef2e91fececaad66cfadbaf6e2780c6554baf_1711467278236_0.6957666395705584","host":"s3://npm-registry-packages"}},"0.31.0-alpha-20240410160936-e50c879eece0fe498707f0e530b01dc8d39af46e":{"name":"@graphql-hive/client","version":"0.31.0-alpha-20240410160936-e50c879eece0fe498707f0e530b01dc8d39af46e","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.31.0-alpha-20240410160936-e50c879eece0fe498707f0e530b01dc8d39af46e","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"07708138e8a6653203bfeaa7ede2de9603458d1c","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.31.0-alpha-20240410160936-e50c879eece0fe498707f0e530b01dc8d39af46e.tgz","fileCount":64,"integrity":"sha512-9yGc6vw33YKNZSnjtg+03i5dDeeuuk/6xThAJk70sGfzkRmi8GzgGDGF3hVp2i1PiTBGKEINacphGQlrQLoe3Q==","signatures":[{"sig":"MEUCIQCbfUbpMS/cCojBZlFNyzfrR4qZOxuT+plCEizptvJdMQIgWuUKl432kKpnjdanz/a1nvc+XBL9Do4IKzX1ly6nyu8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":245937},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.31.0-alpha-20240410160936-e50c879eece0fe498707f0e530b01dc8d39af46e.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/02e3d686e097e45cb2cadd2e02d800a4/graphql-hive-client-0.31.0-alpha-20240410160936-e50c879eece0fe498707f0e530b01dc8d39af46e.tgz","_integrity":"sha512-9yGc6vw33YKNZSnjtg+03i5dDeeuuk/6xThAJk70sGfzkRmi8GzgGDGF3hVp2i1PiTBGKEINacphGQlrQLoe3Q==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.2","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.31.0-alpha-20240410160936-e50c879eece0fe498707f0e530b01dc8d39af46e_1712765403314_0.9861938969100519","host":"s3://npm-registry-packages"}},"0.31.0-alpha-20240411064915-e37809dea13a3e023c4dc15f184b33d63194c607":{"name":"@graphql-hive/client","version":"0.31.0-alpha-20240411064915-e37809dea13a3e023c4dc15f184b33d63194c607","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.31.0-alpha-20240411064915-e37809dea13a3e023c4dc15f184b33d63194c607","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"dd20636f304629fd32d6a07e213deeafc3c43aae","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.31.0-alpha-20240411064915-e37809dea13a3e023c4dc15f184b33d63194c607.tgz","fileCount":64,"integrity":"sha512-F29pFPr5gN3TN4Wl3M9X3FBUg/5BKcd4/OPlzs/pYOW1JoB3f8c/D+Qy+OmGocm+Za+7mivQSZqWhAFVM46+ew==","signatures":[{"sig":"MEUCIDGD/wxZKkcPl2nVsxfllomMQcv3GaFqbh4EkroEgejiAiEA262Y6VSLf9zZg/Gey2yJCE8KnxJp7h4M8X4yrnbgKXc=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":246069},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.31.0-alpha-20240411064915-e37809dea13a3e023c4dc15f184b33d63194c607.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/ee2a0c2438155326d5d96c4cb1b28677/graphql-hive-client-0.31.0-alpha-20240411064915-e37809dea13a3e023c4dc15f184b33d63194c607.tgz","_integrity":"sha512-F29pFPr5gN3TN4Wl3M9X3FBUg/5BKcd4/OPlzs/pYOW1JoB3f8c/D+Qy+OmGocm+Za+7mivQSZqWhAFVM46+ew==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.3","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.31.0-alpha-20240411064915-e37809dea13a3e023c4dc15f184b33d63194c607_1712818182213_0.13240001145017022","host":"s3://npm-registry-packages"}},"0.31.0-rc-20240411070245-9162a01c619bc99307c8c14b0653465c9fc07f5f":{"name":"@graphql-hive/client","version":"0.31.0-rc-20240411070245-9162a01c619bc99307c8c14b0653465c9fc07f5f","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.31.0-rc-20240411070245-9162a01c619bc99307c8c14b0653465c9fc07f5f","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"d3343492553961960dc2ec23bcb099232c2a2caf","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.31.0-rc-20240411070245-9162a01c619bc99307c8c14b0653465c9fc07f5f.tgz","fileCount":64,"integrity":"sha512-eFsZVUKbviMj5R6fNFUF0kN6trxOEu363cOuyxzt9wYpRVSfhY92S6uqQM1w86oVk7/DX/aDicXpqC34jCzEKA==","signatures":[{"sig":"MEUCICvxAyGBTxmQkb5xVBXg/kdJuydxOVBy26OFH8Th+r6VAiEAtHW6pe2BLozkhCnlFW1vbGK5LRtXgjCSt+AmJEohMLo=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":246054},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.31.0-rc-20240411070245-9162a01c619bc99307c8c14b0653465c9fc07f5f.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/86924b9303e12ce21e5f57c958a6e7b9/graphql-hive-client-0.31.0-rc-20240411070245-9162a01c619bc99307c8c14b0653465c9fc07f5f.tgz","_integrity":"sha512-eFsZVUKbviMj5R6fNFUF0kN6trxOEu363cOuyxzt9wYpRVSfhY92S6uqQM1w86oVk7/DX/aDicXpqC34jCzEKA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.3","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.31.0-rc-20240411070245-9162a01c619bc99307c8c14b0653465c9fc07f5f_1712818990011_0.3721003250230617","host":"s3://npm-registry-packages"}},"0.31.0-alpha-20240411100255-2dba02e475bf5fb85f8e6c1dcca63e04a7e76a41":{"name":"@graphql-hive/client","version":"0.31.0-alpha-20240411100255-2dba02e475bf5fb85f8e6c1dcca63e04a7e76a41","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.31.0-alpha-20240411100255-2dba02e475bf5fb85f8e6c1dcca63e04a7e76a41","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"c5409856f81c33e30105848a14b571c7b7ad96d6","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.31.0-alpha-20240411100255-2dba02e475bf5fb85f8e6c1dcca63e04a7e76a41.tgz","fileCount":64,"integrity":"sha512-WXaJZHXyAYCAx8ASq1D3NpikTCPhysfj7+3vi9umrOVyuUGGNU+KrTrxLvQsupyTK9Mta3jhy0W0TgPwqyCP7A==","signatures":[{"sig":"MEUCIQDr6jr/KtaMbLf6ADXoo4Mgh2RlXtQMUBA2S1aByoPAGAIgEPOFfIAr29dHotzGlWbCm82JaMx37SGR1yslxHgsIV4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":246069},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.31.0-alpha-20240411100255-2dba02e475bf5fb85f8e6c1dcca63e04a7e76a41.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/bdefce5adb291a5fb1d434fc6e3d6920/graphql-hive-client-0.31.0-alpha-20240411100255-2dba02e475bf5fb85f8e6c1dcca63e04a7e76a41.tgz","_integrity":"sha512-WXaJZHXyAYCAx8ASq1D3NpikTCPhysfj7+3vi9umrOVyuUGGNU+KrTrxLvQsupyTK9Mta3jhy0W0TgPwqyCP7A==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.3","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.31.0-alpha-20240411100255-2dba02e475bf5fb85f8e6c1dcca63e04a7e76a41_1712829801028_0.33954650569733325","host":"s3://npm-registry-packages"}},"0.31.0-rc-20240411100348-4627887808fbf4462e1fdea1571c6e4b321b3a1c":{"name":"@graphql-hive/client","version":"0.31.0-rc-20240411100348-4627887808fbf4462e1fdea1571c6e4b321b3a1c","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.31.0-rc-20240411100348-4627887808fbf4462e1fdea1571c6e4b321b3a1c","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"ad7bcea7f5d3c76ef1d86d68eb75028d2c4563cc","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.31.0-rc-20240411100348-4627887808fbf4462e1fdea1571c6e4b321b3a1c.tgz","fileCount":64,"integrity":"sha512-SYSJteNZ4hjctB0WfLU1dEXD02N1KRATkS/J6zLk1z0t4pQBpCF5b5ht+7VcMaJkeyVx95hHECcl2ICc1b4jMg==","signatures":[{"sig":"MEUCIA6L+YliqtEA/LPrw7vGZ0wuBhLVVWIIq7al5VpZCOetAiEA4Y307aTgSWflFq7OWhK/w86L63m2aIfzp176e67x2YQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":246054},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.31.0-rc-20240411100348-4627887808fbf4462e1fdea1571c6e4b321b3a1c.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/22d04bdb482de66f4bc4e4d103fa9427/graphql-hive-client-0.31.0-rc-20240411100348-4627887808fbf4462e1fdea1571c6e4b321b3a1c.tgz","_integrity":"sha512-SYSJteNZ4hjctB0WfLU1dEXD02N1KRATkS/J6zLk1z0t4pQBpCF5b5ht+7VcMaJkeyVx95hHECcl2ICc1b4jMg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.3","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.31.0-rc-20240411100348-4627887808fbf4462e1fdea1571c6e4b321b3a1c_1712829853442_0.5503386856037038","host":"s3://npm-registry-packages"}},"0.31.0-alpha-20240411102347-2dbe0a9de4fbc6493d20d1f5310c9671edaa8ccb":{"name":"@graphql-hive/client","version":"0.31.0-alpha-20240411102347-2dbe0a9de4fbc6493d20d1f5310c9671edaa8ccb","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.31.0-alpha-20240411102347-2dbe0a9de4fbc6493d20d1f5310c9671edaa8ccb","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"5e4b16c6c820d4418729e0b6913f9cf0c93cc393","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.31.0-alpha-20240411102347-2dbe0a9de4fbc6493d20d1f5310c9671edaa8ccb.tgz","fileCount":64,"integrity":"sha512-UEIv6/udNQYk8NDowmTQgUmq3kCN+21rwE46W4xH2k06p0HtbROwl6zi9UwmYuU0nLnb+ItvEfz4HlBF5s8+7w==","signatures":[{"sig":"MEQCIAzfS1AJfEdpGEZMHbXF3Mi/f6K1loXMe0ZPY1pzKwEiAiASnY8EzdwQFqLaaE2N3YScLYDuqXffLYDW4CUyxh1aqw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":246069},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.31.0-alpha-20240411102347-2dbe0a9de4fbc6493d20d1f5310c9671edaa8ccb.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/81cc974a0bf7c77f750a277839a2e8de/graphql-hive-client-0.31.0-alpha-20240411102347-2dbe0a9de4fbc6493d20d1f5310c9671edaa8ccb.tgz","_integrity":"sha512-UEIv6/udNQYk8NDowmTQgUmq3kCN+21rwE46W4xH2k06p0HtbROwl6zi9UwmYuU0nLnb+ItvEfz4HlBF5s8+7w==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.3","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.31.0-alpha-20240411102347-2dbe0a9de4fbc6493d20d1f5310c9671edaa8ccb_1712831051699_0.7439933832391084","host":"s3://npm-registry-packages"}},"0.31.0-alpha-20240411102434-7108211b471dee5b116fa326ed94324c3aac33b3":{"name":"@graphql-hive/client","version":"0.31.0-alpha-20240411102434-7108211b471dee5b116fa326ed94324c3aac33b3","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.31.0-alpha-20240411102434-7108211b471dee5b116fa326ed94324c3aac33b3","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"ce714fe3883fa77593bb12bb123e109ea6d04503","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.31.0-alpha-20240411102434-7108211b471dee5b116fa326ed94324c3aac33b3.tgz","fileCount":64,"integrity":"sha512-iCO/XpBAXloT6xvNqosKl+6JLQOG0ClPckOUvbWjC9NQJ9sFpEE9AsFGlEFO+FF2T7RXJuoPTGyijbQOczYDzA==","signatures":[{"sig":"MEUCIQCDyakDlSQ4yfwfdWb2tHyjcR7wB7XUxkKJXMAaU++wXQIgM1KM+555H2GoidSUAaJNoekL5KrZZmQbPmXxqVesOqo=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":246069},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.31.0-alpha-20240411102434-7108211b471dee5b116fa326ed94324c3aac33b3.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/3f436e331447e1001c24c4939e437fba/graphql-hive-client-0.31.0-alpha-20240411102434-7108211b471dee5b116fa326ed94324c3aac33b3.tgz","_integrity":"sha512-iCO/XpBAXloT6xvNqosKl+6JLQOG0ClPckOUvbWjC9NQJ9sFpEE9AsFGlEFO+FF2T7RXJuoPTGyijbQOczYDzA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.3","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.31.0-alpha-20240411102434-7108211b471dee5b116fa326ed94324c3aac33b3_1712831099310_0.3564847828554538","host":"s3://npm-registry-packages"}},"0.31.0-alpha-20240411102524-7ea9a792be1fa39d94c8ef9f33aac26835c98828":{"name":"@graphql-hive/client","version":"0.31.0-alpha-20240411102524-7ea9a792be1fa39d94c8ef9f33aac26835c98828","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.31.0-alpha-20240411102524-7ea9a792be1fa39d94c8ef9f33aac26835c98828","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"3101bb7f52da0f3535815158ee2488ba141fc1d5","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.31.0-alpha-20240411102524-7ea9a792be1fa39d94c8ef9f33aac26835c98828.tgz","fileCount":64,"integrity":"sha512-nYADrvFQiUDWSMrYr+/P6h5qWNLMf0HmP4feBFVbqLTd78TCjd8xB9gffC2bJW/Nt4IgViPOXCPBe2/Z2ErvVA==","signatures":[{"sig":"MEUCIFidHxcULbkHjdFAiF9X1GVbBc+HaBJBFv77sHMCOiY9AiEA0TjbVEaVeanrWfw9Bgv4umNNGP3foSLGXyKsTsfJHYk=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":246069},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.31.0-alpha-20240411102524-7ea9a792be1fa39d94c8ef9f33aac26835c98828.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/ee08c3132ac80305790fb1fcf9b6e95d/graphql-hive-client-0.31.0-alpha-20240411102524-7ea9a792be1fa39d94c8ef9f33aac26835c98828.tgz","_integrity":"sha512-nYADrvFQiUDWSMrYr+/P6h5qWNLMf0HmP4feBFVbqLTd78TCjd8xB9gffC2bJW/Nt4IgViPOXCPBe2/Z2ErvVA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.3","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.31.0-alpha-20240411102524-7ea9a792be1fa39d94c8ef9f33aac26835c98828_1712831152601_0.9659695338003049","host":"s3://npm-registry-packages"}},"0.31.0":{"name":"@graphql-hive/client","version":"0.31.0","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.31.0","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"5f46baf5e359ac52636baa1641ca528805818b2e","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.31.0.tgz","fileCount":64,"integrity":"sha512-NNwamUBzoV4pxmJbV6DWlzQMlsw03rByPOJcJ1YnaYYyMYtn0zYLbGtYsePEQIyljVoNtUsRByeE7tCFAQTxWA==","signatures":[{"sig":"MEQCIBw9/KPHWa4BT4mp5/hzhRqAXidlXL+exSV10OcZYu9NAiBVUN40GKrbaG4O7f9KEhz1k6pdJ53HwH+T+/uUdTIPrQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":245759},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.31.0.tgz","module":"esm/index.js","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/6ca58b44e6fd8ee18d44030300c87706/graphql-hive-client-0.31.0.tgz","_integrity":"sha512-NNwamUBzoV4pxmJbV6DWlzQMlsw03rByPOJcJ1YnaYYyMYtn0zYLbGtYsePEQIyljVoNtUsRByeE7tCFAQTxWA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.3","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.31.0_1712831459527_0.8009265990257046","host":"s3://npm-registry-packages"}},"0.32.0-alpha-20240412114355-00dc7cf3a587b7b576a04b5821a04c91f0208c8d":{"name":"@graphql-hive/client","version":"0.32.0-alpha-20240412114355-00dc7cf3a587b7b576a04b5821a04c91f0208c8d","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.32.0-alpha-20240412114355-00dc7cf3a587b7b576a04b5821a04c91f0208c8d","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"d8dec5e297773506c43dd9cc628036e52931bc56","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.32.0-alpha-20240412114355-00dc7cf3a587b7b576a04b5821a04c91f0208c8d.tgz","fileCount":64,"integrity":"sha512-NK0+FzG7GcZauSf/y+D2nXOwLwAKac+BgVz8eQm0mZ5QdSF+49XFldTCCDv/VJ4hNCmNl86MOkiKq4z2vTiYOw==","signatures":[{"sig":"MEYCIQDQJWF4k+qoyMqb5CXfqOfQMxjosNLfLKRYlEK5JlRCwgIhAM4byL5Plb4R9v0qhIC8OjwxaO7EadPlGyOYtYiZgzxl","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":249354},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.32.0-alpha-20240412114355-00dc7cf3a587b7b576a04b5821a04c91f0208c8d.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/66526070c97b989757df14e6c6963f54/graphql-hive-client-0.32.0-alpha-20240412114355-00dc7cf3a587b7b576a04b5821a04c91f0208c8d.tgz","_integrity":"sha512-NK0+FzG7GcZauSf/y+D2nXOwLwAKac+BgVz8eQm0mZ5QdSF+49XFldTCCDv/VJ4hNCmNl86MOkiKq4z2vTiYOw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.3","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"0.3.0-alpha-20240412114355-00dc7cf3a587b7b576a04b5821a04c91f0208c8d","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.32.0-alpha-20240412114355-00dc7cf3a587b7b576a04b5821a04c91f0208c8d_1712922262587_0.4683526806517848","host":"s3://npm-registry-packages"}},"0.32.0-alpha-20240412120414-3a2e3ae37449da6caa4048360c4f491abd84301e":{"name":"@graphql-hive/client","version":"0.32.0-alpha-20240412120414-3a2e3ae37449da6caa4048360c4f491abd84301e","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.32.0-alpha-20240412120414-3a2e3ae37449da6caa4048360c4f491abd84301e","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"472ae02f95da1c9e922515638987777f010b33b1","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.32.0-alpha-20240412120414-3a2e3ae37449da6caa4048360c4f491abd84301e.tgz","fileCount":64,"integrity":"sha512-7MPJfFvg2usNEvAMwUYUt66v1+YR/enHZT4byMrSq3FNNT0o5eekCdXMfToYh3n5JAz3CWGO/4KQnVKcj5BNkA==","signatures":[{"sig":"MEUCIQCUfZ/w4i7tTqzTHV8yDEZsP+F5i6XzCNb9xrUoVbpl0AIgBUkkESUs7hA7hNfuIbAdp69rf/JkiImcECC8oomHvQ4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":249402},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.32.0-alpha-20240412120414-3a2e3ae37449da6caa4048360c4f491abd84301e.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/94763de59063bedc01f1a1f2d2f8c4c5/graphql-hive-client-0.32.0-alpha-20240412120414-3a2e3ae37449da6caa4048360c4f491abd84301e.tgz","_integrity":"sha512-7MPJfFvg2usNEvAMwUYUt66v1+YR/enHZT4byMrSq3FNNT0o5eekCdXMfToYh3n5JAz3CWGO/4KQnVKcj5BNkA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.3","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"0.3.0-alpha-20240412120414-3a2e3ae37449da6caa4048360c4f491abd84301e","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.32.0-alpha-20240412120414-3a2e3ae37449da6caa4048360c4f491abd84301e_1712923479713_0.26871062311812755","host":"s3://npm-registry-packages"}},"0.32.0-alpha-20240412140857-a77eb6a3b346ce1b39775819de9d43d3f740265a":{"name":"@graphql-hive/client","version":"0.32.0-alpha-20240412140857-a77eb6a3b346ce1b39775819de9d43d3f740265a","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.32.0-alpha-20240412140857-a77eb6a3b346ce1b39775819de9d43d3f740265a","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"d116c8e322aa521e81613dc7ccbe3d62b23697ef","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.32.0-alpha-20240412140857-a77eb6a3b346ce1b39775819de9d43d3f740265a.tgz","fileCount":68,"integrity":"sha512-yD8Fsqcjoe9g1iqeKsQF2yK4eTahsi/AhqbgASr2yCH+N7UAZaJ+6IlvVyi9twHg7g/cDss7tdq1fZ8tTlc/Ug==","signatures":[{"sig":"MEQCIAgviDCFHyhBHxnryLonnkede2ox7gje3mDmlVdoiG1NAiA59VNau/fbjEJlwRBdznyxXNvVdiU4A9zoim8oJm7Deg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":252151},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.32.0-alpha-20240412140857-a77eb6a3b346ce1b39775819de9d43d3f740265a.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/fef9f6b61328fe8404d1d2468792b0cf/graphql-hive-client-0.32.0-alpha-20240412140857-a77eb6a3b346ce1b39775819de9d43d3f740265a.tgz","_integrity":"sha512-yD8Fsqcjoe9g1iqeKsQF2yK4eTahsi/AhqbgASr2yCH+N7UAZaJ+6IlvVyi9twHg7g/cDss7tdq1fZ8tTlc/Ug==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.3","dependencies":{"tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"0.3.0-alpha-20240412140857-a77eb6a3b346ce1b39775819de9d43d3f740265a","@whatwg-node/fetch":"0.9.17","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.32.0-alpha-20240412140857-a77eb6a3b346ce1b39775819de9d43d3f740265a_1712930963457_0.9637982542883512","host":"s3://npm-registry-packages"}},"0.32.0-alpha-20240412143242-fcec5662991d36ef3d3e51261dd2d4deebc4b843":{"name":"@graphql-hive/client","version":"0.32.0-alpha-20240412143242-fcec5662991d36ef3d3e51261dd2d4deebc4b843","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.32.0-alpha-20240412143242-fcec5662991d36ef3d3e51261dd2d4deebc4b843","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"ee69449db19ab922c1aa76aeb13189217b740742","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.32.0-alpha-20240412143242-fcec5662991d36ef3d3e51261dd2d4deebc4b843.tgz","fileCount":68,"integrity":"sha512-H/ojIJxc0quMZA42SR5M5sREvzA3W6839z904OmQSdvw5ZnPxe31LauVAYhSgcicyJanuUhdB5M3Mi3qqx12xg==","signatures":[{"sig":"MEUCIEfTmnxMok0d2po6aI9iMExRm2rcOrZXDJhCAQYdT3tdAiEAtYWwbfULhrGfkP91WQVnn+eMv+bK2hOjJkFFfgNeDe4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":253235},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.32.0-alpha-20240412143242-fcec5662991d36ef3d3e51261dd2d4deebc4b843.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/70ae24f6f285a3b6b7c435704db8d543/graphql-hive-client-0.32.0-alpha-20240412143242-fcec5662991d36ef3d3e51261dd2d4deebc4b843.tgz","_integrity":"sha512-H/ojIJxc0quMZA42SR5M5sREvzA3W6839z904OmQSdvw5ZnPxe31LauVAYhSgcicyJanuUhdB5M3Mi3qqx12xg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.3","dependencies":{"tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"0.3.0-alpha-20240412143242-fcec5662991d36ef3d3e51261dd2d4deebc4b843","@whatwg-node/fetch":"0.9.17","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.32.0-alpha-20240412143242-fcec5662991d36ef3d3e51261dd2d4deebc4b843_1712932390071_0.9805667121685995","host":"s3://npm-registry-packages"}},"0.32.0-alpha-20240412143939-cab44cb1bb0408ec776456341d4c634fbf054589":{"name":"@graphql-hive/client","version":"0.32.0-alpha-20240412143939-cab44cb1bb0408ec776456341d4c634fbf054589","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.32.0-alpha-20240412143939-cab44cb1bb0408ec776456341d4c634fbf054589","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"d90083332900bff151d75755d016c91b3ae12373","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.32.0-alpha-20240412143939-cab44cb1bb0408ec776456341d4c634fbf054589.tgz","fileCount":68,"integrity":"sha512-srYvQJ9zdYbnCmrho7BJ0xrnNMJm6+vvGrgz7ob4lpqmNqS1j8AWaXFLtPuSucO+BONbSemf7NOR4oxXeJxIkw==","signatures":[{"sig":"MEYCIQCBspVDOS3z4zrFeztcRhr2PO0umsKr/h1pHYhbcBs5MQIhAJw/hK6u2xMgm2COtDN8f9WyVFyqOXYsCzRFhemD7Lv0","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":253027},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.32.0-alpha-20240412143939-cab44cb1bb0408ec776456341d4c634fbf054589.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/7bb762964870bdc78893387f2a76b595/graphql-hive-client-0.32.0-alpha-20240412143939-cab44cb1bb0408ec776456341d4c634fbf054589.tgz","_integrity":"sha512-srYvQJ9zdYbnCmrho7BJ0xrnNMJm6+vvGrgz7ob4lpqmNqS1j8AWaXFLtPuSucO+BONbSemf7NOR4oxXeJxIkw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.3","dependencies":{"tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"0.3.0-alpha-20240412143939-cab44cb1bb0408ec776456341d4c634fbf054589","@whatwg-node/fetch":"0.9.17","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.32.0-alpha-20240412143939-cab44cb1bb0408ec776456341d4c634fbf054589_1712932806299_0.6888797038512577","host":"s3://npm-registry-packages"}},"0.32.0-alpha-20240415092429-08eba963b2bb3748fa1dd4d425d06ea99d5bdca7":{"name":"@graphql-hive/client","version":"0.32.0-alpha-20240415092429-08eba963b2bb3748fa1dd4d425d06ea99d5bdca7","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.32.0-alpha-20240415092429-08eba963b2bb3748fa1dd4d425d06ea99d5bdca7","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"960b8c62a8d0e70624fc9d9cd6434468e46554d3","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.32.0-alpha-20240415092429-08eba963b2bb3748fa1dd4d425d06ea99d5bdca7.tgz","fileCount":68,"integrity":"sha512-G2Qy6yaEUEVfWn90gNXzpXvgOoFIlAAUSkLhuCNY7RA8/XjkTVdaykfOb1EX2NyrzSunLj2MC1sFPCl4ehQTOw==","signatures":[{"sig":"MEUCIQDIgK9inYUKksUZDTclL4dWPEDxcFq/0oSU4kJPhsyB/wIge61tkDgCLJW8EAaVVmIDJY16Pzr9E6mqyghYQHnBIGg=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":254853},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.32.0-alpha-20240415092429-08eba963b2bb3748fa1dd4d425d06ea99d5bdca7.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/f0e206d339b4b180fa5b7347612606a8/graphql-hive-client-0.32.0-alpha-20240415092429-08eba963b2bb3748fa1dd4d425d06ea99d5bdca7.tgz","_integrity":"sha512-G2Qy6yaEUEVfWn90gNXzpXvgOoFIlAAUSkLhuCNY7RA8/XjkTVdaykfOb1EX2NyrzSunLj2MC1sFPCl4ehQTOw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.3","dependencies":{"tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"0.3.0-alpha-20240415092429-08eba963b2bb3748fa1dd4d425d06ea99d5bdca7","@whatwg-node/fetch":"0.9.17","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.32.0-alpha-20240415092429-08eba963b2bb3748fa1dd4d425d06ea99d5bdca7_1713173095379_0.03855735491124168","host":"s3://npm-registry-packages"}},"0.32.0-alpha-20240415115323-840154d858b4708d6efb9d7bb1c67ae0ecf6eaa9":{"name":"@graphql-hive/client","version":"0.32.0-alpha-20240415115323-840154d858b4708d6efb9d7bb1c67ae0ecf6eaa9","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.32.0-alpha-20240415115323-840154d858b4708d6efb9d7bb1c67ae0ecf6eaa9","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"9a498a83e4a79d005497e5d3e88107dcdd786ffa","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.32.0-alpha-20240415115323-840154d858b4708d6efb9d7bb1c67ae0ecf6eaa9.tgz","fileCount":68,"integrity":"sha512-L3hterWC4+4G8ulUtjTDb9NVkgf4yjTZxAo1V8RGCYnqS8pTPC5wjK57XXYYNOifX+RV+HmW1zLmb0oExOrcWA==","signatures":[{"sig":"MEYCIQCkicQOhSQJ61V+0DOtryTmxUsNBctNrs/u8lbFFbjG2QIhAJc4FoQEjbV3MrKQvqFIZT4SaFb6mj1NNNE2iCzDW4bD","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":255061},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.32.0-alpha-20240415115323-840154d858b4708d6efb9d7bb1c67ae0ecf6eaa9.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/51d095e4f43541366f7c705529e2f4dd/graphql-hive-client-0.32.0-alpha-20240415115323-840154d858b4708d6efb9d7bb1c67ae0ecf6eaa9.tgz","_integrity":"sha512-L3hterWC4+4G8ulUtjTDb9NVkgf4yjTZxAo1V8RGCYnqS8pTPC5wjK57XXYYNOifX+RV+HmW1zLmb0oExOrcWA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.3","dependencies":{"tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"0.3.0-alpha-20240415115323-840154d858b4708d6efb9d7bb1c67ae0ecf6eaa9","@whatwg-node/fetch":"0.9.17","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.32.0-alpha-20240415115323-840154d858b4708d6efb9d7bb1c67ae0ecf6eaa9_1713182031486_0.5003248121614587","host":"s3://npm-registry-packages"}},"0.32.0-alpha-20240415135346-8a401121d1d86ed46effa28cefadd032c6645413":{"name":"@graphql-hive/client","version":"0.32.0-alpha-20240415135346-8a401121d1d86ed46effa28cefadd032c6645413","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.32.0-alpha-20240415135346-8a401121d1d86ed46effa28cefadd032c6645413","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"a23f64e31d88a02cb69a6a1c652b63724edf6cdc","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.32.0-alpha-20240415135346-8a401121d1d86ed46effa28cefadd032c6645413.tgz","fileCount":68,"integrity":"sha512-DIi7vq7kL3tLBiFkHqc8Mh2WWpjyMHq1Ya5IJtZ+959EgXuwvhw4/jv7tEMcPfpIUSRwuUW59oAyJe8Q6Zqa0w==","signatures":[{"sig":"MEUCIQDw1bH/ePFZqACFnB347oHmOKvQgBiXk4q2uJy1cmKSkQIgdbupsuaRlPFVIomRtEyite6d2S1j0YE+FvzfoSRCyQ0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":253620},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.32.0-alpha-20240415135346-8a401121d1d86ed46effa28cefadd032c6645413.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/efd4e528b8b50e0fad0b932a69852089/graphql-hive-client-0.32.0-alpha-20240415135346-8a401121d1d86ed46effa28cefadd032c6645413.tgz","_integrity":"sha512-DIi7vq7kL3tLBiFkHqc8Mh2WWpjyMHq1Ya5IJtZ+959EgXuwvhw4/jv7tEMcPfpIUSRwuUW59oAyJe8Q6Zqa0w==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.3","dependencies":{"tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"0.3.0-alpha-20240415135346-8a401121d1d86ed46effa28cefadd032c6645413","@whatwg-node/fetch":"0.9.17","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.32.0-alpha-20240415135346-8a401121d1d86ed46effa28cefadd032c6645413_1713189252826_0.377475395578897","host":"s3://npm-registry-packages"}},"0.32.0-alpha-20240415141039-b904bfdd35c6d29520f9e581ca72b71bb3d96646":{"name":"@graphql-hive/client","version":"0.32.0-alpha-20240415141039-b904bfdd35c6d29520f9e581ca72b71bb3d96646","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.32.0-alpha-20240415141039-b904bfdd35c6d29520f9e581ca72b71bb3d96646","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"55ea776ea1292dd77085cc3072968a836e7d2344","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.32.0-alpha-20240415141039-b904bfdd35c6d29520f9e581ca72b71bb3d96646.tgz","fileCount":68,"integrity":"sha512-8pFuaWcIoGgb3qZ+g++3Tp3RHRZUlHP9nCy2iprCCqOqPGH83Zwe7DtifJzfL3zFstSIKqKjvwXUgXkqEUz3ww==","signatures":[{"sig":"MEYCIQCVt2y8QwMx56gWSq/XEBNaMdyDJtSJ+gxe6MjLw/v7vAIhANKmQzAqHDwMMwk2pY4kUA1+fSIU3fHRQq+yA74XEYc4","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":253620},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.32.0-alpha-20240415141039-b904bfdd35c6d29520f9e581ca72b71bb3d96646.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/0c88f0520df830e2edcfa52554ad216b/graphql-hive-client-0.32.0-alpha-20240415141039-b904bfdd35c6d29520f9e581ca72b71bb3d96646.tgz","_integrity":"sha512-8pFuaWcIoGgb3qZ+g++3Tp3RHRZUlHP9nCy2iprCCqOqPGH83Zwe7DtifJzfL3zFstSIKqKjvwXUgXkqEUz3ww==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.3","dependencies":{"tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"0.3.0-alpha-20240415141039-b904bfdd35c6d29520f9e581ca72b71bb3d96646","@whatwg-node/fetch":"0.9.17","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.32.0-alpha-20240415141039-b904bfdd35c6d29520f9e581ca72b71bb3d96646_1713190265380_0.5565413456793276","host":"s3://npm-registry-packages"}},"1.0.0-alpha-20240415144608-54466cf1e3b29f43c6d30a303c9dfcec8697400f":{"name":"@graphql-hive/client","version":"1.0.0-alpha-20240415144608-54466cf1e3b29f43c6d30a303c9dfcec8697400f","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@1.0.0-alpha-20240415144608-54466cf1e3b29f43c6d30a303c9dfcec8697400f","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"c6e71f0771140db59e04771a50be07b0b3d5f49c","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-1.0.0-alpha-20240415144608-54466cf1e3b29f43c6d30a303c9dfcec8697400f.tgz","fileCount":68,"integrity":"sha512-RG7senzQQCTL6jzrPrL9c3oIcx/R4mx8xt1j8hvT7yBceVjouwJSa3EMeagcN0vuTvGAqSP/+AhzQCFk6vVgog==","signatures":[{"sig":"MEUCIGYpa+lncLzq2Uy4M4SFP6poBIi+19LcYDGEHLyNajWDAiEA2OYCLQEJ6il/1WxLnNGF1jcPgiKh/j+D+br5/ddcr44=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":254358},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-1.0.0-alpha-20240415144608-54466cf1e3b29f43c6d30a303c9dfcec8697400f.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### GraphQL Yoga and Cloudflare Workers\n\nIf you're using Cloudflare Workers, you can use the following code:\n\n```typescript\nimport { useYogaHive, createYogaHive, useYogaHive } from '@graphql-hive/client'\nimport { createYoga } from 'graphql-yoga'\n\nconst hive = createYogaHive({\n  enabled: true, // Enable/Disable Hive Client\n  token: 'YOUR-TOKEN',\n  usage: true // Collects schema usage based on operations\n});\n\nconst yoga = createYoga({\n  plugins: [\n    useYogaHive(hive)\n  ]\n})\n\nexport default {\n  async fetch(request, env, ctx) {\n    const response = await yoga.fetch(request, env, ctx);\n    ctx.waitUntil(hive.dispose());\n    return response;\n  }\n}\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n\n// When server is shutting down\nasync function onShutdown() {\n  await hive.close()\n}\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/f0498c130efda9a8d4bc090a7a8e9adb/graphql-hive-client-1.0.0-alpha-20240415144608-54466cf1e3b29f43c6d30a303c9dfcec8697400f.tgz","_integrity":"sha512-RG7senzQQCTL6jzrPrL9c3oIcx/R4mx8xt1j8hvT7yBceVjouwJSa3EMeagcN0vuTvGAqSP/+AhzQCFk6vVgog==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.3","dependencies":{"tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"0.3.0-alpha-20240415144608-54466cf1e3b29f43c6d30a303c9dfcec8697400f","@whatwg-node/fetch":"0.9.17","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_1.0.0-alpha-20240415144608-54466cf1e3b29f43c6d30a303c9dfcec8697400f_1713192395320_0.5309833534250585","host":"s3://npm-registry-packages"}},"0.32.0-alpha-20240415145154-d84f9f9703d1038fbd210c82ecccf03a973bc515":{"name":"@graphql-hive/client","version":"0.32.0-alpha-20240415145154-d84f9f9703d1038fbd210c82ecccf03a973bc515","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.32.0-alpha-20240415145154-d84f9f9703d1038fbd210c82ecccf03a973bc515","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"61403b82cf82439bf66c1e44e2b2f756628afbb3","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.32.0-alpha-20240415145154-d84f9f9703d1038fbd210c82ecccf03a973bc515.tgz","fileCount":68,"integrity":"sha512-CilaFBtefgJMqXrHdspACF1ib8hdevetAIFBbnBGMlKRzwbYXnfl/Vz2t7PcWwMwxMdbvKuMxkQauhpTylncDg==","signatures":[{"sig":"MEUCIFJ37MYkWq59dW//d5EEZ+kLAiw6MJH2ExnId6DNZwbKAiEA+0JQ6WgdEBmmKXk40Ru130SfBigVftPGKD5hej0B9e8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":254363},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.32.0-alpha-20240415145154-d84f9f9703d1038fbd210c82ecccf03a973bc515.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### GraphQL Yoga and Cloudflare Workers\n\nIf you're using Cloudflare Workers, you can use the following code:\n\n```typescript\nimport { useYogaHive, createYogaHive, useYogaHive } from '@graphql-hive/client'\nimport { createYoga } from 'graphql-yoga'\n\nconst hive = createYogaHive({\n  enabled: true, // Enable/Disable Hive Client\n  token: 'YOUR-TOKEN',\n  usage: true // Collects schema usage based on operations\n});\n\nconst yoga = createYoga({\n  plugins: [\n    useYogaHive(hive)\n  ]\n})\n\nexport default {\n  async fetch(request, env, ctx) {\n    const response = await yoga.fetch(request, env, ctx);\n    ctx.waitUntil(hive.dispose());\n    return response;\n  }\n}\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n\n// When server is shutting down\nasync function onShutdown() {\n  await hive.close()\n}\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/112ce42787cdf17d05fd47abbcb4c704/graphql-hive-client-0.32.0-alpha-20240415145154-d84f9f9703d1038fbd210c82ecccf03a973bc515.tgz","_integrity":"sha512-CilaFBtefgJMqXrHdspACF1ib8hdevetAIFBbnBGMlKRzwbYXnfl/Vz2t7PcWwMwxMdbvKuMxkQauhpTylncDg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.3","dependencies":{"tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"0.3.0-alpha-20240415145154-d84f9f9703d1038fbd210c82ecccf03a973bc515","@whatwg-node/fetch":"0.9.17","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.32.0-alpha-20240415145154-d84f9f9703d1038fbd210c82ecccf03a973bc515_1713192741318_0.5549502030740929","host":"s3://npm-registry-packages"}},"0.32.0-alpha-20240416121307-70b0f42ef2860dc96e2bcfa792361ca50d984b88":{"name":"@graphql-hive/client","version":"0.32.0-alpha-20240416121307-70b0f42ef2860dc96e2bcfa792361ca50d984b88","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.32.0-alpha-20240416121307-70b0f42ef2860dc96e2bcfa792361ca50d984b88","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"ba8d50cad7c2a8042dd31ac7d9babc749310505a","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.32.0-alpha-20240416121307-70b0f42ef2860dc96e2bcfa792361ca50d984b88.tgz","fileCount":68,"integrity":"sha512-n/n6PoDndUFgExkhdSkOcvf9HLwtsw+D8zakIbO6Bet4tKwBgYezaBbu8mZxg/6CjkrlQQfXKIBsMyKJdkhTPw==","signatures":[{"sig":"MEYCIQDbdIsW7ZQeS4jkKNTDY1C80yVGeMUIdmWu2IOHZpUzcQIhAJVW+Pahg4GRohXMaDs+Vo9VvcYy1OXy+cG57pSzpOMl","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":254408},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.32.0-alpha-20240416121307-70b0f42ef2860dc96e2bcfa792361ca50d984b88.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### GraphQL Yoga and Cloudflare Workers\n\nIf you're using Cloudflare Workers, you can use the following code:\n\n```typescript\nimport { useYogaHive, createYogaHive, useYogaHive } from '@graphql-hive/client'\nimport { createYoga } from 'graphql-yoga'\n\nexport default {\n  async fetch(request, env, ctx) {\n    const hive = createYogaHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: true // Collects schema usage based on operations\n    });\n    \n    const yoga = createYoga({\n      plugins: [\n        useYogaHive(hive)\n      ]\n    });\n\n    const response = await yoga.fetch(request, env, ctx);\n    ctx.waitUntil(hive.dispose());\n    return response;\n  }\n}\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n\n// When server is shutting down\nasync function onShutdown() {\n  await hive.close()\n}\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/997b919208abfb624032c6811f062d1f/graphql-hive-client-0.32.0-alpha-20240416121307-70b0f42ef2860dc96e2bcfa792361ca50d984b88.tgz","_integrity":"sha512-n/n6PoDndUFgExkhdSkOcvf9HLwtsw+D8zakIbO6Bet4tKwBgYezaBbu8mZxg/6CjkrlQQfXKIBsMyKJdkhTPw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.3","dependencies":{"tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"0.3.0-alpha-20240416121307-70b0f42ef2860dc96e2bcfa792361ca50d984b88","@whatwg-node/fetch":"0.9.17","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.32.0-alpha-20240416121307-70b0f42ef2860dc96e2bcfa792361ca50d984b88_1713269614158_0.19760492436033172","host":"s3://npm-registry-packages"}},"0.32.0-alpha-20240416122350-559037808beeb461ac05345dc7c88bcf19a1aef9":{"name":"@graphql-hive/client","version":"0.32.0-alpha-20240416122350-559037808beeb461ac05345dc7c88bcf19a1aef9","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.32.0-alpha-20240416122350-559037808beeb461ac05345dc7c88bcf19a1aef9","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"d73861152be6d01cc9888d05b4e3f59923f5de0b","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.32.0-alpha-20240416122350-559037808beeb461ac05345dc7c88bcf19a1aef9.tgz","fileCount":68,"integrity":"sha512-QmbATQbBGxcu3vvWRZPddoOzjnP6SF+0JgCSx7z/zmpBQwOkdkP37Pm10fL2VZLYClPCjHlAfF/4Mr3R0ZIwFQ==","signatures":[{"sig":"MEYCIQDL2YbnrpazUmjJK9dKJuWJw4hiBdy7l5j8p+/wDpVP3QIhANObowDBoBrZYlG9rrlS+0Skg0/ycepnfnl1mmXDHID6","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":254408},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.32.0-alpha-20240416122350-559037808beeb461ac05345dc7c88bcf19a1aef9.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### GraphQL Yoga and Cloudflare Workers\n\nIf you're using Cloudflare Workers, you can use the following code:\n\n```typescript\nimport { useYogaHive, createYogaHive, useYogaHive } from '@graphql-hive/client'\nimport { createYoga } from 'graphql-yoga'\n\nexport default {\n  async fetch(request, env, ctx) {\n    const hive = createYogaHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: true // Collects schema usage based on operations\n    });\n    \n    const yoga = createYoga({\n      plugins: [\n        useYogaHive(hive)\n      ]\n    });\n\n    const response = await yoga.fetch(request, env, ctx);\n    ctx.waitUntil(hive.dispose());\n    return response;\n  }\n}\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n\n// When server is shutting down\nasync function onShutdown() {\n  await hive.close()\n}\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/e51da0d2a0db0d0270b58a92f4b53c4f/graphql-hive-client-0.32.0-alpha-20240416122350-559037808beeb461ac05345dc7c88bcf19a1aef9.tgz","_integrity":"sha512-QmbATQbBGxcu3vvWRZPddoOzjnP6SF+0JgCSx7z/zmpBQwOkdkP37Pm10fL2VZLYClPCjHlAfF/4Mr3R0ZIwFQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.3","dependencies":{"tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"0.3.0-alpha-20240416122350-559037808beeb461ac05345dc7c88bcf19a1aef9","@whatwg-node/fetch":"0.9.17","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.32.0-alpha-20240416122350-559037808beeb461ac05345dc7c88bcf19a1aef9_1713270257093_0.6890729480219329","host":"s3://npm-registry-packages"}},"0.32.0-alpha-20240416135849-2aaadeb0e7ba249dfe16adf3837deec47343c27f":{"name":"@graphql-hive/client","version":"0.32.0-alpha-20240416135849-2aaadeb0e7ba249dfe16adf3837deec47343c27f","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.32.0-alpha-20240416135849-2aaadeb0e7ba249dfe16adf3837deec47343c27f","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"1abc91b467603762bf5648c635ff8dbf2d5bfb38","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.32.0-alpha-20240416135849-2aaadeb0e7ba249dfe16adf3837deec47343c27f.tgz","fileCount":68,"integrity":"sha512-i5suuFtQOR6JX2ItqMrhKuxoUfxLFElfdjN3zYvbMGUHQH6IsakAuCvqN6oAMXnlgkAbs6vd//dqBc8pFjDifQ==","signatures":[{"sig":"MEUCIQDnA5BSyMwiEBJc7EHwCfDhq9x7LKzjH+MEnqMo5T29GAIgDNdJAAd6WYbhxsjGpA3qxo0g26yxEQkfFI8405ax07s=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":254404},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.32.0-alpha-20240416135849-2aaadeb0e7ba249dfe16adf3837deec47343c27f.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### GraphQL Yoga and Cloudflare Workers\n\nIf you're using Cloudflare Workers, you can use the following code:\n\n```typescript\nimport { useYogaHive, createYogaHive, useYogaHive } from '@graphql-hive/client'\nimport { createYoga } from 'graphql-yoga'\n\nexport default {\n  async fetch(request, env, ctx) {\n    const hive = createYogaHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: true // Collects schema usage based on operations\n    });\n\n    const yoga = createYoga({\n      plugins: [\n        useYogaHive(hive)\n      ]\n    });\n\n    const response = await yoga.fetch(request, env, ctx);\n    ctx.waitUntil(hive.dispose());\n    return response;\n  }\n}\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n\n// When server is shutting down\nasync function onShutdown() {\n  await hive.close()\n}\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/4e9fde28a97778f9dd7f304b7304b4b6/graphql-hive-client-0.32.0-alpha-20240416135849-2aaadeb0e7ba249dfe16adf3837deec47343c27f.tgz","_integrity":"sha512-i5suuFtQOR6JX2ItqMrhKuxoUfxLFElfdjN3zYvbMGUHQH6IsakAuCvqN6oAMXnlgkAbs6vd//dqBc8pFjDifQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.3","dependencies":{"tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"0.3.0-alpha-20240416135849-2aaadeb0e7ba249dfe16adf3837deec47343c27f","@whatwg-node/fetch":"0.9.17","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.32.0-alpha-20240416135849-2aaadeb0e7ba249dfe16adf3837deec47343c27f_1713275958612_0.29466492114203335","host":"s3://npm-registry-packages"}},"0.32.0-alpha-20240422081851-f4f0bed0d4cc186ad9b9e0f82df0ad46a4d284c4":{"name":"@graphql-hive/client","version":"0.32.0-alpha-20240422081851-f4f0bed0d4cc186ad9b9e0f82df0ad46a4d284c4","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.32.0-alpha-20240422081851-f4f0bed0d4cc186ad9b9e0f82df0ad46a4d284c4","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"cf3c27a8768b22da49c4984a0e1a016d287e7ded","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.32.0-alpha-20240422081851-f4f0bed0d4cc186ad9b9e0f82df0ad46a4d284c4.tgz","fileCount":64,"integrity":"sha512-rd5USBXU3KCoToNOY+rohLAph//SkVg/qyY/fkuCQbvTeEMzKZtbnyjlF7N9IDBYbXshh8oX3LKAW07NAasY0g==","signatures":[{"sig":"MEUCIAL9ctPaqWMXcgy/A1bap8vivsACTGg3coLva3wgx7m+AiEAnZ2aAsvkgsoVzoUFI34iXJM+5uSXtmUMzlBvEMshuJA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":246719},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.32.0-alpha-20240422081851-f4f0bed0d4cc186ad9b9e0f82df0ad46a4d284c4.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/cec39314c1e7e31796c9634cdeec7ff1/graphql-hive-client-0.32.0-alpha-20240422081851-f4f0bed0d4cc186ad9b9e0f82df0ad46a4d284c4.tgz","_integrity":"sha512-rd5USBXU3KCoToNOY+rohLAph//SkVg/qyY/fkuCQbvTeEMzKZtbnyjlF7N9IDBYbXshh8oX3LKAW07NAasY0g==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.3","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.32.0-alpha-20240422081851-f4f0bed0d4cc186ad9b9e0f82df0ad46a4d284c4_1713773959963_0.24199868380715173","host":"s3://npm-registry-packages"}},"0.32.0-alpha-20240422082859-24dd6294840d89be8823232ddea22da5944c30b4":{"name":"@graphql-hive/client","version":"0.32.0-alpha-20240422082859-24dd6294840d89be8823232ddea22da5944c30b4","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.32.0-alpha-20240422082859-24dd6294840d89be8823232ddea22da5944c30b4","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"2312ae860b966d70e4b980c67d0c4a83a94681ff","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.32.0-alpha-20240422082859-24dd6294840d89be8823232ddea22da5944c30b4.tgz","fileCount":64,"integrity":"sha512-rxsLCvqN/S7xL2QeTzFoA6oIiOSH6S1ZIjNw2P+hDZQH3JiTqRfITVZdNIqk/cl6r974njs/9NWqOg0okU65XQ==","signatures":[{"sig":"MEUCIA1pkNmifn5EiNS2yX996LvF8HhA0+5fCN6E8MQKqeBRAiEAtF8wejVnAlaInFOlAkfKVi1EmrafDbj39F2ALd/NwaI=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":246719},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.32.0-alpha-20240422082859-24dd6294840d89be8823232ddea22da5944c30b4.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/b44380675688cc8b34661f9e50405b27/graphql-hive-client-0.32.0-alpha-20240422082859-24dd6294840d89be8823232ddea22da5944c30b4.tgz","_integrity":"sha512-rxsLCvqN/S7xL2QeTzFoA6oIiOSH6S1ZIjNw2P+hDZQH3JiTqRfITVZdNIqk/cl6r974njs/9NWqOg0okU65XQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.3","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.32.0-alpha-20240422082859-24dd6294840d89be8823232ddea22da5944c30b4_1713774566046_0.23229191331067556","host":"s3://npm-registry-packages"}},"0.32.0-alpha-20240422083241-76896dd0be46f9f7e380b2d44beca48d1527b5bf":{"name":"@graphql-hive/client","version":"0.32.0-alpha-20240422083241-76896dd0be46f9f7e380b2d44beca48d1527b5bf","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.32.0-alpha-20240422083241-76896dd0be46f9f7e380b2d44beca48d1527b5bf","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"92629df06555247fdfe0b1f3111d3d422adef9d5","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.32.0-alpha-20240422083241-76896dd0be46f9f7e380b2d44beca48d1527b5bf.tgz","fileCount":64,"integrity":"sha512-03+C3JHqX+LK8htwpC3Io/UF8h1lge8+Q/7peAB5hO/bYuLSYJGiU87YkC4lMCyZ2YbdRWX5Nj/hq1WLylc1SA==","signatures":[{"sig":"MEYCIQDUZ2qjbSEt4Kh+CDiuFRyWE1BeBLILCeZ0bVQSiaCedQIhAPfnxqqu+M5nHzVtqBlyd2S/7FVgiI6hEqaQLJycUZa8","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":246719},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.32.0-alpha-20240422083241-76896dd0be46f9f7e380b2d44beca48d1527b5bf.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/f4ceb79de45ef0082d53de61444321f7/graphql-hive-client-0.32.0-alpha-20240422083241-76896dd0be46f9f7e380b2d44beca48d1527b5bf.tgz","_integrity":"sha512-03+C3JHqX+LK8htwpC3Io/UF8h1lge8+Q/7peAB5hO/bYuLSYJGiU87YkC4lMCyZ2YbdRWX5Nj/hq1WLylc1SA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.3","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.32.0-alpha-20240422083241-76896dd0be46f9f7e380b2d44beca48d1527b5bf_1713774787674_0.40304670589564373","host":"s3://npm-registry-packages"}},"0.32.0-rc-20240422085416-72c76da6346ba6388e2abaecaefff787de081e9a":{"name":"@graphql-hive/client","version":"0.32.0-rc-20240422085416-72c76da6346ba6388e2abaecaefff787de081e9a","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.32.0-rc-20240422085416-72c76da6346ba6388e2abaecaefff787de081e9a","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"ee46678bd137417e8c7a90f403164769fda26e9c","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.32.0-rc-20240422085416-72c76da6346ba6388e2abaecaefff787de081e9a.tgz","fileCount":64,"integrity":"sha512-FfF5oXEAaBODXpETouN+GpsXfpSMW2cFuEd0xlSRfEeLIEzxZWVZDLDIvpy9tFWHaoRLjVRRIJL5GQUfvf5srQ==","signatures":[{"sig":"MEUCIQCFHZJeb0KPaZk71H23XHw41LKVd2dTeBZBEbCQDHpYtQIgFhNRVFpMClwiQ6zFnAG+K9in10zHC0wfvXnLfsbalN0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":246704},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.32.0-rc-20240422085416-72c76da6346ba6388e2abaecaefff787de081e9a.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/d39d585d656a72819045bbad8776939a/graphql-hive-client-0.32.0-rc-20240422085416-72c76da6346ba6388e2abaecaefff787de081e9a.tgz","_integrity":"sha512-FfF5oXEAaBODXpETouN+GpsXfpSMW2cFuEd0xlSRfEeLIEzxZWVZDLDIvpy9tFWHaoRLjVRRIJL5GQUfvf5srQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.3","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.32.0-rc-20240422085416-72c76da6346ba6388e2abaecaefff787de081e9a_1713776082556_0.21251483403533888","host":"s3://npm-registry-packages"}},"0.32.0-alpha-20240422085628-cd88305e6a5d7682c4d16508d99a916c736dff4d":{"name":"@graphql-hive/client","version":"0.32.0-alpha-20240422085628-cd88305e6a5d7682c4d16508d99a916c736dff4d","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.32.0-alpha-20240422085628-cd88305e6a5d7682c4d16508d99a916c736dff4d","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"7bebf79321fc95c94643dc21287998facdf4060a","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.32.0-alpha-20240422085628-cd88305e6a5d7682c4d16508d99a916c736dff4d.tgz","fileCount":64,"integrity":"sha512-hrM21b7h8PTRihcjzbm62RCN6a2RP6TpttqL+2c+ywjMuBkEH9N54VsFa18vtia6bMPTIIq2zezYaBVrVhoGEg==","signatures":[{"sig":"MEQCIEwjETFREQjjRV6R6c3M0vEy3symgLxObq6bKa2gZAyHAiBrWokkhXtNwUkb0zYVjmoJtVB+jblDC2NP3wQwj61wzg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":246719},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.32.0-alpha-20240422085628-cd88305e6a5d7682c4d16508d99a916c736dff4d.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/c62274c821227624b9159cd5435a613e/graphql-hive-client-0.32.0-alpha-20240422085628-cd88305e6a5d7682c4d16508d99a916c736dff4d.tgz","_integrity":"sha512-hrM21b7h8PTRihcjzbm62RCN6a2RP6TpttqL+2c+ywjMuBkEH9N54VsFa18vtia6bMPTIIq2zezYaBVrVhoGEg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.3","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.32.0-alpha-20240422085628-cd88305e6a5d7682c4d16508d99a916c736dff4d_1713776223781_0.16688672073673905","host":"s3://npm-registry-packages"}},"0.32.0":{"name":"@graphql-hive/client","version":"0.32.0","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.32.0","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"c4e9002a6cb413074b5f40320921110cf7c6a1d6","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.32.0.tgz","fileCount":64,"integrity":"sha512-5kWLdXJeH1Ehzt435P61rISrWd+q6RfaoGD+4sCStjZOtln+BNQ0SD9MW4VMZ1yuEfajdebqlgVFI7s5hoiJXg==","signatures":[{"sig":"MEYCIQCmrpRJSQ7Awldt0WLBEcDgSRph2t7aqGjJJn6TKF/ytwIhAJ+zKg+GiLog2ryv80lDGxFiQnhzBMred0iWMkOyF8fr","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":246409},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.32.0.tgz","module":"esm/index.js","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/32360a89eadf1c9bfaa0b5fbe0b32f97/graphql-hive-client-0.32.0.tgz","_integrity":"sha512-5kWLdXJeH1Ehzt435P61rISrWd+q6RfaoGD+4sCStjZOtln+BNQ0SD9MW4VMZ1yuEfajdebqlgVFI7s5hoiJXg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.3","dependencies":{"axios":"^1.6.0","tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"^0.2.4","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.32.0_1713779064976_0.20691480575053678","host":"s3://npm-registry-packages"}},"0.33.0-alpha-20240422164316-388f2e4972b0dbc71392d40a78f773e547bf8531":{"name":"@graphql-hive/client","version":"0.33.0-alpha-20240422164316-388f2e4972b0dbc71392d40a78f773e547bf8531","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.33.0-alpha-20240422164316-388f2e4972b0dbc71392d40a78f773e547bf8531","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"a2a6cfa7cd6abadcb0f69625c9ad96005d6761fb","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.33.0-alpha-20240422164316-388f2e4972b0dbc71392d40a78f773e547bf8531.tgz","fileCount":68,"integrity":"sha512-+wIM9jW2aX+68bTAgkhh0hURr4VomSID+0fQUePCpNeyN+SCe7bnt92ZVLNcTFRpYnUTnHW2mrzFfdmrod3rRQ==","signatures":[{"sig":"MEUCIFO3umpUVTdCF6s7/leHtVYm074axseNoIAvXW3qJL/zAiEA7abN0xZ+PVwfy0b6xob00FONqmQFA0lM2sPiZCi35uE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":256957},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.33.0-alpha-20240422164316-388f2e4972b0dbc71392d40a78f773e547bf8531.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### GraphQL Yoga and Cloudflare Workers\n\nIf you're using Cloudflare Workers, you can use the following code:\n\n```typescript\nimport { useYogaHive, createYogaHive, useYogaHive } from '@graphql-hive/client'\nimport { createYoga } from 'graphql-yoga'\n\nexport default {\n  async fetch(request, env, ctx) {\n    const hive = createYogaHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: true // Collects schema usage based on operations\n    });\n\n    const yoga = createYoga({\n      plugins: [\n        useYogaHive(hive)\n      ]\n    });\n\n    const response = await yoga.fetch(request, env, ctx);\n    ctx.waitUntil(hive.dispose());\n    return response;\n  }\n}\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n\n// When server is shutting down\nasync function onShutdown() {\n  await hive.close()\n}\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/243e5ec5d08957e24cc2690da125708e/graphql-hive-client-0.33.0-alpha-20240422164316-388f2e4972b0dbc71392d40a78f773e547bf8531.tgz","_integrity":"sha512-+wIM9jW2aX+68bTAgkhh0hURr4VomSID+0fQUePCpNeyN+SCe7bnt92ZVLNcTFRpYnUTnHW2mrzFfdmrod3rRQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.3","dependencies":{"tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"0.3.0-alpha-20240422164316-388f2e4972b0dbc71392d40a78f773e547bf8531","@whatwg-node/fetch":"0.9.17","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.33.0-alpha-20240422164316-388f2e4972b0dbc71392d40a78f773e547bf8531_1713804224817_0.0957146653618095","host":"s3://npm-registry-packages"}},"0.33.0-alpha-20240422165351-f7c1428dd55e14ad5f1d43c7ae705dacde6965b7":{"name":"@graphql-hive/client","version":"0.33.0-alpha-20240422165351-f7c1428dd55e14ad5f1d43c7ae705dacde6965b7","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.33.0-alpha-20240422165351-f7c1428dd55e14ad5f1d43c7ae705dacde6965b7","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"b7479b467c436501b1e4777a9048b691f52a455e","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.33.0-alpha-20240422165351-f7c1428dd55e14ad5f1d43c7ae705dacde6965b7.tgz","fileCount":68,"integrity":"sha512-VSSM+5CsY/WVLfONG6RKOjuhJZ6coNhFFad2aytRdz4Ml9pB+eLtrJut89tRMbou6scW0qy8tOyYjRAgeQY2zg==","signatures":[{"sig":"MEUCICtIpi1zsgbPx6svO3g/2bQ8/7FtWzQ8a5MfzX8koIgwAiEApa0nCApFtGgRhh1ux4XzT89rEBYoITcn0M4glWzzzCs=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":256957},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.33.0-alpha-20240422165351-f7c1428dd55e14ad5f1d43c7ae705dacde6965b7.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### GraphQL Yoga and Cloudflare Workers\n\nIf you're using Cloudflare Workers, you can use the following code:\n\n```typescript\nimport { useYogaHive, createYogaHive, useYogaHive } from '@graphql-hive/client'\nimport { createYoga } from 'graphql-yoga'\n\nexport default {\n  async fetch(request, env, ctx) {\n    const hive = createYogaHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: true // Collects schema usage based on operations\n    });\n\n    const yoga = createYoga({\n      plugins: [\n        useYogaHive(hive)\n      ]\n    });\n\n    const response = await yoga.fetch(request, env, ctx);\n    ctx.waitUntil(hive.dispose());\n    return response;\n  }\n}\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n\n// When server is shutting down\nasync function onShutdown() {\n  await hive.close()\n}\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/a89901c04c855b790f35068a16f409a6/graphql-hive-client-0.33.0-alpha-20240422165351-f7c1428dd55e14ad5f1d43c7ae705dacde6965b7.tgz","_integrity":"sha512-VSSM+5CsY/WVLfONG6RKOjuhJZ6coNhFFad2aytRdz4Ml9pB+eLtrJut89tRMbou6scW0qy8tOyYjRAgeQY2zg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.3","dependencies":{"tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"0.3.0-alpha-20240422165351-f7c1428dd55e14ad5f1d43c7ae705dacde6965b7","@whatwg-node/fetch":"0.9.17","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.33.0-alpha-20240422165351-f7c1428dd55e14ad5f1d43c7ae705dacde6965b7_1713804860620_0.4269559572745234","host":"s3://npm-registry-packages"}},"0.33.0-alpha-20240422173604-273c5842957ce9c9b8a0961b53f7ffc16bafed10":{"name":"@graphql-hive/client","version":"0.33.0-alpha-20240422173604-273c5842957ce9c9b8a0961b53f7ffc16bafed10","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.33.0-alpha-20240422173604-273c5842957ce9c9b8a0961b53f7ffc16bafed10","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"ebd441def8655da9d4a575fb0a3e39018998ec8f","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.33.0-alpha-20240422173604-273c5842957ce9c9b8a0961b53f7ffc16bafed10.tgz","fileCount":68,"integrity":"sha512-VzC3tO4MbGsuffsh5CNI2BUQx/Dlz9fshfAWZoJL9gxT1ai9mEwAkUkYH1lxjY6f5hAgTCfKphTgdAW2w5WslA==","signatures":[{"sig":"MEUCIQCoH4Dd8PIextqE0B8JQ1xIIFf6flNeYz0FmCL731QFEQIgIZwDqJHHCqiWuaPWltbItUbVdI+lIoSkv/EQPO5yWJA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":256957},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.33.0-alpha-20240422173604-273c5842957ce9c9b8a0961b53f7ffc16bafed10.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### GraphQL Yoga and Cloudflare Workers\n\nIf you're using Cloudflare Workers, you can use the following code:\n\n```typescript\nimport { useYogaHive, createYogaHive, useYogaHive } from '@graphql-hive/client'\nimport { createYoga } from 'graphql-yoga'\n\nexport default {\n  async fetch(request, env, ctx) {\n    const hive = createYogaHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: true // Collects schema usage based on operations\n    });\n\n    const yoga = createYoga({\n      plugins: [\n        useYogaHive(hive)\n      ]\n    });\n\n    const response = await yoga.fetch(request, env, ctx);\n    ctx.waitUntil(hive.dispose());\n    return response;\n  }\n}\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n\n// When server is shutting down\nasync function onShutdown() {\n  await hive.close()\n}\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/943f68940e8b20ddfd14ef5cc6e115e4/graphql-hive-client-0.33.0-alpha-20240422173604-273c5842957ce9c9b8a0961b53f7ffc16bafed10.tgz","_integrity":"sha512-VzC3tO4MbGsuffsh5CNI2BUQx/Dlz9fshfAWZoJL9gxT1ai9mEwAkUkYH1lxjY6f5hAgTCfKphTgdAW2w5WslA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.3","dependencies":{"tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"0.3.0-alpha-20240422173604-273c5842957ce9c9b8a0961b53f7ffc16bafed10","@whatwg-node/fetch":"0.9.17","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.33.0-alpha-20240422173604-273c5842957ce9c9b8a0961b53f7ffc16bafed10_1713807390513_0.18025458461927735","host":"s3://npm-registry-packages"}},"0.33.0-alpha-20240422174126-64893cd4195b4007cb2a2fe6fa00bcdf2e4adb70":{"name":"@graphql-hive/client","version":"0.33.0-alpha-20240422174126-64893cd4195b4007cb2a2fe6fa00bcdf2e4adb70","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.33.0-alpha-20240422174126-64893cd4195b4007cb2a2fe6fa00bcdf2e4adb70","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"cf589543a6246b16465c4b04ae3812dfe9a56548","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.33.0-alpha-20240422174126-64893cd4195b4007cb2a2fe6fa00bcdf2e4adb70.tgz","fileCount":68,"integrity":"sha512-BC/Og9JZCG8MsYatNVVdfttKuHCBjyNfyxplUvkobOUk0VaEyTCJytzFVPd2qp1eAwA6llCjnRMnJjL3QN8AVg==","signatures":[{"sig":"MEQCIEuWvocuFQqsC478EJRHuN2Sf6r59O+Nq1Kj3xpTLSF2AiA/5QiygBszVu7T/RNW/S1quZiLE1ew8uVsgL7IE8rVvg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":256957},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.33.0-alpha-20240422174126-64893cd4195b4007cb2a2fe6fa00bcdf2e4adb70.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### GraphQL Yoga and Cloudflare Workers\n\nIf you're using Cloudflare Workers, you can use the following code:\n\n```typescript\nimport { useYogaHive, createYogaHive, useYogaHive } from '@graphql-hive/client'\nimport { createYoga } from 'graphql-yoga'\n\nexport default {\n  async fetch(request, env, ctx) {\n    const hive = createYogaHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: true // Collects schema usage based on operations\n    });\n\n    const yoga = createYoga({\n      plugins: [\n        useYogaHive(hive)\n      ]\n    });\n\n    const response = await yoga.fetch(request, env, ctx);\n    ctx.waitUntil(hive.dispose());\n    return response;\n  }\n}\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n\n// When server is shutting down\nasync function onShutdown() {\n  await hive.close()\n}\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/32fe1c0b6948128dd008e7eebee9f45f/graphql-hive-client-0.33.0-alpha-20240422174126-64893cd4195b4007cb2a2fe6fa00bcdf2e4adb70.tgz","_integrity":"sha512-BC/Og9JZCG8MsYatNVVdfttKuHCBjyNfyxplUvkobOUk0VaEyTCJytzFVPd2qp1eAwA6llCjnRMnJjL3QN8AVg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.3","dependencies":{"tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"0.3.0-alpha-20240422174126-64893cd4195b4007cb2a2fe6fa00bcdf2e4adb70","@whatwg-node/fetch":"0.9.17","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.33.0-alpha-20240422174126-64893cd4195b4007cb2a2fe6fa00bcdf2e4adb70_1713807712034_0.5543541763831694","host":"s3://npm-registry-packages"}},"0.33.0-alpha-20240422174622-84f289174f9e231d7ac2bed1f3d4b464ea977d64":{"name":"@graphql-hive/client","version":"0.33.0-alpha-20240422174622-84f289174f9e231d7ac2bed1f3d4b464ea977d64","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.33.0-alpha-20240422174622-84f289174f9e231d7ac2bed1f3d4b464ea977d64","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"f53776ec49ca6fc76ed31f4bdd4f99bcd8b809d1","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.33.0-alpha-20240422174622-84f289174f9e231d7ac2bed1f3d4b464ea977d64.tgz","fileCount":68,"integrity":"sha512-6jpye5gVIT66nwEBqTjdZTOi03TWJiizion8Rp+rg4u66uE49C8t5NkS0/YAqjKjjWySzVG//FZtXdWp5SAcfQ==","signatures":[{"sig":"MEUCIBykAdbggdxOLBDKpGrksU9+MDrXGUkwumthFmJVMFnsAiEAgRe3jnAPXuyK4Q/RvHiIbzJygJHW6F8b42aupobBbzE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":256957},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.33.0-alpha-20240422174622-84f289174f9e231d7ac2bed1f3d4b464ea977d64.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### GraphQL Yoga and Cloudflare Workers\n\nIf you're using Cloudflare Workers, you can use the following code:\n\n```typescript\nimport { useYogaHive, createYogaHive, useYogaHive } from '@graphql-hive/client'\nimport { createYoga } from 'graphql-yoga'\n\nexport default {\n  async fetch(request, env, ctx) {\n    const hive = createYogaHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: true // Collects schema usage based on operations\n    });\n\n    const yoga = createYoga({\n      plugins: [\n        useYogaHive(hive)\n      ]\n    });\n\n    const response = await yoga.fetch(request, env, ctx);\n    ctx.waitUntil(hive.dispose());\n    return response;\n  }\n}\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n\n// When server is shutting down\nasync function onShutdown() {\n  await hive.close()\n}\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/08e47adab75aad11d1dde901ee3fca70/graphql-hive-client-0.33.0-alpha-20240422174622-84f289174f9e231d7ac2bed1f3d4b464ea977d64.tgz","_integrity":"sha512-6jpye5gVIT66nwEBqTjdZTOi03TWJiizion8Rp+rg4u66uE49C8t5NkS0/YAqjKjjWySzVG//FZtXdWp5SAcfQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.3","dependencies":{"tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"0.3.0-alpha-20240422174622-84f289174f9e231d7ac2bed1f3d4b464ea977d64","@whatwg-node/fetch":"0.9.17","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.33.0-alpha-20240422174622-84f289174f9e231d7ac2bed1f3d4b464ea977d64_1713808008479_0.48148846790322186","host":"s3://npm-registry-packages"}},"0.33.0-rc-20240423115227-c7141644bf64f985959bd99dadf65f9d792454b7":{"name":"@graphql-hive/client","version":"0.33.0-rc-20240423115227-c7141644bf64f985959bd99dadf65f9d792454b7","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.33.0-rc-20240423115227-c7141644bf64f985959bd99dadf65f9d792454b7","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"efa58bfeecc55d73c6b64a84fb6bdbdad77b3b00","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.33.0-rc-20240423115227-c7141644bf64f985959bd99dadf65f9d792454b7.tgz","fileCount":68,"integrity":"sha512-NAWN85ZpodoHVNO+FhtxLB1QKj/R1q/KTLjAo/BxoOkGp6TZDeZ8nUhYj5+gOiCdIq9P9rksjBcyVfP64gVVAg==","signatures":[{"sig":"MEYCIQCU3Ou7p4iAUmpTrOJfOzgjgwJldXNlrTJRYFwMEPMBYwIhAKU5KB2+Hn1kNE58/vzM59eRRyfU8/CIzU1fL1g543vp","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":256939},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.33.0-rc-20240423115227-c7141644bf64f985959bd99dadf65f9d792454b7.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### GraphQL Yoga and Cloudflare Workers\n\nIf you're using Cloudflare Workers, you can use the following code:\n\n```typescript\nimport { useYogaHive, createYogaHive, useYogaHive } from '@graphql-hive/client'\nimport { createYoga } from 'graphql-yoga'\n\nexport default {\n  async fetch(request, env, ctx) {\n    const hive = createYogaHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: true // Collects schema usage based on operations\n    });\n\n    const yoga = createYoga({\n      plugins: [\n        useYogaHive(hive)\n      ]\n    });\n\n    const response = await yoga.fetch(request, env, ctx);\n    ctx.waitUntil(hive.dispose());\n    return response;\n  }\n}\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n\n// When server is shutting down\nasync function onShutdown() {\n  await hive.close()\n}\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/bd5b64d32677ae0783621477eb9c215c/graphql-hive-client-0.33.0-rc-20240423115227-c7141644bf64f985959bd99dadf65f9d792454b7.tgz","_integrity":"sha512-NAWN85ZpodoHVNO+FhtxLB1QKj/R1q/KTLjAo/BxoOkGp6TZDeZ8nUhYj5+gOiCdIq9P9rksjBcyVfP64gVVAg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.3","dependencies":{"tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"0.3.0-rc-20240423115227-c7141644bf64f985959bd99dadf65f9d792454b7","@whatwg-node/fetch":"0.9.17","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.33.0-rc-20240423115227-c7141644bf64f985959bd99dadf65f9d792454b7_1713873175029_0.8503215137300968","host":"s3://npm-registry-packages"}},"0.33.0-alpha-20240423115306-b6ec790fd8583575b65cd3d411a546454fa43975":{"name":"@graphql-hive/client","version":"0.33.0-alpha-20240423115306-b6ec790fd8583575b65cd3d411a546454fa43975","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.33.0-alpha-20240423115306-b6ec790fd8583575b65cd3d411a546454fa43975","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"7adb8368b1c51718c66dda1870288e8c060039c2","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.33.0-alpha-20240423115306-b6ec790fd8583575b65cd3d411a546454fa43975.tgz","fileCount":68,"integrity":"sha512-3SqsLYOCc566IIbjlzdOQ5udO2ASYUroKk8gF12tQc4g4aT3tzYDF3JQ/0efs3sDQhEOmsgoLxB6FeFjAZ2nRg==","signatures":[{"sig":"MEUCIDhaXaVSBGqwDQx/1R3LfrdkUi9FYxRtblMXwV1jAWb8AiEAuJU5cKHN4QuHhuttPXviU2LZNyUJAGTiS68J/lTBwkA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":256957},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.33.0-alpha-20240423115306-b6ec790fd8583575b65cd3d411a546454fa43975.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### GraphQL Yoga and Cloudflare Workers\n\nIf you're using Cloudflare Workers, you can use the following code:\n\n```typescript\nimport { useYogaHive, createYogaHive, useYogaHive } from '@graphql-hive/client'\nimport { createYoga } from 'graphql-yoga'\n\nexport default {\n  async fetch(request, env, ctx) {\n    const hive = createYogaHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: true // Collects schema usage based on operations\n    });\n\n    const yoga = createYoga({\n      plugins: [\n        useYogaHive(hive)\n      ]\n    });\n\n    const response = await yoga.fetch(request, env, ctx);\n    ctx.waitUntil(hive.dispose());\n    return response;\n  }\n}\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n\n// When server is shutting down\nasync function onShutdown() {\n  await hive.close()\n}\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/234840dbdc56fceca21ca6b59eb8e04c/graphql-hive-client-0.33.0-alpha-20240423115306-b6ec790fd8583575b65cd3d411a546454fa43975.tgz","_integrity":"sha512-3SqsLYOCc566IIbjlzdOQ5udO2ASYUroKk8gF12tQc4g4aT3tzYDF3JQ/0efs3sDQhEOmsgoLxB6FeFjAZ2nRg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.3","dependencies":{"tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"0.3.0-alpha-20240423115306-b6ec790fd8583575b65cd3d411a546454fa43975","@whatwg-node/fetch":"0.9.17","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.33.0-alpha-20240423115306-b6ec790fd8583575b65cd3d411a546454fa43975_1713873210881_0.1149555551061352","host":"s3://npm-registry-packages"}},"0.33.0-alpha-20240423115345-b3a6b0292ffd8768ee80f01bd2955c57dfceb265":{"name":"@graphql-hive/client","version":"0.33.0-alpha-20240423115345-b3a6b0292ffd8768ee80f01bd2955c57dfceb265","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.33.0-alpha-20240423115345-b3a6b0292ffd8768ee80f01bd2955c57dfceb265","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"75b2d8472e241af9f7c274ea733cfa3e1e3d568d","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.33.0-alpha-20240423115345-b3a6b0292ffd8768ee80f01bd2955c57dfceb265.tgz","fileCount":68,"integrity":"sha512-cFfR+adVSbs7W2zMcOFdOOjYRssVtg1bOM6TiL4ERsvKW24ayXTY7xrXN84XGbGImyrv/0ehlhBUFXIK4Zdgww==","signatures":[{"sig":"MEUCIQChJB9WileP2C/6YH4rnDyClnqP2k323aQsfwBz9Mh7dQIgcPVw0kZ9z/9AWcO8gy4xy3PfyIw2NhcvmeJYNi1bl5Y=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":256957},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.33.0-alpha-20240423115345-b3a6b0292ffd8768ee80f01bd2955c57dfceb265.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### GraphQL Yoga and Cloudflare Workers\n\nIf you're using Cloudflare Workers, you can use the following code:\n\n```typescript\nimport { useYogaHive, createYogaHive, useYogaHive } from '@graphql-hive/client'\nimport { createYoga } from 'graphql-yoga'\n\nexport default {\n  async fetch(request, env, ctx) {\n    const hive = createYogaHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: true // Collects schema usage based on operations\n    });\n\n    const yoga = createYoga({\n      plugins: [\n        useYogaHive(hive)\n      ]\n    });\n\n    const response = await yoga.fetch(request, env, ctx);\n    ctx.waitUntil(hive.dispose());\n    return response;\n  }\n}\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n\n// When server is shutting down\nasync function onShutdown() {\n  await hive.close()\n}\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/d681c10ac7d614a5e21be8e91c3efba8/graphql-hive-client-0.33.0-alpha-20240423115345-b3a6b0292ffd8768ee80f01bd2955c57dfceb265.tgz","_integrity":"sha512-cFfR+adVSbs7W2zMcOFdOOjYRssVtg1bOM6TiL4ERsvKW24ayXTY7xrXN84XGbGImyrv/0ehlhBUFXIK4Zdgww==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.3","dependencies":{"tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"0.3.0-alpha-20240423115345-b3a6b0292ffd8768ee80f01bd2955c57dfceb265","@whatwg-node/fetch":"0.9.17","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.33.0-alpha-20240423115345-b3a6b0292ffd8768ee80f01bd2955c57dfceb265_1713873250892_0.628849450981446","host":"s3://npm-registry-packages"}},"0.33.0-alpha-20240423115452-659acd3c62b9faa1faf1a02d3461292cdd889e1c":{"name":"@graphql-hive/client","version":"0.33.0-alpha-20240423115452-659acd3c62b9faa1faf1a02d3461292cdd889e1c","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.33.0-alpha-20240423115452-659acd3c62b9faa1faf1a02d3461292cdd889e1c","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"b344a97a8898276683f809ed1e2a2de286756b0c","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.33.0-alpha-20240423115452-659acd3c62b9faa1faf1a02d3461292cdd889e1c.tgz","fileCount":68,"integrity":"sha512-9eCgRu4Ceg3JviVLbPPhpXr139osSGZa9HbauPEllWOQ8VNVCO1UupJS/QdWYyQMSNjMQ0xQZPzlap6YZVOiCQ==","signatures":[{"sig":"MEUCIQCf6F27Ee11m0l7h+y6ieESVYCmfsiCkbV/BH0oCIqLUwIgaKi40fdQQUSAgWPvS/19vztDHEEPBVLCfLLUDvQTub8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":256957},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.33.0-alpha-20240423115452-659acd3c62b9faa1faf1a02d3461292cdd889e1c.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### GraphQL Yoga and Cloudflare Workers\n\nIf you're using Cloudflare Workers, you can use the following code:\n\n```typescript\nimport { useYogaHive, createYogaHive, useYogaHive } from '@graphql-hive/client'\nimport { createYoga } from 'graphql-yoga'\n\nexport default {\n  async fetch(request, env, ctx) {\n    const hive = createYogaHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: true // Collects schema usage based on operations\n    });\n\n    const yoga = createYoga({\n      plugins: [\n        useYogaHive(hive)\n      ]\n    });\n\n    const response = await yoga.fetch(request, env, ctx);\n    ctx.waitUntil(hive.dispose());\n    return response;\n  }\n}\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n\n// When server is shutting down\nasync function onShutdown() {\n  await hive.close()\n}\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/34d3138b24eaa813cfe498e58ea741e4/graphql-hive-client-0.33.0-alpha-20240423115452-659acd3c62b9faa1faf1a02d3461292cdd889e1c.tgz","_integrity":"sha512-9eCgRu4Ceg3JviVLbPPhpXr139osSGZa9HbauPEllWOQ8VNVCO1UupJS/QdWYyQMSNjMQ0xQZPzlap6YZVOiCQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.3","dependencies":{"tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"0.3.0-alpha-20240423115452-659acd3c62b9faa1faf1a02d3461292cdd889e1c","@whatwg-node/fetch":"0.9.17","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.33.0-alpha-20240423115452-659acd3c62b9faa1faf1a02d3461292cdd889e1c_1713873317767_0.07583414863610494","host":"s3://npm-registry-packages"}},"0.33.0-alpha-20240423115544-f46fe1be613cf2d15d58bd687a6dcb0e02d88814":{"name":"@graphql-hive/client","version":"0.33.0-alpha-20240423115544-f46fe1be613cf2d15d58bd687a6dcb0e02d88814","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.33.0-alpha-20240423115544-f46fe1be613cf2d15d58bd687a6dcb0e02d88814","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"fc20852ce2a9268f9e3cfe0fc5193d221d22198a","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.33.0-alpha-20240423115544-f46fe1be613cf2d15d58bd687a6dcb0e02d88814.tgz","fileCount":68,"integrity":"sha512-+/DacRsiJkJQPFj93MdbXPjPxc3olvSkkF3XC0kvxkS8OOwGYRB6Sqc7xuW8xwXY5+2RHydVnlFaagJ256zuqA==","signatures":[{"sig":"MEUCIQDGFt6lzDn+HQPA28lrSLMoECqzUsSAtYMfNX0KjKgUVgIgChkrvQBjPYMqGTRvpTYXhX6OjDUlDJF9nw1JTmCG75o=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":256957},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.33.0-alpha-20240423115544-f46fe1be613cf2d15d58bd687a6dcb0e02d88814.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### GraphQL Yoga and Cloudflare Workers\n\nIf you're using Cloudflare Workers, you can use the following code:\n\n```typescript\nimport { useYogaHive, createYogaHive, useYogaHive } from '@graphql-hive/client'\nimport { createYoga } from 'graphql-yoga'\n\nexport default {\n  async fetch(request, env, ctx) {\n    const hive = createYogaHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: true // Collects schema usage based on operations\n    });\n\n    const yoga = createYoga({\n      plugins: [\n        useYogaHive(hive)\n      ]\n    });\n\n    const response = await yoga.fetch(request, env, ctx);\n    ctx.waitUntil(hive.dispose());\n    return response;\n  }\n}\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n\n// When server is shutting down\nasync function onShutdown() {\n  await hive.close()\n}\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/47af76b6c2f67e9fa41f89a685cefe4e/graphql-hive-client-0.33.0-alpha-20240423115544-f46fe1be613cf2d15d58bd687a6dcb0e02d88814.tgz","_integrity":"sha512-+/DacRsiJkJQPFj93MdbXPjPxc3olvSkkF3XC0kvxkS8OOwGYRB6Sqc7xuW8xwXY5+2RHydVnlFaagJ256zuqA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.3","dependencies":{"tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"0.3.0-alpha-20240423115544-f46fe1be613cf2d15d58bd687a6dcb0e02d88814","@whatwg-node/fetch":"0.9.17","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.33.0-alpha-20240423115544-f46fe1be613cf2d15d58bd687a6dcb0e02d88814_1713873374855_0.7209705955294499","host":"s3://npm-registry-packages"}},"0.33.0-alpha-20240423115633-e72070e6d643759e7255b90038d5f0fdc3cedd35":{"name":"@graphql-hive/client","version":"0.33.0-alpha-20240423115633-e72070e6d643759e7255b90038d5f0fdc3cedd35","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.33.0-alpha-20240423115633-e72070e6d643759e7255b90038d5f0fdc3cedd35","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"2bac983adda49af9842b94ebab55cec99efedf35","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.33.0-alpha-20240423115633-e72070e6d643759e7255b90038d5f0fdc3cedd35.tgz","fileCount":68,"integrity":"sha512-+/3HMiVOJyqBxXlC+onqiBGCc0BJ7D7uFOZxF2xoLa1ifnPlC19lFXqwEnOhECSQKmj1fUUPRVch6g78vvZchQ==","signatures":[{"sig":"MEYCIQCWCmEnXdv5owTuBV4T+22oYaAFznA7RaH0E59F2y8jGQIhANNEACFrA4ta3v4E0klghXoSfjKgKTVjz62dPa2DwB5T","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":256957},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.33.0-alpha-20240423115633-e72070e6d643759e7255b90038d5f0fdc3cedd35.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### GraphQL Yoga and Cloudflare Workers\n\nIf you're using Cloudflare Workers, you can use the following code:\n\n```typescript\nimport { useYogaHive, createYogaHive, useYogaHive } from '@graphql-hive/client'\nimport { createYoga } from 'graphql-yoga'\n\nexport default {\n  async fetch(request, env, ctx) {\n    const hive = createYogaHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: true // Collects schema usage based on operations\n    });\n\n    const yoga = createYoga({\n      plugins: [\n        useYogaHive(hive)\n      ]\n    });\n\n    const response = await yoga.fetch(request, env, ctx);\n    ctx.waitUntil(hive.dispose());\n    return response;\n  }\n}\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n\n// When server is shutting down\nasync function onShutdown() {\n  await hive.close()\n}\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/9dce3971e5efc7f79718e6f8d333e6a0/graphql-hive-client-0.33.0-alpha-20240423115633-e72070e6d643759e7255b90038d5f0fdc3cedd35.tgz","_integrity":"sha512-+/3HMiVOJyqBxXlC+onqiBGCc0BJ7D7uFOZxF2xoLa1ifnPlC19lFXqwEnOhECSQKmj1fUUPRVch6g78vvZchQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.3","dependencies":{"tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"0.3.0-alpha-20240423115633-e72070e6d643759e7255b90038d5f0fdc3cedd35","@whatwg-node/fetch":"0.9.17","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.33.0-alpha-20240423115633-e72070e6d643759e7255b90038d5f0fdc3cedd35_1713873418524_0.8501505819481405","host":"s3://npm-registry-packages"}},"0.33.0-alpha-20240423121314-7463b10ca578e2e19c747f90bc10426f2bc3277a":{"name":"@graphql-hive/client","version":"0.33.0-alpha-20240423121314-7463b10ca578e2e19c747f90bc10426f2bc3277a","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.33.0-alpha-20240423121314-7463b10ca578e2e19c747f90bc10426f2bc3277a","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"50a369797c6df94710da67fcba84d565cec96a24","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.33.0-alpha-20240423121314-7463b10ca578e2e19c747f90bc10426f2bc3277a.tgz","fileCount":68,"integrity":"sha512-EU95laFXIX8F16fbqquVyjHWycPCVHdnTyiHcpmJxj+WoWcSt4EbWAqpVDfXzOaYljyeYvYWVgpcDPlAynUHmA==","signatures":[{"sig":"MEQCICQ3Q0h3uszzzfsy6WlM8KU3Q0tEbjbq8rLEbHyjWXunAiBksfCZHPZH8Bry5MBqLUkQkuW1+GsjD90qJJx5ErW1ew==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":256957},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.33.0-alpha-20240423121314-7463b10ca578e2e19c747f90bc10426f2bc3277a.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### GraphQL Yoga and Cloudflare Workers\n\nIf you're using Cloudflare Workers, you can use the following code:\n\n```typescript\nimport { useYogaHive, createYogaHive, useYogaHive } from '@graphql-hive/client'\nimport { createYoga } from 'graphql-yoga'\n\nexport default {\n  async fetch(request, env, ctx) {\n    const hive = createYogaHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: true // Collects schema usage based on operations\n    });\n\n    const yoga = createYoga({\n      plugins: [\n        useYogaHive(hive)\n      ]\n    });\n\n    const response = await yoga.fetch(request, env, ctx);\n    ctx.waitUntil(hive.dispose());\n    return response;\n  }\n}\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n\n// When server is shutting down\nasync function onShutdown() {\n  await hive.close()\n}\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/3fc7de9f773b80c5422af32111c40d70/graphql-hive-client-0.33.0-alpha-20240423121314-7463b10ca578e2e19c747f90bc10426f2bc3277a.tgz","_integrity":"sha512-EU95laFXIX8F16fbqquVyjHWycPCVHdnTyiHcpmJxj+WoWcSt4EbWAqpVDfXzOaYljyeYvYWVgpcDPlAynUHmA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.3","dependencies":{"tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"0.3.0-alpha-20240423121314-7463b10ca578e2e19c747f90bc10426f2bc3277a","@whatwg-node/fetch":"0.9.17","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.33.0-alpha-20240423121314-7463b10ca578e2e19c747f90bc10426f2bc3277a_1713874420940_0.1453897023981947","host":"s3://npm-registry-packages"}},"0.33.0-alpha-20240423121513-6c9e077a33a8575f2c53f4d7411eb100d453e01e":{"name":"@graphql-hive/client","version":"0.33.0-alpha-20240423121513-6c9e077a33a8575f2c53f4d7411eb100d453e01e","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.33.0-alpha-20240423121513-6c9e077a33a8575f2c53f4d7411eb100d453e01e","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"7f7a3ebead782d1eedea6cec767e96e7166d2b87","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.33.0-alpha-20240423121513-6c9e077a33a8575f2c53f4d7411eb100d453e01e.tgz","fileCount":68,"integrity":"sha512-x6gwLDfpd3Ic2NGNO1jPWBmyOiHA7BqJdFL8Nc0kAU2NjP4rKILYBHBYxRuDvTNuA8aw3K3WlLJoDpqbzVcpUA==","signatures":[{"sig":"MEUCIHimJF8Gx1QqjMD4JzRPu72DBWrY95aoUKQX+zJOSpVfAiEAuD86hGLX8L4kypZD8ZlIWzJuM/J2bEmpGUE1gVix6Jw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":256957},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.33.0-alpha-20240423121513-6c9e077a33a8575f2c53f4d7411eb100d453e01e.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### GraphQL Yoga and Cloudflare Workers\n\nIf you're using Cloudflare Workers, you can use the following code:\n\n```typescript\nimport { useYogaHive, createYogaHive, useYogaHive } from '@graphql-hive/client'\nimport { createYoga } from 'graphql-yoga'\n\nexport default {\n  async fetch(request, env, ctx) {\n    const hive = createYogaHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: true // Collects schema usage based on operations\n    });\n\n    const yoga = createYoga({\n      plugins: [\n        useYogaHive(hive)\n      ]\n    });\n\n    const response = await yoga.fetch(request, env, ctx);\n    ctx.waitUntil(hive.dispose());\n    return response;\n  }\n}\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n\n// When server is shutting down\nasync function onShutdown() {\n  await hive.close()\n}\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/1c4e2f6f3009d75a039b72eb2457a39c/graphql-hive-client-0.33.0-alpha-20240423121513-6c9e077a33a8575f2c53f4d7411eb100d453e01e.tgz","_integrity":"sha512-x6gwLDfpd3Ic2NGNO1jPWBmyOiHA7BqJdFL8Nc0kAU2NjP4rKILYBHBYxRuDvTNuA8aw3K3WlLJoDpqbzVcpUA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.3","dependencies":{"tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"0.3.0-alpha-20240423121513-6c9e077a33a8575f2c53f4d7411eb100d453e01e","@whatwg-node/fetch":"0.9.17","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.33.0-alpha-20240423121513-6c9e077a33a8575f2c53f4d7411eb100d453e01e_1713874539139_0.29197501408837456","host":"s3://npm-registry-packages"}},"0.33.0-alpha-20240423121544-c0ad9956f4ad5df6d857e8d97a57ae865405bb28":{"name":"@graphql-hive/client","version":"0.33.0-alpha-20240423121544-c0ad9956f4ad5df6d857e8d97a57ae865405bb28","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.33.0-alpha-20240423121544-c0ad9956f4ad5df6d857e8d97a57ae865405bb28","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"c436eb3b4da4bb8a809e00ed7e1438728b07682b","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.33.0-alpha-20240423121544-c0ad9956f4ad5df6d857e8d97a57ae865405bb28.tgz","fileCount":68,"integrity":"sha512-gEtSpxzxBzwK8yZaqPioo3EN3c3LH0/r8PA1mGaKUSo6OyPY4XBUZH2lSA70MCAk0ylii433CHUh9EthxPNtIA==","signatures":[{"sig":"MEYCIQCDrh7UmARlr04+P1krhSD8URre527MmJ/nppylvWcFUwIhAP0WL2VLJO6N87O7vGt1U801XHV7yI3oIVkF1Ie8jiD2","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":256957},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.33.0-alpha-20240423121544-c0ad9956f4ad5df6d857e8d97a57ae865405bb28.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### GraphQL Yoga and Cloudflare Workers\n\nIf you're using Cloudflare Workers, you can use the following code:\n\n```typescript\nimport { useYogaHive, createYogaHive, useYogaHive } from '@graphql-hive/client'\nimport { createYoga } from 'graphql-yoga'\n\nexport default {\n  async fetch(request, env, ctx) {\n    const hive = createYogaHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: true // Collects schema usage based on operations\n    });\n\n    const yoga = createYoga({\n      plugins: [\n        useYogaHive(hive)\n      ]\n    });\n\n    const response = await yoga.fetch(request, env, ctx);\n    ctx.waitUntil(hive.dispose());\n    return response;\n  }\n}\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n\n// When server is shutting down\nasync function onShutdown() {\n  await hive.close()\n}\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/7f1200d1842b3500e01397cf4a8d725e/graphql-hive-client-0.33.0-alpha-20240423121544-c0ad9956f4ad5df6d857e8d97a57ae865405bb28.tgz","_integrity":"sha512-gEtSpxzxBzwK8yZaqPioo3EN3c3LH0/r8PA1mGaKUSo6OyPY4XBUZH2lSA70MCAk0ylii433CHUh9EthxPNtIA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.3","dependencies":{"tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"0.3.0-alpha-20240423121544-c0ad9956f4ad5df6d857e8d97a57ae865405bb28","@whatwg-node/fetch":"0.9.17","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.33.0-alpha-20240423121544-c0ad9956f4ad5df6d857e8d97a57ae865405bb28_1713874568891_0.2641422588722857","host":"s3://npm-registry-packages"}},"0.33.0-alpha-20240423121707-05ad8a88886c0ac01b49da1b1b08b06aacc06787":{"name":"@graphql-hive/client","version":"0.33.0-alpha-20240423121707-05ad8a88886c0ac01b49da1b1b08b06aacc06787","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.33.0-alpha-20240423121707-05ad8a88886c0ac01b49da1b1b08b06aacc06787","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"b0c3094ba7ce7f798be7bd348d52a9cbd55a4ec4","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.33.0-alpha-20240423121707-05ad8a88886c0ac01b49da1b1b08b06aacc06787.tgz","fileCount":68,"integrity":"sha512-nvOI/rTfUDCNRPxCMLqUKSRJFGr3jPCx5UBKb7HCL7fg8trfqQmdxcLCyb/aZhNe2Bc06yGnSO7pW7KUOJkK6w==","signatures":[{"sig":"MEUCIGNQQvxVJiYdN2yw/rJ19K0kqBnwK/9fhmSbHHXJKKcQAiEA8R81A2Ay2gQKfLf/tHlSAYiIio9wAVM6AHRLth3l078=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":256957},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.33.0-alpha-20240423121707-05ad8a88886c0ac01b49da1b1b08b06aacc06787.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### GraphQL Yoga and Cloudflare Workers\n\nIf you're using Cloudflare Workers, you can use the following code:\n\n```typescript\nimport { useYogaHive, createYogaHive, useYogaHive } from '@graphql-hive/client'\nimport { createYoga } from 'graphql-yoga'\n\nexport default {\n  async fetch(request, env, ctx) {\n    const hive = createYogaHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: true // Collects schema usage based on operations\n    });\n\n    const yoga = createYoga({\n      plugins: [\n        useYogaHive(hive)\n      ]\n    });\n\n    const response = await yoga.fetch(request, env, ctx);\n    ctx.waitUntil(hive.dispose());\n    return response;\n  }\n}\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n\n// When server is shutting down\nasync function onShutdown() {\n  await hive.close()\n}\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/17aa8b5e771c7a04d8b92c79d31804ae/graphql-hive-client-0.33.0-alpha-20240423121707-05ad8a88886c0ac01b49da1b1b08b06aacc06787.tgz","_integrity":"sha512-nvOI/rTfUDCNRPxCMLqUKSRJFGr3jPCx5UBKb7HCL7fg8trfqQmdxcLCyb/aZhNe2Bc06yGnSO7pW7KUOJkK6w==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.3","dependencies":{"tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"0.3.0-alpha-20240423121707-05ad8a88886c0ac01b49da1b1b08b06aacc06787","@whatwg-node/fetch":"0.9.17","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.33.0-alpha-20240423121707-05ad8a88886c0ac01b49da1b1b08b06aacc06787_1713874652403_0.9421088412416858","host":"s3://npm-registry-packages"}},"0.33.0-alpha-20240423121812-3ffd5571073f2fd9e48b3b4f333de924c87d3606":{"name":"@graphql-hive/client","version":"0.33.0-alpha-20240423121812-3ffd5571073f2fd9e48b3b4f333de924c87d3606","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.33.0-alpha-20240423121812-3ffd5571073f2fd9e48b3b4f333de924c87d3606","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"a6f7d42644c1bb24bd4119d936844c45f1b209a7","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.33.0-alpha-20240423121812-3ffd5571073f2fd9e48b3b4f333de924c87d3606.tgz","fileCount":68,"integrity":"sha512-AbNsrzRLWJqEqBohN8gOAogJkK9pQGz7aCq2dlrv1nEGuD5dxbbRjyhBx0XD4sCtMhD6QjWr24hkq7NV+4ipyw==","signatures":[{"sig":"MEYCIQD2XlxJLdbX2hnjXbEnlKYpi6paoINEl2F/pQ3WjWoy0gIhAJ1lYU4fEe+xz92syt6KW60DEqdJvHV2rMCM8ZTP23K6","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":256957},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.33.0-alpha-20240423121812-3ffd5571073f2fd9e48b3b4f333de924c87d3606.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### GraphQL Yoga and Cloudflare Workers\n\nIf you're using Cloudflare Workers, you can use the following code:\n\n```typescript\nimport { useYogaHive, createYogaHive, useYogaHive } from '@graphql-hive/client'\nimport { createYoga } from 'graphql-yoga'\n\nexport default {\n  async fetch(request, env, ctx) {\n    const hive = createYogaHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: true // Collects schema usage based on operations\n    });\n\n    const yoga = createYoga({\n      plugins: [\n        useYogaHive(hive)\n      ]\n    });\n\n    const response = await yoga.fetch(request, env, ctx);\n    ctx.waitUntil(hive.dispose());\n    return response;\n  }\n}\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n\n// When server is shutting down\nasync function onShutdown() {\n  await hive.close()\n}\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/8b4e36ec7a1364aa74a1a4126c6de676/graphql-hive-client-0.33.0-alpha-20240423121812-3ffd5571073f2fd9e48b3b4f333de924c87d3606.tgz","_integrity":"sha512-AbNsrzRLWJqEqBohN8gOAogJkK9pQGz7aCq2dlrv1nEGuD5dxbbRjyhBx0XD4sCtMhD6QjWr24hkq7NV+4ipyw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.3","dependencies":{"tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"0.3.0-alpha-20240423121812-3ffd5571073f2fd9e48b3b4f333de924c87d3606","@whatwg-node/fetch":"0.9.17","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.33.0-alpha-20240423121812-3ffd5571073f2fd9e48b3b4f333de924c87d3606_1713874716511_0.8497916867443158","host":"s3://npm-registry-packages"}},"0.33.0-alpha-20240423121958-0f8212296675ab418430308a7f0d1507ab29bd44":{"name":"@graphql-hive/client","version":"0.33.0-alpha-20240423121958-0f8212296675ab418430308a7f0d1507ab29bd44","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.33.0-alpha-20240423121958-0f8212296675ab418430308a7f0d1507ab29bd44","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"1c36cd99970471dbed99a9e78d68bcd2e02a9bf9","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.33.0-alpha-20240423121958-0f8212296675ab418430308a7f0d1507ab29bd44.tgz","fileCount":68,"integrity":"sha512-tPiCthrh8sm8B40qZyEABnPmZj7wqnyFxHjdFRm9PbYqGqu+9HlTV23jixSZF50KbqYENM3weiSa68/DTuPPoA==","signatures":[{"sig":"MEYCIQCGx84q3Lb1dU1wGlQ9yGO5CL4BiKWRSdfDrR+jEud3ZAIhAJuyKIT2BiGn9tTi5LHAc+X9WiSnwU1E0hST8MDmSG36","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":256957},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.33.0-alpha-20240423121958-0f8212296675ab418430308a7f0d1507ab29bd44.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### GraphQL Yoga and Cloudflare Workers\n\nIf you're using Cloudflare Workers, you can use the following code:\n\n```typescript\nimport { useYogaHive, createYogaHive, useYogaHive } from '@graphql-hive/client'\nimport { createYoga } from 'graphql-yoga'\n\nexport default {\n  async fetch(request, env, ctx) {\n    const hive = createYogaHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: true // Collects schema usage based on operations\n    });\n\n    const yoga = createYoga({\n      plugins: [\n        useYogaHive(hive)\n      ]\n    });\n\n    const response = await yoga.fetch(request, env, ctx);\n    ctx.waitUntil(hive.dispose());\n    return response;\n  }\n}\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n\n// When server is shutting down\nasync function onShutdown() {\n  await hive.close()\n}\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/e3b84253b881f9da4a42e64fc9f17bdd/graphql-hive-client-0.33.0-alpha-20240423121958-0f8212296675ab418430308a7f0d1507ab29bd44.tgz","_integrity":"sha512-tPiCthrh8sm8B40qZyEABnPmZj7wqnyFxHjdFRm9PbYqGqu+9HlTV23jixSZF50KbqYENM3weiSa68/DTuPPoA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.3","dependencies":{"tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"0.3.0-alpha-20240423121958-0f8212296675ab418430308a7f0d1507ab29bd44","@whatwg-node/fetch":"0.9.17","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.33.0-alpha-20240423121958-0f8212296675ab418430308a7f0d1507ab29bd44_1713874822147_0.07267727620524722","host":"s3://npm-registry-packages"}},"0.33.0-alpha-20240423122052-bc51618d20fe1bcebef665f9be9640aeb4313fe6":{"name":"@graphql-hive/client","version":"0.33.0-alpha-20240423122052-bc51618d20fe1bcebef665f9be9640aeb4313fe6","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.33.0-alpha-20240423122052-bc51618d20fe1bcebef665f9be9640aeb4313fe6","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"b1ef580e20f0ea66f1f49a0fccda8036a47aea0e","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.33.0-alpha-20240423122052-bc51618d20fe1bcebef665f9be9640aeb4313fe6.tgz","fileCount":68,"integrity":"sha512-OXnflmLSQvLaW2SrqiHd6HGlNWGHim3w97ktgCvzXb0T92CXIZ28lghJ7fVGxBIZivFo+aBygy/fMCmwLaEEkA==","signatures":[{"sig":"MEYCIQDsmX8yiyA4REQ2xmFPWfwG2r5c3SwN6RwGAUYDz6HQ5wIhAPyLg0kxIJF5BqW0RmEFn+eNg8wnWWxpp8gNbhzL6qZS","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":256957},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.33.0-alpha-20240423122052-bc51618d20fe1bcebef665f9be9640aeb4313fe6.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### GraphQL Yoga and Cloudflare Workers\n\nIf you're using Cloudflare Workers, you can use the following code:\n\n```typescript\nimport { useYogaHive, createYogaHive, useYogaHive } from '@graphql-hive/client'\nimport { createYoga } from 'graphql-yoga'\n\nexport default {\n  async fetch(request, env, ctx) {\n    const hive = createYogaHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: true // Collects schema usage based on operations\n    });\n\n    const yoga = createYoga({\n      plugins: [\n        useYogaHive(hive)\n      ]\n    });\n\n    const response = await yoga.fetch(request, env, ctx);\n    ctx.waitUntil(hive.dispose());\n    return response;\n  }\n}\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n\n// When server is shutting down\nasync function onShutdown() {\n  await hive.close()\n}\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/c0d4fae5801cc6c5c03dc35100bc049b/graphql-hive-client-0.33.0-alpha-20240423122052-bc51618d20fe1bcebef665f9be9640aeb4313fe6.tgz","_integrity":"sha512-OXnflmLSQvLaW2SrqiHd6HGlNWGHim3w97ktgCvzXb0T92CXIZ28lghJ7fVGxBIZivFo+aBygy/fMCmwLaEEkA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.3","dependencies":{"tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"0.3.0-alpha-20240423122052-bc51618d20fe1bcebef665f9be9640aeb4313fe6","@whatwg-node/fetch":"0.9.17","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.33.0-alpha-20240423122052-bc51618d20fe1bcebef665f9be9640aeb4313fe6_1713874876190_0.2671191544456235","host":"s3://npm-registry-packages"}},"0.33.0-alpha-20240423122214-edd921c8ddd31b3884d05208705bf56a5486abbc":{"name":"@graphql-hive/client","version":"0.33.0-alpha-20240423122214-edd921c8ddd31b3884d05208705bf56a5486abbc","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.33.0-alpha-20240423122214-edd921c8ddd31b3884d05208705bf56a5486abbc","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"1de9da4596242471f4d60486dcb70faea934c478","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.33.0-alpha-20240423122214-edd921c8ddd31b3884d05208705bf56a5486abbc.tgz","fileCount":68,"integrity":"sha512-5D0SRL+1KOPy7rpXf0M1pdTonR65BbW8EXFBY/UfigO0OLogvIRHFKuuAyXcqCEMSEd5RueqRs4W7FbG+SNE8g==","signatures":[{"sig":"MEUCICzZ1nuaKzmLqOIJ4eqFCzFrfTQmeLlWnvVkhssLW1UzAiEAxYH1xDYBbKz8sFfb5J6wziMpxXGscqszrzrGx8FtBeI=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":256957},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.33.0-alpha-20240423122214-edd921c8ddd31b3884d05208705bf56a5486abbc.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### GraphQL Yoga and Cloudflare Workers\n\nIf you're using Cloudflare Workers, you can use the following code:\n\n```typescript\nimport { useYogaHive, createYogaHive, useYogaHive } from '@graphql-hive/client'\nimport { createYoga } from 'graphql-yoga'\n\nexport default {\n  async fetch(request, env, ctx) {\n    const hive = createYogaHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: true // Collects schema usage based on operations\n    });\n\n    const yoga = createYoga({\n      plugins: [\n        useYogaHive(hive)\n      ]\n    });\n\n    const response = await yoga.fetch(request, env, ctx);\n    ctx.waitUntil(hive.dispose());\n    return response;\n  }\n}\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n\n// When server is shutting down\nasync function onShutdown() {\n  await hive.close()\n}\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/cd7f25b5ffa4f3c694a26e67f5589655/graphql-hive-client-0.33.0-alpha-20240423122214-edd921c8ddd31b3884d05208705bf56a5486abbc.tgz","_integrity":"sha512-5D0SRL+1KOPy7rpXf0M1pdTonR65BbW8EXFBY/UfigO0OLogvIRHFKuuAyXcqCEMSEd5RueqRs4W7FbG+SNE8g==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.3","dependencies":{"tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"0.3.0-alpha-20240423122214-edd921c8ddd31b3884d05208705bf56a5486abbc","@whatwg-node/fetch":"0.9.17","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.33.0-alpha-20240423122214-edd921c8ddd31b3884d05208705bf56a5486abbc_1713874958361_0.521848398725062","host":"s3://npm-registry-packages"}},"0.33.0-alpha-20240423122334-ea679230e9beae30ef44a34eb16b53d43fdb4bd2":{"name":"@graphql-hive/client","version":"0.33.0-alpha-20240423122334-ea679230e9beae30ef44a34eb16b53d43fdb4bd2","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.33.0-alpha-20240423122334-ea679230e9beae30ef44a34eb16b53d43fdb4bd2","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"355f3d179f4fb6db1f538d118d9e069ec0b9f080","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.33.0-alpha-20240423122334-ea679230e9beae30ef44a34eb16b53d43fdb4bd2.tgz","fileCount":68,"integrity":"sha512-2Ba2E5wUYd64qTLzO7ODOGnIsC/wIXvGPfviL+M3cIu89cQw36R6GVPyd+NMnIkl6sbRwixQR9LEPt2wUTaofQ==","signatures":[{"sig":"MEUCIGWeCx5b55HW2yh02KewOh+LcVor2+Bn31VvPDcFennjAiEAz5Zgy7ZFbl5yzVwW8ZfsMp0fUGAZdvXZ6iDT1TgeCN0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":256957},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.33.0-alpha-20240423122334-ea679230e9beae30ef44a34eb16b53d43fdb4bd2.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### GraphQL Yoga and Cloudflare Workers\n\nIf you're using Cloudflare Workers, you can use the following code:\n\n```typescript\nimport { useYogaHive, createYogaHive, useYogaHive } from '@graphql-hive/client'\nimport { createYoga } from 'graphql-yoga'\n\nexport default {\n  async fetch(request, env, ctx) {\n    const hive = createYogaHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: true // Collects schema usage based on operations\n    });\n\n    const yoga = createYoga({\n      plugins: [\n        useYogaHive(hive)\n      ]\n    });\n\n    const response = await yoga.fetch(request, env, ctx);\n    ctx.waitUntil(hive.dispose());\n    return response;\n  }\n}\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n\n// When server is shutting down\nasync function onShutdown() {\n  await hive.close()\n}\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/31bbe1df004453e9f7f5585c5f4692bc/graphql-hive-client-0.33.0-alpha-20240423122334-ea679230e9beae30ef44a34eb16b53d43fdb4bd2.tgz","_integrity":"sha512-2Ba2E5wUYd64qTLzO7ODOGnIsC/wIXvGPfviL+M3cIu89cQw36R6GVPyd+NMnIkl6sbRwixQR9LEPt2wUTaofQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.3","dependencies":{"tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"0.3.0-alpha-20240423122334-ea679230e9beae30ef44a34eb16b53d43fdb4bd2","@whatwg-node/fetch":"0.9.17","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.33.0-alpha-20240423122334-ea679230e9beae30ef44a34eb16b53d43fdb4bd2_1713875038652_0.08591710443341727","host":"s3://npm-registry-packages"}},"0.33.0-alpha-20240423122635-b90bf4baf49b3c4dfb505d5b339d8ee177a91d48":{"name":"@graphql-hive/client","version":"0.33.0-alpha-20240423122635-b90bf4baf49b3c4dfb505d5b339d8ee177a91d48","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.33.0-alpha-20240423122635-b90bf4baf49b3c4dfb505d5b339d8ee177a91d48","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"957f898198aeb2eb7e4871d552def8d236056161","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.33.0-alpha-20240423122635-b90bf4baf49b3c4dfb505d5b339d8ee177a91d48.tgz","fileCount":68,"integrity":"sha512-LF90n9B/ZwA2hdffyNq4E/h132S3edYNYZkrtKjdBNjXcRBacQRyTdin0XXhZIfqA/XueR4aPHXo06tWo30aIg==","signatures":[{"sig":"MEUCIGFllssRVtF2A4oDYcpt9Or0e/yvzhJMsDZfWRlKcKB0AiEA4jO1qnvOP0QOg2fzxh+TMnja/ageo4wRKaym8fzlljQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":256957},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.33.0-alpha-20240423122635-b90bf4baf49b3c4dfb505d5b339d8ee177a91d48.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### GraphQL Yoga and Cloudflare Workers\n\nIf you're using Cloudflare Workers, you can use the following code:\n\n```typescript\nimport { useYogaHive, createYogaHive, useYogaHive } from '@graphql-hive/client'\nimport { createYoga } from 'graphql-yoga'\n\nexport default {\n  async fetch(request, env, ctx) {\n    const hive = createYogaHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: true // Collects schema usage based on operations\n    });\n\n    const yoga = createYoga({\n      plugins: [\n        useYogaHive(hive)\n      ]\n    });\n\n    const response = await yoga.fetch(request, env, ctx);\n    ctx.waitUntil(hive.dispose());\n    return response;\n  }\n}\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n\n// When server is shutting down\nasync function onShutdown() {\n  await hive.close()\n}\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/e32ab1649f209cd9a724bd4344ebf0c6/graphql-hive-client-0.33.0-alpha-20240423122635-b90bf4baf49b3c4dfb505d5b339d8ee177a91d48.tgz","_integrity":"sha512-LF90n9B/ZwA2hdffyNq4E/h132S3edYNYZkrtKjdBNjXcRBacQRyTdin0XXhZIfqA/XueR4aPHXo06tWo30aIg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.3","dependencies":{"tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"0.3.0-alpha-20240423122635-b90bf4baf49b3c4dfb505d5b339d8ee177a91d48","@whatwg-node/fetch":"0.9.17","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.33.0-alpha-20240423122635-b90bf4baf49b3c4dfb505d5b339d8ee177a91d48_1713875219418_0.49566560466818244","host":"s3://npm-registry-packages"}},"0.33.0-alpha-20240423122654-e283071b7625b481cbf5279b1760203b29056265":{"name":"@graphql-hive/client","version":"0.33.0-alpha-20240423122654-e283071b7625b481cbf5279b1760203b29056265","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.33.0-alpha-20240423122654-e283071b7625b481cbf5279b1760203b29056265","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"48c320a5aa44cc2ddb04cc7e51bfb1902c92bfba","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.33.0-alpha-20240423122654-e283071b7625b481cbf5279b1760203b29056265.tgz","fileCount":68,"integrity":"sha512-dqK/nMmHic2BUmgLg3vLZkmMgH+6DHgxlUfZy8DcTzIo5YaC1HGvnsSqEoCqEAcebhffLf57pZS6cUR78pn3ag==","signatures":[{"sig":"MEUCIQDouE0tOtIHWE8f3Av3Rlvld/AbWBVtb3q6e7H6GMMp/wIgPrMVXdex4IHMczdzeK2NeNWyqpsPhGL12/oby+yvjio=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":256957},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.33.0-alpha-20240423122654-e283071b7625b481cbf5279b1760203b29056265.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### GraphQL Yoga and Cloudflare Workers\n\nIf you're using Cloudflare Workers, you can use the following code:\n\n```typescript\nimport { useYogaHive, createYogaHive, useYogaHive } from '@graphql-hive/client'\nimport { createYoga } from 'graphql-yoga'\n\nexport default {\n  async fetch(request, env, ctx) {\n    const hive = createYogaHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: true // Collects schema usage based on operations\n    });\n\n    const yoga = createYoga({\n      plugins: [\n        useYogaHive(hive)\n      ]\n    });\n\n    const response = await yoga.fetch(request, env, ctx);\n    ctx.waitUntil(hive.dispose());\n    return response;\n  }\n}\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n\n// When server is shutting down\nasync function onShutdown() {\n  await hive.close()\n}\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/79f5a5d8d20fda1ce22c12e725dc4129/graphql-hive-client-0.33.0-alpha-20240423122654-e283071b7625b481cbf5279b1760203b29056265.tgz","_integrity":"sha512-dqK/nMmHic2BUmgLg3vLZkmMgH+6DHgxlUfZy8DcTzIo5YaC1HGvnsSqEoCqEAcebhffLf57pZS6cUR78pn3ag==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.3","dependencies":{"tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"0.3.0-alpha-20240423122654-e283071b7625b481cbf5279b1760203b29056265","@whatwg-node/fetch":"0.9.17","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.33.0-alpha-20240423122654-e283071b7625b481cbf5279b1760203b29056265_1713875240993_0.7236913595972545","host":"s3://npm-registry-packages"}},"0.33.0-alpha-20240423122825-46da0b552498ee543b906844d18602a441dcfb1c":{"name":"@graphql-hive/client","version":"0.33.0-alpha-20240423122825-46da0b552498ee543b906844d18602a441dcfb1c","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.33.0-alpha-20240423122825-46da0b552498ee543b906844d18602a441dcfb1c","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"815308f5991e913f32166c0f3bd1e466af0b3c9c","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.33.0-alpha-20240423122825-46da0b552498ee543b906844d18602a441dcfb1c.tgz","fileCount":68,"integrity":"sha512-eMgTV9E8XFWEuPqiHNSbBPYNz6E+qnmEHrowFbxXVxkto/bOnzY3HFWsK0a2fAf9CcHogD6fqZ/TvHV120PYgg==","signatures":[{"sig":"MEYCIQCRSgDCUYMuo1dzBPeAzU3tiry7ys3Mx09PqU3BxP2pjwIhAMiCeBwn7Jz4aHcSi9TC4ESLAiLJzBvmh8+LsHnOPIZA","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":256957},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.33.0-alpha-20240423122825-46da0b552498ee543b906844d18602a441dcfb1c.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### GraphQL Yoga and Cloudflare Workers\n\nIf you're using Cloudflare Workers, you can use the following code:\n\n```typescript\nimport { useYogaHive, createYogaHive, useYogaHive } from '@graphql-hive/client'\nimport { createYoga } from 'graphql-yoga'\n\nexport default {\n  async fetch(request, env, ctx) {\n    const hive = createYogaHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: true // Collects schema usage based on operations\n    });\n\n    const yoga = createYoga({\n      plugins: [\n        useYogaHive(hive)\n      ]\n    });\n\n    const response = await yoga.fetch(request, env, ctx);\n    ctx.waitUntil(hive.dispose());\n    return response;\n  }\n}\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n\n// When server is shutting down\nasync function onShutdown() {\n  await hive.close()\n}\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/08654909743fb623b7c190e58600d205/graphql-hive-client-0.33.0-alpha-20240423122825-46da0b552498ee543b906844d18602a441dcfb1c.tgz","_integrity":"sha512-eMgTV9E8XFWEuPqiHNSbBPYNz6E+qnmEHrowFbxXVxkto/bOnzY3HFWsK0a2fAf9CcHogD6fqZ/TvHV120PYgg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.3","dependencies":{"tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"0.3.0-alpha-20240423122825-46da0b552498ee543b906844d18602a441dcfb1c","@whatwg-node/fetch":"0.9.17","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.33.0-alpha-20240423122825-46da0b552498ee543b906844d18602a441dcfb1c_1713875329617_0.44555111988069585","host":"s3://npm-registry-packages"}},"0.33.0-alpha-20240423123013-d2aafb605e024a47aa6b88d3c11aa92884f02d86":{"name":"@graphql-hive/client","version":"0.33.0-alpha-20240423123013-d2aafb605e024a47aa6b88d3c11aa92884f02d86","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.33.0-alpha-20240423123013-d2aafb605e024a47aa6b88d3c11aa92884f02d86","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"c31036cc654b6d2995a55bcf3b199de8dd0a8cbf","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.33.0-alpha-20240423123013-d2aafb605e024a47aa6b88d3c11aa92884f02d86.tgz","fileCount":68,"integrity":"sha512-xZoqfjOJ5G2WIkZhpfBzaK1h/fXFxO936nstFfI4Nlx+MIwayN79NfF7z+7sF4mZT6hKVd3FvH3Kac8vbunCIw==","signatures":[{"sig":"MEYCIQDoBxOPwiqJ3k8lbKKd04dZT4NzUgUF/8CnDTQLVeV6mQIhANk7/8Cp6Il+drnuCX+jIQxwdai9ydkyLaJn5bRE0Y6G","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":256957},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.33.0-alpha-20240423123013-d2aafb605e024a47aa6b88d3c11aa92884f02d86.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### GraphQL Yoga and Cloudflare Workers\n\nIf you're using Cloudflare Workers, you can use the following code:\n\n```typescript\nimport { useYogaHive, createYogaHive, useYogaHive } from '@graphql-hive/client'\nimport { createYoga } from 'graphql-yoga'\n\nexport default {\n  async fetch(request, env, ctx) {\n    const hive = createYogaHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: true // Collects schema usage based on operations\n    });\n\n    const yoga = createYoga({\n      plugins: [\n        useYogaHive(hive)\n      ]\n    });\n\n    const response = await yoga.fetch(request, env, ctx);\n    ctx.waitUntil(hive.dispose());\n    return response;\n  }\n}\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n\n// When server is shutting down\nasync function onShutdown() {\n  await hive.close()\n}\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/e31ce5b2c31bb0fae65d6e9a76f8de0f/graphql-hive-client-0.33.0-alpha-20240423123013-d2aafb605e024a47aa6b88d3c11aa92884f02d86.tgz","_integrity":"sha512-xZoqfjOJ5G2WIkZhpfBzaK1h/fXFxO936nstFfI4Nlx+MIwayN79NfF7z+7sF4mZT6hKVd3FvH3Kac8vbunCIw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.3","dependencies":{"tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"0.3.0-alpha-20240423123013-d2aafb605e024a47aa6b88d3c11aa92884f02d86","@whatwg-node/fetch":"0.9.17","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.33.0-alpha-20240423123013-d2aafb605e024a47aa6b88d3c11aa92884f02d86_1713875437754_0.41149527278811515","host":"s3://npm-registry-packages"}},"0.33.0-alpha-20240423123120-b9495a476ed6f15d34cad1b635e3f4985414bb6a":{"name":"@graphql-hive/client","version":"0.33.0-alpha-20240423123120-b9495a476ed6f15d34cad1b635e3f4985414bb6a","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.33.0-alpha-20240423123120-b9495a476ed6f15d34cad1b635e3f4985414bb6a","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"1b9d0b4ede585db11233ae16a3070a0413b18947","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.33.0-alpha-20240423123120-b9495a476ed6f15d34cad1b635e3f4985414bb6a.tgz","fileCount":68,"integrity":"sha512-XgukJVgWFQDeiHNksScnBZTUpCoEhtFoxztzFncKsNMpeC5JxHAr0cQHpMaX4j36T+Gk+et35HcQfsfirqSfcw==","signatures":[{"sig":"MEYCIQDUymdlMb13AMYIScA52ukmFMEqH81nh2jh9iAP/SiBJgIhAOnM+GaNCKvHV9Of8jjvYrmdJWtKvifTPk4gvnjr1B8e","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":256957},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.33.0-alpha-20240423123120-b9495a476ed6f15d34cad1b635e3f4985414bb6a.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### GraphQL Yoga and Cloudflare Workers\n\nIf you're using Cloudflare Workers, you can use the following code:\n\n```typescript\nimport { useYogaHive, createYogaHive, useYogaHive } from '@graphql-hive/client'\nimport { createYoga } from 'graphql-yoga'\n\nexport default {\n  async fetch(request, env, ctx) {\n    const hive = createYogaHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: true // Collects schema usage based on operations\n    });\n\n    const yoga = createYoga({\n      plugins: [\n        useYogaHive(hive)\n      ]\n    });\n\n    const response = await yoga.fetch(request, env, ctx);\n    ctx.waitUntil(hive.dispose());\n    return response;\n  }\n}\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n\n// When server is shutting down\nasync function onShutdown() {\n  await hive.close()\n}\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/ad2f6b0c5e751a870625ce7cbd51a7f3/graphql-hive-client-0.33.0-alpha-20240423123120-b9495a476ed6f15d34cad1b635e3f4985414bb6a.tgz","_integrity":"sha512-XgukJVgWFQDeiHNksScnBZTUpCoEhtFoxztzFncKsNMpeC5JxHAr0cQHpMaX4j36T+Gk+et35HcQfsfirqSfcw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.3","dependencies":{"tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"0.3.0-alpha-20240423123120-b9495a476ed6f15d34cad1b635e3f4985414bb6a","@whatwg-node/fetch":"0.9.17","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.33.0-alpha-20240423123120-b9495a476ed6f15d34cad1b635e3f4985414bb6a_1713875505602_0.87094039170511","host":"s3://npm-registry-packages"}},"0.33.0-alpha-20240423123304-96df076bd128575ca7799bf6cd1a4942cf74ef70":{"name":"@graphql-hive/client","version":"0.33.0-alpha-20240423123304-96df076bd128575ca7799bf6cd1a4942cf74ef70","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.33.0-alpha-20240423123304-96df076bd128575ca7799bf6cd1a4942cf74ef70","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"3fe0d09406e63b1a8d3962297db79a0878969d69","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.33.0-alpha-20240423123304-96df076bd128575ca7799bf6cd1a4942cf74ef70.tgz","fileCount":68,"integrity":"sha512-RRE8n5cnlPHvem0emIhHuNZtzhuWHZlC/v2VD3aLADe7bOy2Af5k4KbOUK+OLu7afpT8nVzFHlRQjCbZCT9GPg==","signatures":[{"sig":"MEYCIQD7ocwgDcq3PX1mK1UIq9g+Ztv24XCoSvWFm112gahWtgIhAOsBUeYJcyzSsChHZ73LrBUBqLm++yXlHaSIgWkH5Ryi","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":256957},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.33.0-alpha-20240423123304-96df076bd128575ca7799bf6cd1a4942cf74ef70.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### GraphQL Yoga and Cloudflare Workers\n\nIf you're using Cloudflare Workers, you can use the following code:\n\n```typescript\nimport { useYogaHive, createYogaHive, useYogaHive } from '@graphql-hive/client'\nimport { createYoga } from 'graphql-yoga'\n\nexport default {\n  async fetch(request, env, ctx) {\n    const hive = createYogaHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: true // Collects schema usage based on operations\n    });\n\n    const yoga = createYoga({\n      plugins: [\n        useYogaHive(hive)\n      ]\n    });\n\n    const response = await yoga.fetch(request, env, ctx);\n    ctx.waitUntil(hive.dispose());\n    return response;\n  }\n}\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n\n// When server is shutting down\nasync function onShutdown() {\n  await hive.close()\n}\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/b4bb3a64f4b0baf7ec0a77c8da8c724d/graphql-hive-client-0.33.0-alpha-20240423123304-96df076bd128575ca7799bf6cd1a4942cf74ef70.tgz","_integrity":"sha512-RRE8n5cnlPHvem0emIhHuNZtzhuWHZlC/v2VD3aLADe7bOy2Af5k4KbOUK+OLu7afpT8nVzFHlRQjCbZCT9GPg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.3","dependencies":{"tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"0.3.0-alpha-20240423123304-96df076bd128575ca7799bf6cd1a4942cf74ef70","@whatwg-node/fetch":"0.9.17","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.33.0-alpha-20240423123304-96df076bd128575ca7799bf6cd1a4942cf74ef70_1713875609827_0.8864825041569373","host":"s3://npm-registry-packages"}},"0.33.0-alpha-20240423123507-49663a3d15b365f696139b181f7efb1b7fbf93be":{"name":"@graphql-hive/client","version":"0.33.0-alpha-20240423123507-49663a3d15b365f696139b181f7efb1b7fbf93be","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.33.0-alpha-20240423123507-49663a3d15b365f696139b181f7efb1b7fbf93be","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"2cb8bd82863c5857805902a359988ca03710be4a","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.33.0-alpha-20240423123507-49663a3d15b365f696139b181f7efb1b7fbf93be.tgz","fileCount":68,"integrity":"sha512-7EPREvOWvvV9CLsMCxZ6/nH/LsiuDBbTh70Zj8KbaVUYx5k8jIpvRJ4NQJJGIigUGT/wGrp9jHi8W3jZKMWdcA==","signatures":[{"sig":"MEUCIQDN58u6axlMsd+fd5e3Mn25EGoKa0vqyAirYzpUFknP3AIgC6AAHdeYgcGNuuBWyjsMiuNtMkPKLgV/8PjyyGJ+ZK8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":256957},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.33.0-alpha-20240423123507-49663a3d15b365f696139b181f7efb1b7fbf93be.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### GraphQL Yoga and Cloudflare Workers\n\nIf you're using Cloudflare Workers, you can use the following code:\n\n```typescript\nimport { useYogaHive, createYogaHive, useYogaHive } from '@graphql-hive/client'\nimport { createYoga } from 'graphql-yoga'\n\nexport default {\n  async fetch(request, env, ctx) {\n    const hive = createYogaHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: true // Collects schema usage based on operations\n    });\n\n    const yoga = createYoga({\n      plugins: [\n        useYogaHive(hive)\n      ]\n    });\n\n    const response = await yoga.fetch(request, env, ctx);\n    ctx.waitUntil(hive.dispose());\n    return response;\n  }\n}\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n\n// When server is shutting down\nasync function onShutdown() {\n  await hive.close()\n}\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/f152f8bac0c1ea468a58ce297bf0f14e/graphql-hive-client-0.33.0-alpha-20240423123507-49663a3d15b365f696139b181f7efb1b7fbf93be.tgz","_integrity":"sha512-7EPREvOWvvV9CLsMCxZ6/nH/LsiuDBbTh70Zj8KbaVUYx5k8jIpvRJ4NQJJGIigUGT/wGrp9jHi8W3jZKMWdcA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.3","dependencies":{"tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"0.3.0-alpha-20240423123507-49663a3d15b365f696139b181f7efb1b7fbf93be","@whatwg-node/fetch":"0.9.17","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.33.0-alpha-20240423123507-49663a3d15b365f696139b181f7efb1b7fbf93be_1713875731666_0.18895968921914985","host":"s3://npm-registry-packages"}},"0.33.0-alpha-20240423123549-4dfad7419d7ccb48f0c9c2b5855263d0a775e9f1":{"name":"@graphql-hive/client","version":"0.33.0-alpha-20240423123549-4dfad7419d7ccb48f0c9c2b5855263d0a775e9f1","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.33.0-alpha-20240423123549-4dfad7419d7ccb48f0c9c2b5855263d0a775e9f1","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"2aac9261b82c05996ff1f96dbc1db8ea57dbe449","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.33.0-alpha-20240423123549-4dfad7419d7ccb48f0c9c2b5855263d0a775e9f1.tgz","fileCount":68,"integrity":"sha512-sVijjZOYGV5OQ9fczIZhoN0eRfx1h4Cir+9DUHVqcZOJtfcWzWIYxBn5Bobqi+pk7+FOtsFZon7BWda9wAJPfg==","signatures":[{"sig":"MEUCID5WpQAu/2Kuh9FwsfUYLpT9jzoHsANhUug1ujIkfUSbAiEAyLV1tPYrLokqC5mYt/ROtdGIWTLQT7nKy8r6vdgXMjA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":256957},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.33.0-alpha-20240423123549-4dfad7419d7ccb48f0c9c2b5855263d0a775e9f1.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### GraphQL Yoga and Cloudflare Workers\n\nIf you're using Cloudflare Workers, you can use the following code:\n\n```typescript\nimport { useYogaHive, createYogaHive, useYogaHive } from '@graphql-hive/client'\nimport { createYoga } from 'graphql-yoga'\n\nexport default {\n  async fetch(request, env, ctx) {\n    const hive = createYogaHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: true // Collects schema usage based on operations\n    });\n\n    const yoga = createYoga({\n      plugins: [\n        useYogaHive(hive)\n      ]\n    });\n\n    const response = await yoga.fetch(request, env, ctx);\n    ctx.waitUntil(hive.dispose());\n    return response;\n  }\n}\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n\n// When server is shutting down\nasync function onShutdown() {\n  await hive.close()\n}\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/55277cf794c049a71f6cfee6fe5717e1/graphql-hive-client-0.33.0-alpha-20240423123549-4dfad7419d7ccb48f0c9c2b5855263d0a775e9f1.tgz","_integrity":"sha512-sVijjZOYGV5OQ9fczIZhoN0eRfx1h4Cir+9DUHVqcZOJtfcWzWIYxBn5Bobqi+pk7+FOtsFZon7BWda9wAJPfg==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.3","dependencies":{"tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"0.3.0-alpha-20240423123549-4dfad7419d7ccb48f0c9c2b5855263d0a775e9f1","@whatwg-node/fetch":"0.9.17","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.33.0-alpha-20240423123549-4dfad7419d7ccb48f0c9c2b5855263d0a775e9f1_1713875774633_0.9626899526925539","host":"s3://npm-registry-packages"}},"0.33.0-alpha-20240423123754-edf965b32213834461c88898173df0506a359c81":{"name":"@graphql-hive/client","version":"0.33.0-alpha-20240423123754-edf965b32213834461c88898173df0506a359c81","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.33.0-alpha-20240423123754-edf965b32213834461c88898173df0506a359c81","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"77c8bda85b3297f796dd63d712f058d74fa658fd","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.33.0-alpha-20240423123754-edf965b32213834461c88898173df0506a359c81.tgz","fileCount":68,"integrity":"sha512-wPBdCH2cu0QsS8dn7W++5raFEaO+5aUrb6B8rjGL8ST90mdRTRjgH9KowqnmycSl4DThd9W0cp09B5XVceIPKA==","signatures":[{"sig":"MEUCIGw2KTjrNKMedI7VydkOldIniUKg7gESnPIvCcR+6pqmAiEAlwurrTw9ttVEF8efNKxqTOBchGfaf1Riadfa5ojbdc8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":256957},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.33.0-alpha-20240423123754-edf965b32213834461c88898173df0506a359c81.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### GraphQL Yoga and Cloudflare Workers\n\nIf you're using Cloudflare Workers, you can use the following code:\n\n```typescript\nimport { useYogaHive, createYogaHive, useYogaHive } from '@graphql-hive/client'\nimport { createYoga } from 'graphql-yoga'\n\nexport default {\n  async fetch(request, env, ctx) {\n    const hive = createYogaHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: true // Collects schema usage based on operations\n    });\n\n    const yoga = createYoga({\n      plugins: [\n        useYogaHive(hive)\n      ]\n    });\n\n    const response = await yoga.fetch(request, env, ctx);\n    ctx.waitUntil(hive.dispose());\n    return response;\n  }\n}\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n\n// When server is shutting down\nasync function onShutdown() {\n  await hive.close()\n}\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/315526928a11612e12ffbbe95c90110f/graphql-hive-client-0.33.0-alpha-20240423123754-edf965b32213834461c88898173df0506a359c81.tgz","_integrity":"sha512-wPBdCH2cu0QsS8dn7W++5raFEaO+5aUrb6B8rjGL8ST90mdRTRjgH9KowqnmycSl4DThd9W0cp09B5XVceIPKA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.3","dependencies":{"tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"0.3.0-alpha-20240423123754-edf965b32213834461c88898173df0506a359c81","@whatwg-node/fetch":"0.9.17","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.33.0-alpha-20240423123754-edf965b32213834461c88898173df0506a359c81_1713875899606_0.8721660502427755","host":"s3://npm-registry-packages"}},"0.33.0-alpha-20240423123927-b43b2c05aaf0c7282e46d9b2b4dfcbed2a32be60":{"name":"@graphql-hive/client","version":"0.33.0-alpha-20240423123927-b43b2c05aaf0c7282e46d9b2b4dfcbed2a32be60","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.33.0-alpha-20240423123927-b43b2c05aaf0c7282e46d9b2b4dfcbed2a32be60","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"6212ec5fae41198ab3a47a42ef0efc486dac7d40","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.33.0-alpha-20240423123927-b43b2c05aaf0c7282e46d9b2b4dfcbed2a32be60.tgz","fileCount":68,"integrity":"sha512-b2wogTyckSL08iwGbnPejYe4CV3wYbH8GM8bsVFkpniwUyZ9NpuZBEIoqD+S8mzp1tENtXsFIfn0WP575+9ykQ==","signatures":[{"sig":"MEQCIBsD3S1KtwmPKyiTWn5e7vcsbF+aA3O4o4LsZ55soptnAiA+ZGs471pDWRecTJPeu2+NyK3qK73kexpXzG3DKguxOA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":256957},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.33.0-alpha-20240423123927-b43b2c05aaf0c7282e46d9b2b4dfcbed2a32be60.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### GraphQL Yoga and Cloudflare Workers\n\nIf you're using Cloudflare Workers, you can use the following code:\n\n```typescript\nimport { useYogaHive, createYogaHive, useYogaHive } from '@graphql-hive/client'\nimport { createYoga } from 'graphql-yoga'\n\nexport default {\n  async fetch(request, env, ctx) {\n    const hive = createYogaHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: true // Collects schema usage based on operations\n    });\n\n    const yoga = createYoga({\n      plugins: [\n        useYogaHive(hive)\n      ]\n    });\n\n    const response = await yoga.fetch(request, env, ctx);\n    ctx.waitUntil(hive.dispose());\n    return response;\n  }\n}\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n\n// When server is shutting down\nasync function onShutdown() {\n  await hive.close()\n}\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/113cadfc912263e404919fb7bd40cd64/graphql-hive-client-0.33.0-alpha-20240423123927-b43b2c05aaf0c7282e46d9b2b4dfcbed2a32be60.tgz","_integrity":"sha512-b2wogTyckSL08iwGbnPejYe4CV3wYbH8GM8bsVFkpniwUyZ9NpuZBEIoqD+S8mzp1tENtXsFIfn0WP575+9ykQ==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.3","dependencies":{"tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"0.3.0-alpha-20240423123927-b43b2c05aaf0c7282e46d9b2b4dfcbed2a32be60","@whatwg-node/fetch":"0.9.17","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.33.0-alpha-20240423123927-b43b2c05aaf0c7282e46d9b2b4dfcbed2a32be60_1713875992264_0.8567825651248722","host":"s3://npm-registry-packages"}},"0.33.0-alpha-20240423124104-1c7333a51c6f2d254de0103db8523f268bc698f5":{"name":"@graphql-hive/client","version":"0.33.0-alpha-20240423124104-1c7333a51c6f2d254de0103db8523f268bc698f5","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.33.0-alpha-20240423124104-1c7333a51c6f2d254de0103db8523f268bc698f5","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"c97d89ce92c9079ba846ce2ad77a7190160bf38d","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.33.0-alpha-20240423124104-1c7333a51c6f2d254de0103db8523f268bc698f5.tgz","fileCount":68,"integrity":"sha512-T+N3WO2boZwN/nOuM2QedpK+DsuhvdSbjy9UggadClPMJszLQNYkh1L0pSDAb7BjDU5J7RG3wlGwhXTl7VPgdw==","signatures":[{"sig":"MEUCIDooAhp+BckRHaXQXB77qhd5LFPQGmdDL8Xuw5FefbfzAiEA35k0ylfqW2scmKpdOrULdScwY/czuW0A/ZWo93SVd0U=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":256957},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.33.0-alpha-20240423124104-1c7333a51c6f2d254de0103db8523f268bc698f5.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### GraphQL Yoga and Cloudflare Workers\n\nIf you're using Cloudflare Workers, you can use the following code:\n\n```typescript\nimport { useYogaHive, createYogaHive, useYogaHive } from '@graphql-hive/client'\nimport { createYoga } from 'graphql-yoga'\n\nexport default {\n  async fetch(request, env, ctx) {\n    const hive = createYogaHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: true // Collects schema usage based on operations\n    });\n\n    const yoga = createYoga({\n      plugins: [\n        useYogaHive(hive)\n      ]\n    });\n\n    const response = await yoga.fetch(request, env, ctx);\n    ctx.waitUntil(hive.dispose());\n    return response;\n  }\n}\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n\n// When server is shutting down\nasync function onShutdown() {\n  await hive.close()\n}\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/3970e2502354107b7a6cca681f4e9d1c/graphql-hive-client-0.33.0-alpha-20240423124104-1c7333a51c6f2d254de0103db8523f268bc698f5.tgz","_integrity":"sha512-T+N3WO2boZwN/nOuM2QedpK+DsuhvdSbjy9UggadClPMJszLQNYkh1L0pSDAb7BjDU5J7RG3wlGwhXTl7VPgdw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.3","dependencies":{"tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"0.3.0-alpha-20240423124104-1c7333a51c6f2d254de0103db8523f268bc698f5","@whatwg-node/fetch":"0.9.17","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.33.0-alpha-20240423124104-1c7333a51c6f2d254de0103db8523f268bc698f5_1713876090249_0.40248064832611363","host":"s3://npm-registry-packages"}},"0.33.0-alpha-20240423124255-dfc190950f40f0c3f5d918013e45de75a0897b5c":{"name":"@graphql-hive/client","version":"0.33.0-alpha-20240423124255-dfc190950f40f0c3f5d918013e45de75a0897b5c","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.33.0-alpha-20240423124255-dfc190950f40f0c3f5d918013e45de75a0897b5c","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"facb64e417bae7e05ebce2950ac91f11446f4e7a","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.33.0-alpha-20240423124255-dfc190950f40f0c3f5d918013e45de75a0897b5c.tgz","fileCount":68,"integrity":"sha512-GfE1lrS7gpbCSvp9Yh1vjSzTO8O1R9s9V2orro/oelCxxpi7qs+vGQf7YS1EPSrVTMQiomvb7bJiUjmh1Tt4PA==","signatures":[{"sig":"MEUCIQDZ6ob+Z2NfbAo/WibY9dVRpgtxNndK46W5I3M1uy7AGgIgKJThYete3vF6dAp8ypz+CpCAHnuEnIZW4LpT4Z6RZbQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":256957},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.33.0-alpha-20240423124255-dfc190950f40f0c3f5d918013e45de75a0897b5c.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### GraphQL Yoga and Cloudflare Workers\n\nIf you're using Cloudflare Workers, you can use the following code:\n\n```typescript\nimport { useYogaHive, createYogaHive, useYogaHive } from '@graphql-hive/client'\nimport { createYoga } from 'graphql-yoga'\n\nexport default {\n  async fetch(request, env, ctx) {\n    const hive = createYogaHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: true // Collects schema usage based on operations\n    });\n\n    const yoga = createYoga({\n      plugins: [\n        useYogaHive(hive)\n      ]\n    });\n\n    const response = await yoga.fetch(request, env, ctx);\n    ctx.waitUntil(hive.dispose());\n    return response;\n  }\n}\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n\n// When server is shutting down\nasync function onShutdown() {\n  await hive.close()\n}\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/64c697f334e4687bfb36c4ef033ec813/graphql-hive-client-0.33.0-alpha-20240423124255-dfc190950f40f0c3f5d918013e45de75a0897b5c.tgz","_integrity":"sha512-GfE1lrS7gpbCSvp9Yh1vjSzTO8O1R9s9V2orro/oelCxxpi7qs+vGQf7YS1EPSrVTMQiomvb7bJiUjmh1Tt4PA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.3","dependencies":{"tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"0.3.0-alpha-20240423124255-dfc190950f40f0c3f5d918013e45de75a0897b5c","@whatwg-node/fetch":"0.9.17","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.33.0-alpha-20240423124255-dfc190950f40f0c3f5d918013e45de75a0897b5c_1713876199706_0.19134707052353672","host":"s3://npm-registry-packages"}},"0.33.0-alpha-20240423124527-189fc7527c58774fce4b81cbd15f830b5fe57df7":{"name":"@graphql-hive/client","version":"0.33.0-alpha-20240423124527-189fc7527c58774fce4b81cbd15f830b5fe57df7","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.33.0-alpha-20240423124527-189fc7527c58774fce4b81cbd15f830b5fe57df7","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"4750cf1896979cb8a3c2c6d0dfb3e431aeef17f5","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.33.0-alpha-20240423124527-189fc7527c58774fce4b81cbd15f830b5fe57df7.tgz","fileCount":68,"integrity":"sha512-z+tVVqGeCCt4yOZeL6updBZ/Z2fcgCxsyfhHTPalSpZKM0UoyOUXesH4s2DiA17xI8xuR/0QIe9mWV35l6L+NA==","signatures":[{"sig":"MEUCIAveAlffFBiyaFBXqWFlLGhhGY2+F+HeJBlVPmBRSdu1AiEA275kJt/WMPyFt4Ln9VIxFgFkFsWllSLedR4mbiVi/F0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":256957},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.33.0-alpha-20240423124527-189fc7527c58774fce4b81cbd15f830b5fe57df7.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### GraphQL Yoga and Cloudflare Workers\n\nIf you're using Cloudflare Workers, you can use the following code:\n\n```typescript\nimport { useYogaHive, createYogaHive, useYogaHive } from '@graphql-hive/client'\nimport { createYoga } from 'graphql-yoga'\n\nexport default {\n  async fetch(request, env, ctx) {\n    const hive = createYogaHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: true // Collects schema usage based on operations\n    });\n\n    const yoga = createYoga({\n      plugins: [\n        useYogaHive(hive)\n      ]\n    });\n\n    const response = await yoga.fetch(request, env, ctx);\n    ctx.waitUntil(hive.dispose());\n    return response;\n  }\n}\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n\n// When server is shutting down\nasync function onShutdown() {\n  await hive.close()\n}\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/eba48a231023822fdeace9b59b5648c3/graphql-hive-client-0.33.0-alpha-20240423124527-189fc7527c58774fce4b81cbd15f830b5fe57df7.tgz","_integrity":"sha512-z+tVVqGeCCt4yOZeL6updBZ/Z2fcgCxsyfhHTPalSpZKM0UoyOUXesH4s2DiA17xI8xuR/0QIe9mWV35l6L+NA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.3","dependencies":{"tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"0.3.0-alpha-20240423124527-189fc7527c58774fce4b81cbd15f830b5fe57df7","@whatwg-node/fetch":"0.9.17","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.33.0-alpha-20240423124527-189fc7527c58774fce4b81cbd15f830b5fe57df7_1713876351654_0.43411766250204886","host":"s3://npm-registry-packages"}},"0.33.0-alpha-20240423124738-98a3ed981659c89feab0c1a16481dfacfbd9b0f5":{"name":"@graphql-hive/client","version":"0.33.0-alpha-20240423124738-98a3ed981659c89feab0c1a16481dfacfbd9b0f5","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.33.0-alpha-20240423124738-98a3ed981659c89feab0c1a16481dfacfbd9b0f5","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"fb5a862b45222311eaa90f5e01292f02d09f2cf9","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.33.0-alpha-20240423124738-98a3ed981659c89feab0c1a16481dfacfbd9b0f5.tgz","fileCount":68,"integrity":"sha512-7tbb4njB4uLQokqdqSfyEyQEqb+dYCSHaNhL1QwvhAzj/O57vLlvHD6NY9OsXJClnaIHtiDSLkCeOpcum5yplw==","signatures":[{"sig":"MEUCIBjD+2Fa9f3GaHOXXJYnR8O4WtIkrDm9X3ozHEoI6c3iAiEA3gRLwNxJ3ipvL7JDJd9li/V9HwtkGdwSOOncU6jMhTc=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":256957},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.33.0-alpha-20240423124738-98a3ed981659c89feab0c1a16481dfacfbd9b0f5.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### GraphQL Yoga and Cloudflare Workers\n\nIf you're using Cloudflare Workers, you can use the following code:\n\n```typescript\nimport { useYogaHive, createYogaHive, useYogaHive } from '@graphql-hive/client'\nimport { createYoga } from 'graphql-yoga'\n\nexport default {\n  async fetch(request, env, ctx) {\n    const hive = createYogaHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: true // Collects schema usage based on operations\n    });\n\n    const yoga = createYoga({\n      plugins: [\n        useYogaHive(hive)\n      ]\n    });\n\n    const response = await yoga.fetch(request, env, ctx);\n    ctx.waitUntil(hive.dispose());\n    return response;\n  }\n}\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n\n// When server is shutting down\nasync function onShutdown() {\n  await hive.close()\n}\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/cafb93960dcca4bafb54f24bc1a0c586/graphql-hive-client-0.33.0-alpha-20240423124738-98a3ed981659c89feab0c1a16481dfacfbd9b0f5.tgz","_integrity":"sha512-7tbb4njB4uLQokqdqSfyEyQEqb+dYCSHaNhL1QwvhAzj/O57vLlvHD6NY9OsXJClnaIHtiDSLkCeOpcum5yplw==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.3","dependencies":{"tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"0.3.0-alpha-20240423124738-98a3ed981659c89feab0c1a16481dfacfbd9b0f5","@whatwg-node/fetch":"0.9.17","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.33.0-alpha-20240423124738-98a3ed981659c89feab0c1a16481dfacfbd9b0f5_1713876482239_0.31394045034778606","host":"s3://npm-registry-packages"}},"0.33.0-alpha-20240423134818-25e6bc59e3ac7e6617cc4d349867034d0e740d08":{"name":"@graphql-hive/client","version":"0.33.0-alpha-20240423134818-25e6bc59e3ac7e6617cc4d349867034d0e740d08","author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","_id":"@graphql-hive/client@0.33.0-alpha-20240423134818-25e6bc59e3ac7e6617cc4d349867034d0e740d08","maintainers":[{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},{"name":"dotansimha","email":"dotansimha@gmail.com"}],"homepage":"https://graphql-hive.com","bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"dist":{"shasum":"d0990bc39ab39e26d0ccf2e1bac7711d901534e9","tarball":"https://registry.npmjs.org/@graphql-hive/client/-/client-0.33.0-alpha-20240423134818-25e6bc59e3ac7e6617cc4d349867034d0e740d08.tgz","fileCount":68,"integrity":"sha512-qesRL6IkYP5GL2ryVCQJ/Uwd+jxool9YFKJ4oB+ARvjyyqNWYkVcDTG0svZY90kWhhTWQbPxNauC72sLWdF+jA==","signatures":[{"sig":"MEQCIDLmKVYQEm/ehKx+Q9Ypnr0s26FG3m0HaIEKR3xslSGaAiAaVS7qDwqFWbL4Q+AkM0SKuL8IWIFOJMESB1OWKafbOA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":256957},"main":"cjs/index.js","type":"module","_from":"file:graphql-hive-client-0.33.0-alpha-20240423134818-25e6bc59e3ac7e6617cc4d349867034d0e740d08.tgz","module":"esm/index.js","readme":"# GraphQL Hive Client\n\n[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage\nand collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema\nstitching, federation, or just a good old monolith.\n\nGraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy\nlifting behind the scenes be managing the registry, scaling it for your needs, to free your time to\nfocus on the most important things at hand.\n\n## Installation\n\n```\nnpm install @graphql-hive/client\n```\n\n## Basic Usage\n\nHive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and\n[Apollo Server](https://github.com/apollographql/apollo-server)\n\n### With GraphQL Yoga\n\n[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever\nbuilt on top of the envelop engine.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n\nserver.start()\n```\n\n### GraphQL Yoga and Cloudflare Workers\n\nIf you're using Cloudflare Workers, you can use the following code:\n\n```typescript\nimport { useYogaHive, createYogaHive, useYogaHive } from '@graphql-hive/client'\nimport { createYoga } from 'graphql-yoga'\n\nexport default {\n  async fetch(request, env, ctx) {\n    const hive = createYogaHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: true // Collects schema usage based on operations\n    });\n\n    const yoga = createYoga({\n      plugins: [\n        useYogaHive(hive)\n      ]\n    });\n\n    const response = await yoga.fetch(request, env, ctx);\n    ctx.waitUntil(hive.dispose());\n    return response;\n  }\n}\n```\n\n### With Envelop\n\nIf you're not familiar with Envelop - in \"short\" it's a lightweight JavaScript library for wrapping\nGraphQL execution layer and flow, allowing developers to develop, share and collaborate on\nGraphQL-related plugins, while filling the missing pieces in GraphQL implementations.\n\nHere's [more](https://github.com/dotansimha/envelop#envelop) on that topic.\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      // Schema reporting\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the schema version',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Apollo Server\n\nThanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:\n\n```ts\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      debug: true, // Debugging mode\n      token: 'YOUR-TOKEN',\n      reporting: {\n        // feel free to set dummy values here\n        author: 'Author of the latest change',\n        commit: 'git sha or any identifier'\n      },\n      usage: true // Collects schema usage based on operations\n    })\n  ]\n})\n```\n\n### With Other Servers\n\nFirst you need to instantiate the Hive Client.\n\nThe `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a\nfunction that expects the execution result object.\n\n- `collectUsage(args)` - should be called when a GraphQL execution starts.\n- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after\n  execution finishes.\n\n```ts\nimport express from 'express'\nimport { graphqlHTTP } from 'express-graphql'\nimport { createHive } from '@graphql-hive/client'\n\nconst app = express()\nconst hive = createHive({\n  enabled: true, // Enable/Disable Hive Client\n  debug: true, // Debugging mode\n  token: 'YOUR-TOKEN',\n  reporting: {\n    // feel free to set dummy values here\n    author: 'Author of the latest change',\n    commit: 'git sha or any identifier'\n  },\n  usage: true // Collects schema usage based operations\n})\n\n// Report Schema\nhive.reportSchema({ schema: yourSchema })\n\napp.post(\n  '/graphql',\n  graphqlHTTP({\n    schema: yourSchema,\n    async customExecuteFn(args) {\n      // Collecting usage\n      const finish = hive.collectUsage(args)\n      const result = await execute(args)\n      finish(result)\n      return result\n    }\n  })\n)\n\n// When server is shutting down\nasync function onShutdown() {\n  await hive.close()\n}\n```\n\n### Using the registry when Stitching\n\nStitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,\nnot something dedicated for stitching. Unfortunately the implementation of gateway + polling is up\nto you.\n\nPrerequisites:\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access key\n\nThe `createServicesFetcher` factory function returns another function that is responsible for\nfetching a list of services from Hive's high-availability endpoint.\n\n```ts\nimport { createServicesFetcher } from '@graphql-hive/client'\n\nconst fetchServices = createServicesFetcher({\n  endpoint: process.env.HIVE_CDN_ENDPOINT,\n  key: process.env.HIVE_CDN_KEY\n})\n\n// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.\nstartMyGraphQLGateway({\n  // a function that resolves a list of services to stitch them together\n  async stitchServices() {\n    const services = await fetchServices()\n\n    return services.map(service => {\n      return {\n        sdl: service.sdl,\n        url: service.url,\n        checksum: service.id // to check if service's schema was modified\n      }\n    })\n  },\n  pollingInSec: 10 // every 10s\n})\n```\n\n### Using the registry with Apollo Gateway\n\nYou can connect your Apollo Gateway with Hive client.\n\n- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step\n- `HIVE_CDN_KEY` - the access\n\n```ts\nimport { ApolloGateway } from '@apollo/gateway'\nimport { ApolloServer } from '@apollo/server'\nimport { startStandaloneServer } from '@apollo/server/standalone'\nimport { createSupergraphManager } from '@graphql-hive/client'\n\nconst gateway = new ApolloGateway({\n  // Apollo Gateway will fetch Supergraph from GraphQL Hive CDN\n  supergraphSdl: createSupergraphManager({\n    endpoint: HIVE_CDN_ENDPOINT,\n    key: HIVE_CDN_KEY,\n    pollIntervalInMs: 15_000\n  })\n})\n\nconst server = new ApolloServer({\n  gateway\n})\n\nconst { url } = await startStandaloneServer({ server })\nconsole.log(`🚀 Server ready at ${url}`)\n```\n\n## Usage Reporting configuration\n\n### Client Info\n\nThe schema usage operation information can be enriched with meta information that will be displayed\non the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL\noperation.\n\n### GraphQL Yoga Example\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n#### Envelop Example\n\n```ts\nimport { envelop } from '@envelop/core'\nimport { useHive } from '@graphql-hive/client'\n\nconst envelopProxy = envelop({\n  plugins: [\n    useHive({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: Request }) {\n          const name = ctx.req.headers.get('x-graphql-client-name')\n          const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n#### Apollo Server Example\n\n```ts\nimport type { IncomingMessage } from 'http'\nimport { ApolloServer } from 'apollo-server'\nimport { hiveApollo } from '@graphql-hive/client'\n\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  plugins: [\n    hiveApollo({\n      enabled: true, // Enable/Disable Hive Client\n      token: 'YOUR-TOKEN',\n      usage: {\n        clientInfo(ctx: { req: IncomingMessage }) {\n          const name = ctx.req.headers['x-graphql-client-name']\n          const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'\n\n          if (name) {\n            return { name, version }\n          }\n\n          return null\n        }\n      }\n    })\n  ]\n})\n```\n\n### Sampling\n\n#### Basic sampling\n\nWith `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting\nit to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that\nevery operation will be reported at least once (see `atLeastOnceSampler`).\n\nDefault: `1` (100%)\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampleRate: 0.6 // 60% of the operations will be sent to Hive\n  }\n})\n```\n\n#### Dynamic sampling\n\nGraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to\nimplement dynamic sampling based on the operation's context.\n\nIf `sampler` is defined, `sampleRate` is ignored.\n\nA sample rate between 0 and 1.\n\n- `0.0` = 0% chance of being sent\n- `1.0` = 100% chance of being sent.\n- `true` = 100%\n- `false` = 0%\n\n```typescript\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler(samplingContext) {\n      if (samplingContext.operationName === 'GetUser') {\n        return 0.5 // 50% of GetUser operations will be sent to Hive\n      }\n\n      return 0.7; // 70% of the other operations will be sent to Hive\n    }\n  }\n})\n```\n\n#### At-least-once sampling\n\nIf you want to make sure that every operation is reported at least once, you can use the\n`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is\ndecided by the sampler.\n\n```typescript\nimport { useHive, atLeastOnceSampler} from '@graphql-hive/client';\n\nuseHive({\n  /* ... other options ... */,\n  usage: {\n    sampler: atLeastOnceSampler({\n      // Produces a unique key for a given GraphQL request.\n      // This key is used to determine the uniqueness of a GraphQL operation.\n      keyFn(samplingContext) {\n        // Operation name is a good candidate for a key, but not perfect,\n        // as not all operations have names\n        // and some operations may have the same name but different body.\n        return samplingContext.operationName;\n      },\n      sampler(_samplingContext) {\n        const hour = new Date().getHours();\n\n        if (hour >= 9 && hour <= 17) {\n          return 0.3;\n        }\n\n        return 0.8;\n      }\n    })\n  }\n})\n```\n\n## Self-Hosting\n\nTo align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in\nthe client configuration.\n\nThe example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and\nothers.\n\n```ts\nimport { useHive } from '@graphql-hive/client'\nimport { createYoga } from '@graphql-yoga/node'\n\nconst server = createYoga({\n  plugins: [\n    useHive({\n      enabled: true,\n      token: 'YOUR-TOKEN',\n      selfHosting: {\n        graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',\n        applicationUrl: 'https://your-own-graphql-hive.com',\n        usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional\n      }\n    })\n  ]\n})\n\nserver.start()\n```\n\n> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and\n> `options.usage.endpoint`.\n","engines":{"node":">=14.0.0"},"exports":{".":{"import":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"default":{"types":"./typings/index.d.ts","default":"./esm/index.js"},"require":{"types":"./typings/index.d.cts","default":"./cjs/index.js"}},"./package.json":"./package.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kamilkisiela","email":"kamil.kisiela@gmail.com"},"_resolved":"/tmp/e994267aec180072428621f9808708bd/graphql-hive-client-0.33.0-alpha-20240423134818-25e6bc59e3ac7e6617cc4d349867034d0e740d08.tgz","_integrity":"sha512-qesRL6IkYP5GL2ryVCQJ/Uwd+jxool9YFKJ4oB+ARvjyyqNWYkVcDTG0svZY90kWhhTWQbPxNauC72sLWdF+jA==","deprecated":"Please read: https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"typescript":{"definition":"typings/index.d.ts"},"_npmVersion":"10.5.0","description":"A NodeJS client for GraphQL Hive","directories":{},"sideEffects":false,"_nodeVersion":"21.7.3","dependencies":{"tiny-lru":"8.0.2","async-retry":"1.3.3","@apollo/server":"^4.0.0","@envelop/types":"^5.0.0","@graphql-hive/core":"0.3.0-alpha-20240423134818-25e6bc59e3ac7e6617cc4d349867034d0e740d08","@whatwg-node/fetch":"0.9.17","@graphql-tools/utils":"^10.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"graphql":"^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"},"optionalDependencies":{"@apollo/server":"^4.0.0","@envelop/types":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_0.33.0-alpha-20240423134818-25e6bc59e3ac7e6617cc4d349867034d0e740d08_1713880123246_0.5721051118614011","host":"s3://npm-registry-packages"}}},"time":{"created":"2021-04-22T09:45:29.287Z","modified":"2025-03-19T08:59:18.562Z","0.0.1":"2021-04-22T09:45:29.814Z","0.0.2":"2021-04-22T13:00:10.993Z","0.0.3":"2021-04-22T13:27:08.211Z","0.0.4":"2021-04-23T07:55:54.658Z","0.0.5":"2021-04-23T10:44:01.213Z","0.0.6":"2021-04-26T11:27:58.959Z","0.0.7":"2021-04-26T12:02:12.104Z","0.0.8":"2021-04-26T12:53:27.609Z","0.1.0":"2021-05-06T10:18:10.412Z","0.1.1":"2021-05-06T13:05:44.780Z","0.1.2":"2021-05-11T12:33:31.212Z","0.1.3":"2021-05-11T13:37:20.813Z","0.2.0":"2021-05-26T06:37:35.442Z","0.2.1":"2021-05-26T18:49:34.574Z","0.2.2":"2021-05-31T09:48:06.174Z","0.3.0":"2021-06-01T18:42:53.428Z","0.3.1":"2021-06-03T16:01:43.590Z","0.3.2":"2021-06-08T08:54:19.969Z","0.3.3":"2021-06-08T15:52:51.570Z","0.4.0":"2021-06-09T17:07:51.524Z","0.4.1":"2021-06-10T12:24:16.931Z","0.4.2":"2021-06-12T17:53:17.870Z","0.4.3":"2021-06-12T18:14:07.494Z","0.4.4":"2021-06-15T16:24:13.264Z","0.4.5":"2021-06-22T08:57:45.998Z","0.5.0":"2021-08-10T10:12:39.222Z","0.5.1":"2021-08-10T12:14:53.741Z","0.5.2":"2021-08-12T08:08:28.745Z","0.5.3":"2021-08-16T07:36:10.828Z","0.6.0":"2021-08-19T13:30:56.163Z","0.6.1":"2021-08-19T13:59:41.748Z","0.6.3":"2021-08-23T07:48:15.822Z","0.7.0":"2021-08-24T10:32:37.990Z","0.8.0":"2021-08-26T10:00:10.010Z","0.9.0":"2021-09-14T11:58:08.087Z","0.9.1":"2021-09-14T16:50:43.598Z","0.10.0":"2021-09-15T17:01:09.469Z","0.11.0":"2021-11-08T11:51:20.375Z","0.11.1":"2021-11-18T12:22:12.506Z","0.12.0":"2021-12-08T16:38:26.084Z","0.13.0":"2022-01-19T09:27:10.672Z","0.14.0":"2022-02-08T17:56:51.291Z","0.14.1":"2022-02-14T10:20:29.744Z","0.14.2":"2022-02-14T10:29:49.817Z","0.15.0":"2022-04-01T13:22:13.849Z","0.15.1":"2022-04-20T07:30:01.083Z","0.15.2":"2022-04-22T10:17:38.004Z","0.15.4":"2022-05-25T13:59:01.301Z","0.16.0":"2022-06-23T15:25:59.123Z","0.17.0":"2022-07-01T10:38:08.281Z","0.18.0":"2022-07-27T15:18:13.180Z","0.18.1":"2022-08-03T09:48:40.493Z","0.18.2":"2022-08-12T14:10:39.957Z","0.18.3":"2022-08-23T13:58:11.239Z","0.18.4":"2022-09-22T11:50:15.799Z","0.18.5":"2022-09-22T17:21:34.993Z","0.19.0":"2022-09-30T15:42:00.875Z","0.20.0":"2022-10-18T07:42:37.857Z","0.20.1":"2022-10-27T09:18:13.385Z","0.21.0":"2022-10-31T09:21:11.796Z","0.21.1":"2022-11-10T13:22:32.952Z","0.21.2":"2022-11-21T16:50:25.713Z","0.21.3":"2022-11-22T17:25:14.540Z","0.21.4":"2022-11-29T14:52:13.105Z","0.21.5-alpha-20221220122847-0b3f830":"2022-12-20T12:29:23.853Z","0.21.5-alpha-20221220123315-e9e3ec0":"2022-12-20T12:33:50.799Z","0.21.5-alpha-20221220123606-037b8a5":"2022-12-20T12:36:42.026Z","0.21.5-alpha-20221220123922-b7ecc5f":"2022-12-20T12:40:14.465Z","0.21.5-alpha-20221220124030-632f24d":"2022-12-20T12:41:14.779Z","0.21.5-alpha-20221220135647-6ade6c4":"2022-12-20T13:57:30.947Z","0.21.5-alpha-20221220141618-b37f156":"2022-12-20T14:16:59.567Z","0.21.5-alpha-20221220143518-0296709":"2022-12-20T14:35:54.494Z","0.21.5-alpha-20221220153507-c723b59":"2022-12-20T15:36:33.194Z","0.21.5-alpha-20221220154815-c0c23b8":"2022-12-20T15:48:54.168Z","0.21.5-alpha-20221220160419-a8bdfb6":"2022-12-20T16:04:53.897Z","0.21.5-alpha-20221220163215-fc0e439":"2022-12-20T16:32:51.275Z","0.21.5-alpha-20221220163732-7b6b37c":"2022-12-20T16:38:08.013Z","0.21.5-alpha-20221220163937-1645a4b":"2022-12-20T16:40:21.589Z","0.21.5-alpha-20221220231211-5c58be9":"2022-12-20T23:12:51.936Z","0.21.5-alpha-20221220231428-fec2f78":"2022-12-20T23:15:17.332Z","0.21.5-alpha-20221221020211-c861948":"2022-12-21T02:02:45.829Z","0.21.5-alpha-20221221071800-d000145":"2022-12-21T07:18:35.405Z","0.21.5-alpha-20221221073243-8a34191":"2022-12-21T07:33:30.880Z","0.21.5-alpha-20221221080035-17c6ef4":"2022-12-21T08:01:15.933Z","0.21.5-alpha-20221221083450-7f91b48":"2022-12-21T08:35:24.360Z","0.21.5-alpha-20221221083947-fe6e502":"2022-12-21T08:40:21.872Z","0.21.5-alpha-20221221085011-7f15a60":"2022-12-21T08:50:45.376Z","0.21.5-alpha-20221221090804-384d9f4":"2022-12-21T09:08:39.470Z","0.21.5-alpha-20221221091556-ac5eb9d":"2022-12-21T09:16:30.770Z","0.21.5-alpha-20221221092617-e418294":"2022-12-21T09:26:59.227Z","0.21.5-alpha-20221221094949-51ad7a8":"2022-12-21T09:50:23.513Z","0.21.5-alpha-20221221095413-0245cc1":"2022-12-21T09:54:49.948Z","0.21.5-alpha-20221221100835-c7f3bf9":"2022-12-21T10:09:10.460Z","0.21.5-alpha-20221221111529-7031b28":"2022-12-21T11:16:16.208Z","0.21.5-alpha-20221221112122-56a2395":"2022-12-21T11:22:02.094Z","0.21.5-alpha-20221221113112-c3129af":"2022-12-21T11:31:46.278Z","0.21.5-alpha-20221221113331-5dbee78":"2022-12-21T11:34:12.089Z","0.21.5-alpha-20221221130732-dedb201":"2022-12-21T13:08:09.610Z","0.21.5-alpha-20221221131208-9ad8d7b":"2022-12-21T13:12:47.945Z","0.21.5-alpha-20221221140151-07b6ed9":"2022-12-21T14:02:31.698Z","0.21.5-alpha-20221221160921-36c76eb":"2022-12-21T16:09:56.147Z","0.21.5-alpha-20221221162420-167811a":"2022-12-21T16:24:53.954Z","0.21.5-alpha-20221221162902-6d08baa":"2022-12-21T16:29:38.125Z","0.21.5-alpha-20221221173857-d596ec3":"2022-12-21T17:39:34.348Z","0.21.5-alpha-20221221183618-3856ed1":"2022-12-21T18:36:53.806Z","0.21.5-alpha-20221221183941-dc6aeee":"2022-12-21T18:40:17.086Z","0.21.5-alpha-20221221184012-35d6449":"2022-12-21T18:40:58.215Z","0.21.5-alpha-20221221184506-fb6de72":"2022-12-21T18:45:40.637Z","0.21.5-alpha-20221221185021-88eba6e":"2022-12-21T18:50:55.289Z","0.21.5-alpha-20221221185654-327304a":"2022-12-21T18:57:27.946Z","0.21.5-alpha-20221221190321-e289808":"2022-12-21T19:04:03.903Z","0.21.5-alpha-20221221190530-54f91ec":"2022-12-21T19:06:07.037Z","0.21.5-alpha-20221221191038-31bb04c":"2022-12-21T19:11:12.290Z","0.21.5-alpha-20221221191551-4136d2e":"2022-12-21T19:16:26.003Z","0.21.5-alpha-20221221191843-e4e82ab":"2022-12-21T19:19:18.481Z","0.21.5-alpha-20221221191848-0f3a610":"2022-12-21T19:19:24.475Z","0.21.5-alpha-20221221192421-71e32fc":"2022-12-21T19:25:01.385Z","0.21.5-alpha-20221221192927-e8a12eb":"2022-12-21T19:30:06.224Z","0.21.5-alpha-20221221193950-fd8d3d6":"2022-12-21T19:40:24.339Z","0.21.5-alpha-20221221194501-446e963":"2022-12-21T19:45:36.919Z","0.21.5-alpha-20221221195016-ca99e63":"2022-12-21T19:50:54.011Z","0.21.5-alpha-20221221195207-46727d7":"2022-12-21T19:52:41.689Z","0.21.5-alpha-20221221230406-3b89db8":"2022-12-21T23:04:40.835Z","0.21.5-alpha-20221221230409-9d749b2":"2022-12-21T23:04:43.145Z","0.21.5-alpha-20221222012353-90aa482":"2022-12-22T01:24:27.003Z","0.21.5-alpha-20221222012356-40ddc17":"2022-12-22T01:24:30.561Z","0.21.5-alpha-20221222042257-783a413":"2022-12-22T04:23:31.999Z","0.21.5-alpha-20221222042817-10dae23":"2022-12-22T04:28:51.473Z","0.21.5-alpha-20221222074533-d1ab1a7":"2022-12-22T07:46:07.705Z","0.21.5-alpha-20221222074713-4bfaf78":"2022-12-22T07:47:49.905Z","0.21.5-alpha-20221222074725-9ce1abb":"2022-12-22T07:48:00.641Z","0.21.5-alpha-20221222074732-61abd91":"2022-12-22T07:48:13.020Z","0.21.5-alpha-20221222074941-81aa4ca":"2022-12-22T07:50:15.065Z","0.21.5-alpha-20221222075218-7886548":"2022-12-22T07:52:51.412Z","0.21.5-alpha-20221222075244-5a0b29f":"2022-12-22T07:53:17.661Z","0.21.5-alpha-20221222075434-7256011":"2022-12-22T07:55:20.252Z","0.21.5-alpha-20221222075830-402133c":"2022-12-22T07:59:03.856Z","0.21.5-alpha-20221222080415-341a00e":"2022-12-22T08:04:48.868Z","0.21.5-alpha-20221222080935-5956a87":"2022-12-22T08:10:09.551Z","0.21.5-alpha-20221222082741-b4e4376":"2022-12-22T08:28:15.521Z","0.21.5-alpha-20221222082745-029b4e6":"2022-12-22T08:28:21.030Z","0.21.5-alpha-20221222082944-5489de6":"2022-12-22T08:30:18.075Z","0.21.5-alpha-20221222083351-984982d":"2022-12-22T08:34:31.775Z","0.21.5-alpha-20221222083747-108007d":"2022-12-22T08:38:20.744Z","0.21.5-alpha-20221222084548-c397477":"2022-12-22T08:46:21.521Z","0.21.5-alpha-20221222085025-02104d8":"2022-12-22T08:51:11.663Z","0.21.5-alpha-20221222085222-9b12bb3":"2022-12-22T08:52:57.240Z","0.21.5-alpha-20221222085355-ca22871":"2022-12-22T08:54:29.365Z","0.21.5-alpha-20221222093223-9592eb7":"2022-12-22T09:32:59.693Z","0.21.5-alpha-20221222093809-65be1e8":"2022-12-22T09:38:50.474Z","0.21.5-alpha-20221222094306-970bac4":"2022-12-22T09:43:43.864Z","0.21.5-alpha-20221222095322-ed5940d":"2022-12-22T09:53:58.490Z","0.21.5-alpha-20221222095410-4902c5f":"2022-12-22T09:54:55.640Z","0.22.0-alpha-20221222095610-acc1db0":"2022-12-22T09:56:46.098Z","0.21.5-alpha-20221222095832-c0e082e":"2022-12-22T09:59:15.182Z","0.21.5-alpha-20221222095947-a60675f":"2022-12-22T10:00:21.160Z","0.21.5-alpha-20221222100733-865d119":"2022-12-22T10:08:17.784Z","0.21.5-alpha-20221222101243-f1e4aa4":"2022-12-22T10:13:17.850Z","0.21.5-alpha-20221222101754-eb1c238":"2022-12-22T10:18:32.165Z","0.21.5-alpha-20221222105058-9fca3fc":"2022-12-22T10:51:39.483Z","0.21.5-alpha-20221222105419-ac4edb9":"2022-12-22T10:54:54.420Z","0.22.0-alpha-20221222112452-bb0da5e":"2022-12-22T11:25:28.766Z","0.22.0-alpha-20221222113039-67d8069":"2022-12-22T11:31:30.275Z","0.22.0-alpha-20221222113513-921dbff":"2022-12-22T11:35:47.821Z","0.22.0-alpha-20221222114530-160d0d8":"2022-12-22T11:46:05.775Z","0.22.0-alpha-20221222115130-3a708d1":"2022-12-22T11:52:18.126Z","0.22.0-alpha-20221222115245-7b3e0d1":"2022-12-22T11:53:21.585Z","0.22.0-alpha-20221222121024-6b76508":"2022-12-22T12:10:59.784Z","0.22.0-alpha-20221222121533-d57751e":"2022-12-22T12:16:08.210Z","0.22.0-alpha-20221222122052-6b4065e":"2022-12-22T12:21:25.708Z","0.22.0-alpha-20221222123148-2ad655c":"2022-12-22T12:32:22.684Z","0.22.0-alpha-20221222123652-da2110f":"2022-12-22T12:37:27.673Z","0.22.0-alpha-20221222123906-ff709e7":"2022-12-22T12:39:52.836Z","0.22.0-alpha-20221222190957-8730c23":"2022-12-22T19:10:31.073Z","0.22.0-alpha-20221222204442-96c67e9":"2022-12-22T20:45:18.614Z","0.22.0-alpha-20221222204918-a19df1e":"2022-12-22T20:49:52.221Z","0.22.0-alpha-20221223000602-6123054":"2022-12-23T00:06:38.144Z","0.22.0-alpha-20221223001143-c470495":"2022-12-23T00:12:16.284Z","0.22.0-alpha-20221223025346-8197d0a":"2022-12-23T02:54:26.120Z","0.22.0-alpha-20221223025521-bbb761d":"2022-12-23T02:55:56.923Z","0.22.0-alpha-20221223051244-9d09446":"2022-12-23T05:13:20.319Z","0.22.0-alpha-20221223051806-64b0a26":"2022-12-23T05:18:48.223Z","0.22.0-alpha-20221223113035-eb1d3f5":"2022-12-23T11:31:09.012Z","0.22.0-alpha-20221223113408-f7d2abf":"2022-12-23T11:34:47.488Z","0.22.0-alpha-20221223113429-d1c379e":"2022-12-23T11:35:13.542Z","0.22.0-alpha-20221223135238-a108575":"2022-12-23T13:53:13.590Z","0.21.5-alpha-20221223140651-74d150f":"2022-12-23T14:07:25.910Z","0.22.0-alpha-20221223195553-6aaaa44":"2022-12-23T19:56:44.807Z","0.22.0-alpha-20221223200052-7754d6f":"2022-12-23T20:01:37.368Z","0.22.0-alpha-20221223225128-99dd99e":"2022-12-23T22:52:03.401Z","0.22.0-alpha-20221224015458-2e377cd":"2022-12-24T01:55:33.432Z","0.22.0-alpha-20221224072654-6af7369":"2022-12-24T07:27:34.782Z","0.22.0-alpha-20221224073100-f11eb97":"2022-12-24T07:31:35.501Z","0.22.0-alpha-20221224073632-ce6e275":"2022-12-24T07:37:06.210Z","0.22.0-alpha-20221224074727-31c5463":"2022-12-24T07:48:01.832Z","0.22.0-alpha-20221224075338-6fa66c5":"2022-12-24T07:54:12.452Z","0.22.0-alpha-20221224083017-247273d":"2022-12-24T08:30:51.140Z","0.22.0-alpha-20221224083542-526379f":"2022-12-24T08:36:16.921Z","0.22.0-alpha-20221224084054-1738bcc":"2022-12-24T08:41:28.564Z","0.22.0-alpha-20221224084549-91cd0b8":"2022-12-24T08:46:24.833Z","0.22.0-alpha-20221224085132-5ed12d7":"2022-12-24T08:52:05.942Z","0.22.0-alpha-20221224090122-67fe9b2":"2022-12-24T09:01:55.857Z","0.22.0-alpha-20221224090632-e8877dc":"2022-12-24T09:07:04.786Z","0.22.0-alpha-20221224091135-fcd5566":"2022-12-24T09:12:08.530Z","0.22.0-alpha-20221224093914-37c3844":"2022-12-24T09:39:48.184Z","0.22.0-alpha-20221224094321-554f47d":"2022-12-24T09:43:55.599Z","0.22.0-alpha-20221224095141-c2546b2":"2022-12-24T09:52:27.998Z","0.22.0-alpha-20221224095643-6e25aca":"2022-12-24T09:57:26.141Z","0.22.0-alpha-20221224095737-fa07669":"2022-12-24T09:58:15.426Z","0.22.0-alpha-20221224095830-004d32f":"2022-12-24T09:59:09.550Z","0.22.0-alpha-20221224100139-45b5063":"2022-12-24T10:02:16.133Z","0.22.0-alpha-20221224100729-24961fa":"2022-12-24T10:08:03.172Z","0.22.0-alpha-20221224101706-3df6e93":"2022-12-24T10:17:39.834Z","0.22.0-alpha-20221224102258-66a3e29":"2022-12-24T10:23:40.718Z","0.22.0-alpha-20221224102734-498ad4e":"2022-12-24T10:28:08.835Z","0.22.0-alpha-20221224104416-dfe8cd2":"2022-12-24T10:44:57.040Z","0.22.0-alpha-20221224104538-817139f":"2022-12-24T10:46:11.439Z","0.22.0-alpha-20221224191343-c07c6f7":"2022-12-24T19:14:28.149Z","0.22.0-alpha-20221224191759-37b08aa":"2022-12-24T19:18:34.049Z","0.22.0-alpha-20221224212711-ea01326":"2022-12-24T21:27:57.561Z","0.22.0-alpha-20221224213140-5eb8dd5":"2022-12-24T21:32:24.902Z","0.22.0-alpha-20221225001851-dc493cb":"2022-12-25T00:19:25.027Z","0.22.0-alpha-20221225002404-27cf158":"2022-12-25T00:24:37.724Z","0.22.0-alpha-20221225022527-3392026":"2022-12-25T02:26:01.424Z","0.22.0-alpha-20221225022541-9007a18":"2022-12-25T02:26:21.484Z","0.22.0-alpha-20221225044810-14b9453":"2022-12-25T04:48:45.457Z","0.22.0-alpha-20221226091057-cfe7532":"2022-12-26T09:11:32.089Z","0.22.0-alpha-20221226093454-b0cecb2":"2022-12-26T09:35:39.455Z","0.22.0-alpha-20221226093643-911681e":"2022-12-26T09:37:18.447Z","0.22.0-alpha-20221226094030-d36c47a":"2022-12-26T09:41:04.912Z","0.22.0-alpha-20221226094539-5767c34":"2022-12-26T09:46:13.594Z","0.22.0-alpha-20221226094740-4bcc469":"2022-12-26T09:48:13.890Z","0.22.0-alpha-20221226095053-25a8b54":"2022-12-26T09:51:26.887Z","0.22.0-alpha-20221226095550-e3fc3ab":"2022-12-26T09:56:24.702Z","0.22.0-alpha-20221226100538-59af8aa":"2022-12-26T10:06:11.021Z","0.22.0-alpha-20221226101050-1e660bd":"2022-12-26T10:11:23.506Z","0.22.0-alpha-20221226101616-6b0d7b6":"2022-12-26T10:16:55.665Z","0.22.0-alpha-20221226102644-f5a3839":"2022-12-26T10:27:27.698Z","0.22.0-alpha-20221226102727-29e713e":"2022-12-26T10:28:01.680Z","0.22.0-alpha-20221226102922-093a204":"2022-12-26T10:29:57.926Z","0.22.0-alpha-20221226103405-e7fbd5c":"2022-12-26T10:34:40.154Z","0.22.0-alpha-20221226104350-2632eb0":"2022-12-26T10:44:27.177Z","0.22.0-alpha-20221226104828-4eec29b":"2022-12-26T10:49:02.910Z","0.22.0-alpha-20221226105325-3425215":"2022-12-26T10:53:58.721Z","0.22.0-alpha-20221226105855-6f55006":"2022-12-26T10:59:35.438Z","0.22.0-alpha-20221226110333-81a7553":"2022-12-26T11:04:06.898Z","0.22.0-alpha-20221226110532-93a3507":"2022-12-26T11:06:05.516Z","0.22.0-alpha-20221226111450-b37d03f":"2022-12-26T11:15:24.690Z","0.22.0-alpha-20221226111507-d23a9f9":"2022-12-26T11:15:40.925Z","0.22.0-alpha-20221226111701-4cf3edc":"2022-12-26T11:17:36.768Z","0.22.0-alpha-20221226184345-1c23a46":"2022-12-26T18:44:19.550Z","0.22.0-alpha-20221226192211-2cc226a":"2022-12-26T19:22:59.155Z","0.22.0-alpha-20221226192236-7885cc8":"2022-12-26T19:23:22.903Z","0.22.0-alpha-20221226193320-90347c3":"2022-12-26T19:33:55.940Z","0.22.0-alpha-20221226195549-353a36d":"2022-12-26T19:56:28.704Z","0.22.0-alpha-20221226200019-3636477":"2022-12-26T20:00:54.669Z","0.22.0-alpha-20221226200030-91fcedb":"2022-12-26T20:01:04.063Z","0.22.0-alpha-20221226231011-b6c5e5b":"2022-12-26T23:10:47.305Z","0.22.0-alpha-20221226231113-bac3f3a":"2022-12-26T23:11:48.611Z","0.22.0-alpha-20221227012702-fb2c9f3":"2022-12-27T01:27:36.013Z","0.22.0-alpha-20221227013237-8542b84":"2022-12-27T01:33:11.061Z","0.22.0-alpha-20221227093106-77d6194":"2022-12-27T09:31:42.257Z","0.22.0-alpha-20221227095131-6b1e926":"2022-12-27T09:52:12.286Z","0.22.0-alpha-20221227104036-6324ed8":"2022-12-27T10:41:11.464Z","0.22.0-alpha-20221227104519-afc93a7":"2022-12-27T10:45:53.290Z","0.22.0-alpha-20221227111150-5c36c3c":"2022-12-27T11:12:25.512Z","0.22.0-alpha-20221227111253-5d51c2d":"2022-12-27T11:13:26.734Z","0.22.0-alpha-20221227111702-f5d10fa":"2022-12-27T11:17:35.693Z","0.22.0-alpha-20221227112240-bbb112b":"2022-12-27T11:23:15.019Z","0.22.0-alpha-20221227112708-e35897a":"2022-12-27T11:27:42.944Z","0.22.0-alpha-20221227113723-1fcbbee":"2022-12-27T11:37:58.668Z","0.22.0-alpha-20221227114242-f3e5320":"2022-12-27T11:43:21.691Z","0.22.0-alpha-20221227114747-0fd3343":"2022-12-27T11:48:33.184Z","0.22.0-alpha-20221227115238-0e14429":"2022-12-27T11:53:21.891Z","0.22.0-alpha-20221227115655-ed85ba6":"2022-12-27T11:57:29.053Z","0.22.0-alpha-20221227115843-78d996c":"2022-12-27T11:59:19.656Z","0.22.0-alpha-20221227115924-31d1864":"2022-12-27T12:00:15.142Z","0.22.0-alpha-20221227123655-f69511c":"2022-12-27T12:37:29.518Z","0.22.0-alpha-20221227123915-0be20b0":"2022-12-27T12:39:49.243Z","0.22.0-alpha-20221227124233-3cf0677":"2022-12-27T12:43:17.629Z","0.22.0-alpha-20221227125156-b066f1b":"2022-12-27T12:52:32.974Z","0.22.0-alpha-20221227125217-57c5cb9":"2022-12-27T12:52:50.772Z","0.22.0-alpha-20221227125348-f416bba":"2022-12-27T12:54:27.931Z","0.22.0-alpha-20221227125611-0295d91":"2022-12-27T12:56:58.161Z","0.22.0-alpha-20221227125833-888a8e9":"2022-12-27T12:59:07.357Z","0.22.0-alpha-20221227130815-28082d7":"2022-12-27T13:08:50.345Z","0.22.0-alpha-20221227130836-75bad42":"2022-12-27T13:09:11.481Z","0.22.0-alpha-20221227131355-40f1dcd":"2022-12-27T13:14:29.150Z","0.22.0-alpha-20221227131738-47f82b9":"2022-12-27T13:18:13.503Z","0.22.0-alpha-20221227132132-82c1c3c":"2022-12-27T13:22:06.464Z","0.22.0-alpha-20221227132310-c506a9c":"2022-12-27T13:23:44.474Z","0.22.0-alpha-20221227132900-758dd72":"2022-12-27T13:29:34.164Z","0.22.0-alpha-20221227132945-40ec76e":"2022-12-27T13:30:28.404Z","0.22.0-alpha-20221227133458-7dce243":"2022-12-27T13:35:33.941Z","0.22.0-alpha-20221227133651-54ad34d":"2022-12-27T13:37:31.635Z","0.22.0-alpha-20221227134832-bef032f":"2022-12-27T13:49:09.106Z","0.22.0-alpha-20221227134845-64e3393":"2022-12-27T13:49:19.186Z","0.22.0-alpha-20221227135445-4e47be1":"2022-12-27T13:55:23.132Z","0.22.0-alpha-20221227152428-976bb22":"2022-12-27T15:25:09.845Z","0.22.0-alpha-20221227152912-9f634cd":"2022-12-27T15:29:59.396Z","0.22.0-alpha-20221227153137-0fa1ac9":"2022-12-27T15:32:27.358Z","0.22.0-alpha-20221227160547-b3bfcfd":"2022-12-27T16:06:35.266Z","0.22.0-alpha-20221227160912-87d853f":"2022-12-27T16:09:55.844Z","0.22.0-alpha-20221227161126-9fd2a07":"2022-12-27T16:12:14.639Z","0.22.0-alpha-20221227161314-f117455":"2022-12-27T16:13:54.618Z","0.22.0-alpha-20221227161659-271bef6":"2022-12-27T16:17:48.620Z","0.22.0-alpha-20221227162704-0f9523e":"2022-12-27T16:27:41.692Z","0.22.0-alpha-20221227162835-7d91434":"2022-12-27T16:29:08.277Z","0.22.0-alpha-20221227163825-277dbcc":"2022-12-27T16:38:59.366Z","0.22.0-alpha-20221227164539-3de2bc4":"2022-12-27T16:46:15.143Z","0.22.0-alpha-20221227165101-e787ce2":"2022-12-27T16:51:35.481Z","0.22.0-alpha-20221227165313-f9f1953":"2022-12-27T16:53:47.953Z","0.22.0-alpha-20221227165512-252ba01":"2022-12-27T16:55:47.041Z","0.22.0-alpha-20221227165610-ccd6317":"2022-12-27T16:56:44.757Z","0.22.0-alpha-20221227165759-3de363e":"2022-12-27T16:58:33.208Z","0.22.0-alpha-20221227170138-a38b6e9":"2022-12-27T17:02:14.068Z","0.22.0-alpha-20221227170710-fb7f79d":"2022-12-27T17:07:55.082Z","0.22.0-alpha-20221227170811-1b98b7b":"2022-12-27T17:08:50.180Z","0.22.0-alpha-20221227171835-7da3b70":"2022-12-27T17:19:10.340Z","0.22.0-alpha-20221227171841-4caecf6":"2022-12-27T17:19:24.762Z","0.22.0-alpha-20221227172415-2dcd7e1":"2022-12-27T17:24:51.435Z","0.22.0-alpha-20221227172516-4556a0d":"2022-12-27T17:25:56.040Z","0.22.0-alpha-20221227175200-e7e028d":"2022-12-27T17:52:45.926Z","0.22.0-alpha-20221227175936-fd17316":"2022-12-27T18:00:13.440Z","0.22.0-alpha-20221227181830-a05f83b":"2022-12-27T18:19:05.769Z","0.22.0-alpha-20221227182615-0c1ca58":"2022-12-27T18:26:53.089Z","0.22.0-alpha-20221227183251-631b41d":"2022-12-27T18:33:32.941Z","0.22.0-alpha-20221227185406-ae00f61":"2022-12-27T18:54:56.633Z","0.22.0-alpha-20221227185657-aebf271":"2022-12-27T18:57:32.348Z","0.22.0-alpha-20221227190906-8b17931":"2022-12-27T19:09:40.055Z","0.22.0-alpha-20221227191211-c0ae416":"2022-12-27T19:12:49.463Z","0.22.0-alpha-20221227191308-f84699a":"2022-12-27T19:13:42.411Z","0.22.0-alpha-20221227193102-e81bfb6":"2022-12-27T19:31:38.358Z","0.22.0-alpha-20221227193224-c4a3575":"2022-12-27T19:33:05.680Z","0.22.0-alpha-20221227194321-34664c9":"2022-12-27T19:43:55.587Z","0.22.0-alpha-20221227194910-a38d1e0":"2022-12-27T19:49:55.697Z","0.22.0-alpha-20221227195526-3e2a6dc":"2022-12-27T19:55:59.562Z","0.22.0-alpha-20221227195929-e39816f":"2022-12-27T20:00:06.220Z","0.22.0-alpha-20221227200037-fb4badf":"2022-12-27T20:01:21.361Z","0.22.0-alpha-20221227201048-63dc197":"2022-12-27T20:11:25.146Z","0.22.0-alpha-20221227201114-70cbd78":"2022-12-27T20:11:59.808Z","0.22.0-alpha-20221227201636-9ca3e3f":"2022-12-27T20:17:19.267Z","0.22.0-alpha-20221227202149-e6caf46":"2022-12-27T20:22:23.646Z","0.22.0-alpha-20221227202929-729cdd8":"2022-12-27T20:30:07.509Z","0.22.0-alpha-20221227203334-af39fc6":"2022-12-27T20:34:09.482Z","0.22.0-alpha-20221227203610-1ad2709":"2022-12-27T20:36:45.558Z","0.22.0-alpha-20221227204609-c212c13":"2022-12-27T20:46:50.251Z","0.22.0-alpha-20221227210348-79aabad":"2022-12-27T21:04:23.881Z","0.22.0-alpha-20221227210903-d0522e8":"2022-12-27T21:09:37.782Z","0.22.0-alpha-20221227214806-c15330d":"2022-12-27T21:48:40.607Z","0.22.0-alpha-20221227222108-180bdf1":"2022-12-27T22:21:42.610Z","0.22.0-alpha-20221227224115-1aadb7c":"2022-12-27T22:42:03.353Z","0.22.0-alpha-20221227224213-7225089":"2022-12-27T22:43:00.356Z","0.22.0-alpha-20221227224533-63e0a87":"2022-12-27T22:46:19.591Z","0.22.0-alpha-20221227224549-821fb3a":"2022-12-27T22:46:22.131Z","0.22.0-alpha-20221227224954-0a55129":"2022-12-27T22:50:27.436Z","0.22.0-alpha-20221227225008-494c808":"2022-12-27T22:50:42.477Z","0.22.0-alpha-20221227225137-d03c5ed":"2022-12-27T22:52:22.063Z","0.22.0-alpha-20221227225400-c7a379f":"2022-12-27T22:54:39.593Z","0.22.0-alpha-20221227225708-827c98a":"2022-12-27T22:57:41.334Z","0.22.0-alpha-20221227230040-9d224a9":"2022-12-27T23:01:15.267Z","0.22.0-alpha-20221227230500-cdebbde":"2022-12-27T23:05:34.495Z","0.22.0-alpha-20221227230943-499e3ed":"2022-12-27T23:10:16.125Z","0.22.0-alpha-20221228014729-9f5976f":"2022-12-28T01:48:07.225Z","0.22.0-alpha-20221228015318-e80f5bb":"2022-12-28T01:53:55.915Z","0.22.0-alpha-20221228045416-2651bed":"2022-12-28T04:54:49.984Z","0.22.0-alpha-20221228050022-d82b625":"2022-12-28T05:01:01.884Z","0.22.0-alpha-20221228075306-7cd1311":"2022-12-28T07:53:40.723Z","0.22.0-alpha-20221228075306-1bb4831":"2022-12-28T07:53:44.320Z","0.22.0-alpha-20221228081416-cb79950":"2022-12-28T08:14:55.257Z","0.22.0-alpha-20221228081753-7cd1311":"2022-12-28T08:18:31.222Z","0.22.0-alpha-20221228083047-372ae13":"2022-12-28T08:31:32.360Z","0.22.0-alpha-20221228083204-5f1b359":"2022-12-28T08:32:38.917Z","0.22.0-alpha-20221228083735-fd03f03":"2022-12-28T08:38:09.507Z","0.22.0-alpha-20221228084755-59ca637":"2022-12-28T08:48:29.558Z","0.22.0-alpha-20221228084759-e043f40":"2022-12-28T08:48:33.412Z","0.22.0-alpha-20221228085348-deb47a6":"2022-12-28T08:54:25.234Z","0.22.0-alpha-20221228085848-2ea4401":"2022-12-28T08:59:24.213Z","0.22.0-alpha-20221228091809-b4f66ad":"2022-12-28T09:18:45.154Z","0.22.0-alpha-20221228094652-3b02987":"2022-12-28T09:47:26.484Z","0.22.0-alpha-20221228095353-a83d4a8":"2022-12-28T09:54:32.227Z","0.22.0-alpha-20221228100317-5ac473c":"2022-12-28T10:03:52.262Z","0.22.0-alpha-20221228100346-13d76a7":"2022-12-28T10:04:26.172Z","0.22.0-alpha-20221228100900-0a0275e":"2022-12-28T10:09:38.388Z","0.22.0-alpha-20221228101430-af30b73":"2022-12-28T10:15:08.081Z","0.22.0-alpha-20221228110830-674d41b":"2022-12-28T11:09:09.040Z","0.22.0-alpha-20221228112226-b69ec31":"2022-12-28T11:23:07.732Z","0.22.0-alpha-20221228114830-6f027bc":"2022-12-28T11:49:10.775Z","0.22.0-alpha-20221228115509-2d15c95":"2022-12-28T11:55:48.193Z","0.22.0-alpha-20221228120437-c4329dd":"2022-12-28T12:05:10.988Z","0.22.0-alpha-20221228120504-b28e7fd":"2022-12-28T12:05:46.899Z","0.22.0-alpha-20221228121015-feb12f7":"2022-12-28T12:10:52.804Z","0.22.0-alpha-20221228121322-122c3e0":"2022-12-28T12:14:03.250Z","0.22.0-alpha-20221228121545-6823e21":"2022-12-28T12:16:18.365Z","0.22.0-alpha-20221228121653-c0930c0":"2022-12-28T12:17:27.459Z","0.22.0-alpha-20221228150858-0e4efc6":"2022-12-28T15:09:44.672Z","0.22.0-alpha-20221228151505-7fe67e9":"2022-12-28T15:15:41.315Z","0.22.0-alpha-20221228152453-1c3de86":"2022-12-28T15:25:27.136Z","0.22.0-alpha-20221228152507-2fee5bf":"2022-12-28T15:25:54.541Z","0.22.0-alpha-20221228153012-e9f9ec1":"2022-12-28T15:30:45.747Z","0.22.0-alpha-20221228153531-e5abb7a":"2022-12-28T15:36:06.719Z","0.22.0-alpha-20221228155711-d204484":"2022-12-28T15:57:56.412Z","0.22.0-alpha-20221228190307-626bccf":"2022-12-28T19:03:41.666Z","0.22.0-alpha-20221228190747-eda9f52":"2022-12-28T19:08:21.957Z","0.22.0-alpha-20221228192756-b9579a7":"2022-12-28T19:28:43.771Z","0.22.0-alpha-20221228193157-e626e03":"2022-12-28T19:32:32.187Z","0.22.0-alpha-20221228193809-9d0665f":"2022-12-28T19:38:45.009Z","0.22.0-alpha-20221228194416-955e611":"2022-12-28T19:44:53.158Z","0.22.0-alpha-20221228194708-aeffb47":"2022-12-28T19:47:45.760Z","0.22.0-alpha-20221228194714-bb26be2":"2022-12-28T19:47:52.768Z","0.22.0-alpha-20221228194733-2a82637":"2022-12-28T19:48:14.932Z","0.22.0-alpha-20221228194835-3618377":"2022-12-28T19:49:11.970Z","0.22.0-alpha-20221228195207-6dbe245":"2022-12-28T19:52:42.773Z","0.22.0-alpha-20221228195644-7f8ae9e":"2022-12-28T19:57:18.695Z","0.22.0-alpha-20221228200851-2945c7c":"2022-12-28T20:09:31.424Z","0.22.0-alpha-20221228201510-38eb2f3":"2022-12-28T20:15:54.179Z","0.22.0-alpha-20221228202318-5e1c0fd":"2022-12-28T20:23:52.119Z","0.22.0-alpha-20221228202341-18cfa21":"2022-12-28T20:24:15.693Z","0.22.0-alpha-20221228220014-163dcbc":"2022-12-28T22:00:43.381Z","0.22.0-alpha-20221228221123-a0a5b8f":"2022-12-28T22:11:56.074Z","0.22.0-alpha-20221228222415-a97f524":"2022-12-28T22:24:50.172Z","0.22.0-alpha-20221228222814-703363c":"2022-12-28T22:28:53.517Z","0.22.0-alpha-20221228223209-6d64087":"2022-12-28T22:32:47.189Z","0.22.0-alpha-20221228223504-1ff7bfd":"2022-12-28T22:35:38.680Z","0.22.0-alpha-20221228224437-44fb12e":"2022-12-28T22:45:11.972Z","0.22.0-alpha-20221228224520-3ec6f56":"2022-12-28T22:45:54.100Z","0.22.0-alpha-20221228225115-a0fe06e":"2022-12-28T22:51:46.725Z","0.22.0-alpha-20221228225144-90fae2c":"2022-12-28T22:52:19.441Z","0.22.0-alpha-20221228225745-0414393":"2022-12-28T22:58:18.160Z","0.22.0-alpha-20221228230959-521bb7c":"2022-12-28T23:10:34.571Z","0.22.0-alpha-20221228232338-33a960b":"2022-12-28T23:24:13.627Z","0.22.0-alpha-20221228234734-3644211":"2022-12-28T23:48:08.875Z","0.22.0-alpha-20221228235829-6c280f4":"2022-12-28T23:59:14.720Z","0.22.0-alpha-20221229000444-013116a":"2022-12-29T00:05:25.719Z","0.22.0-alpha-20221229002446-ab59114":"2022-12-29T00:25:19.725Z","0.22.0-alpha-20221229003450-2eb2d32":"2022-12-29T00:35:32.526Z","0.22.0-alpha-20221229003944-30d8c10":"2022-12-29T00:40:19.766Z","0.22.0-alpha-20221229022315-9516e40":"2022-12-29T02:23:53.293Z","0.22.0-alpha-20221229022818-ba0c8cd":"2022-12-29T02:28:59.928Z","0.22.0-alpha-20221229055023-fcee8ab":"2022-12-29T05:50:58.864Z","0.22.0-alpha-20221229143447-f7a7621":"2022-12-29T14:35:25.680Z","0.22.0-alpha-20221229143644-5491165":"2022-12-29T14:37:24.786Z","0.22.0-alpha-20221229143641-50b1161":"2022-12-29T14:37:29.916Z","0.22.0-alpha-20221229151626-073c2e7":"2022-12-29T15:17:00.075Z","0.22.0-alpha-20221229151803-115b05a":"2022-12-29T15:18:50.885Z","0.22.0-alpha-20221229151836-e148cca":"2022-12-29T15:19:14.639Z","0.22.0-alpha-20221229154544-d900b42":"2022-12-29T15:46:22.875Z","0.22.0-alpha-20221229161508-76dc576":"2022-12-29T16:15:58.286Z","0.22.0-alpha-20221229164824-fe5724c":"2022-12-29T16:49:04.778Z","0.22.0-alpha-20221229171316-4d8d936":"2022-12-29T17:13:50.531Z","0.22.0-alpha-20221229202944-cc0586b":"2022-12-29T20:30:28.265Z","0.22.0-alpha-20221230001643-bf6e50f":"2022-12-30T00:17:21.303Z","0.22.0-alpha-20221230002148-5da1b46":"2022-12-30T00:22:31.368Z","0.22.0-alpha-20221230002540-da5d733":"2022-12-30T00:26:13.670Z","0.22.0-alpha-20221230024209-e422f89":"2022-12-30T02:42:55.026Z","0.22.0-alpha-20221230024623-6affc8e":"2022-12-30T02:46:58.355Z","0.22.0-alpha-20221230111919-81c0a96":"2022-12-30T11:20:02.054Z","0.22.0-alpha-20221230112413-20aa0c8":"2022-12-30T11:24:47.014Z","0.22.0-alpha-20221230114725-049a139":"2022-12-30T11:48:01.845Z","0.22.0-alpha-20221230115033-08a94f5":"2022-12-30T11:51:07.094Z","0.22.0-alpha-20221230115516-6562f4b":"2022-12-30T11:55:55.634Z","0.22.0-alpha-20221230120024-6780d0f":"2022-12-30T12:01:09.007Z","0.22.0-alpha-20221230120431-3cea474":"2022-12-30T12:05:07.217Z","0.22.0-alpha-20221230121115-09c52e9":"2022-12-30T12:12:00.696Z","0.22.0-alpha-20221230122000-fdf1aee":"2022-12-30T12:20:34.805Z","0.22.0-alpha-20221230122009-7dc0e5b":"2022-12-30T12:20:49.973Z","0.22.0-alpha-20221230122330-2569107":"2022-12-30T12:24:09.530Z","0.22.0-alpha-20221230122453-83224c3":"2022-12-30T12:25:35.587Z","0.22.0-alpha-20221230122941-036ef7a":"2022-12-30T12:30:15.101Z","0.22.0-alpha-20221230130350-ce45990":"2022-12-30T13:04:36.277Z","0.22.0-alpha-20221230143215-80815f0":"2022-12-30T14:32:51.912Z","0.22.0-alpha-20221230143420-f84dccd":"2022-12-30T14:34:55.997Z","0.22.0-alpha-20221230143738-0f7ca79":"2022-12-30T14:38:19.353Z","0.22.0-alpha-20221230144225-40c2202":"2022-12-30T14:43:01.446Z","0.22.0-alpha-20221230144746-95baa5f":"2022-12-30T14:48:22.513Z","0.22.0-alpha-20221230145301-a585dad":"2022-12-30T14:53:45.426Z","0.22.0-alpha-20221230150248-0279109":"2022-12-30T15:03:33.287Z","0.22.0-alpha-20221230150656-a107156":"2022-12-30T15:07:31.113Z","0.22.0-alpha-20221230151552-dbd76bc":"2022-12-30T15:16:27.005Z","0.22.0-alpha-20221230152024-351024b":"2022-12-30T15:21:00.014Z","0.22.0-alpha-20221230152124-a6b44d6":"2022-12-30T15:22:00.358Z","0.22.0-alpha-20221230152704-649466f":"2022-12-30T15:27:44.770Z","0.22.0-alpha-20221230153241-34a1c54":"2022-12-30T15:33:17.049Z","0.22.0-alpha-20221230154013-312d8ec":"2022-12-30T15:40:53.371Z","0.22.0-alpha-20221230155053-c3b3a08":"2022-12-30T15:51:28.949Z","0.22.0-alpha-20221230155632-b6461b6":"2022-12-30T15:57:05.494Z","0.22.0-alpha-20221230160153-4771d7d":"2022-12-30T16:02:27.930Z","0.22.0-alpha-20221230163743-3864507":"2022-12-30T16:38:16.604Z","0.22.0-alpha-20221230173903-9a143ca":"2022-12-30T17:39:40.236Z","0.22.0-alpha-20221230174420-fe7ac15":"2022-12-30T17:45:00.424Z","0.22.0-alpha-20221230174901-e335a73":"2022-12-30T17:49:35.478Z","0.22.0-alpha-20221230175359-67e9abf":"2022-12-30T17:54:33.744Z","0.22.0-alpha-20221230175921-83ef110":"2022-12-30T18:00:05.481Z","0.22.0-alpha-20221230180753-7a677c3":"2022-12-30T18:08:40.639Z","0.22.0-alpha-20221230181305-bccaf17":"2022-12-30T18:13:39.019Z","0.22.0-alpha-20221230183659-917b514":"2022-12-30T18:37:33.221Z","0.22.0-alpha-20221230185802-26f7328":"2022-12-30T18:58:37.213Z","0.22.0-alpha-20221231180006-e46d2b3":"2022-12-31T18:00:40.538Z","0.22.0-alpha-20230102080025-e60757c":"2023-01-02T08:00:59.983Z","0.22.0-alpha-20230102080909-671200a":"2023-01-02T08:09:44.638Z","0.22.0-alpha-20230102090112-1935b71":"2023-01-02T09:01:46.323Z","0.22.0-alpha-20230102092908-fc1ebb2":"2023-01-02T09:29:47.051Z","0.22.0-alpha-20230102093030-e5a8731":"2023-01-02T09:31:15.903Z","0.22.0-alpha-20230102094209-936432d":"2023-01-02T09:42:50.684Z","0.22.0-alpha-20230102094238-7ef22cc":"2023-01-02T09:43:15.694Z","0.22.0-alpha-20230102095001-a0d6b4a":"2023-01-02T09:50:33.741Z","0.22.0-alpha-20230102100534-95f4c3b":"2023-01-02T10:06:19.169Z","0.22.0-alpha-20230102101001-c97910e":"2023-01-02T10:10:39.273Z","0.22.0-alpha-20230102101825-7fd1786":"2023-01-02T10:18:58.737Z","0.22.0-alpha-20230102102048-9d87db0":"2023-01-02T10:21:29.815Z","0.22.0-alpha-20230102104847-7c3da7c":"2023-01-02T10:49:21.908Z","0.22.0-alpha-20230102111547-39df89f":"2023-01-02T11:16:32.222Z","0.22.0-alpha-20230102111709-d06d910":"2023-01-02T11:17:43.942Z","0.22.0-alpha-20230102111821-b53bfd0":"2023-01-02T11:19:05.457Z","0.22.0-alpha-20230102112223-0171a82":"2023-01-02T11:22:57.486Z","0.22.0-alpha-20230102112251-516090f":"2023-01-02T11:23:25.978Z","0.22.0-alpha-20230102112729-a6262bd":"2023-01-02T11:28:05.341Z","0.22.0-alpha-20230102113257-fb7391b":"2023-01-02T11:33:32.205Z","0.22.0-alpha-20230102114252-f4fb2a8":"2023-01-02T11:43:27.926Z","0.22.0-alpha-20230102114309-71f09ac":"2023-01-02T11:43:47.287Z","0.22.0-alpha-20230102114905-e7a9148":"2023-01-02T11:49:46.099Z","0.22.0-alpha-20230102115436-4ad26f4":"2023-01-02T11:55:18.412Z","0.22.0-alpha-20230102115836-70d492d":"2023-01-02T11:59:10.134Z","0.22.0-alpha-20230102120525-858b52c":"2023-01-02T12:06:14.916Z","0.22.0-alpha-20230102120605-f5901c0":"2023-01-02T12:06:39.129Z","0.22.0-alpha-20230102121136-45b8eee":"2023-01-02T12:12:12.635Z","0.22.0-alpha-20230102121640-b0639c5":"2023-01-02T12:17:18.726Z","0.22.0-alpha-20230102122133-dac5b2e":"2023-01-02T12:22:08.218Z","0.22.0-alpha-20230102122436-f238eb0":"2023-01-02T12:25:11.689Z","0.22.0-alpha-20230102122642-9ed233e":"2023-01-02T12:27:18.644Z","0.22.0-alpha-20230102123205-a9287f6":"2023-01-02T12:32:45.295Z","0.22.0-alpha-20230102123729-932bd4d":"2023-01-02T12:38:11.288Z","0.22.0-alpha-20230102124205-f3f12d9":"2023-01-02T12:42:40.535Z","0.22.0-alpha-20230102132358-0d4276a":"2023-01-02T13:24:33.520Z","0.22.0-alpha-20230102132520-77388bb":"2023-01-02T13:25:55.693Z","0.22.0-alpha-20230102140938-5c4e325":"2023-01-02T14:10:13.439Z","0.22.0-alpha-20230102142304-951bc25":"2023-01-02T14:23:49.558Z","0.22.0-alpha-20230102143822-8bb2085":"2023-01-02T14:39:08.037Z","0.22.0-alpha-20230102151804-09d4659":"2023-01-02T15:18:38.117Z","0.22.0-alpha-20230102151837-c32bd31":"2023-01-02T15:19:13.811Z","0.22.0-alpha-20230102152456-ca0b426":"2023-01-02T15:25:42.975Z","0.22.0-alpha-20230102152635-c3b9307":"2023-01-02T15:27:09.949Z","0.22.0-alpha-20230102153119-c458f2b":"2023-01-02T15:31:53.980Z","0.22.0-alpha-20230102153621-eb87554":"2023-01-02T15:36:55.166Z","0.22.0-alpha-20230102154125-afb7f0f":"2023-01-02T15:42:00.162Z","0.22.0-alpha-20230102154619-6d6735d":"2023-01-02T15:46:54.870Z","0.22.0-alpha-20230102155135-bc791e5":"2023-01-02T15:52:08.838Z","0.22.0-alpha-20230102155809-e53e940":"2023-01-02T15:58:57.509Z","0.22.0-alpha-20230102160207-ba651ec":"2023-01-02T16:02:41.729Z","0.22.0-alpha-20230102160824-12562f9":"2023-01-02T16:09:15.931Z","0.22.0-alpha-20230102161221-ab7c20b":"2023-01-02T16:13:04.621Z","0.22.0-alpha-20230102161610-09ea4a8":"2023-01-02T16:16:55.475Z","0.22.0-alpha-20230102161713-d715617":"2023-01-02T16:17:50.010Z","0.22.0-alpha-20230102162205-4ffd53a":"2023-01-02T16:22:45.288Z","0.22.0-alpha-20230102162616-404b23b":"2023-01-02T16:26:51.768Z","0.22.0-alpha-20230102163106-e6e9a8d":"2023-01-02T16:31:41.078Z","0.22.0-alpha-20230102163117-361d054":"2023-01-02T16:31:53.306Z","0.22.0-alpha-20230102163636-45ee8eb":"2023-01-02T16:37:20.773Z","0.22.0-alpha-20230102164010-1d88d39":"2023-01-02T16:40:51.080Z","0.22.0-alpha-20230102164524-00bc528":"2023-01-02T16:46:00.255Z","0.22.0-alpha-20230102164857-a90f5ba":"2023-01-02T16:49:33.429Z","0.22.0-alpha-20230102165342-453cfa5":"2023-01-02T16:54:24.640Z","0.22.0-alpha-20230102165855-2782fd2":"2023-01-02T16:59:28.561Z","0.22.0-alpha-20230102165920-0a1a693":"2023-01-02T16:59:54.893Z","0.22.0-alpha-20230102185233-1cc3be5":"2023-01-02T18:53:13.915Z","0.22.0-alpha-20230102185418-2f714ed":"2023-01-02T18:54:52.028Z","0.22.0-alpha-20230102185915-7e804e6":"2023-01-02T18:59:51.958Z","0.22.0-alpha-20230102190003-c3141fc":"2023-01-02T19:00:40.753Z","0.22.0-alpha-20230102190415-458b2d1":"2023-01-02T19:04:50.164Z","0.22.0-alpha-20230102191019-e62312c":"2023-01-02T19:10:56.815Z","0.22.0-alpha-20230102191549-c77feda":"2023-01-02T19:16:36.710Z","0.22.0-alpha-20230102192330-35180a5":"2023-01-02T19:24:05.416Z","0.22.0-alpha-20230102192344-fc1923d":"2023-01-02T19:24:29.497Z","0.22.0-alpha-20230102192912-62f1b0b":"2023-01-02T19:29:46.086Z","0.22.0-alpha-20230102193428-60ba2be":"2023-01-02T19:35:03.430Z","0.22.0-alpha-20230102193958-c1978eb":"2023-01-02T19:40:32.042Z","0.22.0-alpha-20230102220314-6908bc7":"2023-01-02T22:03:58.634Z","0.22.0-alpha-20230102220800-5c1f0b6":"2023-01-02T22:08:34.478Z","0.22.0-alpha-20230102221448-37adb40":"2023-01-02T22:15:32.545Z","0.22.0-alpha-20230102222017-830af1b":"2023-01-02T22:20:57.858Z","0.22.0-alpha-20230102222511-2e81e74":"2023-01-02T22:25:46.109Z","0.22.0-alpha-20230102223029-092f6fc":"2023-01-02T22:31:03.176Z","0.22.0-alpha-20230102224109-a3e747e":"2023-01-02T22:41:43.874Z","0.22.0-alpha-20230102224639-f474d9b":"2023-01-02T22:47:15.702Z","0.22.0-alpha-20230103005721-c8faca2":"2023-01-03T00:57:56.675Z","0.22.0-alpha-20230103094814-c59aef7":"2023-01-03T09:48:49.601Z","0.22.0-alpha-20230103104005-54b2781":"2023-01-03T10:40:49.821Z","0.22.0-alpha-20230103105639-2b32923":"2023-01-03T10:57:13.636Z","0.22.0-alpha-20230103111123-b71136c":"2023-01-03T11:12:02.631Z","0.22.0-alpha-20230103111344-a974331":"2023-01-03T11:14:31.586Z","0.22.0-alpha-20230103124947-496a97b":"2023-01-03T12:50:28.227Z","0.22.0-alpha-20230103135015-b53a461":"2023-01-03T13:50:55.050Z","0.22.0-alpha-20230103174257-9ab8744":"2023-01-03T17:43:33.412Z","0.22.0-alpha-20230104101808-5eb70cc":"2023-01-04T10:18:43.139Z","0.22.0-alpha-20230104103107-dacd228":"2023-01-04T10:31:48.401Z","0.22.0-alpha-20230104110214-a1c3632":"2023-01-04T11:02:51.124Z","0.22.0-alpha-20230104110948-2d6903a":"2023-01-04T11:10:36.822Z","0.22.0-alpha-20230104111008-ea324e3":"2023-01-04T11:10:42.579Z","0.22.0-alpha-20230104114353-ce099ee":"2023-01-04T11:44:27.666Z","0.22.0-alpha-20230104143841-ea324e3":"2023-01-04T14:39:21.441Z","0.22.0-alpha-20230104161513-4f4a02c":"2023-01-04T16:15:49.403Z","0.22.0-alpha-20230104170544-08d7883":"2023-01-04T17:06:21.288Z","0.22.0-alpha-20230104174800-953a3a6":"2023-01-04T17:48:48.662Z","0.22.0-alpha-20230104211015-359cce7":"2023-01-04T21:10:49.436Z","0.22.0-alpha-20230104211529-24b3aa7":"2023-01-04T21:16:04.308Z","0.22.0-alpha-20230105100628-48608f6":"2023-01-05T10:07:04.388Z","0.22.0-alpha-20230105101153-0d1afc6":"2023-01-05T10:12:27.000Z","0.22.0-alpha-20230105103324-3051862":"2023-01-05T10:33:57.421Z","0.22.0-alpha-20230105103712-1fc87a5":"2023-01-05T10:37:46.872Z","0.22.0-alpha-20230105104248-33e492b":"2023-01-05T10:43:37.930Z","0.22.0-alpha-20230105104412-cf981aa":"2023-01-05T10:44:47.565Z","0.22.0-alpha-20230105104853-5e1b518":"2023-01-05T10:49:30.170Z","0.22.0-alpha-20230105105406-cbfd269":"2023-01-05T10:54:43.183Z","0.22.0-alpha-20230105105854-730e80f":"2023-01-05T10:59:28.808Z","0.22.0-alpha-20230105110356-cbeba4d":"2023-01-05T11:04:31.207Z","0.22.0-alpha-20230105111439-df0825b":"2023-01-05T11:15:23.162Z","0.22.0-alpha-20230105111457-8fdca5e":"2023-01-05T11:15:30.996Z","0.22.0-alpha-20230105111834-e78fd1d":"2023-01-05T11:19:13.736Z","0.22.0-alpha-20230105112343-cb6860a":"2023-01-05T11:24:24.181Z","0.22.0-alpha-20230105113809-3836e50":"2023-01-05T11:38:44.752Z","0.22.0-alpha-20230105133613-6bfb6b6":"2023-01-05T13:36:50.719Z","0.22.0-alpha-20230105134821-bc8a9c7":"2023-01-05T13:49:04.765Z","0.22.0-alpha-20230105135259-d90ee79":"2023-01-05T13:53:35.225Z","0.22.0-alpha-20230105135454-9cda8b4":"2023-01-05T13:55:36.383Z","0.22.0-alpha-20230105135927-3c13ff4":"2023-01-05T14:00:03.615Z","0.22.0-alpha-20230105140000-8388e43":"2023-01-05T14:00:35.058Z","0.22.0-alpha-20230105140526-4ab93db":"2023-01-05T14:06:16.128Z","0.22.0-alpha-20230105140916-58d8926":"2023-01-05T14:09:52.031Z","0.22.0-alpha-20230105141355-75a4fd9":"2023-01-05T14:14:29.924Z","0.22.0-alpha-20230105142238-69be9b3":"2023-01-05T14:23:14.310Z","0.22.0-alpha-20230105142245-3cc3566":"2023-01-05T14:23:25.124Z","0.22.0-alpha-20230105142801-2c8122a":"2023-01-05T14:28:38.713Z","0.22.0-alpha-20230105143301-7d72225":"2023-01-05T14:33:37.707Z","0.22.0-alpha-20230105152320-20ac28c":"2023-01-05T15:23:56.180Z","0.22.0-alpha-20230105152550-5f16991":"2023-01-05T15:26:35.923Z","0.22.0-alpha-20230105155231-c50fd06":"2023-01-05T15:53:09.634Z","0.22.0-alpha-20230105155644-4fce363":"2023-01-05T15:57:22.156Z","0.22.0-alpha-20230105155728-ef2d4d4":"2023-01-05T15:58:05.690Z","0.22.0-alpha-20230105155918-4024791":"2023-01-05T15:59:52.620Z","0.22.0-alpha-20230105160401-9a2d54f":"2023-01-05T16:04:37.413Z","0.22.0-alpha-20230105160941-b6f584d":"2023-01-05T16:10:31.812Z","0.22.0-alpha-20230105161410-ea9d2ea":"2023-01-05T16:14:45.794Z","0.22.0-alpha-20230105162409-4fe0482":"2023-01-05T16:24:54.385Z","0.22.0-alpha-20230105162433-08ac06c":"2023-01-05T16:25:19.181Z","0.22.0-alpha-20230105162936-c1252f7":"2023-01-05T16:30:12.416Z","0.22.0-alpha-20230105163503-634e5d6":"2023-01-05T16:35:46.189Z","0.22.0-alpha-20230105164119-3a9969f":"2023-01-05T16:41:55.291Z","0.22.0-alpha-20230105164326-cf21d02":"2023-01-05T16:44:08.352Z","0.22.0-alpha-20230105164819-8facab5":"2023-01-05T16:48:53.484Z","0.22.0-alpha-20230105165320-148ba33":"2023-01-05T16:54:02.612Z","0.22.0-alpha-20230105170249-2aeb560":"2023-01-05T17:03:25.048Z","0.22.0-alpha-20230105170311-ec91c46":"2023-01-05T17:03:56.035Z","0.22.0-alpha-20230105170831-12649ca":"2023-01-05T17:09:13.679Z","0.22.0-alpha-20230105171322-8bdf340":"2023-01-05T17:14:02.971Z","0.22.0-alpha-20230105171858-d3fbfe9":"2023-01-05T17:19:37.972Z","0.22.0-alpha-20230105172358-b29254c":"2023-01-05T17:24:41.448Z","0.22.0-alpha-20230105172611-d622858":"2023-01-05T17:26:46.732Z","0.22.0-alpha-20230105172817-e783929":"2023-01-05T17:28:53.609Z","0.22.0-alpha-20230105181525-24829c9":"2023-01-05T18:16:13.808Z","0.22.0-alpha-20230105181716-453626f":"2023-01-05T18:17:55.891Z","0.22.0-alpha-20230105183347-608016a":"2023-01-05T18:34:25.259Z","0.22.0-alpha-20230105183907-59235c3":"2023-01-05T18:39:48.780Z","0.22.0-alpha-20230105183949-1148c84":"2023-01-05T18:40:24.284Z","0.22.0-alpha-20230105184153-f4577ca":"2023-01-05T18:42:27.907Z","0.22.0-alpha-20230105185307-4eec82d":"2023-01-05T18:53:49.742Z","0.22.0-alpha-20230105185839-bb14de0":"2023-01-05T18:59:15.144Z","0.22.0-alpha-20230105190139-a841984":"2023-01-05T19:02:30.124Z","0.22.0-alpha-20230105190416-5cdb38c":"2023-01-05T19:05:01.770Z","0.22.0-alpha-20230105190915-cbe911c":"2023-01-05T19:09:56.657Z","0.22.0-alpha-20230105191249-7e9e4de":"2023-01-05T19:13:25.629Z","0.22.0-alpha-20230105191502-442206a":"2023-01-05T19:15:43.402Z","0.22.0-alpha-20230105192215-8ef8e36":"2023-01-05T19:22:50.367Z","0.22.0-alpha-20230105192704-95f449e":"2023-01-05T19:27:39.673Z","0.22.0-alpha-20230105193629-d71d47c":"2023-01-05T19:37:12.487Z","0.22.0-alpha-20230105193655-adbbebe":"2023-01-05T19:37:32.367Z","0.22.0-alpha-20230105193802-43f609e":"2023-01-05T19:38:37.941Z","0.22.0-alpha-20230105194721-6643c74":"2023-01-05T19:47:55.688Z","0.22.0-alpha-20230105194757-0cfd6a2":"2023-01-05T19:48:31.531Z","0.22.0-alpha-20230105195341-75aba08":"2023-01-05T19:54:22.933Z","0.22.0-alpha-20230105195814-93d34fd":"2023-01-05T19:58:49.636Z","0.22.0-alpha-20230105200300-6e28ac5":"2023-01-05T20:03:35.538Z","0.22.0-alpha-20230105200803-3e5bcb5":"2023-01-05T20:08:38.631Z","0.22.0-alpha-20230105215320-fa09cec":"2023-01-05T21:54:02.688Z","0.22.0-alpha-20230105220153-4d1a4aa":"2023-01-05T22:02:41.309Z","0.22.0-alpha-20230105221119-405ec7a":"2023-01-05T22:11:54.770Z","0.22.0-alpha-20230105221733-5a7c479":"2023-01-05T22:18:11.289Z","0.22.0-alpha-20230105222310-e4efd2b":"2023-01-05T22:23:46.690Z","0.22.0-alpha-20230105222829-f6a92c1":"2023-01-05T22:29:04.404Z","0.22.0-alpha-20230105223923-2c4f48d":"2023-01-05T22:39:58.442Z","0.22.0-alpha-20230105224451-1d1a8fd":"2023-01-05T22:45:25.973Z","0.22.0-alpha-20230106134402-1279fd0":"2023-01-06T13:44:53.471Z","0.22.0-alpha-20230106163800-74c2d71":"2023-01-06T16:38:38.821Z","0.22.0-alpha-20230106195359-1e14c89":"2023-01-06T19:54:36.916Z","0.22.0-alpha-20230107095044-1da093d":"2023-01-07T09:51:19.189Z","0.22.0-alpha-20230107101641-6fb827e":"2023-01-07T10:17:14.993Z","0.22.0-alpha-20230107102251-4bbd470":"2023-01-07T10:23:38.508Z","0.22.0-alpha-20230107102811-d27ba6c":"2023-01-07T10:28:54.605Z","0.22.0-alpha-20230107103304-a62be7e":"2023-01-07T10:33:42.041Z","0.22.0-alpha-20230107103509-64b627e":"2023-01-07T10:35:43.424Z","0.22.0-alpha-20230107104532-44ed3f1":"2023-01-07T10:46:06.070Z","0.22.0-alpha-20230107104539-92ac783":"2023-01-07T10:46:14.835Z","0.22.0-alpha-20230107123211-5601f75":"2023-01-07T12:32:46.552Z","0.22.0-alpha-20230107123823-a386a80":"2023-01-07T12:39:11.922Z","0.22.0-alpha-20230107124249-d5b8376":"2023-01-07T12:43:24.740Z","0.22.0-alpha-20230107124814-9e737d0":"2023-01-07T12:48:56.542Z","0.22.0-alpha-20230107125316-cb4d6be":"2023-01-07T12:53:50.756Z","0.22.0-alpha-20230107125834-03c4a6f":"2023-01-07T12:59:08.715Z","0.22.0-alpha-20230107130402-45eef93":"2023-01-07T13:04:37.647Z","0.22.0-alpha-20230107131447-b935fc2":"2023-01-07T13:15:31.679Z","0.22.0-alpha-20230107155601-233ff4a":"2023-01-07T15:56:39.220Z","0.22.0-alpha-20230107162959-3cb28dd":"2023-01-07T16:30:35.904Z","0.22.0-alpha-20230107163512-4bf9150":"2023-01-07T16:35:53.951Z","0.22.0-alpha-20230107164032-1de7278":"2023-01-07T16:41:14.224Z","0.22.0-alpha-20230107164617-1ba30f4":"2023-01-07T16:47:04.146Z","0.22.0-alpha-20230107193228-cb6ee72":"2023-01-07T19:33:03.718Z","0.22.0-alpha-20230107193304-858dd01":"2023-01-07T19:33:50.029Z","0.22.0-alpha-20230107193421-52466d0":"2023-01-07T19:34:54.850Z","0.22.0-alpha-20230107194257-4a6ba03":"2023-01-07T19:43:31.453Z","0.22.0-alpha-20230107194313-588885e":"2023-01-07T19:43:48.103Z","0.22.0-alpha-20230107194810-33070f0":"2023-01-07T19:48:49.541Z","0.22.0-alpha-20230107195240-b217819":"2023-01-07T19:53:17.751Z","0.22.0-alpha-20230107195701-29c5f9a":"2023-01-07T19:57:34.831Z","0.22.0-alpha-20230107200114-7ed249a":"2023-01-07T20:01:48.367Z","0.22.0-alpha-20230107200612-b4f4685":"2023-01-07T20:06:46.677Z","0.22.0-alpha-20230107201014-6c261e9":"2023-01-07T20:10:48.803Z","0.22.0-alpha-20230107201516-a9710ee":"2023-01-07T20:16:00.124Z","0.22.0-alpha-20230107220029-f240181":"2023-01-07T22:01:05.958Z","0.22.0-alpha-20230107220657-a0206c2":"2023-01-07T22:07:39.212Z","0.22.0-alpha-20230107221144-482f569":"2023-01-07T22:12:25.960Z","0.22.0-alpha-20230108091705-314a5b3":"2023-01-08T09:17:39.698Z","0.22.0-alpha-20230108092216-ae19914":"2023-01-08T09:22:51.091Z","0.22.0-alpha-20230108092736-cfb846e":"2023-01-08T09:28:09.339Z","0.22.0-alpha-20230108093331-a6ebfbf":"2023-01-08T09:34:14.307Z","0.22.0-alpha-20230108093512-d5aded9":"2023-01-08T09:35:48.389Z","0.22.0-alpha-20230108094512-43af951":"2023-01-08T09:45:47.275Z","0.22.0-alpha-20230108094534-6a10a29":"2023-01-08T09:46:17.501Z","0.22.0-alpha-20230108095101-ff04219":"2023-01-08T09:51:36.285Z","0.22.0-alpha-20230108095613-2e8ce25":"2023-01-08T09:56:46.516Z","0.22.0-alpha-20230108100215-28ed9ed":"2023-01-08T10:03:00.009Z","0.22.0-alpha-20230108100701-421c729":"2023-01-08T10:07:36.453Z","0.22.0-alpha-20230108101220-47d099b":"2023-01-08T10:12:54.965Z","0.22.0-alpha-20230108101735-9ba1ee3":"2023-01-08T10:18:08.519Z","0.22.0-alpha-20230108101941-dd7ceaa":"2023-01-08T10:20:15.021Z","0.22.0-alpha-20230108102948-43a6e40":"2023-01-08T10:30:24.296Z","0.22.0-alpha-20230108103009-0ce0ebc":"2023-01-08T10:30:51.306Z","0.22.0-alpha-20230108103632-f310374":"2023-01-08T10:37:21.350Z","0.22.0-alpha-20230108104102-273e5df":"2023-01-08T10:41:36.213Z","0.22.0-alpha-20230108104637-7c9112a":"2023-01-08T10:47:18.799Z","0.22.0-alpha-20230108105158-61d9856":"2023-01-08T10:52:46.418Z","0.22.0-alpha-20230108105650-76ab468":"2023-01-08T10:57:24.235Z","0.22.0-alpha-20230108110233-43f89aa":"2023-01-08T11:03:06.890Z","0.22.0-alpha-20230108110417-9acbf6d":"2023-01-08T11:04:51.229Z","0.22.0-alpha-20230108111317-bf1cf80":"2023-01-08T11:13:52.127Z","0.22.0-alpha-20230108111329-ae61d68":"2023-01-08T11:14:03.812Z","0.22.0-alpha-20230108111919-420eca9":"2023-01-08T11:19:54.186Z","0.22.0-alpha-20230108112439-e4409ea":"2023-01-08T11:25:18.024Z","0.22.0-alpha-20230108113023-f7e9edc":"2023-01-08T11:30:59.136Z","0.22.0-alpha-20230108113427-250d99f":"2023-01-08T11:35:02.230Z","0.22.0-alpha-20230108114120-362c920":"2023-01-08T11:42:06.309Z","0.22.0-alpha-20230108130753-52b05c0":"2023-01-08T13:08:28.913Z","0.22.0-alpha-20230108131333-ae25aea":"2023-01-08T13:14:16.646Z","0.22.0-alpha-20230108132335-3282488":"2023-01-08T13:24:09.388Z","0.22.0-alpha-20230108132858-cd04419":"2023-01-08T13:29:38.183Z","0.22.0-alpha-20230108210338-0b0ebb7":"2023-01-08T21:04:12.277Z","0.22.0-alpha-20230108210900-89a0e20":"2023-01-08T21:09:41.271Z","0.22.0-alpha-20230108231202-dfd0881":"2023-01-08T23:12:36.820Z","0.22.0-alpha-20230108231754-eb2995b":"2023-01-08T23:18:37.897Z","0.22.0-alpha-20230109042309-965bc2b":"2023-01-09T04:23:50.834Z","0.22.0-alpha-20230109070813-e8f8762":"2023-01-09T07:08:46.796Z","0.22.0-alpha-20230109071349-6070bd4":"2023-01-09T07:14:31.404Z","0.22.0-alpha-20230109071524-9446f71":"2023-01-09T07:15:59.664Z","0.22.0-alpha-20230109072536-6cb0998":"2023-01-09T07:26:11.300Z","0.22.0-alpha-20230109072601-25cc176":"2023-01-09T07:26:47.130Z","0.22.0-alpha-20230109073137-7a64a9d":"2023-01-09T07:32:12.458Z","0.22.0-alpha-20230109073649-b81e6e4":"2023-01-09T07:37:24.249Z","0.22.0-alpha-20230109074241-65f7c6f":"2023-01-09T07:43:24.904Z","0.22.0-alpha-20230109074703-f28fc94":"2023-01-09T07:47:38.513Z","0.22.0-alpha-20230109075231-1c9dcfc":"2023-01-09T07:53:04.982Z","0.22.0-alpha-20230109075746-f9f6bc7":"2023-01-09T07:58:27.778Z","0.22.0-alpha-20230109080225-0e1522e":"2023-01-09T08:03:00.748Z","0.22.0-alpha-20230109080425-f8ebf1a":"2023-01-09T08:04:59.951Z","0.22.0-alpha-20230109081340-82288f4":"2023-01-09T08:14:16.359Z","0.22.0-alpha-20230109081355-84deaa8":"2023-01-09T08:14:29.569Z","0.22.0-alpha-20230109081912-6b2ae48":"2023-01-09T08:19:48.101Z","0.22.0-alpha-20230109082437-f26ec6c":"2023-01-09T08:25:12.267Z","0.22.0-alpha-20230109083016-e59ce84":"2023-01-09T08:30:52.553Z","0.22.0-alpha-20230109083435-fb4fa45":"2023-01-09T08:35:23.581Z","0.22.0-alpha-20230109083928-1e58a5c":"2023-01-09T08:40:03.489Z","0.22.0-alpha-20230109084506-469a844":"2023-01-09T08:45:43.262Z","0.22.0-alpha-20230109092718-b0df1ff":"2023-01-09T09:28:05.825Z","0.22.0-alpha-20230109105438-70e12a8":"2023-01-09T10:55:17.564Z","0.22.0-alpha-20230109105655-685bb73":"2023-01-09T10:57:41.094Z","0.22.0-alpha-20230109105759-a6c5ba0":"2023-01-09T10:58:34.360Z","0.22.0-alpha-20230109110310-685bb73":"2023-01-09T11:03:48.854Z","0.22.0-alpha-20230109110418-d61d042":"2023-01-09T11:05:02.939Z","0.22.0-alpha-20230109110856-65271c6":"2023-01-09T11:09:42.066Z","0.22.0-alpha-20230109112602-ce466b6":"2023-01-09T11:26:44.608Z","0.22.0-alpha-20230109115600-4d71111":"2023-01-09T11:56:35.219Z","0.22.0-alpha-20230109120127-5284a76":"2023-01-09T12:02:03.851Z","0.22.0-alpha-20230109120415-6184545":"2023-01-09T12:04:49.475Z","0.22.0-alpha-20230109120408-f61fa97":"2023-01-09T12:04:55.866Z","0.22.0-alpha-20230109121348-017713d":"2023-01-09T12:14:23.642Z","0.22.0-alpha-20230109121351-e652a58":"2023-01-09T12:14:30.429Z","0.22.0-alpha-20230109121407-544800c":"2023-01-09T12:14:43.942Z","0.22.0-alpha-20230109121714-cd9631a":"2023-01-09T12:17:51.993Z","0.22.0-alpha-20230109121939-c3272fc":"2023-01-09T12:20:15.703Z","0.22.0-alpha-20230109122533-c22b8b9":"2023-01-09T12:26:21.749Z","0.22.0-alpha-20230109122946-94b6465":"2023-01-09T12:30:24.781Z","0.22.0-alpha-20230109123457-69f9121":"2023-01-09T12:35:33.145Z","0.22.0-alpha-20230109123936-8aac5d3":"2023-01-09T12:40:15.914Z","0.22.0-alpha-20230109145539-b28a86b":"2023-01-09T14:56:18.454Z","0.22.0-alpha-20230109152654-c66727a":"2023-01-09T15:27:28.738Z","0.22.0-alpha-20230109153209-aba188e":"2023-01-09T15:32:46.200Z","0.22.0-alpha-20230109153648-f030adb":"2023-01-09T15:37:24.812Z","0.22.0-alpha-20230109154705-b714d7c":"2023-01-09T15:47:40.967Z","0.22.0-alpha-20230109155254-7458caf":"2023-01-09T15:53:44.702Z","0.22.0-alpha-20230109165030-e21be70":"2023-01-09T16:51:10.313Z","0.22.0-alpha-20230109170410-b4f323c":"2023-01-09T17:04:46.984Z","0.22.0-alpha-20230109171537-a1423b7":"2023-01-09T17:16:12.470Z","0.22.0-alpha-20230109192625-084ad89":"2023-01-09T19:27:00.419Z","0.22.0-alpha-20230109204347-7ffbbf7":"2023-01-09T20:44:21.442Z","0.22.0-alpha-20230109204906-87ab419":"2023-01-09T20:49:39.454Z","0.22.0-alpha-20230110001005-13cbd26":"2023-01-10T00:10:40.213Z","0.22.0-alpha-20230110001509-a73e306":"2023-01-10T00:15:46.489Z","0.22.0-alpha-20230110033101-b737cac":"2023-01-10T03:31:34.727Z","0.22.0-alpha-20230110114150-1d28d95":"2023-01-10T11:42:28.110Z","0.22.0-alpha-20230110115140-e5cf489":"2023-01-10T11:52:22.060Z","0.22.0-alpha-20230110115716-4286959":"2023-01-10T11:58:00.265Z","0.22.0-alpha-20230110120153-813ed92":"2023-01-10T12:02:30.564Z","0.22.0-alpha-20230110120655-33e8ec6":"2023-01-10T12:07:35.223Z","0.22.0-alpha-20230110121318-023e555":"2023-01-10T12:14:04.176Z","0.22.0-alpha-20230110121739-b53455e":"2023-01-10T12:18:19.922Z","0.22.0-alpha-20230110122009-0392125":"2023-01-10T12:20:51.552Z","0.22.0-alpha-20230110122930-cc03f60":"2023-01-10T12:30:06.644Z","0.22.0-alpha-20230110122942-cf69358":"2023-01-10T12:30:22.788Z","0.22.0-alpha-20230110143217-df4b511":"2023-01-10T14:32:52.103Z","0.22.0-alpha-20230110143735-58a4d41":"2023-01-10T14:38:21.089Z","0.22.0-alpha-20230110144917-e011c41":"2023-01-10T14:49:51.799Z","0.22.0-alpha-20230110145039-ba3b317":"2023-01-10T14:51:22.885Z","0.22.0-alpha-20230110145451-cdc130e":"2023-01-10T14:55:26.957Z","0.22.0-alpha-20230110150113-0041a59":"2023-01-10T15:01:52.529Z","0.22.0-alpha-20230110150614-fff9d6a":"2023-01-10T15:06:59.136Z","0.22.0-alpha-20230110151200-f84a446":"2023-01-10T15:12:40.341Z","0.22.0-alpha-20230110152302-38d0744":"2023-01-10T15:23:45.114Z","0.22.0-alpha-20230110152832-e757bf7":"2023-01-10T15:29:18.426Z","0.22.0-alpha-20230110154711-a793c7f":"2023-01-10T15:47:46.387Z","0.22.0-alpha-20230110154730-2fdc6d7":"2023-01-10T15:48:08.709Z","0.22.0-alpha-20230110155517-db8ac96":"2023-01-10T15:56:01.444Z","0.22.0-alpha-20230110160040-29966f2":"2023-01-10T16:01:16.101Z","0.22.0-alpha-20230110160600-8540415":"2023-01-10T16:06:35.957Z","0.22.0-alpha-20230110161120-db40036":"2023-01-10T16:11:55.279Z","0.22.0-alpha-20230110161627-6cf1a8e":"2023-01-10T16:17:01.725Z","0.22.0-alpha-20230110162204-349d7e5":"2023-01-10T16:22:38.626Z","0.22.0-alpha-20230110163202-e90a996":"2023-01-10T16:32:45.356Z","0.22.0-alpha-20230110163444-59531ef":"2023-01-10T16:35:21.156Z","0.22.0-alpha-20230110164551-49700bf":"2023-01-10T16:46:40.636Z","0.22.0-alpha-20230110164943-e2e131a":"2023-01-10T16:50:19.791Z","0.22.0-alpha-20230110165159-8873105":"2023-01-10T16:52:38.674Z","0.22.0-alpha-20230110170147-bb8ccd2":"2023-01-10T17:02:33.016Z","0.22.0-alpha-20230110170226-d22be20":"2023-01-10T17:03:08.214Z","0.22.0-alpha-20230110170707-c844956":"2023-01-10T17:07:48.696Z","0.22.0-alpha-20230110171235-f1606b2":"2023-01-10T17:13:15.496Z","0.22.0-alpha-20230110171746-02bce0f":"2023-01-10T17:18:22.174Z","0.22.0-alpha-20230110172240-7b38213":"2023-01-10T17:23:26.020Z","0.22.0-alpha-20230110172711-8406a55":"2023-01-10T17:27:45.007Z","0.22.0-alpha-20230110204151-484e449":"2023-01-10T20:42:26.685Z","0.22.0-alpha-20230110204809-64c6a96":"2023-01-10T20:48:44.433Z","0.22.0-alpha-20230110205315-b622230":"2023-01-10T20:53:50.715Z","0.22.0-alpha-20230110210325-c9b102c":"2023-01-10T21:04:00.459Z","0.22.0-alpha-20230110210851-0a9f206":"2023-01-10T21:09:27.559Z","0.22.0-alpha-20230111002210-90f084e":"2023-01-11T00:22:45.184Z","0.22.0-alpha-20230111002811-0c0e592":"2023-01-11T00:28:58.500Z","0.22.0-alpha-20230111084211-d37acf8":"2023-01-11T08:42:45.260Z","0.22.0-alpha-20230111092159-c92ac3e":"2023-01-11T09:22:34.799Z","0.22.0-alpha-20230111101416-7663df5":"2023-01-11T10:14:51.066Z","0.22.0-alpha-20230111101824-476ab85":"2023-01-11T10:18:58.858Z","0.22.0-alpha-20230111102130-8567955":"2023-01-11T10:22:13.453Z","0.22.0-alpha-20230111103636-c9fb80d":"2023-01-11T10:37:09.823Z","0.22.0-alpha-20230111104604-0e52139":"2023-01-11T10:46:52.845Z","0.22.0-alpha-20230111105051-876c0d9":"2023-01-11T10:51:29.242Z","0.22.0-alpha-20230111105644-b35fa9b":"2023-01-11T10:57:22.368Z","0.22.0-alpha-20230111110136-6e95d3b":"2023-01-11T11:02:12.699Z","0.22.0-alpha-20230111110339-c9ab272":"2023-01-11T11:04:14.016Z","0.22.0-alpha-20230111111329-295c9b5":"2023-01-11T11:14:13.509Z","0.22.0-alpha-20230111111339-3e3077f":"2023-01-11T11:14:23.733Z","0.22.0-alpha-20230111111758-a084ea4":"2023-01-11T11:18:33.020Z","0.22.0-alpha-20230111111850-f470068":"2023-01-11T11:19:27.135Z","0.22.0-alpha-20230111113243-86491b6":"2023-01-11T11:33:20.619Z","0.22.0-alpha-20230111114041-d3203a2":"2023-01-11T11:41:15.916Z","0.22.0-alpha-20230111122500-0aedb08":"2023-01-11T12:25:35.257Z","0.22.0-alpha-20230111130531-1067cdb":"2023-01-11T13:06:07.282Z","0.22.0-alpha-20230111131417-a3c9055":"2023-01-11T13:14:59.122Z","0.22.0-alpha-20230111132355-d16b423":"2023-01-11T13:24:36.016Z","0.22.0-alpha-20230111140802-acb015d":"2023-01-11T14:08:42.050Z","0.22.0-alpha-20230111141059-415158b":"2023-01-11T14:11:34.830Z","0.22.0-alpha-20230111142649-da13515":"2023-01-11T14:27:24.419Z","0.22.0-alpha-20230111142852-6d03000":"2023-01-11T14:29:38.300Z","0.22.0-alpha-20230111143717-be2d5fa":"2023-01-11T14:38:01.602Z","0.22.0-alpha-20230111144210-f90f154":"2023-01-11T14:42:49.338Z","0.22.0-alpha-20230111144718-e755fb4":"2023-01-11T14:47:53.150Z","0.22.0-alpha-20230111145251-6b927a0":"2023-01-11T14:53:38.791Z","0.22.0-alpha-20230111145546-cb568ea":"2023-01-11T14:56:27.972Z","0.22.0-alpha-20230111150116-99309ab":"2023-01-11T15:01:53.926Z","0.22.0-alpha-20230111150433-4aa503b":"2023-01-11T15:05:16.805Z","0.22.0-alpha-20230111150446-517b045":"2023-01-11T15:05:27.542Z","0.22.0-alpha-20230111150947-e366421":"2023-01-11T15:10:23.794Z","0.22.0-alpha-20230111151712-93bec25":"2023-01-11T15:17:52.656Z","0.22.0-alpha-20230111152253-f596a76":"2023-01-11T15:23:42.527Z","0.22.0-alpha-20230111152441-affcd7b":"2023-01-11T15:25:18.110Z","0.22.0-alpha-20230111153500-62e077f":"2023-01-11T15:35:37.069Z","0.22.0-alpha-20230111153541-beccddd":"2023-01-11T15:36:27.631Z","0.22.0-alpha-20230111154136-e6e7267":"2023-01-11T15:42:24.967Z","0.22.0-alpha-20230111154420-69b89ac":"2023-01-11T15:44:56.080Z","0.22.0-alpha-20230111154656-5d43ed7":"2023-01-11T15:47:44.441Z","0.22.0-alpha-20230111154727-f4de89e":"2023-01-11T15:48:08.999Z","0.22.0-alpha-20230111155127-87c09fd":"2023-01-11T15:52:04.503Z","0.22.0-alpha-20230111155631-c678b0e":"2023-01-11T15:57:05.730Z","0.22.0-alpha-20230111160214-72571ff":"2023-01-11T16:02:55.557Z","0.22.0-alpha-20230111191709-5444790":"2023-01-11T19:17:47.453Z","0.22.0-alpha-20230111192215-3301af6":"2023-01-11T19:22:53.092Z","0.22.0-alpha-20230111192632-60d52af":"2023-01-11T19:27:14.307Z","0.22.0-alpha-20230111192852-c7a503b":"2023-01-11T19:29:42.525Z","0.22.0-alpha-20230111193821-9ee1482":"2023-01-11T19:39:07.620Z","0.22.0-alpha-20230111193831-73e4d81":"2023-01-11T19:39:12.237Z","0.22.0-alpha-20230111194351-265bb92":"2023-01-11T19:44:25.656Z","0.22.0-alpha-20230111194859-a35fd48":"2023-01-11T19:49:35.625Z","0.22.0-alpha-20230111195459-9e0468a":"2023-01-11T19:55:40.793Z","0.22.0-alpha-20230111195839-2ac31d9":"2023-01-11T19:59:15.005Z","0.22.0-alpha-20230111200451-7c7d2ff":"2023-01-11T20:05:34.664Z","0.22.0-alpha-20230111201403-5e84376":"2023-01-11T20:14:52.441Z","0.22.0-alpha-20230111205955-34cf53c":"2023-01-11T21:00:41.782Z","0.22.0-alpha-20230111231234-b8f8548":"2023-01-11T23:13:15.512Z","0.22.0-alpha-20230111231831-d27ba3b":"2023-01-11T23:19:06.027Z","0.22.0-alpha-20230111232329-60784ce":"2023-01-11T23:24:09.424Z","0.22.0-alpha-20230111233317-de9786b":"2023-01-11T23:33:52.142Z","0.22.0-alpha-20230111233825-d878b36":"2023-01-11T23:39:00.289Z","0.22.0-alpha-20230112065345-81379a0":"2023-01-12T06:54:33.065Z","0.22.0-alpha-20230112085410-e1c3069":"2023-01-12T08:54:45.426Z","0.22.0-alpha-20230112095538-4826f26":"2023-01-12T09:56:12.704Z","0.22.0-alpha-20230112095549-7c13352":"2023-01-12T09:56:40.682Z","0.22.0-alpha-20230112100108-ee73563":"2023-01-12T10:01:47.638Z","0.22.0-alpha-20230112100131-e8a27d0":"2023-01-12T10:02:12.744Z","0.22.0-alpha-20230112100146-b3a38f6":"2023-01-12T10:02:24.176Z","0.22.0-alpha-20230112100345-325d603":"2023-01-12T10:04:30.515Z","0.22.0-alpha-20230112100653-1dc2f2f":"2023-01-12T10:07:28.362Z","0.22.0-alpha-20230112101222-f671ac2":"2023-01-12T10:12:57.749Z","0.22.0-alpha-20230112101407-399f6a9":"2023-01-12T10:14:43.115Z","0.22.0-alpha-20230112102405-a3abb0b":"2023-01-12T10:24:39.579Z","0.22.0-alpha-20230112102936-a3297d8":"2023-01-12T10:30:11.685Z","0.22.0-alpha-20230112103545-2db2ade":"2023-01-12T10:36:30.418Z","0.22.0-alpha-20230112104046-23d53b1":"2023-01-12T10:41:28.225Z","0.22.0-alpha-20230112105035-88b309d":"2023-01-12T10:51:10.399Z","0.22.0-alpha-20230112105038-8cd0d4e":"2023-01-12T10:51:20.450Z","0.22.0-alpha-20230112105043-2927354":"2023-01-12T10:51:27.404Z","0.22.0-alpha-20230112105547-a98adf8":"2023-01-12T10:56:25.249Z","0.22.0-alpha-20230112110104-a31572d":"2023-01-12T11:01:38.881Z","0.22.0-alpha-20230112110344-53f05fd":"2023-01-12T11:04:28.874Z","0.22.0-alpha-20230112111320-d83aafa":"2023-01-12T11:13:55.165Z","0.22.0-alpha-20230112111432-45b23a0":"2023-01-12T11:15:12.101Z","0.22.0-alpha-20230112111916-22ce2e3":"2023-01-12T11:19:50.424Z","0.22.0-alpha-20230112112430-3be9e34":"2023-01-12T11:25:08.715Z","0.22.0-alpha-20230112113021-08b3b73":"2023-01-12T11:30:55.666Z","0.22.0-alpha-20230112113533-cb09ef6":"2023-01-12T11:36:08.752Z","0.22.0-alpha-20230112114041-55072c2":"2023-01-12T11:41:16.505Z","0.22.0-alpha-20230112130551-da71598":"2023-01-12T13:06:38.796Z","0.22.0-alpha-20230112132913-e4f8565":"2023-01-12T13:29:58.548Z","0.22.0-alpha-20230112141758-7f33ba9":"2023-01-12T14:18:37.328Z","0.22.0-alpha-20230112145832-f0d8a25":"2023-01-12T14:59:20.094Z","0.22.0-alpha-20230112150250-890530a":"2023-01-12T15:03:24.403Z","0.22.0-alpha-20230112151240-67162bf":"2023-01-12T15:13:16.606Z","0.22.0-alpha-20230112190932-d34b8be":"2023-01-12T19:10:07.253Z","0.22.0-alpha-20230112191604-d46b289":"2023-01-12T19:16:46.649Z","0.22.0-alpha-20230112194233-98f5b67":"2023-01-12T19:43:14.798Z","0.22.0-alpha-20230112194251-b10cbbe":"2023-01-12T19:43:26.202Z","0.22.0-alpha-20230112194257-38c43e6":"2023-01-12T19:43:34.963Z","0.22.0-alpha-20230112194314-16aca48":"2023-01-12T19:43:49.821Z","0.22.0-alpha-20230112194802-8d5a430":"2023-01-12T19:48:38.606Z","0.22.0-alpha-20230112195314-2fe095e":"2023-01-12T19:53:52.770Z","0.22.0-alpha-20230112195525-3aeb4f7":"2023-01-12T19:56:00.015Z","0.22.0-alpha-20230112212328-8dfc2e0":"2023-01-12T21:24:07.387Z","0.22.0-alpha-20230112212852-16016b6":"2023-01-12T21:29:28.487Z","0.22.0-alpha-20230112212907-ac4dce2":"2023-01-12T21:29:41.011Z","0.22.0-alpha-20230112212909-1e526b6":"2023-01-12T21:29:54.315Z","0.22.0-alpha-20230112213411-7b6e2ea":"2023-01-12T21:34:45.718Z","0.22.0-alpha-20230112213851-ef0b7a0":"2023-01-12T21:39:28.548Z","0.22.0-alpha-20230112214101-789c5fc":"2023-01-12T21:41:37.412Z","0.22.0-alpha-20230112215153-930a486":"2023-01-12T21:52:29.858Z","0.22.0-alpha-20230112215224-f48aa51":"2023-01-12T21:53:05.252Z","0.22.0-alpha-20230112215739-8c7cca4":"2023-01-12T21:58:15.977Z","0.22.0-alpha-20230112220242-350827c":"2023-01-12T22:03:17.350Z","0.22.0-alpha-20230112220805-84cf3b6":"2023-01-12T22:08:47.025Z","0.22.0-alpha-20230113012721-470e2c6":"2023-01-13T01:28:04.860Z","0.22.0-alpha-20230113013301-bc96c4c":"2023-01-13T01:33:37.362Z","0.22.0-alpha-20230113013855-ad7eecb":"2023-01-13T01:39:30.497Z","0.22.0-alpha-20230113014454-fe0075c":"2023-01-13T01:45:35.391Z","0.22.0-alpha-20230113015659-06b70ef":"2023-01-13T01:57:47.108Z","0.22.0-alpha-20230113020147-1dd8e28":"2023-01-13T02:02:24.259Z","0.22.0-alpha-20230113075630-96e80ab":"2023-01-13T07:57:05.643Z","0.22.0-alpha-20230113080143-9aab134":"2023-01-13T08:02:21.495Z","0.22.0-alpha-20230113080703-db1ff19":"2023-01-13T08:07:39.122Z","0.22.0-alpha-20230113080905-5784913":"2023-01-13T08:09:40.679Z","0.22.0-alpha-20230113081927-f4bb8e3":"2023-01-13T08:20:01.071Z","0.22.0-alpha-20230113081959-ef03170":"2023-01-13T08:20:40.503Z","0.22.0-alpha-20230113082552-e830052":"2023-01-13T08:26:30.007Z","0.22.0-alpha-20230113084629-d56396b":"2023-01-13T08:47:02.598Z","0.22.0-alpha-20230113085227-1a3c8d0":"2023-01-13T08:53:10.466Z","0.22.0-alpha-20230113093306-6cdc20d":"2023-01-13T09:33:42.826Z","0.22.0-alpha-20230113093357-d939a44":"2023-01-13T09:34:39.477Z","0.22.0-alpha-20230113101226-281a951":"2023-01-13T10:13:03.081Z","0.22.0-alpha-20230113122439-ddc9c11":"2023-01-13T12:25:14.103Z","0.22.0-alpha-20230113122957-3220724":"2023-01-13T12:30:43.268Z","0.22.0-alpha-20230113123604-cb2713f":"2023-01-13T12:36:39.236Z","0.22.0-alpha-20230113123830-cfefc19":"2023-01-13T12:39:09.679Z","0.22.0-alpha-20230113124128-4a6aef1":"2023-01-13T12:42:08.487Z","0.22.0-alpha-20230113124459-9049f4f":"2023-01-13T12:45:45.068Z","0.22.0-alpha-20230113124844-6f9cc14":"2023-01-13T12:49:19.642Z","0.22.0-alpha-20230113124857-e3bdecd":"2023-01-13T12:49:33.130Z","0.22.0-alpha-20230113125443-66f855e":"2023-01-13T12:55:21.351Z","0.22.0-alpha-20230113130109-9373edc":"2023-01-13T13:01:44.996Z","0.22.0-alpha-20230113130623-eae9376":"2023-01-13T13:07:03.495Z","0.22.0-alpha-20230113132905-a1586a7":"2023-01-13T13:29:40.671Z","0.22.0-alpha-20230113154643-404eca0":"2023-01-13T15:47:18.908Z","0.22.0-alpha-20230113155946-1631c2d":"2023-01-13T16:00:22.251Z","0.22.0-alpha-20230113162208-5e59624":"2023-01-13T16:22:43.225Z","0.22.0-alpha-20230113162359-6cc2225":"2023-01-13T16:24:41.278Z","0.22.0-alpha-20230113162538-bd8eaf8":"2023-01-13T16:26:15.157Z","0.22.0-alpha-20230113163003-2fbc4d9":"2023-01-13T16:30:38.603Z","0.22.0-alpha-20230113163404-38ecb6b":"2023-01-13T16:34:39.124Z","0.22.0-alpha-20230113164020-16105ec":"2023-01-13T16:40:58.109Z","0.22.0-alpha-20230113164115-ec4804a":"2023-01-13T16:41:55.046Z","0.22.0-alpha-20230113164429-9314a74":"2023-01-13T16:45:07.432Z","0.22.0-alpha-20230113170924-5477d21":"2023-01-13T17:09:58.569Z","0.22.0-alpha-20230113204407-8e6b1bb":"2023-01-13T20:44:50.114Z","0.22.0-alpha-20230114001700-039ffd4":"2023-01-14T00:17:38.736Z","0.22.0-alpha-20230114104025-60ac133":"2023-01-14T10:41:00.129Z","0.22.0-alpha-20230114104728-c48514c":"2023-01-14T10:48:02.360Z","0.22.0-alpha-20230114104741-9859dd3":"2023-01-14T10:48:16.216Z","0.22.0-alpha-20230114105713-82489e2":"2023-01-14T10:57:50.684Z","0.22.0-alpha-20230114110839-1e4d351":"2023-01-14T11:09:18.194Z","0.22.0-alpha-20230114111815-e9b6552":"2023-01-14T11:18:50.108Z","0.22.0-alpha-20230114111832-9150da3":"2023-01-14T11:19:11.177Z","0.22.0-alpha-20230114112922-332711d":"2023-01-14T11:30:05.505Z","0.22.0-alpha-20230114113036-e41c2ef":"2023-01-14T11:31:23.040Z","0.22.0-alpha-20230114113646-7168c29":"2023-01-14T11:37:20.684Z","0.22.0-alpha-20230114113823-d657a58":"2023-01-14T11:38:57.898Z","0.22.0-alpha-20230114114046-f30f5b7":"2023-01-14T11:41:20.491Z","0.22.0-alpha-20230114114057-2b50107":"2023-01-14T11:41:34.228Z","0.22.0-alpha-20230114114247-750d54e":"2023-01-14T11:43:21.384Z","0.22.0-alpha-20230114114653-f3b64bc":"2023-01-14T11:47:27.136Z","0.22.0-alpha-20230114115054-05afbd9":"2023-01-14T11:51:32.637Z","0.22.0-alpha-20230114115320-d97bc34":"2023-01-14T11:53:56.980Z","0.22.0-alpha-20230114115628-80390da":"2023-01-14T11:57:03.949Z","0.22.0-alpha-20230114120326-b5bb8b7":"2023-01-14T12:04:02.789Z","0.22.0-alpha-20230114202607-7bf2a1d":"2023-01-14T20:26:42.118Z","0.22.0-alpha-20230114203130-1e29ccd":"2023-01-14T20:32:04.005Z","0.22.0-alpha-20230114232848-185da45":"2023-01-14T23:29:22.118Z","0.22.0-alpha-20230114233451-200ffa1":"2023-01-14T23:35:39.903Z","0.22.0-alpha-20230115021341-6198df2":"2023-01-15T02:14:15.862Z","0.22.0-alpha-20230115021943-657bf34":"2023-01-15T02:20:21.032Z","0.22.0-alpha-20230115022439-09813f1":"2023-01-15T02:25:12.710Z","0.22.0-alpha-20230115082117-9240257":"2023-01-15T08:21:52.007Z","0.22.0-alpha-20230115082718-128c7fa":"2023-01-15T08:28:01.754Z","0.22.0-alpha-20230115083931-6014b1c":"2023-01-15T08:40:07.917Z","0.22.0-alpha-20230115084415-dd4fdd8":"2023-01-15T08:44:50.575Z","0.22.0-alpha-20230115085001-f28d6de":"2023-01-15T08:50:36.518Z","0.22.0-alpha-20230115090224-6c34adb":"2023-01-15T09:03:00.468Z","0.22.0-alpha-20230115090644-a709664":"2023-01-15T09:07:19.728Z","0.22.0-alpha-20230115090921-85f2cc3":"2023-01-15T09:09:55.332Z","0.22.0-alpha-20230115091408-b632690":"2023-01-15T09:14:55.431Z","0.22.0-alpha-20230115091512-e5fd42a":"2023-01-15T09:15:47.892Z","0.22.0-alpha-20230115091822-16b5ee7":"2023-01-15T09:18:56.516Z","0.22.0-alpha-20230115092115-409bb1a":"2023-01-15T09:21:51.430Z","0.22.0-alpha-20230115092807-ec19b51":"2023-01-15T09:28:41.890Z","0.22.0-alpha-20230115093758-a80ea9a":"2023-01-15T09:38:39.230Z","0.22.0-alpha-20230115130921-bdaabdc":"2023-01-15T13:09:57.551Z","0.22.0-alpha-20230115131002-a382940":"2023-01-15T13:10:36.793Z","0.22.0-alpha-20230115131350-a9d1a89":"2023-01-15T13:14:25.674Z","0.22.0-alpha-20230115131658-31e2631":"2023-01-15T13:17:32.580Z","0.22.0-alpha-20230115132111-d86ce28":"2023-01-15T13:21:44.613Z","0.22.0-alpha-20230115132341-f5d7eda":"2023-01-15T13:24:16.497Z","0.22.0-alpha-20230115132727-f03b06b":"2023-01-15T13:28:03.170Z","0.22.0-alpha-20230115133414-f61f4b7":"2023-01-15T13:34:50.017Z","0.22.0-alpha-20230115212914-2a13752":"2023-01-15T21:29:49.045Z","0.22.0-alpha-20230115213448-097f80e":"2023-01-15T21:35:24.694Z","0.22.0-alpha-20230116005832-5b3e48b":"2023-01-16T00:59:17.941Z","0.22.0-alpha-20230116010229-5bf8870":"2023-01-16T01:03:05.607Z","0.22.0-alpha-20230116042730-f871ddf":"2023-01-16T04:28:05.665Z","0.22.0-alpha-20230116043302-95fa504":"2023-01-16T04:33:36.265Z","0.22.0-alpha-20230116083441-d0d477a":"2023-01-16T08:35:16.581Z","0.22.0-alpha-20230116084436-7413816":"2023-01-16T08:45:10.629Z","0.22.0-alpha-20230116084927-56e6299":"2023-01-16T08:50:06.224Z","0.22.0-alpha-20230116085119-456dd11":"2023-01-16T08:51:57.838Z","0.22.0-alpha-20230116085614-0cfe55c":"2023-01-16T08:56:48.607Z","0.22.0-alpha-20230116090102-0ad85cb":"2023-01-16T09:01:40.331Z","0.22.0-alpha-20230116090550-f1c4580":"2023-01-16T09:06:25.758Z","0.22.0-alpha-20230116091040-755742b":"2023-01-16T09:11:15.288Z","0.22.0-alpha-20230116091534-f104130":"2023-01-16T09:16:08.901Z","0.22.0-alpha-20230116092409-1bda877":"2023-01-16T09:24:43.809Z","0.22.0-alpha-20230116092957-7f2df09":"2023-01-16T09:30:34.850Z","0.22.0-alpha-20230116093353-f29730a":"2023-01-16T09:34:26.784Z","0.22.0-alpha-20230116093847-4e7f625":"2023-01-16T09:39:32.632Z","0.22.0-alpha-20230116094036-29fb454":"2023-01-16T09:41:11.795Z","0.22.0-alpha-20230116094523-f475f71":"2023-01-16T09:45:59.784Z","0.22.0-alpha-20230116095013-484fb46":"2023-01-16T09:50:49.515Z","0.22.0-alpha-20230116095354-335c84d":"2023-01-16T09:54:30.296Z","0.22.0-alpha-20230116095540-970a4d8":"2023-01-16T09:56:16.512Z","0.22.0-alpha-20230116100101-76bce3b":"2023-01-16T10:01:45.700Z","0.22.0-alpha-20230116100515-e795702":"2023-01-16T10:05:50.697Z","0.22.0-alpha-20230116100919-8287334":"2023-01-16T10:09:55.104Z","0.22.0-alpha-20230116101138-c7118bb":"2023-01-16T10:12:18.522Z","0.22.0-alpha-20230116101642-7122c62":"2023-01-16T10:17:30.337Z","0.22.0-alpha-20230116101741-9e28502":"2023-01-16T10:18:20.053Z","0.22.0-alpha-20230116102202-4c2e429":"2023-01-16T10:22:37.037Z","0.22.0-alpha-20230116102744-9e5ced2":"2023-01-16T10:28:22.854Z","0.22.0-alpha-20230116102939-bdfc03d":"2023-01-16T10:30:19.596Z","0.22.0-alpha-20230116103407-1261419":"2023-01-16T10:34:41.514Z","0.22.0-alpha-20230116103939-36badcd":"2023-01-16T10:40:21.840Z","0.22.0-alpha-20230116104617-2685e74":"2023-01-16T10:46:53.283Z","0.22.0-alpha-20230116104933-0e60407":"2023-01-16T10:50:13.774Z","0.22.0-alpha-20230116105230-104cc67":"2023-01-16T10:53:06.737Z","0.22.0-alpha-20230116105413-8dfa03d":"2023-01-16T10:54:48.432Z","0.22.0-alpha-20230116105729-2343a81":"2023-01-16T10:58:06.924Z","0.22.0-alpha-20230116110031-7a293a0":"2023-01-16T11:01:06.371Z","0.22.0-alpha-20230116110454-d54252f":"2023-01-16T11:05:33.000Z","0.22.0-alpha-20230116111924-2c50571":"2023-01-16T11:19:59.062Z","0.22.0-alpha-20230116112401-c2370b7":"2023-01-16T11:24:36.280Z","0.22.0-alpha-20230116113335-a82cfed":"2023-01-16T11:34:11.327Z","0.22.0-alpha-20230116113939-7ac8a6a":"2023-01-16T11:40:15.445Z","0.22.0-alpha-20230116114437-40c5be4":"2023-01-16T11:45:15.867Z","0.22.0-alpha-20230116114932-fa529b6":"2023-01-16T11:50:11.498Z","0.22.0-alpha-20230116120539-d319aef":"2023-01-16T12:06:13.521Z","0.22.0-alpha-20230116121427-46feb02":"2023-01-16T12:15:06.414Z","0.22.0-alpha-20230116121700-49ea30a1":"2023-01-16T12:17:34.300Z","0.22.0-alpha-20230116122123-d503484f":"2023-01-16T12:21:59.231Z","0.22.0-alpha-20230116123800-fbc99c6c":"2023-01-16T12:38:36.159Z","0.22.0-alpha-20230116123844-22f69250":"2023-01-16T12:39:21.146Z","0.22.0-alpha-20230116125736-1e9371a2":"2023-01-16T12:58:13.066Z","0.22.0-alpha-20230116134633-48698357":"2023-01-16T13:47:08.153Z","0.22.0-alpha-20230116160257-6cf3c1cc":"2023-01-16T16:03:31.560Z","0.22.0-alpha-20230116160842-1a47e09c":"2023-01-16T16:09:17.760Z","0.22.0-alpha-20230116161405-841c949c":"2023-01-16T16:14:53.262Z","0.22.0-alpha-20230116161706-6df97595":"2023-01-16T16:17:43.571Z","0.22.0-alpha-20230116161903-3e9fd9ce":"2023-01-16T16:19:53.618Z","0.22.0-alpha-20230116162717-f25fb8a0":"2023-01-16T16:27:53.179Z","0.22.0-alpha-20230116163507-2962fd42":"2023-01-16T16:35:42.419Z","0.22.0-alpha-20230116164823-18776615":"2023-01-16T16:48:57.240Z","0.22.0-alpha-20230116190134-2c405dcd":"2023-01-16T19:02:17.029Z","0.22.0-alpha-20230116191612-840352d1":"2023-01-16T19:16:48.539Z","0.22.0-alpha-20230116195953-1b6c00e4":"2023-01-16T20:00:27.236Z","0.22.0-alpha-20230116200037-611153ba":"2023-01-16T20:01:27.519Z","0.22.0-alpha-20230116202532-bb077401":"2023-01-16T20:26:06.846Z","0.22.0-alpha-20230116203526-7abd41a3":"2023-01-16T20:36:02.249Z","0.22.0-alpha-20230116204613-f6f410cd":"2023-01-16T20:46:48.178Z","0.22.0-alpha-20230117010919-61820ce0":"2023-01-17T01:10:09.485Z","0.22.0-alpha-20230117011032-c3ea5ace":"2023-01-17T01:11:12.941Z","0.22.0-alpha-20230117042550-822e1d34":"2023-01-17T04:26:25.968Z","0.22.0-alpha-20230117043059-b4092e43":"2023-01-17T04:31:33.316Z","0.22.0-alpha-20230117075639-2e02f6dc":"2023-01-17T07:57:14.007Z","0.22.0-alpha-20230117091419-8a0791ff":"2023-01-17T09:14:54.991Z","0.22.0-alpha-20230117091655-d1c08aa3":"2023-01-17T09:17:30.381Z","0.22.0-alpha-20230117092035-c26fc3d1":"2023-01-17T09:21:09.994Z","0.22.0-alpha-20230117093458-e246bc41":"2023-01-17T09:35:38.537Z","0.22.0-alpha-20230117114320-584ada21":"2023-01-17T11:43:57.488Z","0.22.0-alpha-20230117121240-f70beefa":"2023-01-17T12:13:21.887Z","0.22.0-alpha-20230117122627-1dfcaac1":"2023-01-17T12:27:02.570Z","0.22.0-alpha-20230117122635-2af243be":"2023-01-17T12:27:20.093Z","0.22.0-alpha-20230117122924-d5711e85":"2023-01-17T12:30:03.790Z","0.22.0-alpha-20230117123422-cecca3f7":"2023-01-17T12:34:57.725Z","0.22.0-alpha-20230117124400-7e148070":"2023-01-17T12:44:37.177Z","0.22.0-alpha-20230117124910-461517c9":"2023-01-17T12:49:47.976Z","0.22.0-alpha-20230117125523-667520ec":"2023-01-17T12:56:11.773Z","0.22.0-alpha-20230117130008-03459431":"2023-01-17T13:00:44.969Z","0.22.0-alpha-20230117130501-fa70f757":"2023-01-17T13:05:38.820Z","0.22.0-alpha-20230117131024-2dc63cb8":"2023-01-17T13:11:11.402Z","0.22.0-alpha-20230117131451-89d32f33":"2023-01-17T13:15:27.893Z","0.22.0-alpha-20230117132116-819c49cf":"2023-01-17T13:21:51.081Z","0.22.0-alpha-20230117132301-28229e9f":"2023-01-17T13:23:41.866Z","0.22.0-alpha-20230117132520-0bf49708":"2023-01-17T13:26:10.845Z","0.22.0-alpha-20230117133150-cac8802f":"2023-01-17T13:32:35.695Z","0.22.0-alpha-20230117133635-ef5e92d1":"2023-01-17T13:37:09.892Z","0.22.0-alpha-20230117133952-a9857651":"2023-01-17T13:40:28.742Z","0.22.0-alpha-20230117134223-8a0b782c":"2023-01-17T13:42:58.697Z","0.22.0-alpha-20230117134346-89e63304":"2023-01-17T13:44:29.237Z","0.22.0-alpha-20230117134742-7380b1d3":"2023-01-17T13:48:28.139Z","0.22.0-alpha-20230117135014-84ecc572":"2023-01-17T13:50:49.643Z","0.22.0-alpha-20230117135046-2796c6f6":"2023-01-17T13:51:24.727Z","0.22.0-alpha-20230117135330-3c773dd9":"2023-01-17T13:54:06.783Z","0.22.0-alpha-20230117135455-95e4a8cb":"2023-01-17T13:55:40.213Z","0.22.0-alpha-20230117135752-0c426d39":"2023-01-17T13:58:30.476Z","0.22.0-alpha-20230117135808-bc879aa0":"2023-01-17T13:58:56.569Z","0.22.0":"2023-01-17T14:16:32.282Z","0.23.0-alpha-20230208100219-8a154e0c":"2023-02-08T10:03:02.179Z","0.23.0-alpha-20230210090506-c8dbfe32":"2023-02-10T09:05:41.449Z","0.23.0-alpha-20230210090742-d5b11a5e":"2023-02-10T09:08:20.638Z","0.23.0-alpha-20230210091245-be130c15":"2023-02-10T09:13:23.231Z","0.23.0-alpha-20230210091750-fa501ba0":"2023-02-10T09:18:29.801Z","0.23.0-alpha-20230210092650-432472b1":"2023-02-10T09:27:20.998Z","0.23.0-alpha-20230210093144-3e1d7dd3":"2023-02-10T09:32:21.972Z","0.23.0-alpha-20230210102108-737e7786":"2023-02-10T10:21:38.131Z","0.23.0-alpha-20230210102618-0681f9ff":"2023-02-10T10:26:55.361Z","0.23.0-alpha-20230210103039-877edf21":"2023-02-10T10:31:09.029Z","0.23.0-alpha-20230210103545-1f509c78":"2023-02-10T10:36:14.855Z","0.23.0-alpha-20230210104023-4c24ac57":"2023-02-10T10:40:57.068Z","0.23.0-alpha-20230210104946-b40ef0e7":"2023-02-10T10:50:16.183Z","0.23.0-alpha-20230210105239-754fa2a9":"2023-02-10T10:53:10.878Z","0.23.0-alpha-20230210113705-0c669348":"2023-02-10T11:37:35.750Z","0.23.0-alpha-20230210120031-f5b42d42":"2023-02-10T12:01:03.440Z","0.23.0-alpha-20230210120311-b348cbff":"2023-02-10T12:03:41.652Z","0.23.0-alpha-20230210121420-da538854":"2023-02-10T12:14:50.434Z","0.23.0-alpha-20230210122411-2fda1580":"2023-02-10T12:24:41.808Z","0.23.0-alpha-20230210123050-13e6898c":"2023-02-10T12:31:24.253Z","0.23.0-alpha-20230210123427-deb31f7b":"2023-02-10T12:34:57.900Z","0.23.0-alpha-20230210124512-01d8a07f":"2023-02-10T12:45:42.602Z","0.23.0-alpha-20230210125042-9ac57089":"2023-02-10T12:51:12.705Z","0.23.0-alpha-20230210133000-96f00a02":"2023-02-10T13:30:41.106Z","0.23.0-alpha-20230210133412-31beb219":"2023-02-10T13:34:44.778Z","0.23.0-alpha-20230210133921-b7f005a2":"2023-02-10T13:39:52.420Z","0.23.0-alpha-20230210151627-4a8aa897":"2023-02-10T15:16:58.705Z","0.23.0-alpha-20230210155439-19481707":"2023-02-10T15:55:16.222Z","0.23.0":"2023-02-10T16:25:42.946Z","0.23.0-alpha-20230210162531-7fb44d1e":"2023-02-10T16:26:11.371Z","0.23.1-alpha-20230213090810-b98936ac":"2023-02-13T09:08:44.389Z","0.23.1":"2023-02-13T09:28:38.297Z","0.24.0-alpha-20230615091436-e7c527b8":"2023-06-15T09:15:22.406Z","0.24.0-alpha-20230615100127-4472d65b":"2023-06-15T10:02:02.449Z","0.24.0-alpha-20230615100945-0ce2709c":"2023-06-15T10:10:20.393Z","0.24.0-alpha-20230615112327-6f00eae5":"2023-06-15T11:24:00.832Z","0.24.0-alpha-20230616074730-dc6f93bd":"2023-06-16T07:48:09.893Z","0.24.0-alpha-20230620130030-39261598":"2023-06-20T13:01:10.701Z","0.24.0-rc-20230620134529-c38690af":"2023-06-20T13:46:04.160Z","0.24.0-alpha-20230620134629-3768bb62":"2023-06-20T13:47:02.835Z","0.24.0-alpha-20230620141319-94512794":"2023-06-20T14:13:55.213Z","0.24.0-alpha-20230620141446-8947c43d":"2023-06-20T14:15:33.335Z","0.24.0-alpha-20230620141614-53ebda22":"2023-06-20T14:17:01.123Z","0.24.0-alpha-20230620141743-f06c56b2":"2023-06-20T14:18:18.592Z","0.24.0-alpha-20230620150457-3ee886b6":"2023-06-20T15:05:34.483Z","0.24.0-alpha-20230620151917-24f1a885":"2023-06-20T15:20:01.219Z","0.24.0-alpha-20230620193531-c83abff6":"2023-06-20T19:36:05.914Z","0.24.0-alpha-20230621024050-a406dcea":"2023-06-21T02:41:24.531Z","0.24.0-alpha-20230621024105-a406dcea":"2023-06-21T02:41:42.313Z","0.24.0-alpha-20230621081140-9e44d151":"2023-06-21T08:12:15.034Z","0.24.0-alpha-20230621081204-9e44d151":"2023-06-21T08:12:46.421Z","0.24.0-alpha-20230621084952-e2fe8713":"2023-06-21T08:50:28.453Z","0.24.0-alpha-20230621085024-89c9cee5":"2023-06-21T08:51:13.208Z","0.24.0-alpha-20230621085251-e9c0c710":"2023-06-21T08:53:33.117Z","0.24.0-alpha-20230621085919-fb8a8abb":"2023-06-21T08:59:55.607Z","0.24.0-alpha-20230621092700-2217178f":"2023-06-21T09:27:34.371Z","0.24.0-alpha-20230621092815-e84b6921":"2023-06-21T09:28:48.864Z","0.24.0-alpha-20230621093055-122f652b":"2023-06-21T09:31:31.168Z","0.24.0-alpha-20230621093252-87ab461b":"2023-06-21T09:33:26.904Z","0.24.0-alpha-20230621093433-1f918bba":"2023-06-21T09:35:07.234Z","0.24.0-alpha-20230621093637-1f918bba":"2023-06-21T09:37:26.489Z","0.24.0-alpha-20230621110607-58068982":"2023-06-21T11:06:48.326Z","0.24.0-alpha-20230621110659-d9d43271":"2023-06-21T11:07:33.889Z","0.24.0-alpha-20230621112008-62a31a8d":"2023-06-21T11:21:00.989Z","0.24.0-alpha-20230621112823-59232682":"2023-06-21T11:29:04.722Z","0.24.0-alpha-20230621114549-bac18fda":"2023-06-21T11:46:35.647Z","0.24.0-alpha-20230621125127-6940197a":"2023-06-21T12:52:03.102Z","0.24.0-alpha-20230621125252-2afbca6f":"2023-06-21T12:53:29.441Z","0.24.0-alpha-20230621125410-435aee48":"2023-06-21T12:54:45.333Z","0.24.0-alpha-20230621125547-1c13a0e6":"2023-06-21T12:56:21.748Z","0.24.0-alpha-20230621125702-1c13a0e6":"2023-06-21T12:57:36.611Z","0.24.0-alpha-20230621134430-10052ec4":"2023-06-21T13:45:03.822Z","0.24.0-alpha-20230621134621-e1ffaed8":"2023-06-21T13:46:55.347Z","0.24.0-alpha-20230621134642-c2233c1c":"2023-06-21T13:47:17.491Z","0.24.0-alpha-20230621140122-3ed05dbf":"2023-06-21T14:01:56.189Z","0.24.0-alpha-20230621140150-1fdc4c7c":"2023-06-21T14:02:25.544Z","0.24.0-alpha-20230621142140-62ea6117":"2023-06-21T14:22:14.452Z","0.24.0-alpha-20230621142836-770170f1":"2023-06-21T14:29:21.238Z","0.24.0-alpha-20230621151433-c3f04bdc":"2023-06-21T15:15:07.098Z","0.24.0-alpha-20230621151846-a5bae3c5":"2023-06-21T15:19:29.053Z","0.24.0-alpha-20230621201935-65bbf891":"2023-06-21T20:20:10.306Z","0.24.0-alpha-20230621213718-37ba4541":"2023-06-21T21:37:52.244Z","0.24.0-alpha-20230622023451-f80db8aa":"2023-06-22T02:35:32.735Z","0.24.0-alpha-20230622023508-f80db8aa":"2023-06-22T02:35:54.625Z","0.24.0-alpha-20230622062017-e6a21282":"2023-06-22T06:20:52.433Z","0.24.0-alpha-20230622062049-3f3d0265":"2023-06-22T06:21:37.125Z","0.24.0-alpha-20230622062159-6f944eab":"2023-06-22T06:22:34.747Z","0.24.0-alpha-20230622065502-1db4d321":"2023-06-22T06:55:38.798Z","0.24.0-alpha-20230622065955-4f4b0e88":"2023-06-22T07:00:35.126Z","0.24.0-alpha-20230622070443-fad9e29c":"2023-06-22T07:05:17.388Z","0.24.0-alpha-20230622081632-00a7835b":"2023-06-22T08:17:16.937Z","0.24.0-alpha-20230622082730-6da74f68":"2023-06-22T08:28:06.738Z","0.24.0-alpha-20230622110147-3830766e":"2023-06-22T11:02:28.410Z","0.24.0-alpha-20230622150559-5e3d3233":"2023-06-22T15:06:35.963Z","0.24.0-alpha-20230622151154-b33d5643":"2023-06-22T15:12:37.242Z","0.24.0-alpha-20230622192126-8ea6ea4e":"2023-06-22T19:22:01.827Z","0.24.0-alpha-20230623045708-d3b09848":"2023-06-23T04:57:55.003Z","0.24.0-alpha-20230623075243-0b1cd923":"2023-06-23T07:53:24.010Z","0.24.0-alpha-20230623075332-81646edc":"2023-06-23T07:54:06.175Z","0.24.0-alpha-20230623075455-26b57a36":"2023-06-23T07:55:30.174Z","0.24.0-alpha-20230623075719-b9db8a7c":"2023-06-23T07:58:01.870Z","0.24.0-alpha-20230623075747-b9db8a7c":"2023-06-23T07:58:20.760Z","0.24.0-alpha-20230623082758-98c0ec20":"2023-06-23T08:28:32.079Z","0.24.0-alpha-20230623083017-7ffa1935":"2023-06-23T08:31:04.325Z","0.24.0-alpha-20230623083944-93a24c24":"2023-06-23T08:40:19.795Z","0.24.0-alpha-20230623084247-f85af85c":"2023-06-23T08:43:21.258Z","0.24.0-alpha-20230623084523-6dcefd7d":"2023-06-23T08:46:04.816Z","0.24.0-alpha-20230623085220-6c457b93":"2023-06-23T08:52:54.261Z","0.24.0-alpha-20230623093018-bba228a8":"2023-06-23T09:31:03.685Z","0.24.0-alpha-20230623223345-29405af2":"2023-06-23T22:34:20.402Z","0.24.0-alpha-20230623223506-29405af2":"2023-06-23T22:35:41.741Z","0.24.0-alpha-20230623223525-3d54c06f":"2023-06-23T22:35:59.325Z","0.24.0-alpha-20230624032049-5e6bb3fc":"2023-06-24T03:21:23.986Z","0.24.0-alpha-20230624094001-7c901d43":"2023-06-24T09:40:37.263Z","0.24.0-alpha-20230624094209-07c0afb2":"2023-06-24T09:42:47.283Z","0.24.0-alpha-20230625040408-6f0e23a7":"2023-06-25T04:04:54.009Z","0.24.0-alpha-20230625103255-ef9fa5bf":"2023-06-25T10:33:35.893Z","0.24.0-alpha-20230625103549-a5bfec1b":"2023-06-25T10:36:32.559Z","0.24.0-alpha-20230625114520-43ffb90e":"2023-06-25T11:45:54.741Z","0.24.0-alpha-20230625114714-0bf7326b":"2023-06-25T11:47:54.017Z","0.24.0-alpha-20230625114825-9b1099b6":"2023-06-25T11:49:04.408Z","0.24.0-alpha-20230625114924-efbd21d3":"2023-06-25T11:49:57.870Z","0.24.0-alpha-20230625115022-25473b9f":"2023-06-25T11:50:55.855Z","0.24.0-alpha-20230625115124-6bbc17c5":"2023-06-25T11:51:57.980Z","0.24.0-alpha-20230625123657-117f1da3":"2023-06-25T12:37:33.614Z","0.24.0-alpha-20230626083547-2ce7d70f":"2023-06-26T08:36:23.158Z","0.24.0-alpha-20230626083612-2ce7d70f":"2023-06-26T08:36:46.936Z","0.24.0-alpha-20230627002708-5b7a3da9":"2023-06-27T00:27:45.657Z","0.24.0-alpha-20230627002729-5b7a3da9":"2023-06-27T00:28:04.731Z","0.24.0-alpha-20230627085251-f82ef5f3":"2023-06-27T08:53:27.498Z","0.24.0-alpha-20230627093336-3fe7ed15":"2023-06-27T09:34:20.302Z","0.24.0-alpha-20230627093818-a1c919f2":"2023-06-27T09:38:57.519Z","0.24.0-alpha-20230627101822-31468b6b":"2023-06-27T10:18:57.466Z","0.24.0-alpha-20230627102906-f22e6c9f":"2023-06-27T10:29:43.977Z","0.24.0-alpha-20230627103019-641ecfee":"2023-06-27T10:30:52.619Z","0.24.0-alpha-20230627103136-7b3d2387":"2023-06-27T10:32:08.910Z","0.24.0-alpha-20230627112304-c3e69392":"2023-06-27T11:23:38.299Z","0.24.0-alpha-20230627161933-e782f03f":"2023-06-27T16:20:19.149Z","0.24.0-alpha-20230627183516-5f919da1":"2023-06-27T18:36:07.258Z","0.24.0-alpha-20230627183955-6698fbec":"2023-06-27T18:40:28.460Z","0.24.0-alpha-20230627184656-4d75fe45":"2023-06-27T18:47:39.129Z","0.24.0-alpha-20230627193122-9e0fd083":"2023-06-27T19:31:56.780Z","0.24.0-alpha-20230628082730-004728cd":"2023-06-28T08:28:10.256Z","0.24.0-alpha-20230628082832-06594691":"2023-06-28T08:29:20.897Z","0.24.0-alpha-20230628083144-2eac5b3d":"2023-06-28T08:32:19.225Z","0.24.0":"2023-06-28T08:36:03.651Z","0.24.1-alpha-20230711083346-835ec800":"2023-07-11T08:34:28.588Z","0.24.1-alpha-20230711083601-561c8084":"2023-07-11T08:36:41.707Z","0.24.1-alpha-20230711083637-ff504576":"2023-07-11T08:37:14.928Z","0.24.1-alpha-20230711090946-12496b03":"2023-07-11T09:10:27.431Z","0.24.1-alpha-20230711092328-642e2c88":"2023-07-11T09:24:05.166Z","0.24.1-alpha-20230711092450-5f84cc9b":"2023-07-11T09:25:28.421Z","0.24.1-alpha-20230711093219-df93e330":"2023-07-11T09:32:55.545Z","0.24.1-alpha-20230711093707-3a682256":"2023-07-11T09:37:41.801Z","0.24.1-alpha-20230711094721-563ef15e":"2023-07-11T09:47:58.818Z","0.24.1-alpha-20230711101034-12496b03":"2023-07-11T10:11:08.950Z","0.24.1-alpha-20230711104647-4f4dd09a":"2023-07-11T10:47:31.573Z","0.24.1-alpha-20230711105947-90321fe8":"2023-07-11T11:00:26.304Z","0.24.1-alpha-20230711112657-6eb7b0f9":"2023-07-11T11:27:42.576Z","0.24.1-alpha-20230711113035-05a0cc2e":"2023-07-11T11:31:16.970Z","0.24.1-alpha-20230711134058-af0ebb8b":"2023-07-11T13:41:32.253Z","0.24.1-alpha-20230712073019-1769edb9":"2023-07-12T07:30:53.589Z","0.24.1-alpha-20230712074255-11c3c862":"2023-07-12T07:43:33.427Z","0.24.1-alpha-20230712084903-30cc8f9b":"2023-07-12T08:49:38.034Z","0.24.1-alpha-20230712092724-cb5c70a7":"2023-07-12T09:28:00.424Z","0.24.1-alpha-20230712100406-ef15a8a7":"2023-07-12T10:04:41.789Z","0.24.1-alpha-20230712112639-afbf9aa0":"2023-07-12T11:27:23.037Z","0.24.1-alpha-20230712142835-5ff29214":"2023-07-12T14:29:18.043Z","0.24.1-alpha-20230712162743-d7089332":"2023-07-12T16:28:23.434Z","0.24.1-alpha-20230712162927-feb591b2":"2023-07-12T16:30:10.270Z","0.24.1-alpha-20230713044311-a63f2da3":"2023-07-13T04:43:47.540Z","0.24.1-alpha-20230713070230-8071969e":"2023-07-13T07:03:08.008Z","0.24.1-alpha-20230713075451-303565f2":"2023-07-13T07:55:33.121Z","0.24.1-alpha-20230713081613-46703519":"2023-07-13T08:16:49.546Z","0.24.1-alpha-20230713083916-4ece1aac":"2023-07-13T08:39:59.388Z","0.24.1-alpha-20230713084133-2079c1fc":"2023-07-13T08:42:11.680Z","0.24.1-alpha-20230713090241-f2096f53":"2023-07-13T09:03:15.501Z","0.24.1":"2023-07-13T09:23:41.807Z","0.24.2-alpha-20230928151650-fb1f0fa0":"2023-09-28T15:17:36.458Z","0.24.2-rc-20230929103826-eee4d536":"2023-09-29T10:39:06.567Z","0.24.2":"2023-09-29T10:41:06.326Z","0.24.3-alpha-20231005081633-eea71f5f":"2023-10-05T08:17:21.192Z","0.24.3-alpha-20231005085447-ceb7a201":"2023-10-05T08:55:44.675Z","0.24.3-alpha-20231009144310-9d666f54":"2023-10-09T14:43:49.871Z","0.24.3-alpha-20231010091547-53c041d7":"2023-10-10T09:16:37.929Z","0.24.3-rc-20231010121508-12c166eb":"2023-10-10T12:15:47.720Z","0.24.3-alpha-20231010121806-9d441a83":"2023-10-10T12:18:54.781Z","0.24.3-alpha-20231010121826-5e714d9a":"2023-10-10T12:19:04.794Z","0.24.3-rc-20231010123313-9a886f3f":"2023-10-10T12:33:52.472Z","0.24.3-rc-20231010125614-556d3e1a":"2023-10-10T12:56:59.834Z","0.24.3":"2023-10-10T13:15:07.540Z","0.25.0-alpha-20231030120701-9c1b15e5":"2023-10-30T12:07:42.481Z","0.25.0-alpha-20231030121725-1219bb28":"2023-10-30T12:18:04.192Z","0.24.4-alpha-20231030122518-f1c4ba5e":"2023-10-30T12:25:56.556Z","0.25.0-alpha-20231030150901-aa84edf4":"2023-10-30T15:09:48.812Z","0.25.0-alpha-20231030152508-4b39d815":"2023-10-30T15:25:54.371Z","0.25.0-rc-20231031072840-bacaf744":"2023-10-31T07:29:18.580Z","0.25.0-alpha-20231031073158-9b3eacf8":"2023-10-31T07:32:39.818Z","0.25.0-rc-20231031074406-e186f404":"2023-10-31T07:44:46.324Z","0.25.0-alpha-20231031074450-9dfb6f4e":"2023-10-31T07:45:44.475Z","0.25.0-alpha-20231031074555-ac409d78":"2023-10-31T07:46:34.258Z","0.25.0-alpha-20231031074826-54826226":"2023-10-31T07:49:17.880Z","0.25.0-rc-20231031085447-8769faa7":"2023-10-31T08:55:31.471Z","0.25.0-rc-20231031090210-90a6d05a":"2023-10-31T09:02:49.882Z","0.25.0-rc-20231031090235-90a6d05a":"2023-10-31T09:03:15.534Z","0.25.0-alpha-20231031090447-580da5d5":"2023-10-31T09:05:27.469Z","0.25.0-rc-20231031090654-a94711c1":"2023-10-31T09:07:31.474Z","0.25.0-alpha-20231031090814-3f4c1cde":"2023-10-31T09:09:09.479Z","0.25.0-alpha-20231031090921-b04c348d":"2023-10-31T09:10:15.616Z","0.25.0-alpha-20231031091151-b8aa2ffa":"2023-10-31T09:12:41.257Z","0.25.0-rc-20231031091327-ddae0ade":"2023-10-31T09:14:14.286Z","0.25.0-alpha-20231031114705-472f2519":"2023-10-31T11:47:43.628Z","0.25.0-alpha-20231031134123-77954bdc":"2023-10-31T13:42:09.523Z","0.25.0-alpha-20231031135300-b41368d5":"2023-10-31T13:53:54.876Z","0.25.0-alpha-20231031135519-5875b3ab":"2023-10-31T13:56:00.706Z","0.25.0-alpha-20231031140451-a7867c1f":"2023-10-31T14:05:29.529Z","0.25.0-alpha-20231031140846-60e26853":"2023-10-31T14:09:33.939Z","0.25.0-alpha-20231031141122-ae748cad":"2023-10-31T14:12:09.211Z","0.25.0-rc-20231031141141-5302e5bb":"2023-10-31T14:12:31.564Z","0.25.0-alpha-20231031141307-73aa3eb1":"2023-10-31T14:13:56.664Z","0.25.0-alpha-20231031141421-c839137c":"2023-10-31T14:15:03.428Z","0.25.0-alpha-20231031141953-addfe1b6":"2023-10-31T14:20:32.728Z","0.25.0-alpha-20231031142139-19f579cc":"2023-10-31T14:22:17.729Z","0.25.0-alpha-20231031142258-286f6eb6":"2023-10-31T14:23:47.511Z","0.25.0-rc-20231031142703-c99a33e3":"2023-10-31T14:27:43.671Z","0.25.0-alpha-20231031142907-e13db453":"2023-10-31T14:29:49.794Z","0.25.0-alpha-20231031145007-d8f1ec91":"2023-10-31T14:50:47.487Z","0.25.0-rc-20231031145049-fef07f5b":"2023-10-31T14:51:29.160Z","0.25.0-alpha-20231031145259-7324e496":"2023-10-31T14:53:43.854Z","0.25.0-alpha-20231031160713-dda5d8d2":"2023-10-31T16:08:02.774Z","0.25.0-rc-20231031171315-7a716826":"2023-10-31T17:14:04.125Z","0.25.0-alpha-20231101075150-6d877e22":"2023-11-01T07:52:45.573Z","0.25.0-alpha-20231101075723-62d9449a":"2023-11-01T07:58:10.395Z","0.25.0-rc-20231101082022-abbaf302":"2023-11-01T08:21:12.680Z","0.25.0-rc-20231101082324-36a832a8":"2023-11-01T08:24:14.721Z","0.25.0":"2023-11-01T08:45:54.321Z","0.26.0-alpha-20231103140036-43467e10":"2023-11-03T14:01:06.469Z","0.26.0-rc-20231103141956-0ab03423":"2023-11-03T14:20:49.162Z","0.26.0-rc-20231103152855-629bebd4":"2023-11-03T15:29:44.117Z","0.26.0-alpha-20231103154051-62d3f475":"2023-11-03T15:41:19.743Z","0.26.0-alpha-20231103154517-fa3cffa3":"2023-11-03T15:46:06.470Z","0.26.0-alpha-20231103155216-cb406210":"2023-11-03T15:52:55.590Z","0.26.0-alpha-20231103160019-3dfb685c":"2023-11-03T16:00:49.582Z","0.26.0-alpha-20231103160335-5db3de26":"2023-11-03T16:04:26.987Z","0.26.0-alpha-20231103160704-9f667371":"2023-11-03T16:07:33.449Z","0.26.0":"2023-11-03T16:11:08.851Z","0.26.0-alpha-20231103161227-65452cb6":"2023-11-03T16:13:22.215Z","0.26.0-alpha-20231103163951-edce4bf0":"2023-11-03T16:40:32.003Z","0.26.0-alpha-20231106125332-f4f34253":"2023-11-06T12:54:12.806Z","0.27.0-alpha-20231108152420-6fcdec9f":"2023-11-08T15:24:50.007Z","0.27.0-alpha-20231108155352-6d9f32aa":"2023-11-08T15:54:23.108Z","0.27.0-alpha-20231109082711-3ec3cf5b":"2023-11-09T08:28:06.314Z","0.27.0-rc-20231205091621-f0bfe8fcdf28de5264bbfa2e733c862020bbdcf5":"2023-12-05T09:16:49.420Z","0.27.0-alpha-20231205092100-147c8f01e68f74e8f0033eedd750bd1c9a6484c9":"2023-12-05T09:21:28.967Z","0.27.0-alpha-20231205093716-3c32205bc2a9a67c378a664f5050d55785f3da6e":"2023-12-05T09:37:44.803Z","0.27.0-alpha-20231205094359-17c20b7e1304e25ba81ac5d1cf16bf5bc922cfa9":"2023-12-05T09:44:29.194Z","0.27.0-alpha-20231205101758-af91ac0d6fb47661e03e5fa74e9680c8cce36519":"2023-12-05T10:18:27.323Z","0.27.0-rc-20231205105656-459012e657575a39f5824b014298fdf09be4c664":"2023-12-05T10:57:26.106Z","0.27.0":"2023-12-05T11:46:51.107Z","0.28.0-alpha-20231214083356-6eb8b2b7517382eb835291f089a40d7a791a5343":"2023-12-14T08:34:24.567Z","0.28.0-rc-20231214085001-6757efe085e3670fd9477adab05b2dfefdeb0482":"2023-12-14T08:50:27.921Z","0.28.0-alpha-20231214085646-5f24f0e62f834769c0feeddab2bf560d057eb5e3":"2023-12-14T08:57:14.670Z","0.28.0-rc-20231214090055-75aac203329eab5765674f72db0e0542d7ec246e":"2023-12-14T09:01:22.895Z","0.28.0":"2023-12-14T09:12:57.189Z","0.28.1-alpha-20240116110654-26801bd2110783c5ac87243b7cc730d97c5e440a":"2024-01-16T11:07:22.272Z","0.28.1-alpha-20240116111445-1f3909f5589ce42c9b4310fd6d9d838190f2c2ef":"2024-01-16T11:15:12.745Z","0.28.1-alpha-20240116111859-734d96d0afe27f54d771fc47041451ccdecfff1b":"2024-01-16T11:19:27.547Z","0.28.1-alpha-20240116121934-699d6e6fd23284a3e819490d91cc8b8f9271990c":"2024-01-16T12:20:03.546Z","0.28.1-alpha-20240116142655-0296755a1ea7ac7507d3cd239be65f5996f362c3":"2024-01-16T14:27:25.237Z","0.28.1-alpha-20240117100704-0296755a1ea7ac7507d3cd239be65f5996f362c3":"2024-01-17T10:07:32.215Z","0.28.1-rc-20240117102113-6e5167513484597ee3d704d9dafd6bf31fa752ff":"2024-01-17T10:21:45.918Z","0.28.1":"2024-01-17T10:43:21.359Z","0.29.0-alpha-20240228155204-c86962123ed6e5f7b92119d82d2fdd1df5d8ec04":"2024-02-28T15:52:31.387Z","0.29.0-alpha-20240229095018-cdfa18f6ff998bf992e8780699bba1b02d494562":"2024-02-29T09:50:44.566Z","0.29.0-alpha-20240307151351-9f5b393612bb58a8f0a2eca5bb75d3f43c3a2172":"2024-03-07T15:14:17.594Z","0.29.0-alpha-20240307151832-32cbde7039f3c0ef0baf1ee6a8d2988133c736a8":"2024-03-07T15:19:00.296Z","0.29.0-alpha-20240307154710-7c834a9b552f462253a6905dd8b74936e834a2d0":"2024-03-07T15:47:37.020Z","0.29.0-alpha-20240307154937-694b4ce9b8e1c4ebea5617e10cf13223fdef5949":"2024-03-07T15:50:04.680Z","0.29.0-alpha-20240318085921-e14fcd97f46f2213bd24afb64ece0d19f032ee2e":"2024-03-18T08:59:48.970Z","0.29.0-alpha-20240318090322-35cab27b2e46cda9ed18a247e108cab65ceb454d":"2024-03-18T09:03:48.832Z","0.29.0-alpha-20240318111045-ca9ad6cafb6c02d725df2b8271fcc2fd8f89dddd":"2024-03-18T11:11:16.834Z","0.29.0-alpha-20240318115013-df34f6593116adb60bb6c84a7db897f909a2fbdf":"2024-03-18T11:50:39.963Z","0.29.0-alpha-20240318115333-30169eb5cbd55b43b8b9755d673b5467e5775c7f":"2024-03-18T11:53:59.597Z","0.29.0-alpha-20240318125246-d2ba64388cee7ef9614de338abf9d013d422af42":"2024-03-18T12:53:12.644Z","0.29.0-alpha-20240318130111-7653a807a54d482e47962407658711336435d7a7":"2024-03-18T13:01:38.916Z","0.29.0-alpha-20240318134414-95e2bbcb4f28b697367f29eeb49af59ad83ec90a":"2024-03-18T13:44:40.020Z","0.29.0-alpha-20240318135144-aa210cdb8ffde06a090e09913a96aa1cffeaa054":"2024-03-18T13:52:10.771Z","0.29.0-alpha-20240318142728-04637b90a657aa4eafe45ea8e3618156b0528307":"2024-03-18T14:27:54.394Z","0.29.0-rc-20240318143553-bd0fba2bd34eb9d6816ce41d72617a07f8ba2515":"2024-03-18T14:36:19.458Z","0.29.0-alpha-20240318143747-451863f33dd91a661cc084ca09fbb3b253bd18b8":"2024-03-18T14:38:14.037Z","0.29.0":"2024-03-18T14:46:34.500Z","0.29.0-alpha-20240319084129-18ccf88d53de98f8c5d652bfbf32b38bd5d68e1e":"2024-03-19T08:41:55.731Z","0.30.0-alpha-20240319092820-fa6bd35dcc8926136495d5f6adbdb0b5dde47bc4":"2024-03-19T09:28:46.294Z","0.30.0-alpha-20240319100626-a400e46e7f29f462a0a776241516cc5b9f2cacaf":"2024-03-19T10:06:53.292Z","0.30.0-alpha-20240319100803-f9a060690ab1d3adb77d53ace2022937dffa8259":"2024-03-19T10:08:33.025Z","0.30.0-alpha-20240319101437-656fb001039150d71fafc91d94c529bdc6dccf83":"2024-03-19T10:15:07.301Z","0.30.0-alpha-20240319101915-9d657de68a22ae6fb27e031d85831fa82521d751":"2024-03-19T10:19:42.222Z","0.30.0-alpha-20240319112829-d69821dfa46ab09302453552af90136973db7daa":"2024-03-19T11:28:55.797Z","0.30.0-alpha-20240319134508-86e13f46ed89e707ae5e2f3d7cdb4b31d21fe070":"2024-03-19T13:45:34.859Z","0.30.0-alpha-20240319151847-ee6346a8ffd6ad2dbb279ac274cab5e06bf748bb":"2024-03-19T15:19:14.884Z","0.30.0-alpha-20240320133324-0298f71426d843f319895301a1cd03d207021c8b":"2024-03-20T13:33:50.719Z","0.30.0-alpha-20240320151335-2a06e268824a41e6b2cf91ac13917a846499d49a":"2024-03-20T15:14:02.214Z","0.30.0-alpha-20240320152059-84c86ef0f483a56c8d5fd86e690ba1be2e40a800":"2024-03-20T15:21:33.144Z","0.30.0-alpha-20240320154305-ce101c66a79858342bfffa55dfd0240445dd9912":"2024-03-20T15:43:32.092Z","0.30.0-alpha-20240325082747-6590220194683b5210d11394504f8eec4cb82db6":"2024-03-25T08:28:13.856Z","0.29.1-rc-20240325112321-720a01659edb97457cd3ea522e1ae9f4c7f5845d":"2024-03-25T11:23:48.508Z","0.29.1-rc-20240325112732-7df9c9ac446bf5ad8588559283b79029bfc903c9":"2024-03-25T11:27:58.433Z","0.30.0-alpha-20240325113809-b0cce1bccd91f098d5265f5e7b2337e32c5bc8f7":"2024-03-25T11:38:37.539Z","0.30.0-alpha-20240325122646-3e5cd939d56ead63cbb9547c4a20b16744523895":"2024-03-25T12:27:13.804Z","0.30.0-alpha-20240325123205-b49898675ce5fac824364aa7aa43e29c7d33658a":"2024-03-25T12:32:32.097Z","0.30.0-alpha-20240325123709-ad2e9a517b1574aef1dfa7359e8a7b1b266c9b33":"2024-03-25T12:37:35.311Z","0.30.0-alpha-20240325124147-5d3d28c55b09f975ff40bb7cea60ef4700776a6d":"2024-03-25T12:42:12.922Z","0.30.0-alpha-20240325124730-4682c0852c133ac48ca27c668f314deac46f9e0f":"2024-03-25T12:47:56.551Z","0.30.0-alpha-20240325124821-d92e220bcf23edd4fb44c5f08b85cc40c35b513b":"2024-03-25T12:48:47.899Z","0.30.0-rc-20240325125259-6e112ab7ff5a2f30904a1f27fc1b0133a7c8eb91":"2024-03-25T12:53:25.831Z","0.30.0-alpha-20240325125919-0e0896ac7352de9fa367c13e4b5602a403a63a77":"2024-03-25T12:59:44.772Z","0.30.0-alpha-20240325130306-b0b650ac2e21d96dcb3d9111427ce94af799ee76":"2024-03-25T13:03:32.716Z","0.30.0-alpha-20240325130901-11ddb4d0e694c03b195ae57704fdcf7d5546548c":"2024-03-25T13:09:27.116Z","0.30.0-alpha-20240325131613-d55fa83dc90b460fac9473b9b5a5e1fce205cc08":"2024-03-25T13:16:40.496Z","0.30.0-alpha-20240325131929-43ca0442e7726910ecc3cc2bb75190425bdaf1f9":"2024-03-25T13:20:00.362Z","0.30.0-alpha-20240325132509-0f90875e8aed3e2f565c2e308814417de2c0d9d5":"2024-03-25T13:25:38.011Z","0.30.0-alpha-20240325132549-daa9c18c1708b3bb89f0bf69616b0699e29cde8e":"2024-03-25T13:26:15.635Z","0.30.0-alpha-20240325132808-68e7501afad8aaa2453721eaebed0540b0899305":"2024-03-25T13:28:34.432Z","0.30.0-alpha-20240325132825-c868b61c7c38496a3a89a031aec060a188f9f53d":"2024-03-25T13:28:50.899Z","0.30.0-alpha-20240325132853-ceb9d2796cf602c7332c380ce7b5240fef1d6fc2":"2024-03-25T13:29:19.615Z","0.30.0-alpha-20240325133203-7cf36c4ad117ad59c046a2b2e698c282deb933fc":"2024-03-25T13:32:30.783Z","0.30.0-alpha-20240325133748-e7e49a7227658a0f6c136eb0a2b30d002a41b95c":"2024-03-25T13:38:14.336Z","0.30.0-alpha-20240325135546-c3532a59a93e6f891f72465a90f659976a74c7fc":"2024-03-25T13:56:14.145Z","0.30.0-alpha-20240325135635-df18d1758c9f58390e40e4e35d4a36f8667942c3":"2024-03-25T13:57:01.038Z","0.30.0-alpha-20240325142727-2c1e9cbd6fea82c8b4f853f820015c995e697457":"2024-03-25T14:27:53.492Z","0.30.0-alpha-20240325142838-945e623014b4aa42fe3c78279e1eb3077eaa6090":"2024-03-25T14:29:04.341Z","0.30.0-rc-20240325142936-0b09c2dc4cc9aeb77b4609ba8be595961e33d678":"2024-03-25T14:30:03.427Z","0.30.0-alpha-20240325155817-2c1e9cbd6fea82c8b4f853f820015c995e697457":"2024-03-25T15:58:45.793Z","0.30.0-alpha-20240325165050-fba680a924213c2a8365ff313ffd739134cfb340":"2024-03-25T16:51:17.986Z","0.30.0-alpha-20240325172809-50e4ecdd330219a7d79caeb0a01207668b6e09b7":"2024-03-25T17:28:37.119Z","0.30.0-rc-20240325173629-6f492e243c0172898fa88d5b45d020f0c931fc62":"2024-03-25T17:36:55.096Z","0.30.0-alpha-20240325173751-dbb49b78c8a867cacafc5f5caf929e3295fafef5":"2024-03-25T17:38:21.393Z","0.30.0-alpha-20240325173844-fba0c45f9a8fffd8c50a9e318372c15606bacccf":"2024-03-25T17:39:11.474Z","0.30.0-rc-20240326065042-95710614dc235ae09402933b188a92c0f9e7574e":"2024-03-26T06:51:10.188Z","0.30.0-alpha-20240326065230-967b5e904c6aa067d1cc5d4a103a9689debc453e":"2024-03-26T06:52:57.108Z","0.30.0-alpha-20240326065318-a020756edec13a8f352e4f6f28647a06340d6a80":"2024-03-26T06:53:45.192Z","0.30.0-alpha-20240326065420-420a3360fe898ed62ac1a36b0e233ed5b6588c85":"2024-03-26T06:54:46.074Z","0.30.0-alpha-20240326065525-6405c9f207c62c94d05f86bf31553c495c012d41":"2024-03-26T06:55:50.402Z","0.30.0-alpha-20240326065638-baab1a3153a874c0787c83236e4172c58ba55b33":"2024-03-26T06:57:06.177Z","0.30.0-alpha-20240326065729-30a68ec610299a169f5aa11fd41c19b0f54eaa26":"2024-03-26T06:57:55.553Z","0.30.0-alpha-20240326065846-b918b35b4934a639a25161380485d3e8f95baf78":"2024-03-26T06:59:13.707Z","0.30.0-alpha-20240326065954-e548dc36a6caf00bad2c3d7560ab2b38681ff4b7":"2024-03-26T07:00:20.163Z","0.30.0-rc-20240326070111-dbd33a99fbdf7c059b007e12a812037763b74402":"2024-03-26T07:01:36.886Z","0.30.0-alpha-20240326072209-284333d417529d2e93c3ee2d5382329c083e663f":"2024-03-26T07:22:35.387Z","0.30.0-rc-20240326072252-c2dd53881e9380926ef4f1ef4362514b51b25a4d":"2024-03-26T07:23:18.721Z","0.30.0-rc-20240326073107-688b1ceddcc49a06104b867391b2c4bc36122e94":"2024-03-26T07:31:33.095Z","0.30.0-alpha-20240326073131-a07a625084887b65ee1320044c52a65e0fbf04a6":"2024-03-26T07:31:57.038Z","0.30.0-alpha-20240326073218-4fe1dff1deda765d30d9e8f0acf5b768a4a66f57":"2024-03-26T07:32:44.841Z","0.30.0-rc-20240326073348-e906aa2918ee8a0dbd5a3133f392c9249d5d70e7":"2024-03-26T07:34:15.333Z","0.30.0-alpha-20240326073433-8cea6c473a378e6c135cb7d3574a95667a9a6e25":"2024-03-26T07:34:59.494Z","0.30.0-alpha-20240326074316-aa0db721c8e10c339d3bee5b35f6ffeb5f033028":"2024-03-26T07:43:43.091Z","0.30.0-alpha-20240326075340-6c5f55c4a14e6a825db1e59cb3320872f39e0669":"2024-03-26T07:54:06.233Z","0.30.0-alpha-20240326075746-38d4fec36ecc516717af3bcb2c8716e5769a5f08":"2024-03-26T07:58:10.292Z","0.30.0-rc-20240326080701-e9de96e941c4b9f7a672628ccd14bfd5ff755250":"2024-03-26T08:07:27.298Z","0.30.0-alpha-20240326080839-9d646bdc87fc719473d77a3f02a5ca39e802f7ca":"2024-03-26T08:09:05.764Z","0.30.0-rc-20240326082003-5805658ee8c7f2468be4ce57785bea5d685197e0":"2024-03-26T08:20:29.592Z","0.30.0-alpha-20240326082120-9387f609d5bf616c48cabceacddbb8813b30fcf0":"2024-03-26T08:21:46.984Z","0.30.0-alpha-20240326082229-fc6755f65fa74d1a03643fd1e1a4e3fcb68fd558":"2024-03-26T08:22:55.375Z","0.30.0-rc-20240326082828-22b288474b6797cb3997603843a5553dc45093e2":"2024-03-26T08:29:00.503Z","0.30.0-alpha-20240326082916-bd0cea91fd3ad20454d8d9303eaa38ea442389ca":"2024-03-26T08:29:42.658Z","0.30.0-alpha-20240326090215-f23a86e8afffa60a231fb705c5a94a4964e852d1":"2024-03-26T09:02:42.023Z","0.30.0-alpha-20240326105242-e6ad5b266f791e4071d2b05ff45f0efee1dda669":"2024-03-26T10:53:09.121Z","0.30.0-alpha-20240326113741-229c1494ff7ea002f32fb78b6ba619799be1c08f":"2024-03-26T11:38:08.626Z","0.30.0-alpha-20240326121342-c72cb37243e297f5becf96bc5bd8767a579ad3df":"2024-03-26T12:14:09.612Z","0.30.0-alpha-20240326122640-47a31514ae3e08525d74f674aa8391214e10c39f":"2024-03-26T12:27:06.427Z","0.30.0-rc-20240326124608-8d8b1e690278da0ff85d5b80cec05ddbcda6e858":"2024-03-26T12:46:34.681Z","0.30.0-alpha-20240326124845-3af21cfc791c96489bfae44451473f0984d39152":"2024-03-26T12:49:13.330Z","0.30.0-alpha-20240326124906-e1ce080d7f9f898f2a468cfb8cbc9300f22b90b7":"2024-03-26T12:49:32.323Z","0.30.0-alpha-20240326125008-506099879ff7a6f44498182473410a7262d93a61":"2024-03-26T12:50:34.582Z","0.30.0-alpha-20240326125151-d88f532d348f772b879777622b4db42a84595296":"2024-03-26T12:52:18.307Z","0.30.0-alpha-20240326125226-0cc213f3cbcfc3152cfec72b287006fd9792b216":"2024-03-26T12:52:52.956Z","0.30.0-alpha-20240326125317-36e794bb090f7233965104cc7a0f2a24c6d24fa2":"2024-03-26T12:53:43.317Z","0.30.0-alpha-20240326125948-8a7797eae50070b95973e396e7289c5c14ad5f53":"2024-03-26T13:00:14.357Z","0.30.0-rc-20240326130309-fb4b2f461ab945ddb5c6a3a4c454db80caab8431":"2024-03-26T13:03:35.471Z","0.30.0":"2024-03-26T14:08:10.337Z","0.30.0-alpha-20240326142250-cb3184d239292f0a018dc85af54978e3876ea61d":"2024-03-26T14:23:20.595Z","0.30.0-alpha-20240326143409-0517bd2c11fa07415c4d6db101163eea6aa6c073":"2024-03-26T14:34:39.031Z","0.30.0-alpha-20240326150137-229dd401da671787e4f1ccf6ebd8c035ca006f57":"2024-03-26T15:02:04.442Z","0.30.0-alpha-20240326150611-204bec922447fe031700ac8611c7f5a13c3eddd2":"2024-03-26T15:06:37.291Z","0.30.0-alpha-20240326152018-671a8a92bfa1b5fc81e01244796536f17cdae85d":"2024-03-26T15:20:45.064Z","0.30.0-alpha-20240326153229-fd388230c4f9ea1b5ed437953f7eca1a6f6ad3a0":"2024-03-26T15:32:56.086Z","0.30.0-alpha-20240326153409-2ebef2e91fececaad66cfadbaf6e2780c6554baf":"2024-03-26T15:34:38.426Z","0.31.0-alpha-20240410160936-e50c879eece0fe498707f0e530b01dc8d39af46e":"2024-04-10T16:10:03.580Z","0.31.0-alpha-20240411064915-e37809dea13a3e023c4dc15f184b33d63194c607":"2024-04-11T06:49:42.441Z","0.31.0-rc-20240411070245-9162a01c619bc99307c8c14b0653465c9fc07f5f":"2024-04-11T07:03:10.178Z","0.31.0-alpha-20240411100255-2dba02e475bf5fb85f8e6c1dcca63e04a7e76a41":"2024-04-11T10:03:21.207Z","0.31.0-rc-20240411100348-4627887808fbf4462e1fdea1571c6e4b321b3a1c":"2024-04-11T10:04:13.662Z","0.31.0-alpha-20240411102347-2dbe0a9de4fbc6493d20d1f5310c9671edaa8ccb":"2024-04-11T10:24:11.912Z","0.31.0-alpha-20240411102434-7108211b471dee5b116fa326ed94324c3aac33b3":"2024-04-11T10:24:59.476Z","0.31.0-alpha-20240411102524-7ea9a792be1fa39d94c8ef9f33aac26835c98828":"2024-04-11T10:25:52.889Z","0.31.0":"2024-04-11T10:30:59.710Z","0.32.0-alpha-20240412114355-00dc7cf3a587b7b576a04b5821a04c91f0208c8d":"2024-04-12T11:44:22.747Z","0.32.0-alpha-20240412120414-3a2e3ae37449da6caa4048360c4f491abd84301e":"2024-04-12T12:04:39.917Z","0.32.0-alpha-20240412140857-a77eb6a3b346ce1b39775819de9d43d3f740265a":"2024-04-12T14:09:23.650Z","0.32.0-alpha-20240412143242-fcec5662991d36ef3d3e51261dd2d4deebc4b843":"2024-04-12T14:33:10.268Z","0.32.0-alpha-20240412143939-cab44cb1bb0408ec776456341d4c634fbf054589":"2024-04-12T14:40:06.471Z","0.32.0-alpha-20240415092429-08eba963b2bb3748fa1dd4d425d06ea99d5bdca7":"2024-04-15T09:24:55.588Z","0.32.0-alpha-20240415115323-840154d858b4708d6efb9d7bb1c67ae0ecf6eaa9":"2024-04-15T11:53:51.669Z","0.32.0-alpha-20240415135346-8a401121d1d86ed46effa28cefadd032c6645413":"2024-04-15T13:54:13.003Z","0.32.0-alpha-20240415141039-b904bfdd35c6d29520f9e581ca72b71bb3d96646":"2024-04-15T14:11:05.572Z","1.0.0-alpha-20240415144608-54466cf1e3b29f43c6d30a303c9dfcec8697400f":"2024-04-15T14:46:35.505Z","0.32.0-alpha-20240415145154-d84f9f9703d1038fbd210c82ecccf03a973bc515":"2024-04-15T14:52:21.451Z","0.32.0-alpha-20240416121307-70b0f42ef2860dc96e2bcfa792361ca50d984b88":"2024-04-16T12:13:34.339Z","0.32.0-alpha-20240416122350-559037808beeb461ac05345dc7c88bcf19a1aef9":"2024-04-16T12:24:17.276Z","0.32.0-alpha-20240416135849-2aaadeb0e7ba249dfe16adf3837deec47343c27f":"2024-04-16T13:59:18.824Z","0.32.0-alpha-20240422081851-f4f0bed0d4cc186ad9b9e0f82df0ad46a4d284c4":"2024-04-22T08:19:20.170Z","0.32.0-alpha-20240422082859-24dd6294840d89be8823232ddea22da5944c30b4":"2024-04-22T08:29:26.209Z","0.32.0-alpha-20240422083241-76896dd0be46f9f7e380b2d44beca48d1527b5bf":"2024-04-22T08:33:07.854Z","0.32.0-rc-20240422085416-72c76da6346ba6388e2abaecaefff787de081e9a":"2024-04-22T08:54:42.732Z","0.32.0-alpha-20240422085628-cd88305e6a5d7682c4d16508d99a916c736dff4d":"2024-04-22T08:57:03.963Z","0.32.0":"2024-04-22T09:44:25.137Z","0.33.0-alpha-20240422164316-388f2e4972b0dbc71392d40a78f773e547bf8531":"2024-04-22T16:43:45.021Z","0.33.0-alpha-20240422165351-f7c1428dd55e14ad5f1d43c7ae705dacde6965b7":"2024-04-22T16:54:20.816Z","0.33.0-alpha-20240422173604-273c5842957ce9c9b8a0961b53f7ffc16bafed10":"2024-04-22T17:36:30.756Z","0.33.0-alpha-20240422174126-64893cd4195b4007cb2a2fe6fa00bcdf2e4adb70":"2024-04-22T17:41:52.242Z","0.33.0-alpha-20240422174622-84f289174f9e231d7ac2bed1f3d4b464ea977d64":"2024-04-22T17:46:48.661Z","0.33.0-rc-20240423115227-c7141644bf64f985959bd99dadf65f9d792454b7":"2024-04-23T11:52:55.202Z","0.33.0-alpha-20240423115306-b6ec790fd8583575b65cd3d411a546454fa43975":"2024-04-23T11:53:31.029Z","0.33.0-alpha-20240423115345-b3a6b0292ffd8768ee80f01bd2955c57dfceb265":"2024-04-23T11:54:11.071Z","0.33.0-alpha-20240423115452-659acd3c62b9faa1faf1a02d3461292cdd889e1c":"2024-04-23T11:55:17.931Z","0.33.0-alpha-20240423115544-f46fe1be613cf2d15d58bd687a6dcb0e02d88814":"2024-04-23T11:56:15.054Z","0.33.0-alpha-20240423115633-e72070e6d643759e7255b90038d5f0fdc3cedd35":"2024-04-23T11:56:58.714Z","0.33.0-alpha-20240423121314-7463b10ca578e2e19c747f90bc10426f2bc3277a":"2024-04-23T12:13:41.148Z","0.33.0-alpha-20240423121513-6c9e077a33a8575f2c53f4d7411eb100d453e01e":"2024-04-23T12:15:39.287Z","0.33.0-alpha-20240423121544-c0ad9956f4ad5df6d857e8d97a57ae865405bb28":"2024-04-23T12:16:09.079Z","0.33.0-alpha-20240423121707-05ad8a88886c0ac01b49da1b1b08b06aacc06787":"2024-04-23T12:17:32.598Z","0.33.0-alpha-20240423121812-3ffd5571073f2fd9e48b3b4f333de924c87d3606":"2024-04-23T12:18:36.688Z","0.33.0-alpha-20240423121958-0f8212296675ab418430308a7f0d1507ab29bd44":"2024-04-23T12:20:22.368Z","0.33.0-alpha-20240423122052-bc51618d20fe1bcebef665f9be9640aeb4313fe6":"2024-04-23T12:21:16.349Z","0.33.0-alpha-20240423122214-edd921c8ddd31b3884d05208705bf56a5486abbc":"2024-04-23T12:22:38.527Z","0.33.0-alpha-20240423122334-ea679230e9beae30ef44a34eb16b53d43fdb4bd2":"2024-04-23T12:23:58.813Z","0.33.0-alpha-20240423122635-b90bf4baf49b3c4dfb505d5b339d8ee177a91d48":"2024-04-23T12:26:59.593Z","0.33.0-alpha-20240423122654-e283071b7625b481cbf5279b1760203b29056265":"2024-04-23T12:27:21.146Z","0.33.0-alpha-20240423122825-46da0b552498ee543b906844d18602a441dcfb1c":"2024-04-23T12:28:49.764Z","0.33.0-alpha-20240423123013-d2aafb605e024a47aa6b88d3c11aa92884f02d86":"2024-04-23T12:30:37.903Z","0.33.0-alpha-20240423123120-b9495a476ed6f15d34cad1b635e3f4985414bb6a":"2024-04-23T12:31:45.799Z","0.33.0-alpha-20240423123304-96df076bd128575ca7799bf6cd1a4942cf74ef70":"2024-04-23T12:33:29.987Z","0.33.0-alpha-20240423123507-49663a3d15b365f696139b181f7efb1b7fbf93be":"2024-04-23T12:35:31.837Z","0.33.0-alpha-20240423123549-4dfad7419d7ccb48f0c9c2b5855263d0a775e9f1":"2024-04-23T12:36:14.860Z","0.33.0-alpha-20240423123754-edf965b32213834461c88898173df0506a359c81":"2024-04-23T12:38:19.785Z","0.33.0-alpha-20240423123927-b43b2c05aaf0c7282e46d9b2b4dfcbed2a32be60":"2024-04-23T12:39:52.438Z","0.33.0-alpha-20240423124104-1c7333a51c6f2d254de0103db8523f268bc698f5":"2024-04-23T12:41:30.399Z","0.33.0-alpha-20240423124255-dfc190950f40f0c3f5d918013e45de75a0897b5c":"2024-04-23T12:43:19.871Z","0.33.0-alpha-20240423124527-189fc7527c58774fce4b81cbd15f830b5fe57df7":"2024-04-23T12:45:51.821Z","0.33.0-alpha-20240423124738-98a3ed981659c89feab0c1a16481dfacfbd9b0f5":"2024-04-23T12:48:02.435Z","0.33.0-alpha-20240423134818-25e6bc59e3ac7e6617cc4d349867034d0e740d08":"2024-04-23T13:48:43.419Z"},"bugs":{"url":"https://github.com/kamilkisiela/graphql-hive/issues"},"author":{"url":"https://the-guild.dev","name":"The Guild","email":"contact@the-guild.dev"},"license":"MIT","homepage":"https://graphql-hive.com","repository":{"url":"git+https://github.com/kamilkisiela/graphql-hive.git","type":"git","directory":"packages/libraries/client"},"description":"A NodeJS client for GraphQL Hive","maintainers":[{"email":"dotan@the-guild.dev","name":"dotansimha"},{"email":"kamil.kisiela@gmail.com","name":"kamilkisiela"},{"email":"ardatanrikulu@gmail.com","name":"ardatan"},{"email":"badurinadenis@gmail.com","name":"enisdenjo"},{"email":"bot@the-guild.dev","name":"theguild-bot"}],"readme":"","readmeFilename":""}